LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/sebastienmeyer2[P]mst-clustering/src/kmeans.cpp
// Function: Cloud::set_voronoi_labels()
int Cloud::set_voronoi_labels()
{
    /*!
     * @brief E-step in the kmeans algorithm
     */

	int changedLabels = 0;

	for (int i = 0; i < this->n; i ++){
		int pointLabel = points[i].label;
		int newLabel = points[i].label;
		double minDist = points[i].distance(&(centers[pointLabel]));

		for (int j = 0; j < this->k; j ++){
			double dist = points[i].distance(&(centers[j]));
			if (dist < minDist || (dist == minDist && j < newLabel)) {
				minDist = dist;
				newLabel = j;
			}
		}

		if (newLabel != pointLabel){
			points[i].label = newLabel;
			changedLabels += 1;
		}
	}
	
	return changedLabels;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpl $0x0, 0x4(%rdi)
jle 0xea46
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x0, 0x4(%rsp)
movq 0x10(%rbx), %rdi
movq %r14, %r15
shlq $0x4, %r15
movslq 0x8(%rdi,%r15), %r12
addq %r15, %rdi
movq %r12, %rsi
shlq $0x4, %rsi
addq 0x18(%rbx), %rsi
callq 0x3b3a
cmpl $0x0, 0x8(%rbx)
jle 0xea34
movapd %xmm0, %xmm1
xorl %r13d, %r13d
xorl %ebp, %ebp
movq %r12, 0x8(%rsp)
movsd %xmm1, 0x10(%rsp)
movq 0x10(%rbx), %rdi
addq %r15, %rdi
movq 0x18(%rbx), %rsi
addq %r13, %rsi
callq 0x3b3a
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0xea09
ucomisd %xmm1, %xmm0
setnp %al
sete %cl
andb %al, %cl
movslq %r12d, %rax
cmpq %rax, %rbp
setl %al
andb %cl, %al
cmpb $0x1, %al
jne 0xea10
movl %ebp, %r12d
movapd %xmm0, %xmm1
incq %rbp
movslq 0x8(%rbx), %rax
addq $0x10, %r13
cmpq %rax, %rbp
jl 0xe9c9
cmpl 0x8(%rsp), %r12d
je 0xea34
movq 0x10(%rbx), %rax
movl %r12d, 0x8(%rax,%r15)
incl 0x4(%rsp)
incq %r14
movslq 0x4(%rbx), %rax
cmpq %rax, %r14
jl 0xe992
jmp 0xea4e
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/sebastienmeyer2[P]mst-clustering/src/kmeans.cpp
// Function: Cloud::kmeans()
void Cloud::kmeans()
{
	/*!
     * @brief Computes the kmeans algorithm on this cloud. It is possible 
	 * to select different initializations for the centers, within bounding 
	 * box, forgy, plusplus and random partition. 
     */

	std::cout << "\nComputing clustering using kmeans...";

	// init_bounding_box();
	init_forgy(); 
	// init_plusplus(); 
	// init_random_partition();

	// running Lloyd's heuristics
	int changesMade = 0;
	do {
		changesMade = set_voronoi_labels();
		set_centroid_centers();
	} while (changesMade > 0);
	
	std::cout << "[OK]" << std::endl;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movq 0x8356(%rip), %rbx      # 0x16fb8
leaq 0x2da1(%rip), %rsi      # 0x11a0a
movl $0x25, %edx
movq %rbx, %rdi
callq 0x32d0
movq %r14, %rdi
callq 0xecd4
movq %r14, %rdi
callq 0xe96c
movl %eax, %ebp
movq %r14, %rdi
callq 0xea62
testl %ebp, %ebp
jg 0xec7e
leaq 0x2af8(%rip), %rsi      # 0x11793
movl $0x4, %edx
movq %rbx, %rdi
callq 0x32d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x3270
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x31a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/sebastienmeyer2[P]mst-clustering/src/kmeans.cpp
// Function: Cloud::init_bounding_box()
void Cloud::init_bounding_box()
{
    /*!
     * @brief Initializes the centers of this cloud by using a bounding box over 
	 * all the points
     */

	double* minBox = new double [this->d] ();
	double* maxBox = new double [this->d] ();
	for (int i = 0; i < this->d; i ++){
		minBox[i] = DBL_MAX;
		maxBox[i] = DBL_MIN;
	}

	for (int i = 0; i < this->n; i ++){
		for (int j = 0; j < this->d; j ++){
			if (points[i].coords[j] < minBox[j]){
				minBox[j] = points[i].coords[j];
			}
			if (points[i].coords[j] > maxBox[j]){
				maxBox[j] = points[i].coords[j];
			}
		}
	}

	Point center;
	for (int i = 0; i < this->k; i ++){
		center.label = i;

		for (int j = 0; j < this->d; j ++){
			double randomValue = (double)rand() / RAND_MAX;
			randomValue = minBox[j] + (randomValue * (maxBox[j] - minBox[j]));
			
			center.coords[j] = randomValue;
		}

		this->set_center(center, i);
	}

	delete[] minBox;
	minBox = NULL;
	delete[] maxBox;
	maxBox = NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movslq (%rdi), %r13
leaq (,%r13,8), %rax
testq %r13, %r13
movq $-0x1, %r12
cmovnsq %rax, %r12
movq %r12, %rdi
callq 0x3030
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3130
movq %r12, %rdi
callq 0x3030
movq %rax, %r15
movq %rax, %rdi
xorl %esi, %esi
movq %r12, %rdx
callq 0x3130
movl %r13d, %eax
testq %r13, %r13
jle 0xefad
xorl %ecx, %ecx
movabsq $0x7fefffffffffffff, %rdx # imm = 0x7FEFFFFFFFFFFFFF
movabsq $0x10000000000000, %rsi # imm = 0x10000000000000
movq %rdx, (%r14,%rcx,8)
movq %rsi, (%r15,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0xef9d
movslq 0x4(%rbx), %rcx
testq %rcx, %rcx
jle 0xf004
movq 0x10(%rbx), %rdx
xorl %esi, %esi
testl %eax, %eax
jle 0xeffc
movq %rsi, %rdi
shlq $0x4, %rdi
movq (%rdx,%rdi), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
movsd (%r14,%r8,8), %xmm1
ucomisd %xmm0, %xmm1
jbe 0xefe6
movsd %xmm0, (%r14,%r8,8)
ucomisd (%r15,%r8,8), %xmm0
jbe 0xeff4
movsd %xmm0, (%r15,%r8,8)
incq %r8
cmpq %r8, %rax
jne 0xefce
incq %rsi
cmpq %rcx, %rsi
jne 0xefbc
movq %rsp, %rdi
callq 0x3a20
cmpl $0x0, 0x8(%rbx)
jle 0xf0a7
movl (%rbx), %eax
xorl %r12d, %r12d
movl %r12d, 0x8(%rsp)
testl %eax, %eax
jle 0xf097
xorl %r13d, %r13d
callq 0x30a0
movsd 0x294c(%rip), %xmm1     # 0x11980
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
movsd (%r14,%r13,8), %xmm1
movsd (%r15,%r13,8), %xmm2
subsd %xmm1, %xmm2
mulsd %xmm0, %xmm2
addsd %xmm1, %xmm2
movq (%rsp), %rax
movsd %xmm2, (%rax,%r13,8)
incq %r13
movslq (%rbx), %rax
cmpq %rax, %r13
jl 0xf027
testl %eax, %eax
jle 0xf097
movq (%rsp), %rcx
movq 0x18(%rbx), %rdx
movq %r12, %rsi
shlq $0x4, %rsi
movq (%rdx,%rsi), %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
movsd %xmm0, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rax
jne 0xf085
incq %r12
movslq 0x8(%rbx), %rcx
cmpq %rcx, %r12
jl 0xf01b
movq %r14, %rdi
callq 0x3360
movq %r15, %rdi
callq 0x3360
movq %rsp, %rdi
callq 0x3a6e
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/sebastienmeyer2[P]mst-clustering/src/kmeans.cpp
// Function: Cloud::init_random_partition()
void Cloud::init_random_partition()
{
    /*!
     * @brief Initializes the centers of this cloud using random partitions,
	 * ie builds centers as the centers of random partitions of the data points
     */

	// random labelization of data points
	int randomCenter = 0;
	for (int i = 0; i < this->n; i ++){
		randomCenter = rand() % this->k;
		points[i].label = randomCenter;
	}

	// centers will be centroids of this partition
	this->set_centroid_centers();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x4(%rdi)
jle 0xf37a
movl $0x8, %r14d
xorl %r15d, %r15d
callq 0x30a0
cltd
idivl 0x8(%rbx)
movq 0x10(%rbx), %rax
movl %edx, (%rax,%r14)
incq %r15
movslq 0x4(%rbx), %rax
addq $0x10, %r14
cmpq %rax, %r15
jl 0xf359
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0xea62
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/PixelStencil.cpp
// Function: kallaballa::PixelPlanes::PixelPlanes(char*)
PixelPlanes::PixelPlanes(char* filename) : img(filename), width(img.width()), height(img.height()) {
	for (int h = 0; h < img.height(); h++) {
		for (int w = 0; w < img.width(); w++) {
			Color p = 0;
			p |= img(w, h, 0, 0) << 16;
			p |= img(w, h, 0, 1) << 8;
			p |= img(w, h, 0, 2);

			planes[p].push_back({w,h});
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x3611c(%rip), %rax     # 0x39c50
movq %rax, (%rdi)
leaq 0x8(%rdi), %r14
xorl %r15d, %r15d
movq %r15, 0x20(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rdi)
movb $0x0, 0x18(%rdi)
movq %r14, %rdi
callq 0x5420
movslq 0x8(%rbx), %rax
movq %rax, 0x28(%rbx)
movslq 0xc(%rbx), %rcx
leaq 0x40(%rbx), %rdx
movq %rcx, 0x30(%rbx)
movl $0x0, 0x40(%rbx)
movq %r15, 0x48(%rbx)
movq %rdx, 0x50(%rbx)
movq %rdx, 0x58(%rbx)
movq %r15, 0x60(%rbx)
testq %rcx, %rcx
jle 0x3c45
leaq 0x38(%rbx), %r15
xorl %ebp, %ebp
leaq 0x10(%rsp), %r13
testl %eax, %eax
jle 0x3c36
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
movq 0x20(%rbx), %rcx
movl %eax, %eax
movl 0xc(%rbx), %edx
movl 0x10(%rbx), %esi
movq %rbp, %rdi
imulq %rax, %rdi
addq %rcx, %rdi
movzbl (%r12,%rdi), %edi
shll $0x10, %edi
movl %edi, 0xc(%rsp)
imulq %rdx, %rsi
leaq (%rsi,%rbp), %rdx
imulq %rax, %rdx
addq %rcx, %rdx
movzbl (%r12,%rdx), %edx
shll $0x8, %edx
orl %edi, %edx
movl %edx, 0xc(%rsp)
leaq (,%rsi,2), %rsi
addq %rbp, %rsi
imulq %rax, %rsi
addq %rcx, %rsi
movzbl (%r12,%rsi), %eax
orl %edx, %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
leaq 0xc(%rsp), %rsi
callq 0x5040
movl %r12d, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
movq %rax, %rdi
movq %r13, %rsi
callq 0x2b7e0
incq %r12
movslq (%r14), %rax
cmpq %rax, %r12
jl 0x3b9f
movl 0xc(%rbx), %ecx
incq %rbp
movslq %ecx, %rdx
cmpq %rdx, %rbp
jl 0x3b94
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3c56
movq %rax, %r14
movq %r15, %rdi
callq 0x5244
cmpb $0x0, 0x18(%rbx)
jne 0x3c75
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x3c75
callq 0x3380
movq %r14, %rdi
callq 0x34d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::_M_erase_subtree(KDTree::_Node<kallaballa::NamedColor>*)
void
      _M_erase_subtree(_Link_type __n)
      {
        while (__n)
          {
            _M_erase_subtree(_S_right(__n));
            _Link_type __t = _S_left(__n);
            _M_delete_node(__n);
            __n = __t;
          }
      }

// Assembly:
testq %rsi, %rsi
je 0x53f4
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x10(%r14), %rsi
movq %rbx, %rdi
callq 0x53bc
movq 0x8(%r14), %r15
movq %rbx, %rdi
movq %r14, %rsi
callq 0x53f6
movq %r15, %r14
testq %r15, %r15
jne 0x53cc
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./CImg.h
// Function: cimg_library::CImg<unsigned char>::CImg(unsigned int, unsigned int, unsigned int, unsigned int)
explicit CImg(const unsigned int size_x, const unsigned int size_y=1, const unsigned int size_z=1, const unsigned int size_c=1):
      _is_shared(false) {
      const unsigned long siz = (unsigned long)size_x*size_y*size_z*size_c;
      if (siz) {
        _width = size_x; _height = size_y; _depth = size_z; _spectrum = size_c;
        try { _data = new T[siz]; } catch (...) {
          _width = _height = _depth = _spectrum = 0; _data = 0;
          throw CImgInstanceException(_cimg_instance
                                      "CImg(): Failed to allocate memory (%s) for image (%u,%u,%u,%u).",
                                      cimg_instance,
                                      cimg::strbuffersize(sizeof(T)*size_x*size_y*size_z*size_c),size_x,size_y,size_z,size_c);
        }
      } else { _width = _height = _depth = _spectrum = 0; _data = 0; }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %r15d
movq %rdi, %rbp
movb $0x0, 0x10(%rdi)
movl %esi, %eax
movl %edx, %ecx
imulq %rax, %rcx
movl %r15d, %eax
movl %r8d, %r13d
imulq %rax, %r13
imulq %rcx, %r13
testq %r13, %r13
je 0x13f91
movl %r8d, %r12d
movl %edx, %r14d
movl %esi, %ebx
movl %esi, (%rbp)
movl %edx, 0x4(%rbp)
movl %r15d, 0x8(%rbp)
movl %r8d, 0xc(%rbp)
movq %r13, %rdi
callq 0x3040
movq %rax, 0x18(%rbp)
jmp 0x13fa0
movq $0x0, 0x18(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rdi
callq 0x30f0
movq $0x0, 0x18(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, (%rbp)
movl $0x4008, %edi           # imm = 0x4008
callq 0x3110
movq %rax, 0x18(%rsp)
movl (%rbp), %eax
movl %eax, 0x14(%rsp)
movl 0x4(%rbp), %eax
movl %eax, 0x10(%rsp)
movl 0x8(%rbp), %eax
movl %eax, 0xc(%rsp)
movl 0xc(%rbp), %eax
movl %eax, 0x8(%rsp)
movq 0x18(%rbp), %rax
movq %rax, 0x20(%rsp)
leaq 0x1c44e(%rip), %rax     # 0x3044f
leaq 0x194f7(%rip), %rcx     # 0x2d4ff
cmpb $0x0, 0x10(%rbp)
cmovneq %rax, %rcx
movq %rcx, %rbp
movq %r13, %rdi
callq 0xa43a
movq %rax, %r10
leaq 0x19695(%rip), %r11     # 0x2d6ba
leaq 0x1a2c0(%rip), %rsi     # 0x2e2ec
movq 0x18(%rsp), %rdi
movq %rdi, %r13
movl 0x14(%rsp), %edx
movl 0x10(%rsp), %ecx
movl 0xc(%rsp), %r8d
movl 0x8(%rsp), %r9d
xorl %eax, %eax
pushq %r12
pushq %r15
pushq %r14
pushq %rbx
pushq %r10
pushq %r11
pushq %rbp
pushq 0x58(%rsp)
callq 0xa51e
addq $0x40, %rsp
leaq 0x25ca8(%rip), %rsi     # 0x39d10
movq 0x25f69(%rip), %rdx     # 0x39fd8
movq %r13, %rdi
callq 0x34b0
movq %rax, %rbx
jmp 0x14087
movq %rax, %rbx
movq %r13, %rdi
callq 0x31e0
callq 0x34a0
movq %rbx, %rdi
callq 0x34d0
movq %rax, %rdi
callq 0x50a5
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./CImg.h
// Function: cimg_library::CImg<float>::vector(float const&, float const&, float const&, float const&, float const&, float const&, float const&, float const&)
static CImg<T> vector(const T& a0, const T& a1, const T& a2, const T& a3,
                          const T& a4, const T& a5, const T& a6, const T& a7) {
      _cimg_static CImg<T> r(1,8); T *ptr = r._data;
      *(ptr++) = a0; *(ptr++) = a1; *(ptr++) = a2; *(ptr++) = a3;
      *(ptr++) = a4; *(ptr++) = a5; *(ptr++) = a6; *(ptr++) = a7;
      return r;
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %rbp
movq %rdi, %rbx
movb 0x1c8ef(%rip), %al      # 0x3a468
testb %al, %al
je 0x1dc06
movq 0x50(%rsp), %rax
movq 0x48(%rsp), %rcx
movq 0x40(%rsp), %rdx
leaq 0x1c8b1(%rip), %rsi     # 0x3a448
movq 0x1c8c2(%rip), %rdi     # 0x3a460
movss (%rbp), %xmm0
movss %xmm0, (%rdi)
movss (%r13), %xmm0
movss %xmm0, 0x4(%rdi)
movss (%r12), %xmm0
movss %xmm0, 0x8(%rdi)
movss (%r15), %xmm0
movss %xmm0, 0xc(%rdi)
movss (%r14), %xmm0
movss %xmm0, 0x10(%rdi)
movss (%rdx), %xmm0
movss %xmm0, 0x14(%rdi)
movss (%rcx), %xmm0
movss %xmm0, 0x18(%rdi)
movss (%rax), %xmm0
movss %xmm0, 0x1c(%rdi)
movq %rbx, %rdi
callq 0x1df84
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1c85b(%rip), %rdi     # 0x3a468
callq 0x3500
testl %eax, %eax
je 0x1db81
leaq 0x1c827(%rip), %rdi     # 0x3a448
movl $0x1, %esi
movl $0x8, %edx
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x139fe
leaq -0xa3ec(%rip), %rdi     # 0x13856
leaq 0x1c7ff(%rip), %rsi     # 0x3a448
leaq 0x1c660(%rip), %rdx     # 0x3a2b0
callq 0x3260
leaq 0x1c80c(%rip), %rdi     # 0x3a468
callq 0x3190
jmp 0x1db81
movq %rax, %rbx
leaq 0x1c7f8(%rip), %rdi     # 0x3a468
callq 0x3180
movq %rbx, %rdi
callq 0x34d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/NamedColorTable.cpp
// Function: kallaballa::getNextLineAndSplitIntoTokens[abi:cxx11](std::istream&)
std::vector<string> getNextLineAndSplitIntoTokens(std::istream& str) {
  std::vector<string> result;
  string line;
  if(!std::getline(str, line))
    return {};

  std::stringstream lineStream(line);
  string cell;

  while (std::getline(lineStream, cell, ',')) {
    result.push_back(cell);
  }
  return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb $0x0, (%r13)
movq (%rsi), %rax
movq -0x18(%rax), %rdi
addq %rsi, %rdi
movl $0xa, %esi
callq 0x3290
movsbl %al, %edx
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
callq 0x3520
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
je 0x2c0d1
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
jmp 0x2c187
leaq 0x60(%rsp), %rdi
leaq 0x20(%rsp), %rsi
movl $0x18, %edx
callq 0x3450
leaq 0x50(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq $0x0, -0x8(%rbp)
movb $0x0, (%rbp)
leaq 0x60(%rsp), %r14
leaq 0x40(%rsp), %r15
movq %rsp, %r12
movq %r14, %rdi
movq %r15, %rsi
movl $0x2c, %edx
callq 0x3520
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2c132
movq %r12, %rdi
movq %r15, %rsi
callq 0x2c3ce
jmp 0x2c107
movaps (%rsp), %xmm0
movups %xmm0, (%rbx)
movq 0x10(%rsp), %rax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2c169
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xde30(%rip), %rsi      # 0x39fa0
leaq 0x60(%rsp), %rdi
callq 0x31f0
leaq 0xe0(%rsp), %rdi
callq 0x30c0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2c19e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rsp, %rdi
callq 0x2c40c
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c1bd
movq %rax, %rbx
jmp 0x2c1fa
movq %rax, %rbx
movq 0x40(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2c1dc
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq 0xddbd(%rip), %rsi      # 0x39fa0
leaq 0x60(%rsp), %rdi
callq 0x31f0
leaq 0xe0(%rsp), %rdi
callq 0x30c0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2c211
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rsp, %rdi
callq 0x2c40c
movq %rbx, %rdi
callq 0x34d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/NamedColorTable.cpp
// Function: kallaballa::NamedColorTable::readFromCSV(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
void NamedColorTable::readFromCSV(const string& filename) {
  std::ifstream ifs(filename);
  std::vector<string> row;
  NamedColor ralColor;
  while ((row = getNextLineAndSplitIntoTokens(ifs)).size() == 2) {
    ralColor.name = row[0];
    ralColor.rgb = strtol(row[1].substr(1).c_str(), NULL, 16);
    this->insert(ralColor);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdi, %rbx
leaq 0x80(%rsp), %rdi
movl $0x8, %edx
callq 0x3470
xorl %eax, %eax
movq %rax, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
leaq 0x30(%rsp), %rcx
movq %rcx, -0x10(%rcx)
movq %rax, -0x8(%rcx)
movb $0x0, (%rcx)
leaq 0x50(%rsp), %r14
leaq 0x60(%rsp), %r12
leaq 0x40(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq %r12, %rdi
leaq 0x80(%rsp), %rsi
callq 0x2c055
movq 0x10(%rsp), %rax
movaps 0x60(%rsp), %xmm0
movq 0x70(%rsp), %rcx
movq %rcx, 0x10(%rsp)
movaps (%rsp), %xmm1
movaps %xmm0, (%rsp)
movaps %xmm1, 0x40(%rsp)
movq %rax, 0x50(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x60(%rsp)
movq $0x0, 0x70(%rsp)
movq %r13, %rdi
callq 0x2c40c
movq 0x8(%rsp), %r15
subq (%rsp), %r15
movq %r12, %rdi
callq 0x2c40c
cmpq $0x40, %r15
jne 0x2c349
movq (%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x3140
movq (%rsp), %rsi
addq $0x20, %rsi
movl $0x1, %edx
movq %r13, %rdi
movq $-0x1, %rcx
callq 0x32e0
movq 0x40(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x33a0
movl %eax, 0x18(%rsp)
movq 0x40(%rsp), %rdi
cmpq %r14, %rdi
je 0x2c336
movq 0x50(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %r13, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x2c46a
jmp 0x2c27a
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2c365
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rsp, %rdi
callq 0x2c40c
leaq 0x80(%rsp), %rdi
callq 0x3070
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2c392
jmp 0x2c392
jmp 0x2c392
movq %rax, %rbx
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x2c3b1
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rsp, %rdi
callq 0x2c40c
leaq 0x80(%rsp), %rdi
callq 0x3070
movq %rbx, %rdi
callq 0x34d0
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::insert(kallaballa::NamedColor const&)
iterator
      insert(const_reference __V)
      {
        if (!_M_get_root())
          {
            _Link_type __n = _M_new_node(__V, &_M_header);
            ++_M_count;
            _M_set_root(__n);
            _M_set_leftmost(__n);
            _M_set_rightmost(__n);
            return iterator(__n);
          }
        return _M_insert(_M_get_root(), __V, 0);
      }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rcx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rdx
testq %rdx, %rdx
je 0x2c490
movq %rbx, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x2c7aa
jmp 0x2c4b7
leaq 0x10(%r14), %rdx
movq %r14, %rdi
movq %rcx, %rsi
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2c6ce
incq 0x28(%r14)
movq %rax, 0x8(%r14)
movq %rax, 0x18(%r14)
movq %rax, 0x20(%r14)
movq %rax, (%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::_M_new_node(kallaballa::NamedColor const&, KDTree::_Node_base*, KDTree::_Node_base*, KDTree::_Node_base*)
_Link_type
      _M_new_node(const_reference __V, //  = value_type(),
                  _Base_ptr const __PARENT = NULL,
                  _Base_ptr const __LEFT = NULL,
                  _Base_ptr const __RIGHT = NULL)
      {
         typename _Base::NoLeakAlloc noleak(this);
         _Link_type new_node = noleak.get();
	 _Base::_M_construct_node(new_node, __V, __PARENT, __LEFT, __RIGHT);
         noleak.disconnect();
         return new_node;
      }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movl $0x40, %edi
callq 0x32c0
movq %rax, %rbx
movl (%r13), %eax
leaq 0x8(%rsp), %rdi
movl %eax, -0x8(%rdi)
leaq 0x18(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq 0x8(%r13), %rsi
movq 0x10(%r13), %rdx
addq %rsi, %rdx
callq 0x52ba
movq %r12, (%rbx)
movq %r15, 0x8(%rbx)
movq %r14, 0x10(%rbx)
movl (%rsp), %eax
movl %eax, 0x18(%rbx)
leaq 0x20(%rbx), %rdi
movq %rbx, %rax
addq $0x30, %rax
movq %rax, 0x20(%rbx)
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
addq %rsi, %rdx
callq 0x52ba
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2c763
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32d0
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %rbp, %rdi
je 0x2c794
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x32d0
jmp 0x2c794
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x32d0
movq %r14, %rdi
callq 0x34d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::_M_insert(KDTree::_Node<kallaballa::NamedColor>*, kallaballa::NamedColor const&, unsigned long)
iterator
      _M_insert(_Link_type __N, const_reference __V,
             size_type const __L)
      {
        if (_Node_compare_(__L % __K, _M_acc, _M_cmp)(__V, __N->_M_value))
          {
            if (!_S_left(__N))
              return _M_insert_left(__N, __V);
            return _M_insert(_S_left(__N), __V, __L+1);
          }
        else
          {
            if (!_S_right(__N) || __N == _M_get_rightmost())
              return _M_insert_right(__N, __V);
            return _M_insert(_S_right(__N), __V, __L+1);
          }
      }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %r15
movq %rdx, %r13
movq %rsi, %r12
movq %rdi, 0x10(%rsp)
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
movq %r8, %rax
mulq %rdx
shrq %rdx
leal (%rdx,%rdx,2), %eax
movl %r15d, %ebx
subl %eax, %ebx
movq 0x30(%rsi), %r14
leaq 0x18(%r13), %rbp
leaq 0x24(%rsp), %rsi
movl %ebx, (%rsi)
movq %rcx, 0x8(%rsp)
movq %rcx, %rdi
callq *%r14
movsd %xmm0, 0x18(%rsp)
leaq 0x20(%rsp), %rsi
movl %ebx, (%rsi)
movq %rbp, %rdi
callq *%r14
ucomisd 0x18(%rsp), %xmm0
jbe 0x2c839
movq 0x8(%r13), %rdx
testq %rdx, %rdx
jne 0x2c849
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq 0x8(%rsp), %rcx
callq 0x2c890
jmp 0x2c87e
movq 0x10(%r13), %rdx
testq %rdx, %rdx
je 0x2c866
cmpq %r13, 0x20(%r12)
je 0x2c866
incq %r15
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq 0x8(%rsp), %rcx
movq %r15, %r8
callq 0x2c7aa
jmp 0x2c87e
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq 0x8(%rsp), %rcx
callq 0x2c8d6
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::_M_insert_left(KDTree::_Node<kallaballa::NamedColor>*, kallaballa::NamedColor const&)
iterator
      _M_insert_left(_Link_type __N, const_reference __V)
      {
        _S_set_left(__N, _M_new_node(__V)); ++_M_count;
        _S_set_parent( _S_left(__N), __N );
        if (__N == _M_get_leftmost())
           _M_set_leftmost( _S_left(__N) );
        return iterator(_S_left(__N));
      }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movq %rcx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2c6ce
movq %rax, 0x8(%r14)
incq 0x28(%r15)
movq %r14, (%rax)
cmpq %r14, 0x18(%r15)
jne 0x2c8c9
movq %rax, 0x18(%r15)
movq 0x8(%r14), %rax
movq %rax, (%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/kallaballa[P]PixelStencil/./kdtree++/kdtree.hpp
// Function: KDTree::KDTree<3ul, kallaballa::NamedColor, std::pointer_to_binary_function<kallaballa::NamedColor const&, int const&, double>, KDTree::squared_difference<double, double>, std::less<double>, std::allocator<KDTree::_Node<kallaballa::NamedColor>>>::_M_insert_right(KDTree::_Node<kallaballa::NamedColor>*, kallaballa::NamedColor const&)
iterator
      _M_insert_right(_Link_type __N, const_reference __V)
      {
        _S_set_right(__N, _M_new_node(__V)); ++_M_count;
        _S_set_parent( _S_right(__N), __N );
        if (__N == _M_get_rightmost())
           _M_set_rightmost( _S_right(__N) );
        return iterator(_S_right(__N));
      }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rsi, %rdi
movq %rcx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
callq 0x2c6ce
movq %rax, 0x10(%r14)
incq 0x28(%r15)
movq %r14, (%rax)
cmpq %r14, 0x20(%r15)
jne 0x2c90f
movq %rax, 0x20(%r15)
movq 0x10(%r14), %rax
movq %rax, (%rbx)
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/IInstructions.cpp
// Function: Clarkitechture::MIPS::ADDIInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void ADDIInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int32_t left = reg.read(rs);
    int32_t right = (int16_t)constant;
    int32_t result = left + right;
    
    bool overflow = sameSign(left, right) && !sameSign(left, result);
    if (overflow) { throw BadArithmeticOperation("ADDI encountered an overflow"); }
    
    reg.write(rt, result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movswl 0xa(%r14), %ecx
leal (%rax,%rcx), %edx
xorl %eax, %ecx
js 0x6ad8
xorl %edx, %eax
js 0x6aef
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x980c
movl $0x48, %edi
callq 0x5100
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x488d(%rip), %rsi      # 0xb399
leaq 0x48a2(%rip), %rdx      # 0xb3b5
leaq 0x8(%rsp), %rdi
callq 0x7e20
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x55d6
xorl %ebp, %ebp
leaq 0x923a(%rip), %rsi      # 0xfd70
leaq -0x607(%rip), %rdx      # 0x6536
movq %rbx, %rdi
callq 0x5380
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x6b5f
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5210
testb %bpl, %bpl
jne 0x6b69
jmp 0x6b71
movq %rax, %r14
movq %rbx, %rdi
callq 0x5190
movq %r14, %rdi
callq 0x53a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/IInstructions.cpp
// Function: Clarkitechture::MIPS::LWLInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void LWLInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t addr = reg.read(rs) + (int16_t)constant;
    uint32_t byteIndex = addr % 4;
    uint32_t wordIndex = addr - byteIndex;
    uint32_t mask = 0xFFFFFFFF;
    
    uint32_t rawWord = mem.read<uint32_t>(wordIndex);
    byte* byteArray = reinterpret_cast<byte*>(&rawWord);
    
    for (int i = byteIndex; i < 4; ++i)
    {
        data <<= 8;
        data |= byteArray[3 - i];
        mask >>= 8;
    }
    data <<= 8 * byteIndex;
    data |= (reg.read(rt) & mask);
    reg.write(rt, data);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movswl 0xa(%r14), %r15d
addl %eax, %r15d
movl %r15d, %esi
andl $-0x4, %esi
movq %r12, %rdi
callq 0x7114
movl %eax, 0xc(%rsp)
movl 0xc(%r14), %eax
movl %r15d, %edx
andl $0x3, %edx
movl $0x4, %ecx
subq %rdx, %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %eax, %edx
shll $0x8, %edx
movzbl 0xb(%rsp,%rcx), %eax
orl %edx, %eax
shrl $0x8, %ebp
decq %rcx
jne 0x6da0
shll $0x3, %r15d
movl %r15d, %ecx
shll %cl, %eax
movl %eax, 0xc(%r14)
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
andl %eax, %ebp
orl 0xc(%r14), %ebp
movl %ebp, 0xc(%r14)
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x980c
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/IInstructions.cpp
// Function: Clarkitechture::MIPS::LWRInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void LWRInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t addr = reg.read(rs) + (int16_t)constant;
    uint32_t byteIndex = addr % 4;
    uint32_t wordIndex = addr - byteIndex;
    uint32_t mask = 0xFFFFFFFF;

    uint32_t rawWord = mem.read<uint32_t>(wordIndex);
    byte* byteArray = reinterpret_cast<byte*>(&rawWord);
    
    for (int i = 0; i <= byteIndex; ++i)
    {
        data <<= 8;
        data |= byteArray[3 - i];
        mask <<= 8;
    }
    data |= (reg.read(rt) & mask);
    reg.write(rt, data);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %r12d
movswl 0xa(%r14), %r13d
leal (%r12,%r13), %esi
andl $-0x4, %esi
movq %r15, %rdi
callq 0x7114
movl %eax, 0x4(%rsp)
movl 0xc(%r14), %eax
addb %r12b, %r13b
movzbl %r13b, %ecx
andl $0x3, %ecx
negq %rcx
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %edx
movl %eax, %esi
shll $0x8, %esi
movzbl 0x6(%rsp,%rdx), %eax
orl %esi, %eax
shll $0x8, %ebp
decq %rdx
cmpq %rdx, %rcx
jne 0x6e4a
movl %eax, 0xc(%r14)
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
andl %eax, %ebp
orl 0xc(%r14), %ebp
movl %ebp, 0xc(%r14)
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x980c
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/Instructions.cpp
// Function: Clarkitechture::MIPS::BinaryDecoder::decodeInstruction(unsigned int)
Instruction* BinaryDecoder::decodeInstruction(uint32_t bin)
{
	byte opcode = 0b111111 & (bin >> (32 - 6));
	if (opcode == 0) { return decodeRInstruction(bin); }
    else if (opcode == 0b10 || opcode == 0b11) { return decodeJInstruction(bin); }
	else { return decodeIInstruction(bin); }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
cmpl $0x3ffffff, %edi        # imm = 0x3FFFFFF
ja 0x817a
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x81d2
movl %ebx, %eax
andl $0xf8000000, %eax       # imm = 0xF8000000
cmpl $0x8000000, %eax        # imm = 0x8000000
jne 0x81b0
movl %ebx, %ebp
andl $0x3ffffff, %ebp        # imm = 0x3FFFFFF
notl %ebx
movl $0x10, %edi
callq 0x5200
movl %ebp, 0x8(%rax)
testl $0xc000000, %ebx        # imm = 0xC000000
jne 0x81bd
leaq 0x858a(%rip), %rcx      # 0x10738
jmp 0x81c4
movl %ebx, %edi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x836e
leaq 0x853c(%rip), %rcx      # 0x10700
addq $0x10, %rcx
movq %rcx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/Instructions.cpp
// Function: Clarkitechture::MIPS::BinaryDecoder::decodeBranchInstruction(unsigned int)
BranchIInstruction* BinaryDecoder::decodeBranchInstruction(uint32_t bin)
{
    byte rs = 0b11111 & (bin >> (32 - (6 + 5)));
    byte cond = 0b11111 & (bin >> (32 - (6 + 5 + 5)));
    uint16_t constant = 0xFFFF & bin;
    
    switch (cond)
    {
        case 0b00001: return new BGEZInstr(rs, cond, constant);
        case 0b10001: return new BGEZALInstr(rs, cond, constant);
        case 0b00000: return new BLTZInstr(rs, cond, constant);
        case 0b10000: return new BLTZALInstr(rs, cond, constant);
        default:
            throw BadInstructionDecode(bin, "invalid or unsupported branch condition - " + toBinStr(cond));
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
movl %edi, %ebp
movl %edi, %eax
shrl $0x10, %eax
movl %eax, %r14d
andb $0x1f, %r14b
andl $0x1f, %eax
cmpl $0xf, %eax
jg 0x87b0
testl %eax, %eax
je 0x87c3
cmpl $0x1, %eax
jne 0x8806
leaq 0x7aa2(%rip), %rbx      # 0x10250
jmp 0x87d3
cmpl $0x10, %eax
je 0x87cc
cmpl $0x11, %eax
jne 0x8806
leaq 0x7ad7(%rip), %rbx      # 0x10298
jmp 0x87d3
leaq 0x7ba6(%rip), %rbx      # 0x10370
jmp 0x87d3
leaq 0x7be5(%rip), %rbx      # 0x103b8
addq $0x10, %rbx
movl %ebp, %r15d
shrl $0x15, %r15d
andb $0x1f, %r15b
movl $0x18, %edi
callq 0x5200
movb %r15b, 0x8(%rax)
movb %r14b, 0x9(%rax)
movw %bp, 0xa(%rax)
movq %rbx, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x50, %edi
callq 0x5100
movq %rax, %rbx
movzbl %r14b, %esi
leaq 0x8(%rsp), %rdi
callq 0x89ed
leaq 0x313c(%rip), %rsi      # 0xb964
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rdx
callq 0x897d
movb $0x1, %r15b
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x5b82
xorl %r15d, %r15d
leaq 0x7565(%rip), %rsi      # 0xfdb8
leaq -0x2158(%rip), %rdx     # 0x6702
movq %rbx, %rdi
callq 0x5380
movq %rax, %r14
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8880
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x5210
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x889b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5210
testb %r15b, %r15b
jne 0x88c5
jmp 0x88cd
movq %rax, %r14
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x88c5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5210
jmp 0x88c5
movq %rax, %r14
movq %rbx, %rdi
callq 0x5190
movq %r14, %rdi
callq 0x53a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/Instructions.cpp
// Function: Clarkitechture::MIPS::RInstruction::RInstruction(unsigned char, unsigned char, unsigned char, unsigned char)
RInstruction::RInstruction(byte rs, byte rt, byte rd, byte shamt)
{
	this->rs = rs;
	this->rt = rt;
	this->rd = rd;
	this->shamt = shamt;
}

// Assembly:
leaq 0x7b91(%rip), %rax      # 0x10470
movq %rax, (%rdi)
movb %sil, 0x8(%rdi)
movb %dl, 0x9(%rdi)
movb %cl, 0xa(%rdi)
movb %r8b, 0xb(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/MemoryMap.cpp
// Function: Clarkitechture::MIPS::MemoryMap::MemoryMap(Clarkitechture::MIPS::MemoryMap const&)
MemoryMap::MemoryMap(const MemoryMap &a)
{
    memory = a.memory;
    
    instrMemorySize = a.instrMemorySize;
    if (instrMemorySize > 0)
    {
        instrMemory = new byte[instrMemorySize];
        memcpy(instrMemory, a.instrMemory, a.instrMemorySize);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x30(%rdi), %rax
movq %rax, (%rdi)
movq $0x1, 0x8(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movl $0x3f800000, 0x20(%rdi) # imm = 0x3F800000
movups %xmm0, 0x28(%rdi)
movq $0x0, 0x40(%rdi)
cmpq %rdi, %rsi
je 0x8d60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x8e20
movq 0x40(%r14), %r15
movq %r15, 0x40(%rbx)
testq %r15, %r15
je 0x8d8d
movq %r15, %rdi
callq 0x5030
movq %rax, 0x38(%rbx)
movq 0x38(%r14), %rsi
movq %rax, %rdi
movq %r15, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x51c0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x8db0
movq %r14, %rdi
callq 0x53a0
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::ADDInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void ADDInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int32_t left = reg.read(rs);
    int32_t right = reg.read(rt);
    int32_t result = left + right;
    
    bool overflow = sameSign(left, right) && !sameSign(left, result);
    if (overflow) { throw BadArithmeticOperation("ADD encountered an overflow"); }
    
    reg.write(rd, result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %r15d
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
leal (%rax,%r15), %edx
xorl %r15d, %eax
js 0x9172
xorl %edx, %r15d
js 0x9189
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x980c
movl $0x48, %edi
callq 0x5100
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2878(%rip), %rsi      # 0xba1e
leaq 0x288c(%rip), %rdx      # 0xba39
leaq 0x8(%rsp), %rdi
callq 0x7e20
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x55d6
xorl %ebp, %ebp
leaq 0x6ba0(%rip), %rsi      # 0xfd70
leaq -0x2ca1(%rip), %rdx     # 0x6536
movq %rbx, %rdi
callq 0x5380
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x91f9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5210
testb %bpl, %bpl
jne 0x9203
jmp 0x920b
movq %rax, %r14
movq %rbx, %rdi
callq 0x5190
movq %r14, %rdi
callq 0x53a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::ADDUInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void ADDUInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t left = reg.read(rs);
    uint32_t right = reg.read(rt);
    uint32_t result = left + right;
    reg.write(rd, result);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
addl %eax, %ebp
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x980c
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::SUBInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void SUBInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int32_t left = reg.read(rs);
    int32_t right = reg.read(rt);
    int32_t result = left - right;
    
    bool overflow = !sameSign(left, right) && !sameSign(left, result);
    if (overflow) { throw BadArithmeticOperation("SUB encountered an overflow"); }
    
    reg.write(rd, result);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
movl %ebp, %edx
subl %eax, %edx
xorl %ebp, %eax
jns 0x9285
xorl %edx, %ebp
js 0x929c
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x980c
movl $0x48, %edi
callq 0x5100
movq %rax, %rbx
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2781(%rip), %rsi      # 0xba3a
leaq 0x2795(%rip), %rdx      # 0xba55
leaq 0x8(%rsp), %rdi
callq 0x7e20
movb $0x1, %bpl
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x55d6
xorl %ebp, %ebp
leaq 0x6a8d(%rip), %rsi      # 0xfd70
leaq -0x2db4(%rip), %rdx     # 0x6536
movq %rbx, %rdi
callq 0x5380
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x930c
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5210
testb %bpl, %bpl
jne 0x9316
jmp 0x931e
movq %rax, %r14
movq %rbx, %rdi
callq 0x5190
movq %r14, %rdi
callq 0x53a0
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::NORInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void NORInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t left = reg.read(rs);
    uint32_t right = reg.read(rt);
    uint32_t result = ~(left | right);
    reg.write(rd, result);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
orl %eax, %ebp
notl %ebp
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x980c
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::MULTInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void MULTInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int64_t left = (int32_t)reg.read(rs);
    int64_t right = (int32_t)reg.read(rt);
    int64_t result = left * right;
    reg.lo = 0xFFFFFFFF & result;
    reg.hi = 0xFFFFFFFF & (result >> 32);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movslq %eax, %r15
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
cltq
imulq %r15, %rax
rorq $0x20, %rax
movq %rax, 0x4(%rbx)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::DIVInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void DIVInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int32_t left = reg.read(rs);
    int32_t right = reg.read(rt);
    
    if (right != 0)
    {
        int32_t quotient = left / right;
        int32_t remainder = left % right;
        reg.lo = quotient;
        reg.hi = remainder;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
testl %eax, %eax
je 0x94f8
movl %eax, %ecx
movl %ebp, %eax
cltd
idivl %ecx
movl %eax, 0x8(%rbx)
movl %edx, 0x4(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::DIVUInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void DIVUInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t left = reg.read(rs);
    uint32_t right = reg.read(rt);
    
    if (right != 0)
    {
        uint32_t quotient = left / right;
        uint32_t remainder = left % right;
        reg.lo = quotient;
        reg.hi = remainder;
    }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x8(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x9(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
testl %eax, %eax
je 0x9535
movl %eax, %ecx
movl %ebp, %eax
xorl %edx, %edx
divl %ecx
movl %eax, 0x8(%rbx)
movl %edx, 0x4(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::SLLVInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void SLLVInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t value = reg.read(rt);
    uint32_t newShamt = 0b11111 & reg.read(rs);
    value <<= newShamt;
    reg.write(rd, value);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x9(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
movl %eax, %ecx
shll %cl, %ebp
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x980c
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::SRLVInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void SRLVInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    uint32_t value = reg.read(rt);
    uint32_t newShamt = 0b11111 & reg.read(rs);
    value >>= newShamt;
    reg.write(rd, value);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x9(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
movl %eax, %ecx
shrl %cl, %ebp
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x980c
// File: /workspace/github_cpp_makefile_star2_O3/QFSW[P]MIPS1-Simulator/src/RInstructions.cpp
// Function: Clarkitechture::MIPS::SRAVInstr::execute(Clarkitechture::MIPS::MemoryMap&, Clarkitechture::MIPS::RegisterMap&)
void SRAVInstr::execute(MemoryMap &mem, RegisterMap& reg)
{
    int32_t value = reg.read(rt);
    uint32_t newShamt = 0b11111 & reg.read(rs);
    value >>= newShamt;
    reg.write(rd, value);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rdi, %r14
movzbl 0x9(%rdi), %esi
movq %rdx, %rdi
callq 0x97a8
movl %eax, %ebp
movzbl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x97a8
movl %eax, %ecx
sarl %cl, %ebp
movzbl 0xa(%r14), %esi
movq %rbx, %rdi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x980c