LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: Matrix::operator=(Matrix const&)
Matrix& Matrix::operator=(const Matrix& A)

{
	assert(EqualDim(*this,A));

	for (int i=0; i<A.mRows; i++)
	{
		for (int j=0; j< A.mColumns; j++)
		{
			mElements[i][j] = A.mElements[i][j];
		}
	}
	return *this;
}

// Assembly:
pushq %rax
movl 0xc(%rdi), %eax
cmpl 0xc(%rsi), %eax
jne 0x4c6f
movl 0x8(%rdi), %ecx
cmpl 0x8(%rsi), %ecx
jne 0x4c6f
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
testl %ecx, %ecx
cmovlel %edx, %ecx
cmpq %rcx, %rdx
je 0x4c6a
movq (%rsi), %r8
movq (%rdi), %r9
xorl %r10d, %r10d
cmpq %r10, %rax
je 0x4c65
movq (%r8,%rdx,8), %r11
movsd (%r11,%r10,8), %xmm0
movq (%r9,%rdx,8), %r11
movsd %xmm0, (%r11,%r10,8)
incq %r10
jmp 0x4c47
incq %rdx
jmp 0x4c39
movq %rdi, %rax
popq %rcx
retq
leaq 0x4859(%rip), %rdi      # 0x94cf
leaq 0x4754(%rip), %rsi      # 0x93d1
leaq 0x485d(%rip), %rcx      # 0x94e1
movl $0x1ce, %edx            # imm = 0x1CE
callq 0x10a0
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: outer(Vector, Vector)
Matrix outer(Vector u, Vector v)
{
	int l1 = length(u); int l2 =length(v);
	Matrix ans(l1, l2);
	for (int i=0;i<l1;i++)
	{
		for(int j=0;j<l2;j++)
		{
			ans.mElements[i][j] = u(i+1)*v(j+1);
		}
	}
	return ans;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movq %rsi, 0x18(%rsp)
movq %rsi, %rdi
callq 0x2141
movl %eax, %ebp
movq %rbx, %r15
movq %rbx, %rdi
callq 0x2141
movl %eax, %r13d
movq %r14, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x285c
xorl %ebx, %ebx
testl %r13d, %r13d
cmovlel %ebx, %r13d
movq %r14, 0x8(%rsp)
movq (%r14), %r12
testl %ebp, %ebp
cmovlel %ebx, %ebp
movq %rbp, 0x10(%rsp)
cmpq 0x10(%rsp), %rbx
je 0x4de3
leaq 0x1(%rbx), %rbp
xorl %r14d, %r14d
cmpq %r14, %r13
je 0x4dde
movq 0x18(%rsp), %rdi
movl %ebp, %esi
callq 0x2030
movsd (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
leal 0x1(%r14), %esi
movq %r15, %rdi
callq 0x2030
movsd 0x20(%rsp), %xmm0
mulsd (%rax), %xmm0
movq (%r12,%rbx,8), %rax
movsd %xmm0, (%rax,%r14,8)
incq %r14
jmp 0x4d9e
movq %rbp, %rbx
jmp 0x4d90
movq 0x8(%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x8(%rsp), %rdi
callq 0x2a78
movq %r14, %rdi
callq 0x1180
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: eye(int)
Matrix eye(int i)
{
	Matrix I(i,i);
	for (int k=0;k<i;k++)
	{
		I.mElements[k][k] = 1;
	}
	return I;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, %edx
callq 0x285c
movq (%rbx), %rax
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
cmpq %rcx, %r14
je 0x5100
movq (%rax,%rcx,8), %rsi
movq %rdx, (%rsi,%rcx,8)
incq %rcx
jmp 0x50ee
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: diag(Vector const&)
Matrix diag(const Vector& v)
{
	Matrix D(length(v), length(v));
	for (int k=0;k<length(v);k++)
	{
		D.mElements[k][k] = v(k+1);
	}
	return D;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2141
movl %eax, %ebp
movq %r14, %rdi
callq 0x2141
movq %rbx, %rdi
movl %ebp, %esi
movl %eax, %edx
callq 0x285c
movq (%rbx), %r15
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x2141
cltq
cmpq %rax, %r12
jge 0x516c
leal 0x1(%r12), %esi
movq %r14, %rdi
callq 0x1ee2
movsd (%rax), %xmm0
movq (%r15,%r12,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
jmp 0x513d
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2a78
movq %r14, %rdi
callq 0x1180
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: diag(Vector const&, int)
Matrix diag(const Vector& v, int i) // lets you specify which diagonal to put the vector on
{
	int dim = length(v)+abs(i);
	Matrix D(dim, dim);
	if (i==0) {return diag(v);}
	else if (i>0) {
		for (int k=0;k<length(v);k++)
		{
			D.mElements[k][k+i] = v(k+1);
		}
	}
	else if (i<0)	{
		for (int k=0;k<length(v);k++)
		{
			D.mElements[k-i][k] = v(k+1);
		}
	}
	//std::cout<<"This comes form inside 2\n"<<D<<"\n";
	return D;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2141
movl %ebp, %edx
negl %edx
cmovsl %ebp, %edx
addl %eax, %edx
leaq 0x8(%rsp), %rdi
movl %edx, %esi
callq 0x285c
testl %ebp, %ebp
je 0x5204
movq 0x8(%rsp), %r15
jle 0x5211
movl %ebp, %r12d
shlq $0x3, %r12
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x2141
cltq
cmpq %rax, %r13
jge 0x524d
leal 0x1(%r13), %esi
movq %r14, %rdi
callq 0x1ee2
movsd (%rax), %xmm0
movq (%r15,%r13,8), %rax
addq %r12, %rax
movsd %xmm0, (%rax,%r13,8)
incq %r13
jmp 0x51d3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x510b
jmp 0x525a
movslq %ebp, %rax
shlq $0x3, %rax
subq %rax, %r15
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x2141
cltq
cmpq %rax, %r12
jge 0x524d
leal 0x1(%r12), %esi
movq %r14, %rdi
callq 0x1ee2
movsd (%rax), %xmm0
movq (%r15,%r12,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
jmp 0x521e
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x29b2
leaq 0x8(%rsp), %rdi
callq 0x2a78
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x527a
jmp 0x527a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x2a78
movq %rbx, %rdi
callq 0x1180
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: diag(Matrix const&)
Vector diag(const Matrix& A)
{
	int r =  A.mRows; int c = A.mColumns;
	int l = std::max(r,c);
	Vector diagonal(l);
	for (int i=0;i<l;i++)
	{
		diagonal(i+1) = A.mElements[i][i]; //vectors are also indexed in this notation from 1 not 0, given the overloaded index operator in the Vector class
	}
	return diagonal;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x8(%rsi), %eax
movl 0xc(%rsi), %r15d
cmpl %r15d, %eax
cmovgl %eax, %r15d
movl %r15d, %esi
callq 0x186c
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
cmpq %r12, %r15
je 0x52ef
movq (%r14), %rax
movq (%rax,%r12,8), %rax
movsd (%rax,%r12,8), %xmm0
movsd %xmm0, (%rsp)
leal 0x1(%r12), %esi
movq %rbx, %rdi
callq 0x2030
movsd (%rsp), %xmm0
movsd %xmm0, (%rax)
incq %r12
jmp 0x52bd
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x1908
movq %r14, %rdi
callq 0x1180
// File: /workspace/github_cpp_makefile_star2_O2/IlanPrice[P]Linear-Algebra-Library-in-Cplusplus/Matrix.cpp
// Function: Matrix::applygivens(int, int, double, double)
void Matrix:: applygivens(int i, int j, double c, double s)
{
	for (int k = 1; k<=mColumns; k++)
	{
		double newi = c*mElements[i-1][k-1] - s*mElements[j-1][k-1];
		double newj = s*mElements[i-1][k-1] + c*mElements[j-1][k-1];
		mElements[i-1][k-1] = newi; mElements[j-1][k-1] = newj;
	}
}

// Assembly:
movl 0xc(%rdi), %eax
movq (%rdi), %rcx
movslq %esi, %rsi
movslq %edx, %rdx
xorl %edi, %edi
testl %eax, %eax
cmovlel %edi, %eax
cmpq %rdi, %rax
je 0x616d
movq -0x8(%rcx,%rsi,8), %r8
movsd (%r8,%rdi,8), %xmm2
movq -0x8(%rcx,%rdx,8), %r9
movsd (%r9,%rdi,8), %xmm3
movapd %xmm3, %xmm4
mulsd %xmm1, %xmm4
movapd %xmm0, %xmm5
mulsd %xmm2, %xmm5
subsd %xmm4, %xmm5
mulsd %xmm0, %xmm3
mulsd %xmm1, %xmm2
addsd %xmm3, %xmm2
movsd %xmm5, (%r8,%rdi,8)
movsd %xmm2, (%r9,%rdi,8)
incq %rdi
jmp 0x6121
retq
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH17_SpecializedLibraryFacilities/examples/prec.cc
// Function: main
int main()
{
	// cout.precision reports the current precision value
	cout  << "Precision: " << cout.precision()  
	      << ", Value: "   << sqrt(2.0) << endl;
	
	// cout.precision(12) asks that 12 digits of precision be printed
	cout.precision(12);
	cout << "Precision: " << cout.precision() 
	     << ", Value: "   << sqrt(2.0) << endl;
	
	// alternative way to set precision using the setprecision manipulator
	cout << setprecision(3);
	cout << "Precision: " << cout.precision() 
	     << ", Value: "   << sqrt(2.0) << endl;
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x2dfb(%rip), %rbx      # 0x3fd8
leaq 0xe2c(%rip), %r14       # 0x2010
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq (%rbx), %rcx
movq -0x18(%rcx), %rcx
movq 0x8(%rbx,%rcx), %rsi
movq %rax, %rdi
callq 0x1050
leaq 0xe12(%rip), %r15       # 0x201c
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movsd 0xdeb(%rip), %xmm0      # 0x2008
movq %rax, %rdi
callq 0x1080
movq %rax, %rdi
callq 0x1030
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0xc, 0x8(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq (%rbx), %rcx
movq -0x18(%rcx), %rcx
movq 0x8(%rbx,%rcx), %rsi
movq %rax, %rdi
callq 0x1050
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movsd 0xd96(%rip), %xmm0      # 0x2008
callq 0x1080
movq %rax, %rdi
callq 0x1030
movq (%rbx), %rax
movq -0x18(%rax), %rax
movq $0x3, 0x8(%rbx,%rax)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1060
movq (%rbx), %rcx
movq -0x18(%rcx), %rcx
movq 0x8(%rbx,%rcx), %rsi
movq %rax, %rdi
callq 0x1050
movq %rax, %rdi
movq %r15, %rsi
callq 0x1060
movq %rax, %rdi
movsd 0xd44(%rip), %xmm0      # 0x2008
callq 0x1080
movq %rax, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/sanket143[P]2048-Terminal-Game/./src/2048.cpp
// Function: main
int main(){
  gb::Board board;
  while(true){
    std::cout << "\033[2J\033[1;1H";
    std::cout << "2048 Terminal Game" << std::endl;
    std::cout << "Valid Directions: [R|D|L|U]" << std::endl;
    std::string input;

    board.display();

    std::cout << "Direction: ";
    std::cin >> input;

    if(!board.valid(input)){
      continue;
    }
    std::cout << "Loading..." << std::endl;
    board.move(input);
    board.add_tile();
    board.display();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
leaq -0xcc(%rbp), %rbx
movq %rbx, %rdi
callq 0x2460
movq 0x2c9a(%rip), %r14      # 0x4fd0
leaq -0x48(%rbp), %r13
leaq -0x88(%rbp), %r15
movq %r14, %rdi
leaq 0xcb9(%rip), %rsi       # 0x3004
callq 0x2110
movq %r14, %rdi
leaq 0xcb5(%rip), %rsi       # 0x300f
callq 0x2110
movq %rax, %rdi
callq 0x20b0
movq %r14, %rdi
leaq 0xcb1(%rip), %rsi       # 0x3022
callq 0x2110
movq %rax, %rdi
callq 0x20b0
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %rbx, %rdi
callq 0x2492
movq %r14, %rdi
leaq 0xc9d(%rip), %rsi       # 0x303e
callq 0x2110
movq 0x2c33(%rip), %rdi      # 0x4fe0
movq %r13, %rsi
callq 0x2150
movq %r15, %rdi
movq %r13, %rsi
callq 0x2160
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2586
movl %eax, %r12d
movq %r15, %rdi
callq 0x20a0
testb %r12b, %r12b
je 0x2425
movq %r14, %rdi
leaq 0xc65(%rip), %rsi       # 0x304a
callq 0x2110
movq %rax, %rdi
callq 0x20b0
leaq -0x68(%rbp), %rdi
movq %r13, %rsi
callq 0x2160
movq %rbx, %rdi
leaq -0x68(%rbp), %r12
movq %r12, %rsi
callq 0x266c
movq %r12, %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x28f6
movq %rbx, %rdi
callq 0x2492
movq %r13, %rdi
callq 0x20a0
jmp 0x2341
movq %rax, %rbx
leaq -0x68(%rbp), %rdi
jmp 0x2445
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20a0
jmp 0x244f
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O2/sanket143[P]2048-Terminal-Game/./src/board.h
// Function: gb::Board::display()
void display() {
        flag = false;
        for(int row = 0; row < size; row++) {
          for(int col = 0; col < size; col++) {
            if(tiles[row][col] == 0) {
              std::cout << " .  ";
            } else {
              if(tiles[row][col] < 10) {
                std::cout << " " << tiles[row][col] << "  ";
              }
              else if(tiles[row][col] < 100) {
                std::cout << " " << tiles[row][col] << " ";
              }
              else if(tiles[row][col] < 1000) {
                std::cout << " " <<  tiles[row][col];
              } else {
                std::cout << tiles[row][col];
              }
            }
          }
          std::cout << std::endl;
        }
        std::cout << std::endl;
      }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x2c58(%rip)      # 0x5102
xorl %eax, %eax
movq 0x2b1d(%rip), %r14      # 0x4fd0
leaq 0xb9b(%rip), %r15       # 0x3055
leaq 0xb97(%rip), %r12       # 0x3058
cmpq $0x4, %rax
je 0x256c
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
cmpq $0x4, %r13
je 0x2554
movl (%rbx,%r13,4), %esi
movq %r14, %rdi
testl %esi, %esi
je 0x2508
cmpl $0x9, %esi
jg 0x250d
movq %r12, %rsi
callq 0x2110
movl (%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
leaq 0xb51(%rip), %rsi       # 0x3057
jmp 0x252c
movq %r15, %rsi
jmp 0x252c
cmpl $0x63, %esi
ja 0x2536
movq %r12, %rsi
callq 0x2110
movl (%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x21a0
movq %rax, %rdi
movq %r12, %rsi
callq 0x2110
incq %r13
jmp 0x24d2
cmpl $0x3e7, %esi            # imm = 0x3E7
ja 0x254d
movq %r12, %rsi
callq 0x2110
movl (%rbx,%r13,4), %esi
movq %rax, %rdi
callq 0x21a0
jmp 0x2531
movq %r14, %rdi
callq 0x20b0
movq -0x30(%rbp), %rax
incq %rax
addq $0x10, %rbx
jmp 0x24c1
movq 0x2a5d(%rip), %rdi      # 0x4fd0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
// File: /workspace/github_cpp_makefile_star2_O2/sanket143[P]2048-Terminal-Game/./src/board.h
// Function: gb::Board::valid(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool valid(std::string direction) {
        std::string valid_directions[4] = {"R", "D", "L", "U"};
        for(int i = 0; i < 4; i++) {
          if(direction == valid_directions[i]) {
            return true;
          }
        }
        return false;
      }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r15
leaq 0xaba(%rip), %rsi       # 0x305a
leaq -0xa0(%rbp), %rbx
leaq -0x1c(%rbp), %rdx
movq %rbx, %rdi
callq 0x29ec
leaq -0x80(%rbp), %r14
leaq 0xa9e(%rip), %rsi       # 0x305c
leaq -0x1b(%rbp), %rdx
movq %r14, %rdi
callq 0x29ec
leaq -0x60(%rbp), %r14
leaq 0xa89(%rip), %rsi       # 0x305e
leaq -0x1a(%rbp), %rdx
movq %r14, %rdi
callq 0x29ec
leaq -0x40(%rbp), %r14
leaq 0xa74(%rip), %rsi       # 0x3060
leaq -0x19(%rbp), %rdx
movq %r14, %rdi
callq 0x29ec
xorl %ecx, %ecx
movq %rcx, %r14
cmpq $0x4, %rcx
je 0x261a
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2a27
leaq 0x1(%r14), %rcx
addq $0x20, %rbx
testb %al, %al
je 0x25fa
pushq $0x60
popq %rbx
leaq (%rbx,%rbp), %rdi
addq $-0xa0, %rdi
callq 0x20a0
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x261d
cmpq $0x4, %r14
setb %al
addq $0x88, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2650
jmp 0x2650
movq %rax, %r15
addq $-0x20, %r14
movq %r14, %rdi
callq 0x20a0
cmpq %rbx, %r14
jne 0x2653
movq %r15, %rdi
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O2/sanket143[P]2048-Terminal-Game/./src/board.h
// Function: gb::Board::add_tile()
void add_tile() {
      
        vector <int> available;

        for(int row = 0; row < 4; row++){
          for(int col = 0; col < 4; col++){
            if(tiles[row][col] == 0){
              available.push_back(row * 4 + col);
            }
          }
        }
        
        if(available.size() == 0) {
          printf("Game Over\n");
          exit(0);
        }
        int random_empty_tile = available[(int)(rand() % (int)available.size())];
        tiles[random_empty_tile / 4][random_empty_tile % 4] = 2;
          
      }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %r14
movaps %xmm0, (%r14)
andq $0x0, 0x10(%r14)
xorl %r12d, %r12d
leaq -0x2c(%rbp), %r15
movq %rdi, -0x38(%rbp)
movq %rdi, %r13
xorl %eax, %eax
cmpq $0x4, %rax
je 0x2969
movq %rax, -0x40(%rbp)
xorl %ebx, %ebx
cmpq $0x4, %rbx
je 0x2958
cmpl $0x0, (%r13,%rbx,4)
jne 0x2953
leal (%r12,%rbx), %eax
movl %eax, -0x2c(%rbp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2cee
incq %rbx
jmp 0x2933
movq -0x40(%rbp), %rax
incq %rax
addq $0x4, %r12
addq $0x10, %r13
jmp 0x2927
movq -0x58(%rbp), %rax
cmpq -0x60(%rbp), %rax
je 0x29c4
callq 0x2030
leaq -0x60(%rbp), %rdi
movq (%rdi), %rcx
movq 0x8(%rdi), %rsi
subq %rcx, %rsi
shrq $0x2, %rsi
cltd
idivl %esi
movslq %edx, %rax
movl (%rcx,%rax,4), %eax
pushq $0x4
popq %rcx
cltd
idivl %ecx
cltq
movslq %edx, %rcx
shlq $0x4, %rax
movq -0x38(%rbp), %rdx
addq %rax, %rdx
movl $0x2, (%rdx,%rcx,4)
callq 0x2ea2
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6ee(%rip), %rdi       # 0x30b9
callq 0x2180
xorl %edi, %edi
callq 0x2140
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x2ea2
movq %rbx, %rdi
callq 0x21b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: usage()
void usage() {
    cout << "Usage : nrf24lx1Flash -f [hexfile] -p port -b baudrate -r reset -b BL_enabled -c command\n";
    cout << "-f [hexfile], path to hex file\n";
    cout << "-p port, port device\n\t-default /dev/ttyUSB0 \n";
    cout << "-b baudrate, UART speed\n\t-default 38400 \n";
    cout << "-r reset, reset pin DTR, RTS or CTS\n\t-default DTR\n";
    cout << "-bl BL_enabled, DISABLED or DTR or RTS\n\t-default DISABLED\n";
    cout << "-c command, CHECK, FLASH\n\t-default CHECK\n";
    cout << "\nVersion " << version << "\n";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq 0x692f(%rip), %rbx      # 0x8fd8
leaq 0x39b1(%rip), %rsi      # 0x6061
movq %rbx, %rdi
callq 0x2200
leaq 0x39fc(%rip), %rsi      # 0x60bb
movq %rbx, %rdi
callq 0x2200
leaq 0x3a0d(%rip), %rsi      # 0x60db
movq %rbx, %rdi
callq 0x2200
leaq 0x3a2c(%rip), %rsi      # 0x6109
movq %rbx, %rdi
callq 0x2200
leaq 0x3a47(%rip), %rsi      # 0x6133
movq %rbx, %rdi
callq 0x2200
leaq 0x3a6b(%rip), %rsi      # 0x6166
movq %rbx, %rdi
callq 0x2200
leaq 0x3a97(%rip), %rsi      # 0x61a1
movq %rbx, %rdi
callq 0x2200
leaq 0x3ab2(%rip), %rsi      # 0x61cb
movq %rbx, %rdi
callq 0x2200
leaq 0x6b00(%rip), %rsi      # 0x9228
movq %rax, %rdi
callq 0x21e0
leaq 0x4319(%rip), %rsi      # 0x6a50
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x2200
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: set_interface_attribs(int, int, int)
int
set_interface_attribs (int fd, int speed, int parity)
{
        struct termios tty;
        memset (&tty, 0, sizeof tty);
        if (tcgetattr (fd, &tty) != 0)
        {
                cout <<  "error %d from tcgetattr" <<  errno;
                return -1;
        }

        cfsetospeed (&tty, speed);
        cfsetispeed (&tty, speed);

        tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8;     // 8-bit chars
        // disable IGNBRK for mismatched speed tests; otherwise receive break
        // as \000 chars
        tty.c_iflag &= ~IGNBRK;         // disable break processing
        tty.c_lflag = 0;                // no signaling chars, no echo,
                                        // no canonical processing
        tty.c_oflag = 0;                // no remapping, no delays
        tty.c_cc[VMIN]  = 0;            // read doesn't block
        tty.c_cc[VTIME] = 5;            // 0.5 seconds read timeout

        tty.c_iflag &= ~(IXON | IXOFF | IXANY); // shut off xon/xoff ctrl

        tty.c_cflag |= (CLOCAL | CREAD);// ignore modem controls,
                                        // enable reading
        tty.c_cflag &= ~(PARENB | PARODD);      // shut off parity
        tty.c_cflag |= parity;
        tty.c_cflag &= ~CSTOPB;
        tty.c_cflag &= ~CRTSCTS;

        if (tcsetattr (fd, TCSANOW, &tty) != 0)
        {
                cout << "error from tcsetattr:" << errno;
                return -1;
        }
        return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %edx, %r14d
movl %esi, %r15d
movl %edi, %ebx
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rsi
movups %xmm0, 0x2c(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
callq 0x2250
testl %eax, %eax
je 0x3028
leaq 0x33ae(%rip), %rsi      # 0x63d4
jmp 0x3098
leaq -0x60(%rbp), %r12
movq %r12, %rdi
movl %r15d, %esi
callq 0x2240
movq %r12, %rdi
movl %r15d, %esi
callq 0x2160
andl $0x0, 0xc(%r12)
andl $0x0, 0x4(%r12)
movw $0x5, 0x16(%r12)
andl $0xffffe3fe, (%r12)     # imm = 0xFFFFE3FE
movl $0x7ffff40f, %eax       # imm = 0x7FFFF40F
andl 0x8(%r12), %eax
andl $0x7ffff70f, %r14d      # imm = 0x7FFFF70F
orl %eax, %r14d
orl $0x8b0, %r14d           # imm = 0x8B0
movl %r14d, 0x8(%r12)
xorl %r14d, %r14d
movl %ebx, %edi
xorl %esi, %esi
movq %r12, %rdx
callq 0x2270
testl %eax, %eax
je 0x30ba
leaq 0x3354(%rip), %rsi      # 0x63ec
movq 0x5f39(%rip), %rdi      # 0x8fd8
callq 0x2200
movq %rax, %rbx
callq 0x2040
movl (%rax), %esi
movq %rbx, %rdi
callq 0x2360
pushq $-0x1
popq %r14
movl %r14d, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: set_blocking(int, int)
void
set_blocking (int fd, int should_block)
{
        struct termios tty;
        memset (&tty, 0, sizeof tty);
        if (tcgetattr (fd, &tty) != 0)
        {
                cout << "error from tggetattr: " << errno;
                return;
        }

        tty.c_cc[VMIN]  = should_block ? 1 : 0;
        tty.c_cc[VTIME] = 5;            // 0.5 seconds read timeout

        if (tcsetattr (fd, TCSANOW, &tty) != 0)
                cout << "error setting term attributes:"<<errno;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %esi, %r14d
movl %edi, %ebx
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rsi
movups %xmm0, 0x2c(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
callq 0x2250
testl %eax, %eax
je 0x3102
leaq 0x3302(%rip), %rsi      # 0x6402
jmp 0x3125
testl %r14d, %r14d
leaq -0x50(%rbp), %rdx
setne 0x17(%rdx)
movb $0x5, 0x16(%rdx)
movl %ebx, %edi
xorl %esi, %esi
callq 0x2270
testl %eax, %eax
je 0x3143
leaq 0x32f4(%rip), %rsi      # 0x6419
movq 0x5eac(%rip), %rdi      # 0x8fd8
callq 0x2200
movq %rax, %rbx
callq 0x2040
movl (%rax), %esi
movq %rbx, %rdi
callq 0x2360
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: OpenSerialPort(unsigned int)
bool OpenSerialPort(speed_t baudRate)
{
    string s = port;
    strreplace(s,"/dev/", "");
    string lockFileName = "/tmp/LCK.." + s;

    try
    {
        ifstream *lockFile = new ifstream(lockFileName.c_str());
    }
    catch (...)
    {
        cout << "Error: Lock file " + lockFileName + " exists!  It is likely that another serial terminal has this port open!\r\n";
        return false;
    }

    progSerPort = open(port.c_str(),O_RDWR | O_NOCTTY | O_SYNC );

    set_interface_attribs (progSerPort, B38400, 0);
    set_blocking (progSerPort, 0);
    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0xb0, %rsp
leaq 0x618f(%rip), %rsi      # 0x92f0
leaq -0x98(%rbp), %rdi
callq 0x22a0
leaq 0x32c4(%rip), %rsi      # 0x6438
leaq -0x38(%rbp), %rdi
leaq -0x78(%rbp), %rdx
callq 0x4942
leaq 0x38c9(%rip), %rsi      # 0x6a51
leaq -0x58(%rbp), %rdi
leaq -0x11(%rbp), %rdx
callq 0x4942
leaq -0xb8(%rbp), %rdi
leaq -0x98(%rbp), %rsi
leaq -0x38(%rbp), %rdx
leaq -0x58(%rbp), %rcx
callq 0x56dc
leaq -0xb8(%rbp), %rdi
callq 0x23e8
leaq -0x58(%rbp), %rdi
callq 0x23e8
leaq -0x38(%rbp), %rdi
callq 0x23e8
leaq 0x3269(%rip), %rsi      # 0x643e
leaq -0x38(%rbp), %rdi
leaq -0x98(%rbp), %rdx
callq 0x497d
movl $0x208, %edi            # imm = 0x208
callq 0x2210
movq %rax, %rbx
movq -0x38(%rbp), %rsi
pushq $0x8
popq %rdx
movq %rax, %rdi
callq 0x2390
movq 0x60e8(%rip), %rdi      # 0x92f0
movl $0x101102, %esi         # imm = 0x101102
xorl %eax, %eax
callq 0x2190
movl %eax, 0x60fe(%rip)      # 0x9318
pushq $0xf
popq %rsi
movl %eax, %edi
xorl %edx, %edx
callq 0x2fe9
movb $0x1, %bl
movl 0x60ea(%rip), %edi      # 0x9318
xorl %esi, %esi
callq 0x30ca
leaq -0x38(%rbp), %rdi
callq 0x23e8
leaq -0x98(%rbp), %rdi
callq 0x23e8
movl %ebx, %eax
addq $0xb0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movl $0x208, %esi            # imm = 0x208
movq %rbx, %rdi
callq 0x2220
jmp 0x326d
movq %rax, %r14
movq %r14, %rdi
callq 0x2120
leaq 0x31cd(%rip), %rsi      # 0x6449
leaq -0x78(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x497d
leaq 0x31cb(%rip), %rdx      # 0x645b
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x49f3
movq 0x5d34(%rip), %rdi      # 0x8fd8
leaq -0x58(%rbp), %rsi
callq 0x21e0
leaq -0x58(%rbp), %rdi
callq 0x23e8
leaq -0x78(%rbp), %rdi
callq 0x23e8
callq 0x2340
xorl %ebx, %ebx
jmp 0x3235
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x23e8
jmp 0x32dc
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x23e8
jmp 0x32ea
movq %rax, %rbx
callq 0x2340
jmp 0x3313
movq %rax, %rdi
callq 0x4a1c
jmp 0x330b
movq %rax, %rbx
leaq -0x58(%rbp), %rdi
callq 0x23e8
jmp 0x3313
jmp 0x3310
movq %rax, %rbx
jmp 0x331c
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x23e8
leaq -0x98(%rbp), %rdi
callq 0x23e8
movq %rbx, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ReadSerialDataByte(unsigned char*)
BLCommandReturnType ReadSerialDataByte(unsigned char *buffer)
{
  fd_set set;
  struct timeval timeout;
  int rv;

  FD_ZERO(&set); /* clear the set */
  FD_SET(progSerPort, &set); /* add our file descriptor to the set */

  timeout.tv_sec = 0;
  timeout.tv_usec = 2000000;

  rv = select(progSerPort + 1, &set, NULL, NULL, &timeout);
  if(rv == -1)
    return BLCommandReturnType_SerialPortFailure; /* an error accured */
  else if(rv == 0)
    return BLCommandReturnType_Timeout; /* a timeout occured */
  else
    read( progSerPort, (void *)buffer,1 ); /* there was data to read */

    return BLCommandReturnType_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
xorl %eax, %eax
cmpq $0x10, %rax
je 0x34f9
andq $0x0, -0x98(%rbp,%rax,8)
incq %rax
jmp 0x34e5
movl 0x5e19(%rip), %edi      # 0x9318
pushq $0x40
popq %rcx
movl %edi, %eax
cltd
idivl %ecx
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
pushq $0x1
popq %rax
shlq %cl, %rax
orq %rax, -0x98(%rbp,%rdx,8)
leaq -0x18(%rbp), %r8
andq $0x0, (%r8)
movq $0x1e8480, 0x8(%r8)     # imm = 0x1E8480
incl %edi
leaq -0x98(%rbp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x21f0
cmpl $-0x1, %eax
je 0x354e
testl %eax, %eax
jne 0x3553
pushq $0x2
jmp 0x3550
pushq $0x3
popq %rax
jmp 0x3566
movl 0x5dbf(%rip), %edi      # 0x9318
pushq $0x1
popq %rdx
movq %rbx, %rsi
callq 0x22d0
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ReadSerialCommandByte(BLCommand)
BLCommandReturnType ReadSerialCommandByte(BLCommand command)
{
    unsigned char buffer = 0;
    BLCommandReturnType blCommandReturnVal;

    blCommandReturnVal = ReadSerialDataByte(&buffer);

    if (blCommandReturnVal == BLCommandReturnType_OK)
    {
        if ((command == BLCommand_Any) || (buffer == (char)command))
        {
            return BLCommandReturnType_OK;
        }
        else
        {
            return BLCommandReturnType_BadCharacter;
        }
    }
    else
    {
        return blCommandReturnVal;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
leaq -0x9(%rbp), %rdi
movb $0x0, (%rdi)
callq 0x34d4
testl %eax, %eax
jne 0x359d
xorl %eax, %eax
cmpl $0x2a, %ebx
je 0x359d
movzbl -0x9(%rbp), %ecx
movsbl %bl, %edx
xorl %eax, %eax
cmpl %ecx, %edx
setne %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandStartBootloader()
BLCommandReturnType ExecuteCommandStartBootloader()
{
    if (!OpenSerialPort(baudrate))
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    //reset the chip
    ResetDevice();

    //send the start byte
    if (WriteSerialByte((unsigned char)BLCommand_Start) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    //wait for the return character and return it
    return ReadSerialCommandByte(BLCommand_Start);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x314c
testb %al, %al
je 0x35c2
callq 0x33a8
pushq $0x73
popq %rdi
callq 0x3489
testl %eax, %eax
je 0x35c7
pushq $0x3
popq %rax
popq %rbp
retq
pushq $0x73
popq %rdi
popq %rbp
jmp 0x3570
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandGetDevID(unsigned short*)
BLCommandReturnType ExecuteCommandGetDevID(uint16_t *buffer)
{
    unsigned char tempByte = 0;

    if (WriteSerialByte((unsigned char )BLCommand_GetDevID) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    if (ReadSerialDataByte(&tempByte) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_Timeout;
    }

    *buffer = tempByte;

    if (ReadSerialDataByte(&tempByte) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_Timeout;
    }

    (*buffer) += ((uint16_t)tempByte) << 8;

    return ReadSerialCommandByte(BLCommand_GetDevID);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movb $0x0, -0x11(%rbp)
pushq $0x69
popq %rdi
callq 0x3489
testl %eax, %eax
je 0x35f4
pushq $0x3
popq %r14
jmp 0x3618
leaq -0x11(%rbp), %rdi
callq 0x34d4
pushq $0x2
popq %r14
testl %eax, %eax
jne 0x3618
leaq -0x11(%rbp), %rdi
movzbl (%rdi), %eax
movw %ax, (%rbx)
callq 0x34d4
testl %eax, %eax
je 0x3624
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movzbl -0x11(%rbp), %eax
shll $0x8, %eax
addw %ax, (%rbx)
pushq $0x69
popq %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x3570
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ConvertBLDevIDToString[abi:cxx11](unsigned short)
string ConvertBLDevIDToString(uint16_t blDevId)
{
    string retVal;

    if(blDevId >= sizeof(&blDevIdToString))
    {
        retVal = "[Invalid Device ID]";
    }
    else
    {
        retVal = blDevIdToString[blDevId];
    }

    retVal += " (ID: " + ToString(blDevId) + ")\n";

    return retVal;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x70, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movw %si, -0x12(%rbp)
movb $0x0, 0x10(%rdi)
cmpw $0x8, %si
jb 0x36d2
leaq 0x2ddd(%rip), %rsi      # 0x64a5
movq %rbx, %rdi
callq 0x23b0
jmp 0x36ea
movzwl %si, %eax
shll $0x5, %eax
leaq 0x5b71(%rip), %rsi      # 0x9250
addq %rax, %rsi
movq %rbx, %rdi
callq 0x2150
leaq -0x38(%rbp), %rdi
leaq -0x12(%rbp), %rsi
callq 0x4a58
leaq 0x2dbb(%rip), %rsi      # 0x64b9
leaq -0x58(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x4a2a
leaq 0x2dae(%rip), %rdx      # 0x64c0
leaq -0x78(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x49f3
leaq -0x78(%rbp), %rsi
movq %rbx, %rdi
callq 0x23c0
leaq -0x78(%rbp), %rdi
callq 0x23e8
leaq -0x58(%rbp), %rdi
callq 0x23e8
leaq -0x38(%rbp), %rdi
callq 0x23e8
movq %rbx, %rax
addq $0x70, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
leaq -0x78(%rbp), %rdi
callq 0x23e8
jmp 0x3763
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x23e8
jmp 0x3771
movq %rax, %r14
leaq -0x38(%rbp), %rdi
callq 0x23e8
jmp 0x3781
jmp 0x377e
movq %rax, %r14
movq %rbx, %rdi
callq 0x23e8
movq %r14, %rdi
callq 0x2370
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandSetRWAddress(unsigned short)
BLCommandReturnType ExecuteCommandSetRWAddress(uint16_t address)
{
    if (WriteSerialByte((uint8_t)BLCommand_SetRWAddress) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    if (WriteSerialByte((uint8_t)address & 0xFF) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    if (WriteSerialByte((uint8_t)(address >> 8)) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    return ReadSerialCommandByte(BLCommand_SetRWAddress);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $0x61
popq %rdi
callq 0x3489
testl %eax, %eax
jne 0x391f
movzbl %bl, %edi
callq 0x3489
testl %eax, %eax
jne 0x391f
movzwl %bx, %edi
shrl $0x8, %edi
callq 0x3489
testl %eax, %eax
je 0x3929
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
pushq $0x61
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3570
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandWrite(unsigned char*, unsigned short, unsigned short)
BLCommandReturnType ExecuteCommandWrite(uint8_t buffer[], uint16_t startIndex, uint16_t len)
{
    uint numWritten = 0;

    while(numWritten < len)
    {
        uint numToWrite;

        //The write operation only supports writing up to 256 bytes per write
        if ((len - numWritten) > 256)
        {
            numToWrite = 256;
        }
        else
        {
            numToWrite = len - numWritten;
        }

        //Send write command
        if (WriteSerialByte((uint8_t)BLCommand_Write) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_SerialPortFailure;
        }

        //Send number of bytes to be written (0 here indicates we want to write 256 bytes, so casting numToWrite to a byte does the trick of getting rid of the MSb)
        if (WriteSerialByte((uint8_t)numToWrite) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_SerialPortFailure;
        }

        //Send the bytes to be written one by one
        for(unsigned int x = 0; x < numToWrite; x++)
        {
            if (WriteSerialByte(buffer[startIndex + numWritten]) != BLCommandReturnType_OK)
            {
                return BLCommandReturnType_SerialPortFailure;
            }

            numWritten++;
        }

        if (ReadSerialCommandByte(BLCommand_Write) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_Timeout;
        }
    }

    return BLCommandReturnType_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r12
movl $0x100, %eax            # imm = 0x100
xorl %r13d, %r13d
movl %edx, -0x2c(%rbp)
movl %r15d, %r14d
subl %r13d, %r14d
jbe 0x39d1
cmpl %eax, %r14d
cmovael %eax, %r14d
pushq $0x77
popq %rdi
callq 0x3489
testl %eax, %eax
jne 0x39bf
movzbl %r14b, %edi
callq 0x3489
testl %eax, %eax
jne 0x39bf
movq %rbx, %r15
addl %r13d, %ebx
addl %r14d, %r13d
subl $0x1, %r14d
jb 0x39a3
movl %ebx, %eax
movzbl (%r12,%rax), %edi
callq 0x3489
incl %ebx
testl %eax, %eax
je 0x3989
jmp 0x39bf
pushq $0x77
popq %rdi
callq 0x3570
testl %eax, %eax
movq %r15, %rbx
movl -0x2c(%rbp), %r15d
movl $0x100, %eax            # imm = 0x100
je 0x3958
pushq $0x2
jmp 0x39c1
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x39c2
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandSetUsrMainAddress(unsigned short)
BLCommandReturnType ExecuteCommandSetUsrMainAddress(uint16_t address)
{
    if (WriteSerialByte((uint8_t)BLCommand_SetUsrMainAddress) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    if (WriteSerialByte((uint8_t)address & 0xFF) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    if (WriteSerialByte((uint8_t)address >> 8) != BLCommandReturnType_OK)
    {
        return BLCommandReturnType_SerialPortFailure;
    }

    return ReadSerialCommandByte(BLCommand_SetUsrMainAddress);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
pushq $0x6d
popq %rdi
callq 0x3489
testl %eax, %eax
jne 0x3a00
movzbl %bl, %edi
callq 0x3489
testl %eax, %eax
jne 0x3a00
xorl %edi, %edi
callq 0x3489
testl %eax, %eax
je 0x3a0a
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
pushq $0x6d
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x3570
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: ExecuteCommandRead(unsigned char*, unsigned short, unsigned short)
BLCommandReturnType ExecuteCommandRead(uint8_t buffer[], uint16_t startIndex, uint16_t len)
{
    unsigned int numRead = 0;

    while(numRead < len)
    {
        unsigned int numToRead;

        //The read operation only supports reading up to 256 bytes per read
        if ((len - numRead) > 256)
        {
            numToRead = 256;
        }
        else
        {
            numToRead = len - numRead;
        }

        //Send read command
        if (WriteSerialByte((uint8_t)BLCommand_Read) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_SerialPortFailure;
        }

        //Send number of bytes to be read (0 here indicates we want to read 256 bytes, so casting numToRead to a byte does the trick of getting rid of the MSb)
        if (WriteSerialByte((uint8_t)numToRead) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_SerialPortFailure;
        }

        //Read in the bytes from the micro one by one
        for(unsigned int x = 0; x < numToRead; x++)
        {
            if (ReadSerialDataByte(&buffer[startIndex + numRead]) != BLCommandReturnType_OK)
            {
                return BLCommandReturnType_SerialPortFailure;
            }

            numRead++;
        }

        if (ReadSerialCommandByte(BLCommand_Read) != BLCommandReturnType_OK)
        {
            return BLCommandReturnType_Timeout;
        }
    }

    return BLCommandReturnType_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movl %esi, %ebx
movq %rdi, %r12
movl $0x100, %eax            # imm = 0x100
xorl %r13d, %r13d
movl %edx, -0x2c(%rbp)
movl %r15d, %r14d
subl %r13d, %r14d
jbe 0x3ab0
cmpl %eax, %r14d
cmovael %eax, %r14d
pushq $0x72
popq %rdi
callq 0x3489
testl %eax, %eax
jne 0x3a9e
movzbl %r14b, %edi
callq 0x3489
testl %eax, %eax
jne 0x3a9e
movq %rbx, %r15
addl %r13d, %ebx
addl %r14d, %r13d
subl $0x1, %r14d
jb 0x3a82
movl %ebx, %edi
addq %r12, %rdi
callq 0x34d4
incl %ebx
testl %eax, %eax
je 0x3a6a
jmp 0x3a9e
pushq $0x72
popq %rdi
callq 0x3570
testl %eax, %eax
movq %r15, %rbx
movl -0x2c(%rbp), %r15d
movl $0x100, %eax            # imm = 0x100
je 0x3a39
pushq $0x2
jmp 0x3aa0
pushq $0x3
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x3aa1
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/main.cpp
// Function: main
int main(int argc, char **argv)
{
    if(argc==1) usage();
    if(!processCommandLine(argc, argv)) exit(0);
    if(command==C_CHECK) {
        if(!CheckUC()) return -1;
    } else
    {
        if(!ProgramUC()) return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %r14d
cmpl $0x1, %edi
jne 0x4907
callq 0x269c
movl %r14d, %edi
movq %rbx, %rsi
callq 0x2745
testb %al, %al
je 0x493b
cmpl $0x0, 0x49f7(%rip)      # 0x9314
je 0x4926
callq 0x3ab4
jmp 0x492b
callq 0x3791
testb %al, %al
je 0x4933
xorl %eax, %eax
jmp 0x4936
pushq $-0x1
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
xorl %edi, %edi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/./include/misc.h
// Function: unsigned char ParseHex<unsigned char>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
T ParseHex(const std::string& str) {
    T value = 0;
    for(unsigned int i=0;i<str.length();i++) {
        value = value << 4;
        if(str[i]>='0' && str[i]<='9') {
            int v = str[i]-'0';
            value += v;
        }
        else if(str[i]>='A' && str[i]<='F') {
            int v = str[i]-'A' + 10;
            value += v;
        }
    }
    return value;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
xorl %esi, %esi
xorl %eax, %eax
movl %esi, %esi
cmpq %rsi, %rdx
jbe 0x53db
shlb $0x4, %al
movb (%rcx,%rsi), %dil
cmpb $0x30, %dil
jl 0x53d7
cmpb $0x39, %dil
ja 0x53c4
addb %al, %dil
addb $-0x30, %dil
jmp 0x53d5
leal -0x41(%rdi), %r8d
cmpb $0x5, %r8b
ja 0x53d7
addb %al, %dil
addb $-0x37, %dil
movl %edi, %eax
incl %esi
jmp 0x53a1
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/gulamf[P]NRF24LE1Flash/src/misc.cpp
// Function: sleep_ms(int)
void sleep_ms(int milliseconds)
{
#if _POSIX_C_SOURCE >= 199309L
    struct timespec ts;
    ts.tv_sec = milliseconds / 1000;
    ts.tv_nsec = (milliseconds % 1000) * 1000000;
    nanosleep(&ts, NULL);
#else
    usleep(milliseconds * 1000);
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movl %edi, %eax
movl $0x3e8, %ecx            # imm = 0x3E8
cltd
idivl %ecx
cltq
leaq -0x10(%rbp), %rdi
movq %rax, (%rdi)
imull $0xf4240, %edx, %eax    # imm = 0xF4240
cltq
movq %rax, 0x8(%rdi)
xorl %esi, %esi
callq 0x20e0
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: getrandom(int)
const int getrandom (const int x)
{
	if (x <= 0)
		return 0;

	// r will be between 0 and 1 (but below 1 as we are dividing by RAND_MAX+1)
	double r = static_cast<double> (std::rand () % RAND_MAX) / (static_cast<double> (RAND_MAX) + 1.0);
	return floor (r * x);

}

// Assembly:
testl %edi, %edi
jle 0x839f
pushq %rbx
movl %edi, %ebx
callq 0x7110
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cltd
idivl %ecx
cvtsi2sd %edx, %xmm1
mulsd 0x24c7c(%rip), %xmm1    # 0x2d008
cvtsi2sd %ebx, %xmm0
mulsd %xmm1, %xmm0
callq 0x7790
cvttsd2si %xmm0, %eax
popq %rbx
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: roll(int, int)
const int roll (const int howmany, const int die)
{
	int count;
	int total = 0;

	for (count = 0; count < howmany; ++count)
		total += getrandom (die) + 1;

	return total;

}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
xorl %r14d, %r14d
testl %edi, %edi
cmovlel %r14d, %ebp
subl $0x1, %ebp
jb 0x83c7
movl %ebx, %edi
callq 0x836c
addl %eax, %r14d
incl %r14d
jmp 0x83b3
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: Parser::Expression(bool)
const double Parser::Expression (const bool get)  // AND and OR
  {
  double left = Comparison (get);
  while (true)
    {
    switch (type_)
      {
      case AND: 
            {
            double d = Comparison (true);   // don't want short-circuit evaluation
            left = (left != 0.0) && (d != 0.0); 
            }
          break;
      case OR:  
            {
            double d = Comparison (true);   // don't want short-circuit evaluation
            left = (left != 0.0) || (d != 0.0); 
            }
          break;
      default:    return left;
      } // end of switch on type
    }   // end of loop
  }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
callq 0x9128
pushq $0x1
popq %rbp
movl 0x30(%rbx), %eax
cmpl $0x44, %eax
movapd %xmm0, (%rsp)
je 0x8fb2
cmpl $0x43, %eax
jne 0x8fe2
movq %rbx, %rdi
movl %ebp, %esi
callq 0x9128
xorpd %xmm1, %xmm1
movapd (%rsp), %xmm2
cmpneqpd %xmm1, %xmm2
cmpneqpd %xmm1, %xmm0
andpd %xmm2, %xmm0
jmp 0x8fd3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x9128
xorpd %xmm1, %xmm1
movapd (%rsp), %xmm2
cmpneqpd %xmm1, %xmm2
cmpneqpd %xmm1, %xmm0
orpd %xmm2, %xmm0
movd %xmm0, %eax
andb $0x1, %al
movzbl %al, %eax
cvtsi2sd %eax, %xmm0
jmp 0x8f7d
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: Parser::CommaList(bool)
const double Parser::CommaList (const bool get)  // expr1, expr2
  {
  double left = Expression (get);
  while (true)
    {
    switch (type_)
      {
      case COMMA:  left = Expression (true); break; // discard previous value
      default:    return left;
      } // end of switch on type
    }   // end of loop
  }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x8f6c
pushq $0x1
popq %rbp
cmpl $0x2c, 0x30(%rbx)
jne 0x900a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8f6c
jmp 0x8ff8
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: Parser::Term(bool)
const double Parser::Term (const bool get)    // multiply and divide
  {
  double left = Primary (get);
  while (true)
    {
    switch (type_)
      {
      case MULTIPLY:  
        left *= Primary (true); break;
      case DIVIDE: 
          {
          double d = Primary (true);
          if (d == 0.0)
            throw std::runtime_error ("Divide by zero");
          left /= d; 
          break;
          }
      default:    return left;
      } // end of switch on type
    }   // end of loop
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
callq 0x8ace
pushq $0x1
popq %rbp
movl 0x30(%rbx), %eax
cmpl $0x2f, %eax
movsd %xmm0, 0x8(%rsp)
je 0x905a
cmpl $0x2a, %eax
jne 0x9080
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8ace
movsd 0x8(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movsd 0x8(%rsp), %xmm0
jmp 0x9025
movq %rbx, %rdi
movl %ebp, %esi
callq 0x8ace
ucomisd 0x23fac(%rip), %xmm0    # 0x2d018
jne 0x9070
jnp 0x9089
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
jmp 0x9025
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x71d0
movq %rax, %rbx
leaq 0x240b7(%rip), %rsi     # 0x2d152
movq %rax, %rdi
callq 0x7150
movq 0x3bf46(%rip), %rsi     # 0x44ff0
movq 0x3bed7(%rip), %rdx     # 0x44f88
movq %rbx, %rdi
callq 0x76a0
movq %rax, %r14
movq %rbx, %rdi
callq 0x7300
movq %r14, %rdi
callq 0x76d0
// File: /workspace/github_cpp_makefile_star2_O2/melop[P]admixem/./parser/parser.cpp
// Function: Parser::AddSubtract(bool)
const double Parser::AddSubtract (const bool get)  // add and subtract
  {
  double left = Term (get);
  while (true)
    {
    switch (type_)
      {
      case PLUS:  left += Term (true); break;
      case MINUS: left -= Term (true); break;
      default:    return left;
      } // end of switch on type
    }   // end of loop
  }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x9012
pushq $0x1
popq %rbp
movl 0x30(%rbx), %eax
cmpl $0x2d, %eax
movsd %xmm0, (%rsp)
je 0x9101
cmpl $0x2b, %eax
jne 0x9120
movq %rbx, %rdi
movl %ebp, %esi
callq 0x9012
movsd (%rsp), %xmm1
addsd %xmm0, %xmm1
jmp 0x9114
movq %rbx, %rdi
movl %ebp, %esi
callq 0x9012
movsd (%rsp), %xmm1
subsd %xmm0, %xmm1
movsd %xmm1, (%rsp)
movsd (%rsp), %xmm0
jmp 0x90da
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop