LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/WeihuaZhu[P]hpc_prog2/mpi_tests.cpp
// Function: MpiTest_Jacobi1_Test::TestBody()
TEST(MpiTest, Jacobi1)
{
    // simple 4 by 4 input matrix
    double A[4*4] = {10., -1., 2., 0.,
                           -1., 11., -1., 3.,
                           2., -1., 10., -1.,
                           0.0, 3., -1., 8.};
    double b[4] =  {6., 25., -11., 15.};
    double x[4];
    double expected_x[4] = {1.0,  2.0, -1.0, 1.0};
    int n = 4;

    // get grid communicator
    MPI_Comm grid_comm;
    get_grid_comm(&grid_comm);

    // testing sequential matrix multiplication
    mpi_jacobi(n, A, b, x, grid_comm);

    // checking if all values are correct (up to some error value)
    for (int i = 0; i < n; ++i)
    {
        EXPECT_NEAR(expected_x[i], x[i], 1e-5) << " element y[" << i << "] is wrong";
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0x21940(%rip), %rsi     # 0x29210
leaq 0x70(%rsp), %rbx
movl $0x10, %ecx
movq %rbx, %rdi
rep  movsq (%rsi), %es:(%rdi)
movaps 0x218f9(%rip), %xmm0    # 0x291e0
leaq 0x50(%rsp), %r14
movaps %xmm0, 0x10(%r14)
movaps 0x218d8(%rip), %xmm0    # 0x291d0
movaps %xmm0, (%r14)
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x7529
movq (%r15), %r8
leaq 0x30(%rsp), %rcx
movsd 0x2171f(%rip), %xmm0    # 0x29038
movl $0x4, %edi
movq %rbx, %rsi
movq %r14, %rdx
movl $0x64, %r9d
callq 0x28139
leaq 0x218ba(%rip), %r12     # 0x291f0
xorl %r14d, %r14d
leaq 0x217cc(%rip), %r13     # 0x2910c
leaq 0x10(%rsp), %rbp
leaq 0x8(%rsp), %rbx
leaq 0x20(%rsp), %r15
movsd (%r12), %xmm0
movsd 0x30(%rsp,%r14,8), %xmm1
movq %rbp, %rdi
leaq 0x21798(%rip), %rsi     # 0x290fe
leaq 0x2179a(%rip), %rdx     # 0x29107
movq %r13, %rcx
movsd 0x216c8(%rip), %xmm2    # 0x29040
callq 0xb27f
cmpb $0x0, 0x10(%rsp)
jne 0x7a3b
movq %rbx, %rdi
callq 0xaadc
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movl $0xb, %edx
leaq 0x2173a(%rip), %rsi     # 0x290df
callq 0x65a0
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movl %r14d, %esi
callq 0x6960
movq 0x8(%rsp), %rdi
addq $0x10, %rdi
movl $0xa, %edx
leaq 0x2171b(%rip), %rsi     # 0x290eb
callq 0x65a0
movq 0x18(%rsp), %rax
leaq 0x23264(%rip), %r8      # 0x2ac45
testq %rax, %rax
je 0x79e9
movq (%rax), %r8
movq %r15, %rdi
movl $0x1, %esi
leaq 0x216ab(%rip), %rdx     # 0x290a3
movl $0x62, %ecx
callq 0x8a02
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8a9e
movq %r15, %rdi
callq 0x8a6e
cmpq $0x0, 0x8(%rsp)
je 0x7a3b
movl $0x1, %edi
callq 0x89ff
testb %al, %al
je 0x7a3b
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x7a3b
movq (%rdi), %rax
callq *0x8(%rax)
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x801c
incq %r14
addq $0x8, %r12
cmpq $0x4, %r14
jne 0x794f
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7a82
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x8a6e
jmp 0x7a8d
movq %rax, %rbx
jmp 0x7a97
jmp 0x7a8a
movq %rax, %rdi
callq 0x7fdb
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x7f32
leaq 0x10(%rsp), %rdi
callq 0x7f44
movq %rbx, %rdi
callq 0x69a0
nop
// File: /workspace/github_cpp_makefile_star2_O3/WeihuaZhu[P]hpc_prog2/./gtest/gtest.h
// Function: testing::AssertionResult testing::internal::CmpHelperEQ<int, int>(char const*, char const*, int const&, int const&)
AssertionResult CmpHelperEQ(const char* expected_expression,
                            const char* actual_expression,
                            const T1& expected,
                            const T2& actual) {
#ifdef _MSC_VER
# pragma warning(push)          // Saves the current warning state.
# pragma warning(disable:4389)  // Temporarily disables warning on
                                // signed/unsigned mismatch.
#endif

  if (expected == actual) {
    return AssertionSuccess();
  }

#ifdef _MSC_VER
# pragma warning(pop)          // Restores the warning state.
#endif

  return EqFailure(expected_expression,
                   actual_expression,
                   FormatForComparisonFailureMessage(expected, actual),
                   FormatForComparisonFailureMessage(actual, expected),
                   false);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movl (%rcx), %eax
cmpl (%r8), %eax
jne 0x819c
movq %rbx, %rdi
callq 0xa44d
jmp 0x8210
movq %r8, %r12
movq %rdx, %r14
movq %rsi, %r15
leaq 0x28(%rsp), %rdi
movq %rcx, %rsi
callq 0x8265
leaq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x8265
leaq 0x28(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %r9d, %r9d
callq 0xaf35
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x81f5
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x64c0
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8210
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x64c0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x8242
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x64c0
jmp 0x8242
movq %rax, %rbx
leaq 0x38(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x825d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x64c0
movq %rbx, %rdi
callq 0x69a0
// File: /workspace/github_cpp_makefile_star2_O3/WeihuaZhu[P]hpc_prog2/mpi_jacobi.cpp
// Function: transpose_bcast_vector(int, double*, double*, ompi_communicator_t*)
void transpose_bcast_vector(const int n, double* col_vector, double* row_vector, MPI_Comm comm)
{
    // obtain the necessary parameters required in thie method
    int rank;
    MPI_Comm_rank(comm, &rank);
    int p;
    MPI_Comm_size(comm, &p);
    int q = sqrt(p);
    int dims[2];
    int coords[2];
    int periods[2];
    MPI_Cart_get(comm, 2, dims, periods, coords);
    MPI_Status stat;

    //first column send to diagonal processors
    int send_rec_count = block_decompose(n, q, coords[0]);
    if (coords[1] == 0) {
        MPI_Send(col_vector, send_rec_count, MPI_DOUBLE, (coords[0] * (q + 1)), 0, comm);
    }
    if (coords[0] == coords[1]) {
        MPI_Recv(row_vector, send_rec_count, MPI_DOUBLE, coords[0] * q, 0, comm, &stat);
    }

    //broadcast columnwise
    MPI_Comm n_comm;
    MPI_Comm_split(comm, coords[1], rank, &n_comm);
    MPI_Bcast(row_vector, block_decompose(n, q, coords[1]), MPI_DOUBLE, coords[1], n_comm);

    // free the useless memory
    MPI_Comm_free(&n_comm);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, 0x18(%rsp)
movl %edi, %ebp
leaq 0x14(%rsp), %rsi
movq %rcx, %rdi
callq 0x6790
leaq 0x24(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x65e0
cvtsi2sdl (%r15), %xmm0
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jb 0x27907
sqrtsd %xmm0, %xmm0
jmp 0x2790c
callq 0x63a0
cvttsd2si %xmm0, %r12d
leaq 0x38(%rsp), %rdx
leaq 0x30(%rsp), %rcx
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movl $0x2, %esi
movq %r15, %r8
callq 0x6420
movl (%r15), %ecx
movl 0x4(%r15), %r8d
movl %ebp, %eax
cltd
idivl %r12d
movl %eax, %ebp
movl %edx, %r15d
xorl %r13d, %r13d
cmpl %ecx, %edx
setg %r13b
addl %eax, %r13d
testl %r8d, %r8d
jne 0x2797e
leal 0x1(%r12), %eax
imull %eax, %ecx
movq 0x1163e(%rip), %rdx     # 0x38fa0
movq 0x18(%rsp), %rdi
movl %r13d, %esi
xorl %r8d, %r8d
movq %r14, %r9
callq 0x61c0
movl 0xc(%rsp), %ecx
movl 0x10(%rsp), %r8d
cmpl %r8d, %ecx
jne 0x279b0
imull %r12d, %r8d
leaq 0x40(%rsp), %rax
movq %rax, (%rsp)
movq 0x11609(%rip), %rdx     # 0x38fa0
movq %rbx, %rdi
movl %r13d, %esi
movl %r8d, %ecx
xorl %r8d, %r8d
movq %r14, %r9
callq 0x63d0
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %edx
leaq 0x28(%rsp), %r12
movq %r14, %rdi
movl %r8d, %esi
movq %r12, %rcx
callq 0x68d0
movl 0x10(%rsp), %ecx
xorl %eax, %eax
cmpl %ecx, %r15d
setg %al
addl %eax, %ebp
movq (%r12), %r8
movq 0x115c0(%rip), %rdx     # 0x38fa0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x60d0
movq %r12, %rdi
callq 0x68b0
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: elimDups(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void elimDups(vector<string>& words)
{
    // sort words alphabetically so we can find the duplicates
    sort(words.begin(), words.end());

	// print the sorted contents
	for_each(words.begin(), words.end(), PrintString(cerr));
	cerr << endl;

    // unique reorders the input so that each word appears once in the
    // front part of the range
	// returns an iterator one past the unique range;
    auto end_unique = unique(words.begin(), words.end());

    // erase uses a vector operation to remove the nonunique elements
    words.erase(end_unique, words.end());

	// print the reduced vector
	for_each(words.begin(), words.end(), PrintString(cerr));
	cerr << endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %r12
movq 0x8(%rdi), %r15
cmpq %r15, %r12
je 0x23d8
movq %r15, %rax
subq %r12, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x2a18
movq %r12, %rdi
movq %r15, %rsi
callq 0x2aec
movq (%rbx), %r12
movq 0x8(%rbx), %r15
movq 0x4c11(%rip), %r14      # 0x6ff0
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x27f9
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
callq 0x3248
movq 0x8(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3322
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
movq %r14, %rdx
callq 0x27f9
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x20b0
// File: /workspace/github_cpp_makefile_star2_O3/iZhangHui[P]CppPrimer/CH14_OverloadedOperationsAndConversions/examples/newcount-size.cc
// Function: main
int main()
{
    vector<string> words;

    // copy contents of each book into a single vector
    string next_word;
    while (cin >> next_word) {
        // insert next book's contents at end of words
        words.push_back(next_word);
    }

	biggies(words, 6);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rbx
movaps %xmm0, (%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rbx)
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq %rax, -0x8(%r12)
movb $0x0, (%r12)
movq 0x486f(%rip), %r14      # 0x6fd8
leaq -0x40(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2793
movq %rbx, %rdi
movq %r15, %rsi
callq 0x284e
jmp 0x276d
leaq -0x60(%rbp), %rdi
movl $0x6, %esi
callq 0x246d
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x27b6
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x289a
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x27d0
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x27e8
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2140
leaq -0x60(%rbp), %rdi
callq 0x289a
movq %rbx, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O3/t0mm4rx[P]piscine_cpp/day08/ex01/main.cpp
// Function: main
int main()
{
	int n = 10000;
	Span sp = Span(n);

	std::srand(time(0));
	// for (int i = 0; i < n; i++)
	// 	addNumber(sp, n * 10);
	std::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	sp.addRange(v.begin(), v.end());
	std::cout << "Shortest span: " << sp.shortestSpan() << std::endl;
	std::cout << "Longest span: " << sp.longestSpan() << std::endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x48, %rsp
leaq -0x50(%rbp), %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x16f8
xorl %edi, %edi
callq 0x10d0
movl %eax, %edi
callq 0x10e0
xorps %xmm0, %xmm0
leaq -0x30(%rbp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
leaq -0xc(%rbp), %rdx
movl $0x1, (%rdx)
xorl %esi, %esi
callq 0x159a
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x2, -0xc(%rbp)
cmpq %rcx, %rax
je 0x13f5
movl $0x2, (%rax)
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x140d
leaq -0x30(%rbp), %rdi
leaq -0xc(%rbp), %rdx
movq %rax, %rsi
callq 0x159a
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x3, -0xc(%rbp)
cmpq %rcx, %rax
je 0x1429
movl $0x3, (%rax)
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x1441
leaq -0x30(%rbp), %rdi
leaq -0xc(%rbp), %rdx
movq %rax, %rsi
callq 0x159a
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
movl $0x4, -0xc(%rbp)
cmpq %rcx, %rax
je 0x145d
movl $0x4, (%rax)
addq $0x4, %rax
movq %rax, -0x28(%rbp)
jmp 0x1471
leaq -0x30(%rbp), %rdi
leaq -0xc(%rbp), %rdx
movq %rax, %rsi
callq 0x159a
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %rdi
movq %rax, %rdx
callq 0x19aa
movq 0x2b40(%rip), %rdi      # 0x3fc8
leaq 0xb75(%rip), %rsi       # 0x2004
movl $0xf, %edx
callq 0x1120
leaq -0x50(%rbp), %rdi
callq 0x1884
movq 0x2b1f(%rip), %rdi      # 0x3fc8
movl %eax, %esi
callq 0x1170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq 0x2ae7(%rip), %rdi      # 0x3fc8
leaq 0xb2c(%rip), %rsi       # 0x2014
movl $0xe, %edx
callq 0x1120
leaq -0x50(%rbp), %rdi
callq 0x1916
movq 0x2ac6(%rip), %rdi      # 0x3fc8
movl %eax, %esi
callq 0x1170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10f0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x10a0
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x1548
movq -0x20(%rbp), %rsi
subq %rdi, %rsi
callq 0x1110
leaq -0x50(%rbp), %rdi
callq 0x17a4
xorl %eax, %eax
addq $0x48, %rsp
popq %rbx
popq %rbp
retq
jmp 0x1562
jmp 0x1562
jmp 0x1562
jmp 0x1562
movq %rax, %rbx
movq -0x30(%rbp), %rdi
testq %rdi, %rdi
je 0x157a
movq -0x20(%rbp), %rsi
subq %rdi, %rsi
callq 0x1110
leaq -0x50(%rbp), %rdi
callq 0x17a4
movq %rbx, %rdi
callq 0x1180
// File: /workspace/github_cpp_makefile_star2_O3/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::addNumber(int)
void Span::addNumber(int n)
{
	if (this->isInList(n))
		throw std::exception();
	if (this->list.size() >= this->maxItems)
		throw std::exception();
	this->list.push_back(n);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
movl %esi, -0x14(%rbp)
leaq -0x18(%rbp), %rdx
movl %esi, (%rdx)
movq (%rdi), %rdi
movq 0x8(%rbx), %rsi
callq 0x1b67
movq 0x8(%rbx), %rsi
cmpq %rsi, %rax
jne 0x182b
movq %rax, %rcx
subq (%rbx), %rcx
sarq $0x2, %rcx
movl 0x18(%rbx), %edx
cmpq %rdx, %rcx
jae 0x182b
cmpq 0x10(%rbx), %rax
je 0x1816
movl %r14d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rbx)
jmp 0x1822
leaq -0x14(%rbp), %rdx
movq %rbx, %rdi
callq 0x1a8c
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movl $0x8, %edi
callq 0x1080
movq 0x2784(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x278e(%rip), %rsi      # 0x3fd8
movq 0x279f(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1160
nop
// File: /workspace/github_cpp_makefile_star2_O3/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::shortestSpan()
int Span::shortestSpan(void)
{
	int							min;
	int							tmp;
	std::vector<int>::iterator	it1;
	std::vector<int>::iterator	it2;

	if (this->list.size() <= 1)
		throw std::exception();
	min = INT_MAX;
	it1 = this->list.begin();
	while (it1 != this->list.end())
	{
		it2 = this->list.begin();
		while (it2 != this->list.end())
		{
			if (it1 != it2)
			{
				tmp = abs(*it1 - *it2);
				if (tmp < min)
					min = tmp;
			}
			it2++;
		}
		it1++;
	}
	return (min);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, %rax
subq %rcx, %rax
cmpq $0x5, %rax
jb 0x18e8
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
cmpq %rdx, %rcx
je 0x18e6
xorl %esi, %esi
movq %rcx, %rdi
movq %rsi, %r8
movq %rcx, %r9
testq %r8, %r8
je 0x18cc
movl (%rdi), %r10d
subl (%r9), %r10d
movl %r10d, %r11d
negl %r11d
cmovsl %r10d, %r11d
cmpl %eax, %r11d
cmovll %r11d, %eax
addq $0x4, %r9
addq $-0x4, %r8
cmpq %rdx, %r9
jne 0x18b0
addq $0x4, %rdi
addq $0x4, %rsi
cmpq %rdx, %rdi
jne 0x18aa
popq %rbp
retq
movl $0x8, %edi
callq 0x1080
movq 0x26c7(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x26d1(%rip), %rsi      # 0x3fd8
movq 0x26e2(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O3/t0mm4rx[P]piscine_cpp/day08/ex01/span.cpp
// Function: Span::longestSpan()
int Span::longestSpan(void)
{
	int							max;
	int							tmp;
	std::vector<int>::iterator	it1;
	std::vector<int>::iterator	it2;

	if (this->list.size() <= 1)
		throw std::exception();
	max = 0;
	it1 = this->list.begin();
	while (it1 != this->list.end())
	{
		it2 = this->list.begin();
		while (it2 != this->list.end())
		{
			if (it1 != it2)
			{
				tmp = abs(*it1 - *it2);
				if (tmp > max)
					max = tmp;
			}
			it2++;
		}
		it1++;
	}
	return (max);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movq 0x8(%rdi), %rdx
movq %rdx, %rax
subq %rcx, %rax
cmpq $0x5, %rax
jb 0x197b
cmpq %rdx, %rcx
je 0x1977
xorl %esi, %esi
xorl %eax, %eax
movq %rcx, %rdi
movq %rsi, %r8
movq %rcx, %r9
testq %r8, %r8
je 0x195b
movl (%rdi), %r10d
subl (%r9), %r10d
movl %r10d, %r11d
negl %r11d
cmovsl %r10d, %r11d
cmpl %eax, %r11d
cmovgl %r11d, %eax
addq $0x4, %r9
addq $-0x4, %r8
cmpq %rdx, %r9
jne 0x193f
addq $0x4, %rdi
addq $0x4, %rsi
cmpq %rdx, %rdi
jne 0x1939
jmp 0x1979
xorl %eax, %eax
popq %rbp
retq
movl $0x8, %edi
callq 0x1080
movq 0x2634(%rip), %rcx      # 0x3fc0
addq $0x10, %rcx
movq %rcx, (%rax)
movq 0x263e(%rip), %rsi      # 0x3fd8
movq 0x264f(%rip), %rdx      # 0x3ff0
movq %rax, %rdi
callq 0x1160
nop
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codfile.cpp
// Function: CODFile::getAppName[abi:cxx11]()
string CODFile::getAppName()
{
    if (!isOpen) throw "Load file first";

    // find resource with name
    CODResource *r = FindResource(CODRESTAppName);

    // can't find
    if (r == NULL) throw "No AppName in resources";

    return *( new string(r->getData()+2, r->getReversedU16(0)) );

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpb $0x0, 0x48(%rsi)
je 0x3a78
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x2, %esi
callq 0x3856
testq %rax, %rax
je 0x3a8b
movq %rax, %r12
movl $0x20, %edi
callq 0x21b0
movq %rax, %r14
movq %r12, %rdi
callq 0x3fea
movq %rax, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x3ffe
movzwl %ax, %eax
movq %r14, %rcx
addq $0x10, %rcx
movq %rcx, (%r14)
leaq (%r15,%rax), %rdx
addq $0x2, %rdx
addq $0x2, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d8c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3e2a
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2110
leaq 0x172b(%rip), %rcx      # 0x51b4
jmp 0x3a9c
movl $0x8, %edi
callq 0x2110
leaq 0x174c(%rip), %rcx      # 0x51e8
movq %rcx, (%rax)
movq 0x3512(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
jmp 0x3ab2
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codfile.cpp
// Function: CODFile::getDescription[abi:cxx11]()
string CODFile::getDescription()
{
    if (!isOpen) throw "Load file first";

    // find resource with name
    CODResource *r = FindResource(CODRESTDescription);

    // can't find
    if (r == NULL) throw "No Description in resources";

    return *( new string(r->getData()+2, r->getReversedU16(0)) );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpb $0x0, 0x48(%rsi)
je 0x3b66
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x3, %esi
callq 0x3856
testq %rax, %rax
je 0x3b79
movq %rax, %r12
movl $0x20, %edi
callq 0x21b0
movq %rax, %r14
movq %r12, %rdi
callq 0x3fea
movq %rax, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x3ffe
movzwl %ax, %eax
movq %r14, %rcx
addq $0x10, %rcx
movq %rcx, (%r14)
leaq (%r15,%rax), %rdx
addq $0x2, %rdx
addq $0x2, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d8c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3e2a
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2110
leaq 0x163d(%rip), %rcx      # 0x51b4
jmp 0x3b8a
movl $0x8, %edi
callq 0x2110
leaq 0x1676(%rip), %rcx      # 0x5200
movq %rcx, (%rax)
movq 0x3424(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
jmp 0x3ba0
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codfile.cpp
// Function: CODFile::getVendor[abi:cxx11]()
string CODFile::getVendor()
{
    if (!isOpen) throw "Load file first";

    // find resource with name
    CODResource *r = FindResource(CODRESTVendor);

    // can't find
    if (r == NULL) throw "No Vendor in resources";

    return *( new string(r->getData()+2, r->getReversedU16(0)) );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpb $0x0, 0x48(%rsi)
je 0x3c54
movq %rdi, %rbx
movq %rsi, %rdi
movl $0x4, %esi
callq 0x3856
testq %rax, %rax
je 0x3c67
movq %rax, %r12
movl $0x20, %edi
callq 0x21b0
movq %rax, %r14
movq %r12, %rdi
callq 0x3fea
movq %rax, %r15
movq %r12, %rdi
xorl %esi, %esi
callq 0x3ffe
movzwl %ax, %eax
movq %r14, %rcx
addq $0x10, %rcx
movq %rcx, (%r14)
leaq (%r15,%rax), %rdx
addq $0x2, %rdx
addq $0x2, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x3d8c
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
movq %rbx, %rdi
callq 0x3e2a
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x8, %edi
callq 0x2110
leaq 0x154f(%rip), %rcx      # 0x51b4
jmp 0x3c78
movl $0x8, %edi
callq 0x2110
leaq 0x15a4(%rip), %rcx      # 0x521c
movq %rcx, (%rax)
movq 0x3336(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
jmp 0x3c8e
movq %rax, %rbx
movl $0x20, %esi
movq %r14, %rdi
callq 0x21c0
movq %rbx, %rdi
callq 0x2310
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codfile.cpp
// Function: CODFile::getIcon(unsigned short&)
char *CODFile::getIcon(u16 &size)
{
    if (!isOpen) throw "Load file first";

    // find resource with icon
    CODResource *r = FindResource(CODRESTIcon);

    // can't find
    if (r == NULL) return NULL;

    size = r->getReversedU16(2);
    return r->getData() + 4;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
cmpb $0x0, 0x48(%rdi)
je 0x3ced
movq %rsi, %rbx
movl $0x5, %esi
callq 0x3856
testq %rax, %rax
je 0x3ce6
movq %rax, %r14
movq %rax, %rdi
movl $0x2, %esi
callq 0x3ffe
movw %ax, (%rbx)
movq %r14, %rdi
callq 0x3fea
addq $0x4, %rax
jmp 0x3ce8
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movl $0x8, %edi
callq 0x2110
leaq 0x14b6(%rip), %rcx      # 0x51b4
movq %rcx, (%rax)
movq 0x32b0(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codresource.cpp
// Function: CODResource::CODResource(TCODRESOURCE*, char*, unsigned short)
CODResource::CODResource(TCODRESOURCE *res, char *DataSeg, u16 DataSZ)
{
    // set data
    type = (char *)(DataSeg + res->type_ptr);
    size = res->size;
    data = (char *)(DataSeg + res->data_ptr);
    itype = CODRESTUndefined;

    // sanity check
    if ( (res->type_ptr + (strlen(type)) >= DataSZ) ||
         (res->data_ptr + size >= DataSZ))
        throw "Incorrect file format";

	#define CMPRES(res) ((strlen(type) == sizeof(res)) && \
						 (memcmp(res, (u8 *)type, sizeof(res)) == 0))

    // decode resource type
    if      (CMPRES(CODRESAppName))     itype = CODRESTAppName;
    else if (CMPRES(CODRESDescription)) itype = CODRESTDescription;
    else if (CMPRES(CODRESVendor))      itype = CODRESTVendor;
    else if (CMPRES(CODRESIcon))        itype = CODRESTIcon;
    else itype = CODRESTUnknown;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r15d
movzwl (%rsi), %ebx
leaq (%rdx,%rbx), %r14
movq %r14, (%rdi)
movzwl 0x2(%rsi), %r12d
movw %r12w, 0x8(%rdi)
movzwl 0x4(%rsi), %r13d
addq %r13, %rdx
movq %rdx, 0x10(%rdi)
movq %rdi, -0x30(%rbp)
movl $0x0, 0x18(%rdi)
movq %r14, %rdi
callq 0x20f0
addq %rax, %rbx
movl %r15d, %ecx
cmpq %rcx, %rbx
jae 0x3fba
addl %r12d, %r13d
movzwl %r15w, %ecx
cmpl %ecx, %r13d
jae 0x3fba
cmpq $0x4, %rax
je 0x3f81
cmpq $0x7, %rax
movq -0x30(%rbp), %rdx
jne 0x3f8e
movl $0x4e70185f, %eax       # imm = 0x4E70185F
xorl (%r14), %eax
movl $0x73652c4e, %ecx       # imm = 0x73652C4E
xorl 0x3(%r14), %ecx
orl %eax, %ecx
je 0x3fa5
movl $0x6373065f, %eax       # imm = 0x6373065F
xorl (%r14), %eax
movl $0x88697263, %ecx       # imm = 0x88697263
xorl 0x3(%r14), %ecx
orl %eax, %ecx
je 0x3fb3
movl $0x4970185f, %eax       # imm = 0x4970185F
xorl (%r14), %eax
movl $0x73106349, %ecx       # imm = 0x73106349
xorl 0x3(%r14), %ecx
orl %eax, %ecx
jne 0x3f8e
movl $0x5, %eax
jmp 0x3f93
cmpl $0x19c9765f, (%r14)     # imm = 0x19C9765F
movq -0x30(%rbp), %rdx
je 0x3fac
movl $0x1, %eax
movl %eax, 0x18(%rdx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %eax
jmp 0x3f93
movl $0x4, %eax
jmp 0x3f93
movl $0x3, %eax
jmp 0x3f93
movl $0x8, %edi
callq 0x2110
leaq 0x11d3(%rip), %rcx      # 0x519e
movq %rcx, (%rax)
movq 0x2fe3(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
nop
// File: /workspace/github_cpp_makefile_star2_O3/sc0ty[P]CODExtract/src/codfile/codresource.cpp
// Function: CODResource::getReversedU16(unsigned short)
u16 CODResource::getReversedU16(u16 offset)
{
    // sanity check
    if (offset+1 >= size) throw "Exceeded end of resource data";

    // get two bytes from data
    u8 b1 = data[offset];
    u8 b2 = data[offset + 1];

    // revers byte order and return
    return (u16)(b1 * 256 + b2);
}

// Assembly:
movl %esi, %eax
incq %rax
movzwl 0x8(%rdi), %ecx
cmpl %ecx, %eax
jae 0x4020
movq 0x10(%rdi), %rcx
movzwl %si, %edx
movzbl (%rcx,%rax), %esi
movzbl (%rcx,%rdx), %eax
shll $0x8, %eax
orl %esi, %eax
retq
pushq %rbp
movq %rsp, %rbp
movl $0x8, %edi
callq 0x2110
leaq 0x1231(%rip), %rcx      # 0x5266
movq %rcx, (%rax)
movq 0x2f79(%rip), %rsi      # 0x6fb8
movq %rax, %rdi
xorl %edx, %edx
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.cxx
// Function: M6502::dump()
void M6502::dump()
{
  printf(" PC: 0x%04x, SP: 0x%04x, A: 0x%02x, X: 0x%02x, Y: 0x%02x\n",
    pc, sp, reg_a, reg_x, reg_y);
  printf(" N V B * D I Z C\n");
  printf(" %d %d %d %d %d %d %d %d\n",
    status.n,
    status.v,
    status.b,
    status.one,
    status.d,
    status.i,
    status.z,
    status.c);
  printf(" total_instructions=%d\n", total_instructions);
  printf(" total_cycles=%d\n", total_cycles);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzwl 0x18(%rdi), %esi
movzwl 0x1a(%rdi), %edx
movl 0xc(%rdi), %ecx
movl 0x10(%rdi), %r8d
movl 0x14(%rdi), %r9d
leaq 0x6587(%rip), %rdi      # 0xb8bc
xorl %eax, %eax
callq 0x4050
leaq 0x6630(%rip), %rdi      # 0xb973
callq 0x4310
movzbl 0x29(%rbx), %r10d
movl %r10d, %esi
shrl $0x7, %esi
movl %r10d, %edx
shrl $0x6, %edx
andl $0x1, %edx
movl %r10d, %ecx
shrl $0x4, %ecx
andl $0x1, %ecx
movl %r10d, %r8d
shrl $0x5, %r8d
andl $0x1, %r8d
movl %r10d, %r9d
shrl $0x3, %r9d
andl $0x1, %r9d
movl %r10d, %r11d
shrl $0x2, %r11d
andl $0x1, %r11d
movl %r10d, %r14d
shrl %r14d
andl $0x1, %r14d
andl $0x1, %r10d
subq $0x8, %rsp
leaq 0x6557(%rip), %rdi      # 0xb8f6
xorl %eax, %eax
pushq %r10
pushq %r14
pushq %r11
callq 0x4050
addq $0x20, %rsp
movl 0x20(%rbx), %esi
leaq 0x6556(%rip), %rdi      # 0xb910
xorl %eax, %eax
callq 0x4050
movl 0x1c(%rbx), %esi
leaq 0x655d(%rip), %rdi      # 0xb928
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4050
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::read_indirect_x(int&)
int read_indirect_x(int &address)
  {
    int m;
    m = memory_bus->read(pc++) + reg_x;
    m = memory_bus->read16(m & 0xff);
    address = m;
    return memory_bus->read(m);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
movzwl 0x18(%rbx), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%rbx)
callq 0x6fce
movq (%rbx), %r15
addb 0x10(%rbx), %al
movzbl %al, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r12d
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %esi
shll $0x8, %esi
orl %r12d, %esi
movl %esi, (%r14)
movq (%rbx), %rdi
callq 0x6fce
movzbl %al, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::read_absolute(int&)
int read_absolute(int &address)
  {
    int m = memory_bus->read16(pc);
    address = m;
    pc += 2;
    return memory_bus->read(m);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
movzwl 0x18(%rdi), %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r12d
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %esi
shll $0x8, %esi
orl %r12d, %esi
movl %esi, (%rbx)
addw $0x2, 0x18(%r14)
movq (%r14), %rdi
callq 0x6fce
movzbl %al, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::read_indirect_y(int&, int&)
int read_indirect_y(int &address, int &address_before)
  {
    int m;
    m = memory_bus->read(pc++);
    m = memory_bus->read16(m);
    address_before = m;
    m += reg_y;
    m = m & 0xffff;
    address = m;
    return memory_bus->read(m);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
movzwl 0x18(%rbx), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%rbx)
callq 0x6fce
movzbl %al, %ebp
movq (%rbx), %r12
movq %r12, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r13d
incl %ebp
movq %r12, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %eax
shll $0x8, %eax
orl %r13d, %eax
movl %eax, (%r15)
addl 0x14(%rbx), %eax
movzwl %ax, %esi
movl %esi, (%r14)
movq (%rbx), %rdi
callq 0x6fce
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::read_zero_page_x(int&)
int read_zero_page_x(int &address)
  {
    int m;
    m = memory_bus->read(pc++) + reg_x;
    m = m & 0xff;
    address = m;
    return memory_bus->read(m);
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
movzwl 0x18(%r14), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%r14)
callq 0x6fce
addb 0x10(%r14), %al
movzbl %al, %esi
movl %esi, (%rbx)
movq (%r14), %rdi
callq 0x6fce
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::read_absolute_y(int&, int&)
int read_absolute_y(int &address, int &address_before)
  {
    int m = memory_bus->read16(pc);
    address_before = m;
    m += reg_y;
    address = m;
    pc += 2;
    return memory_bus->read(m);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq (%rdi), %r12
movzwl 0x18(%rdi), %ebp
movq %r12, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r13d
incl %ebp
movq %r12, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %esi
shll $0x8, %esi
orl %r13d, %esi
movl %esi, (%rbx)
addl 0x14(%r15), %esi
movl %esi, (%r14)
addw $0x2, 0x18(%r15)
movq (%r15), %rdi
callq 0x6fce
movzbl %al, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::run_adc(int)
void run_adc(int data)
  {
    if (status.d == 0)
    {
      reg_a = reg_a + data + status.c;

      status.c = reg_a > 0xff;
      reg_a &= 0xff;
      status.z = reg_a == 0;
      status.n = (reg_a & 0x80) != 0;
      status.v = status.c ^ status.n;
    }
      else
    {
      int d0 = data & 0xf;
      int d1 = data >> 4;
      int a0 = reg_a & 0xf;
      int a1 = reg_a >> 4;

      a0 = a0 + d0 + status.c;

      if (a0 > 10)
      {
        a1 += a0 / 10;
        a0 = a0 % 10;
      }

      a1 = a1 + d1;

      status.c = a1 / 10 > 0;
      a1 = a1 % 10;

      reg_a = ((a1 << 4) | a0) & 0xff;
      status.z = reg_a == 0;
    }
  }

// Assembly:
movzbl 0x29(%rdi), %eax
testb $0x8, %al
jne 0x6a77
movl %eax, %ecx
andl $0x1, %ecx
addl %esi, %ecx
addl 0xc(%rdi), %ecx
xorl %edx, %edx
cmpl $0x100, %ecx            # imm = 0x100
setge %dl
andb $0x34, %al
orb %dl, %al
movl %ecx, %esi
andl $0xff, %esi
movl %esi, 0xc(%rdi)
sete %sil
addb %sil, %sil
orb %al, %sil
movl %ecx, %eax
andb $-0x80, %al
orb %sil, %al
shrl $0x7, %ecx
xorl %edx, %ecx
shlb $0x6, %cl
andb $0x40, %cl
orb %al, %cl
jmp 0x6afc
movl %esi, %r8d
andl $0xf, %r8d
sarl $0x4, %esi
movl 0xc(%rdi), %edx
movl %edx, %r9d
andl $0xf, %r9d
sarl $0x4, %edx
movl %eax, %ecx
andl $0x1, %ecx
addl %r8d, %ecx
addl %r9d, %ecx
cmpl $0xb, %ecx
jb 0x6abd
leal (%rcx,%rcx,4), %r8d
leal (%r8,%r8,4), %r8d
addl %ecx, %r8d
shrl $0x8, %r8d
addl %r8d, %edx
addl %r8d, %r8d
leal (%r8,%r8,4), %r8d
subb %r8b, %cl
movzbl %cl, %ecx
addl %esi, %edx
cmpl $0xa, %edx
setge %sil
andb $-0x4, %al
orb %sil, %al
movslq %edx, %rdx
imulq $0x66666667, %rdx, %rsi # imm = 0x66666667
movq %rsi, %r8
shrq $0x3f, %r8
sarq $0x22, %rsi
addl %r8d, %esi
addl %esi, %esi
leal (%rsi,%rsi,4), %esi
subl %esi, %edx
shll $0x4, %edx
movzbl %dl, %edx
orl %ecx, %edx
movl %edx, 0xc(%rdi)
sete %cl
addb %cl, %cl
orb %al, %cl
movb %cl, 0x29(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::store_indirect_x(int)
void store_indirect_x(int data)
  {
    int address;
    address = memory_bus->read(pc++) + reg_x;
    address = memory_bus->read16(address & 0xff);
    memory_bus->write(address, data);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
movzwl 0x18(%r14), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%r14)
callq 0x6fce
movq (%r14), %r15
addb 0x10(%r14), %al
movzbl %al, %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r12d
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %esi
shll $0x8, %esi
orl %r12d, %esi
movq (%r14), %rdi
movzbl %bl, %edx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x704c
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::store_indirect_y(int)
void store_indirect_y(int data)
  {
    int address;
    address = memory_bus->read(pc++);
    address = memory_bus->read16(address) + reg_y;
    memory_bus->write(address, data);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rdi
movzwl 0x18(%r14), %esi
leal 0x1(%rsi), %eax
movw %ax, 0x18(%r14)
callq 0x6fce
movzbl %al, %ebp
movq (%r14), %r15
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %r12d
incl %ebp
movq %r15, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %eax
shll $0x8, %eax
addl 0x14(%r14), %r12d
addl %eax, %r12d
movq (%r14), %rdi
movzbl %bl, %edx
movl %r12d, %esi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x704c
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::store_absolute_y(int, int&)
void store_absolute_y(int data, int &cycles)
  {
    int a = memory_bus->read16(pc);
    cycles = 5;
    int address = a + reg_y;
    //if (!same_page(address, a)) { cycles++; }
    pc += 2;
    memory_bus->write(address, data);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq (%rdi), %r15
movzwl 0x18(%rdi), %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x6fce
movzbl %al, %r13d
incl %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x6fce
movzbl %al, %esi
shll $0x8, %esi
orl %r13d, %esi
movl $0x5, (%rbx)
addl 0x14(%r14), %esi
addw $0x2, 0x18(%r14)
movq (%r14), %rdi
movzbl %bpl, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x704c
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::run_sbc(int)
void run_sbc(int data)
  {
    if (status.d == 0)
    {
      reg_a = ((status.c << 8) | reg_a) - data;
      status.c = reg_a > 0xff;
      reg_a &= 0xff;
      status.z = reg_a == 0;
      status.n = (reg_a & 0x80) != 0;
      status.v = status.c ^ status.n;
    }
      else
    {
      int d0 = data & 0xf;
      int d1 = data >> 4;
      int a0 = reg_a & 0xf;
      int a1 = reg_a >> 4;

      a0 = a0 - d0 - (status.c ^ 1);

      if (a0 < 0)
      {
        a1--;
        a0 += 1;
      }

      a1 = a1 - d1;

      status.c = a1 / 10 > 0;
      a1 = a1 % 10;

      reg_a = ((a1 << 4) | a0) & 0xff;
      status.z = reg_a == 0;
    }
  }

// Assembly:
movzbl 0x29(%rdi), %eax
testb $0x8, %al
jne 0x6e6b
movl %eax, %ecx
andl $0x1, %ecx
shll $0x8, %ecx
orl 0xc(%rdi), %ecx
subl %esi, %ecx
xorl %edx, %edx
cmpl $0x100, %ecx            # imm = 0x100
setge %dl
andb $0x34, %al
orb %dl, %al
movl %ecx, %esi
andl $0xff, %esi
movl %esi, 0xc(%rdi)
sete %sil
addb %sil, %sil
orb %al, %sil
movl %ecx, %eax
andb $-0x80, %al
orb %sil, %al
shrl $0x7, %ecx
xorl %edx, %ecx
shlb $0x6, %cl
andb $0x40, %cl
orb %al, %cl
jmp 0x6edd
movl %esi, %ecx
andl $0xf, %ecx
sarl $0x4, %esi
movl 0xc(%rdi), %edx
movl %edx, %r8d
andl $0xf, %r8d
sarl $0x4, %edx
subl %esi, %edx
movl %eax, %esi
notl %esi
andl $0x1, %esi
addl %ecx, %esi
subl %esi, %r8d
movl %r8d, %ecx
shrl $0x1f, %ecx
addl %r8d, %ecx
sarl $0x1f, %r8d
addl %edx, %r8d
cmpl $0xa, %r8d
setge %dl
andb $-0x4, %al
orb %dl, %al
movslq %r8d, %rdx
imulq $0x66666667, %rdx, %rsi # imm = 0x66666667
movq %rsi, %r8
shrq $0x3f, %r8
sarq $0x22, %rsi
addl %r8d, %esi
addl %esi, %esi
leal (%rsi,%rsi,4), %esi
subl %esi, %edx
shll $0x4, %edx
orl %ecx, %edx
andl $0xff, %edx
movl %edx, 0xc(%rdi)
sete %cl
addb %cl, %cl
orb %al, %cl
movb %cl, 0x29(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/M6502.h
// Function: M6502::run_inc_memory(int, int)
void run_inc_memory(int address, int data)
  {
    data++;
    data &= 0xff;
    set_load_flags(data);
    memory_bus->write(address, data);
  }

// Assembly:
incl %edx
movl %edx, %eax
andl $0xff, %eax
sete %cl
movb 0x29(%rdi), %r8b
addb %cl, %cl
andb $0x7d, %r8b
andb $-0x80, %dl
orb %cl, %dl
orb %r8b, %dl
movb %dl, 0x29(%rdi)
movq (%rdi), %rdi
movl %eax, %edx
jmp 0x704c
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/MemoryBus.cxx
// Function: MemoryBus::read(int)
uint8_t MemoryBus::read(int address)
{
  // Takes care of mirrored memory.
  if ((address & 0x1000) == 0x1000)
  {
    if (address == 0x1ff9)
    {
      if (rom->set_bank(1)) { return 0; }
    }
      else
    if (address == 0x1ff8)
    {
      if (rom->set_bank(0)) { return 0; }
    }

    return rom->read_int8(address & 0x0fff);
  }

  if (address <= 0x3f)
  {
    return tia->read_memory(address & 0x3f);
  }

  return riot->read_memory(address);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
btl $0xc, %esi
jb 0x6ff4
cmpl $0x3f, %ebx
jg 0x7019
movq 0x10(%r14), %rdi
andl $0x3f, %ebx
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x7bba
cmpl $0x1ff8, %ebx           # imm = 0x1FF8
je 0x7028
cmpl $0x1ff9, %ebx           # imm = 0x1FF9
jne 0x7038
movq (%r14), %rdi
movl $0x1, %esi
callq 0x78b8
testb %al, %al
je 0x7038
xorl %ebp, %ebp
jmp 0x7045
movq 0x8(%r14), %rdi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x7622
movq (%r14), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x78b8
testb %al, %al
jne 0x7045
movq (%r14), %rax
andl $0xfff, %ebx            # imm = 0xFFF
movb (%rax,%rbx), %bpl
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/MemoryBus.cxx
// Function: MemoryBus::dump(int, int)
void MemoryBus::dump(int start, int end)
{
  start &= 0xfff0;

  for (int n = start; n <= end; n++)
  {
    if ((n % 16) == 0)
    {
      printf("%04x:", n);
    }

    if ((n % 8) == 0)
    {
      printf(" " );
    }

    printf(" %02x", read(n));

    if ((n % 16) == 15)
    {
      printf("\n");
    }
  }

  printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebp
andl $0xfff0, %ebp           # imm = 0xFFF0
cmpl %edx, %ebp
jg 0x70f2
movl %edx, %ebx
movq %rdi, %r14
incl %ebx
leaq 0x48eb(%rip), %r15      # 0xb984
leaq 0x48ea(%rip), %r12      # 0xb98a
movl %ebp, %r13d
andl $0xf, %r13d
jne 0x70b5
movq %r15, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x4050
testb $0x7, %bpl
jne 0x70c5
movl $0x20, %edi
callq 0x42b0
movq %r14, %rdi
movl %ebp, %esi
callq 0x6fce
movzbl %al, %esi
movq %r12, %rdi
xorl %eax, %eax
callq 0x4050
cmpl $0xf, %r13d
jne 0x70ec
movl $0xa, %edi
callq 0x42b0
incl %ebp
cmpl %ebp, %ebx
jne 0x70a0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x42b0
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/Network.cxx
// Function: Network::net_close()
void Network::net_close()
{
  if (client != -1)
  {
    close(client);
    client = -1;
  }

  if (socket_id != -1)
  {
    close(socket_id);
    socket_id = -1;
  }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x4(%rdi), %edi
cmpl $-0x1, %edi
je 0x7168
callq 0x4360
movl $0xffffffff, 0x4(%rbx)  # imm = 0xFFFFFFFF
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x717a
callq 0x4360
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/Network.cxx
// Function: Network::net_open(int)
int Network::net_open(int port)
{
  struct sockaddr_in server_addr;
  struct sockaddr_in client_addr;

  socket_id = socket(AF_INET, SOCK_STREAM, 0);

  if (socket_id < 0)
  {
    printf("Can't open socket.\n");
    return -1;
  }

  memset((char*)&server_addr, 0, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  server_addr.sin_port = htons(port);

  if (bind(socket_id, (const sockaddr *)&server_addr, sizeof(server_addr)) < 0)
  {
    printf("Server can't bind.\n");
    return -1;
  }

  if (listen(socket_id, 1) != 0)
  {
    printf("Listen failed.\n");
    return -1;
  }

  socklen_t n = sizeof(client_addr);

  client = accept(socket_id, (struct sockaddr *)&client_addr, &n);

  if (client == -1) { return -1; }

  fcntl(client, F_SETFL, O_NONBLOCK);

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40a0
movl %eax, (%rbx)
testl %eax, %eax
js 0x71e8
leaq 0x18(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movw $0x2, (%rsi)
movl $0x0, 0x4(%rsi)
rolw $0x8, %bp
movw %bp, 0x2(%rsi)
movl %eax, %edi
movl $0x10, %edx
callq 0x4080
testl %eax, %eax
js 0x71f1
movl (%rbx), %edi
movl $0x1, %esi
callq 0x4200
testl %eax, %eax
je 0x720b
leaq 0x4809(%rip), %rdi      # 0xb9ef
jmp 0x71f8
leaq 0x4822(%rip), %rdi      # 0xba11
jmp 0x71f8
leaq 0x4806(%rip), %rdi      # 0xb9fe
callq 0x4310
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %rbp
retq
leaq 0x4(%rsp), %rdx
movl $0x10, (%rdx)
movl (%rbx), %edi
leaq 0x8(%rsp), %rsi
callq 0x40c0
movl %eax, 0x4(%rbx)
cmpl $-0x1, %eax
je 0x71fd
xorl %ebx, %ebx
movl %eax, %edi
movl $0x4, %esi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x4120
jmp 0x7202
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/Network.cxx
// Function: Network::net_send(unsigned char const*, int)
int Network::net_send(const uint8_t *buffer, int length)
{
  struct timeval tv;
  fd_set writeset;

  int bytes_sent = 0;

  while (bytes_sent < length)
  {
    FD_ZERO(&writeset);
    FD_SET(client, &writeset);

    tv.tv_sec = 10;
    tv.tv_usec = 0;

    int n = select(client + 1, NULL, &writeset, NULL, &tv);

    if (n == -1)
    {
      if (errno == EINTR) { continue; }

      perror("Problem with select in net_send");
      return -1;
    }

    if (n == 0) { return -3; }

    n = send(client, buffer + bytes_sent, length - bytes_sent, 0);
    if (n < 0) { return -4; }

    bytes_sent += n;
  }

  return bytes_sent;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
testl %edx, %edx
jle 0x7320
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
leaq 0x10(%rsp), %r12
movq %rsp, %r13
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl 0x4(%r15), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %edx
andl $-0x40, %edx
movl %edi, %ecx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
sarl $0x6, %eax
cltq
orq %rdx, 0x10(%rsp,%rax,8)
movq $0xa, (%rsp)
movq $0x0, 0x8(%rsp)
incl %edi
xorl %esi, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movq %r13, %r8
callq 0x41b0
cmpl $-0x1, %eax
je 0x730c
testl %eax, %eax
je 0x7324
movl 0x4(%r15), %edi
movl %ebx, %esi
addq %r14, %rsi
movl %ebp, %eax
subl %ebx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x4100
testl %eax, %eax
js 0x732b
addl %eax, %ebx
jmp 0x7316
callq 0x4040
cmpl $0x4, (%rax)
jne 0x7344
cmpl %ebp, %ebx
jl 0x726d
jmp 0x7330
xorl %ebx, %ebx
jmp 0x7330
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
jmp 0x7330
movl $0xfffffffc, %ebx       # imm = 0xFFFFFFFC
movl %ebx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4645(%rip), %rdi      # 0xb990
callq 0x4160
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7330
nop