LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::ReadGrid(_IO_FILE*)
int R3PlanarGrid::
ReadGrid(FILE *fp)
{
  // Read grid 
  if (!grid.ReadGrid(fp)) return 0;

  // Read plane from file
  RNScalar p[4];
  if (fread(p, sizeof(RNScalar), 4, fp) != 4) {
    RNFail("Unable to read plane from file");
    return 0;
  }

  // Read bounding box from file
  RNScalar b[6];
  if (fread(b, sizeof(RNScalar), 6, fp) != 6) {
    RNFail("Unable to read bounding box from file");
    return 0;
  }

  // Read transformation from file
  RNScalar m[16];
  if (fread(m, sizeof(RNScalar), 16, fp) != 16) {
    RNFail("Unable to read transformation matrix from file");
    return 0;
  }

  // Update variables
  transformation.Reset(R4Matrix(m));
  plane = R3Plane(p);
  bbox.Reset(R3Point(b[0], b[1], b[2]), R3Point(b[3], b[4], b[5]));

  // Return success
  return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x170, %rsp            # imm = 0x170
movq %rsi, %r14
movq %rdi, %rbx
addq $0x130, %rdi            # imm = 0x130
callq 0x8c75e
testl %eax, %eax
je 0x6b470
leaq 0x30(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x4
popq %rdx
movq %r14, %rcx
callq 0x137d0
cmpq $0x4, %rax
jne 0x6b474
movq %rsp, %rdi
pushq $0x8
popq %rsi
pushq $0x6
popq %rdx
movq %r14, %rcx
callq 0x137d0
cmpq $0x6, %rax
jne 0x6b47d
leaq 0xf0(%rsp), %rdi
pushq $0x8
popq %rsi
pushq $0x10
popq %rdx
movq %r14, %rcx
callq 0x137d0
cmpq $0x10, %rax
jne 0x6b486
leaq 0x20(%rbx), %r14
leaq 0x70(%rsp), %r15
leaq 0xf0(%rsp), %rsi
movq %r15, %rdi
callq 0x68880
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x66e66
leaq 0x70(%rsp), %r14
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x76dd6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2865e
addq $0x200, %rbx            # imm = 0x200
movsd (%rsp), %xmm0
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm2
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0x781bc
movsd 0x18(%rsp), %xmm0
movsd 0x20(%rsp), %xmm1
movsd 0x28(%rsp), %xmm2
leaq 0x58(%rsp), %r15
movq %r15, %rdi
callq 0x781bc
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x6494c
pushq $0x1
popq %rbx
jmp 0x6b496
xorl %ebx, %ebx
jmp 0x6b496
leaq 0x5f543(%rip), %rdi     # 0xca9be
jmp 0x6b48d
leaq 0x5f559(%rip), %rdi     # 0xca9dd
jmp 0x6b48d
leaq 0x5f576(%rip), %rdi     # 0xcaa03
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x9ce26
movl %ebx, %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R3Shapes/R3PlanarGrid.cpp
// Function: gaps::R3PlanarGrid::WriteGrid(_IO_FILE*) const
int R3PlanarGrid::
WriteGrid(FILE *fp) const
{
  // Write grid 
  if (!grid.WriteGrid(fp)) return 0;

  // Write plane to file
  for (int i = 0; i < 4; i++) {
    RNScalar a = plane[i];
    if (fwrite(&a, sizeof(RNScalar), 1, fp) != 1) {
      RNFail("Unable to write plane to file");
      return 0;
    }
  }

  // Write bounding box to file
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 3; j++) {
      RNScalar a = bbox[i][j];
      if (fwrite(&a, sizeof(RNScalar), 1, fp) != 1) {
        RNFail("Unable to write plane to file");
        return 0;
      }
    }
  }

  // Write transformation to file
  const R4Matrix& matrix = transformation.Matrix();
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      RNScalar a = matrix[i][j];
      if (fwrite(&a, sizeof(RNScalar), 1, fp) != 1) {
        RNFail("Unable to write plane to file");
        return 0;
      }
    }
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
addq $0x130, %rdi            # imm = 0x130
callq 0x8c948
testl %eax, %eax
je 0x6b522
movq %r14, (%rsp)
leaq 0x18(%r14), %rbp
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
pushq $0x8
popq %r12
pushq $0x1
popq %r13
cmpq $0x20, %r14
je 0x6b529
movq (%rsp), %rax
addq %r14, %rax
cmpq $0x18, %r14
cmoveq %rbp, %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x6b5a7
addq $0x8, %r14
jmp 0x6b4e2
xorl %ebp, %ebp
jmp 0x6b5b7
movq (%rsp), %rax
addq $0x200, %rax            # imm = 0x200
xorl %ecx, %ecx
leaq 0x20(%rax), %r14
addq $0x8, %rax
leaq 0x8(%rsp), %r15
pushq $0x8
popq %r12
pushq $0x1
popq %r13
movq %rax, 0x20(%rsp)
movq %r14, 0x18(%rsp)
cmpl $0x2, %ecx
je 0x6b5c8
movq %rcx, 0x10(%rsp)
testl %ecx, %ecx
cmoveq %rax, %r14
xorl %ebp, %ebp
cmpq $0x3, %rbp
je 0x6b594
movsd (%r14,%rbp,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x6b5a7
incq %rbp
jmp 0x6b566
movq 0x10(%rsp), %rcx
incl %ecx
movq 0x20(%rsp), %rax
movq 0x18(%rsp), %r14
jmp 0x6b554
leaq 0x5f484(%rip), %rdi     # 0xcaa32
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x9ce26
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
addq $0x28, (%rsp)
xorl %eax, %eax
pushq $0x1
popq %rbp
leaq 0x8(%rsp), %r15
pushq $0x8
popq %r12
pushq $0x1
popq %r13
cmpq $0x4, %rax
je 0x6b5b7
movq %rax, 0x10(%rsp)
xorl %r14d, %r14d
cmpq $0x4, %r14
je 0x6b61f
movq (%rsp), %rax
movsd (%rax,%r14,8), %xmm0
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
callq 0x139e0
cmpq $0x1, %rax
jne 0x6b62e
incq %r14
jmp 0x6b5ed
movq 0x10(%rsp), %rax
incq %rax
addq $0x20, (%rsp)
jmp 0x6b5df
xorl %ebp, %ebp
cmpq $0x4, 0x10(%rsp)
setae %bpl
leaq 0x5f3f1(%rip), %rdi     # 0xcaa32
jmp 0x6b5b0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::FindImage(char const*, gaps::R2Image*) const
int R2PixelDatabase::
FindImage(const char *key, R2Image *image) const
{
  // Find entry
  R2PixelDatabaseEntry entry;
  if (!map.Find(key, &entry)) return FALSE;

  // Read image
  if (image) {
    // Seek to start of entry
    RNFileSeek(fp, entry.seek, RN_FILE_SEEK_SET);
  
    // Read entry
    if (!image->ReadPNGStream(fp)) {
      RNFail("Error reading %s from pixel database\n", key);
      return FALSE;
    }
  }

  // Return success
  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r12
movups %xmm0, 0x80(%r12)
andq $0x0, 0x90(%r12)
movaps 0x3b011(%rip), %xmm0    # 0xc83e0
movups %xmm0, 0x98(%r12)
xorl %ebp, %ebp
movb %bpl, (%r12)
movb %bpl, 0x7f(%r12)
leaq 0x10(%rsp), %r13
leaq 0xf(%rsp), %rdx
movq %r13, %rdi
callq 0x5edd2
leaq 0x40(%r15), %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x8e4b4
movl %eax, %r12d
leaq 0x10(%rsp), %rdi
callq 0x13230
testl %r12d, %r12d
je 0x8d454
pushq $0x1
popq %rbp
testq %r14, %r14
je 0x8d454
movq 0x8(%r15), %rdi
movq 0xb8(%rsp), %rsi
xorl %edx, %edx
callq 0x9c462
movq 0x8(%r15), %rsi
movq %r14, %rdi
callq 0x96e38
testl %eax, %eax
jne 0x8d454
leaq 0x43b48(%rip), %rdi     # 0xd0f90
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9ce26
xorl %ebp, %ebp
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x13230
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::FindGrid(char const*, gaps::R2Grid*, int) const
int R2PixelDatabase::
FindGrid(const char *key, R2Grid *grid, RNBoolean apply_transformation) const
{
  // Find entry
  R2PixelDatabaseEntry entry;
  if (!map.Find(key, &entry)) return FALSE;

  // Read grid
  if (grid) {
    // Seek to start of entry
    RNFileSeek(fp, entry.seek, RN_FILE_SEEK_SET);
  
    // Read entry
    if (!grid->ReadPNGStream(fp)) {
      RNFail("Error reading %s from pixel database\n", key);
      return FALSE;
    }

    // Check if should apply transformation
    if (apply_transformation) {
      // Apply offset 
      if (entry.offset != 0) {
        grid->Subtract(entry.offset);
      }

      // Apply scale 
      if ((entry.scale != 0) && (entry.scale != 1)) {
        grid->Multiply(1.0 / entry.scale);
      }

      // Apply exponent
      if ((entry.exponent != 0) && (entry.exponent != 1)) {
        grid->Pow(1.0 / entry.exponent);
      }
    }
  }

  // Return success
  return TRUE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %ecx, 0xc(%rsp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r13
movups %xmm0, 0x80(%r13)
andq $0x0, 0x90(%r13)
movapd 0x3af24(%rip), %xmm0    # 0xc83e0
movupd %xmm0, 0x98(%r13)
xorl %ebp, %ebp
movb %bpl, (%r13)
movb %bpl, 0x7f(%r13)
leaq 0x10(%rsp), %r15
leaq 0xb(%rsp), %rdx
movq %r15, %rdi
callq 0x5edd2
leaq 0x40(%r12), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x8e4b4
movl %eax, %r13d
leaq 0x10(%rsp), %rdi
callq 0x13230
testl %r13d, %r13d
je 0x8d5e7
pushq $0x1
popq %r15
testq %rbx, %rbx
je 0x8d5d1
movq 0x8(%r12), %rdi
movq 0xb8(%rsp), %rsi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x9c462
movq 0x8(%r12), %rsi
movq %rbx, %rdi
callq 0x8caa8
testl %eax, %eax
je 0x8d5d6
cmpl $0x0, 0xc(%rsp)
je 0x8d5d1
movsd 0xc0(%rsp), %xmm0
xorpd %xmm2, %xmm2
ucomisd %xmm2, %xmm0
jne 0x8d55f
jnp 0x8d56b
movq %rbx, %rdi
callq 0x87f68
xorpd %xmm2, %xmm2
movsd 0xc8(%rsp), %xmm1
ucomisd %xmm2, %xmm1
jne 0x8d57c
jnp 0x8d59c
ucomisd 0x3abc4(%rip), %xmm1    # 0xc8148
jne 0x8d588
jnp 0x8d59c
movsd 0x3abb8(%rip), %xmm0    # 0xc8148
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x87fce
movsd 0xd0(%rsp), %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
jne 0x8d5b1
jnp 0x8d5d1
ucomisd 0x3ab8f(%rip), %xmm1    # 0xc8148
jne 0x8d5bd
jnp 0x8d5d1
movsd 0x3ab83(%rip), %xmm0    # 0xc8148
divsd %xmm1, %xmm0
movq %rbx, %rdi
callq 0x880f4
movl %r15d, %ebp
jmp 0x8d5e7
leaq 0x439b3(%rip), %rdi     # 0xd0f90
movq %r14, %rsi
xorl %eax, %eax
callq 0x9ce26
movl %ebp, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x13230
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::GetFormat(char const*) const
int R2PixelDatabase::
GetFormat(const char *key) const
{
  // Find entry
  R2PixelDatabaseEntry entry;
  if (!map.Find(key, &entry)) return -1;
  return entry.format;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xd0, %rsp
movq %rdi, %r14
xorps %xmm0, %xmm0
leaq 0x28(%rsp), %r15
movups %xmm0, 0x80(%r15)
andq $0x0, 0x90(%r15)
movaps 0x3ad9f(%rip), %xmm0    # 0xc83e0
movups %xmm0, 0x98(%r15)
xorl %ebx, %ebx
movb %bl, (%r15)
movb %bl, 0x7f(%r15)
leaq 0x8(%rsp), %r12
leaq 0x7(%rsp), %rdx
movq %r12, %rdi
callq 0x5edd2
addq $0x40, %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x8e4b4
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x13230
cmpl $0x1, %ebp
sbbl %ebx, %ebx
orl 0xa8(%rsp), %ebx
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x13230
movq %rbx, %rdi
callq 0x138f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::InsertImage(char const*, gaps::R2Image const&)
int R2PixelDatabase::
InsertImage(const char *key, const R2Image& image)
{
  // Seek to end of entries
  unsigned long long seek = entries_seek;
  RNFileSeek(fp, seek, RN_FILE_SEEK_SET);

  // Write pixels to file
  if (!image.WritePNGStream(fp)) return FALSE;

  // Update entries seek
  entries_seek = RNFileTell(fp);
  unsigned int size = entries_seek - seek;
  
  // Insert entry into map
  R2PixelDatabaseEntry entry(key, R2_PIXEL_DATABASE_3_8_PNG_FORMAT, size, seek);
  map.Insert(key, entry);

  // Insert key
  keys.push_back(key);
  
  // Increment number of entries
  entries_count++;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
movq 0x38(%rbx), %r15
xorl %ebp, %ebp
movq %r15, %rsi
xorl %edx, %edx
callq 0x9c462
movq 0x8(%rbx), %rsi
movq %r12, %rdi
callq 0x96ffe
testl %eax, %eax
je 0x8d7ae
movq 0x8(%rbx), %rdi
callq 0x9c473
movq %rax, 0x38(%rbx)
subl %r15d, %eax
leaq 0xd8(%rsp), %rdi
movsd 0x3aa32(%rip), %xmm1    # 0xc8148
xorps %xmm0, %xmm0
movq %r14, %rsi
xorl %edx, %edx
movl %eax, %ecx
movq %r15, %r8
movaps %xmm1, %xmm2
callq 0x8e46c
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x5edd2
leaq 0x30(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
movl $0xa8, %edx
callq 0x13400
movq 0x40(%rbx), %rdi
leaq 0x10(%rsp), %rsi
callq 0x8e764
leaq 0x30(%rsp), %rsi
movl $0xa8, %edx
movq %rax, %rdi
callq 0x13400
leaq 0x10(%rsp), %rdi
callq 0x13230
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
movq %r14, %rsi
callq 0x5edd2
leaq 0x48(%rbx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x8eece
leaq 0x30(%rsp), %rdi
callq 0x13230
incl 0x34(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
jmp 0x8d7d4
jmp 0x8d7db
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x13230
jmp 0x8d7de
movq %rax, %rbx
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::Remove(char const*)
int R2PixelDatabase::
Remove(const char *key)
{
  // Remove entry from map
  map.Remove(key);

  // Remove key
  std::vector<std::string>::iterator it = std::find(keys.begin(), keys.end(), key);
  if (it != keys.end()) keys.erase(it);
  
  // Leaves hole in file where pixels were :(

  // Decrement number of entries
  entries_count--;

  // Return success
  return 1;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movq %rsi, 0x10(%rsp)
leaq 0x18(%rsp), %r14
leaq 0xf(%rsp), %rdx
movq %r14, %rdi
callq 0x5edd2
leaq 0x40(%rbx), %rdi
movq %r14, %rsi
callq 0x8e4fa
leaq 0x18(%rsp), %rdi
callq 0x13230
movq 0x48(%rbx), %rdi
movq 0x50(%rbx), %rsi
leaq 0x10(%rsp), %rdx
callq 0x8f0e4
cmpq 0x50(%rbx), %rax
je 0x8da77
leaq 0x48(%rbx), %rdi
movq %rax, %rsi
callq 0x8e51e
decl 0x34(%rbx)
pushq $0x1
popq %rax
addq $0x38, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x13230
movq %rbx, %rdi
callq 0x138f0
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::OpenFile(char const*, char const*)
int R2PixelDatabase::
OpenFile(const char *filename, const char *rwaccess)
{
  // Remember file name
  if (this->filename) free(this->filename);
  this->filename = RNStrdup(filename);

  // Parse rwaccess
  if (this->rwaccess) free(this->rwaccess);
  if (!rwaccess) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "w")) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "+")) this->rwaccess = RNStrdup("r+b");
  else this->rwaccess = RNStrdup("rb"); 

  // Open file
  fp = fopen(filename, this->rwaccess);
  if (!fp) {
    RNFail("Unable to open database file %s with rwaccess %s\n", filename, rwaccess);
    return 0;
  }

  // Check if file is new
  if (!strcmp(this->rwaccess, "w+b")) {
    // Just checking ...
    assert(entries_count == 0);

    // File is new -- write header
    if (!WriteHeader(fp, 0)) return 0;

    // Update entries info
    entries_seek = RNFileTell(fp);
  }
  else {
    // Read header
    if (!ReadHeader(fp)) return 0;

    // Read entries
    if (!ReadEntries(fp, swap_endian)) return 0;
  }

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
callq 0x13600
movq %r15, %rdi
callq 0x9cc91
movq %rax, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x13600
leaq 0x3bf65(%rip), %r12     # 0xc9a35
testq %r14, %r14
je 0x8db05
pushq $0x77
popq %rsi
movq %r14, %rdi
callq 0x131d0
testq %rax, %rax
jne 0x8db05
pushq $0x2b
popq %rsi
movq %r14, %rdi
callq 0x131d0
testq %rax, %rax
leaq 0x3a6db(%rip), %rax     # 0xc81d5
leaq 0x3bf38(%rip), %r12     # 0xc9a39
cmoveq %rax, %r12
movq %r12, %rdi
callq 0x9cc91
movq %rax, 0x20(%rbx)
movq %r15, %rdi
movq %rax, %rsi
callq 0x135f0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x8db64
movq %rax, %r12
movq 0x20(%rbx), %rdi
leaq 0x3bf02(%rip), %rsi     # 0xc9a35
callq 0x13750
movq (%rbx), %rcx
testl %eax, %eax
je 0x8db7c
movq %rbx, %rdi
movq %r12, %rsi
callq *0x68(%rcx)
xorl %ebp, %ebp
testl %eax, %eax
je 0x8db9d
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rbx, %rdi
callq *0x78(%rax)
testl %eax, %eax
jne 0x8db9a
jmp 0x8db9d
leaq 0x3bed2(%rip), %rdi     # 0xc9a3d
xorl %ebp, %ebp
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x9ce26
jmp 0x8db9d
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq *0x70(%rcx)
testl %eax, %eax
je 0x8db9d
movq 0x8(%rbx), %rdi
callq 0x9c473
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::CloseFile()
int R2PixelDatabase::
CloseFile(void)
{
  // Check if writing file
  if (strcmp(rwaccess, "rb")) {
    // Write entries
    if (!WriteEntries(fp, swap_endian)) return 0;

    // Write header again (now that the seek values have been filled in)
    if (!WriteHeader(fp, swap_endian)) return 0;
  }

  // Close file
  fclose(fp);
  fp = NULL;
  
  // Reset filename
  if (filename) free(filename);
  filename = NULL;

  // Reset rwaccess
  if (rwaccess) free(rwaccess);
  rwaccess = NULL;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdi), %rax
cmpb $0x72, (%rax)
jne 0x8dbc3
cmpb $0x62, 0x1(%rax)
jne 0x8dbc3
cmpb $0x0, 0x2(%rax)
je 0x8dbf0
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rbx, %rdi
callq *0x80(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x8dc1d
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rbx, %rdi
callq *0x70(%rax)
testl %eax, %eax
je 0x8dc1d
movq 0x8(%rbx), %rdi
callq 0x134e0
andq $0x0, 0x8(%rbx)
movq 0x18(%rbx), %rdi
callq 0x13600
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x13600
andq $0x0, 0x20(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::OpenStream(_IO_FILE*, char const*)
int R2PixelDatabase::
OpenStream(FILE *fp, const char *rwaccess)
{
  // Set dummy file name
  if (this->filename) free(this->filename);
  this->filename = RNStrdup("stream");

  // Parse rwaccess
  if (this->rwaccess) free(this->rwaccess);
  if (!rwaccess) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "w")) this->rwaccess = RNStrdup("w+b");
  else if (strstr(rwaccess, "+")) this->rwaccess = RNStrdup("r+b");
  else this->rwaccess = RNStrdup("rb"); 

  // Check if file is new
  if (!strcmp(this->rwaccess, "w+b")) {
    // Just checking ...
    assert(entries_count == 0);

    // File is new -- write header
    if (!WriteHeader(fp, 0)) return 0;

    // Update entries info
    entries_seek = RNFileTell(fp);
  }
  else {
    // Read header
    if (!ReadHeader(fp)) return 0;

    // Read entries
    if (!ReadEntries(fp, swap_endian)) return 0;
  }

  // Remember file
  this->fp = fp;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq 0x18(%rdi), %rdi
callq 0x13600
leaq 0x45fa0(%rip), %rdi     # 0xd3be7
callq 0x9cc91
movq %rax, 0x18(%r14)
movq 0x20(%r14), %rdi
callq 0x13600
leaq 0x3bdd5(%rip), %r12     # 0xc9a35
testq %r15, %r15
je 0x8dc95
pushq $0x77
popq %rsi
movq %r15, %rdi
callq 0x131d0
testq %rax, %rax
jne 0x8dc95
pushq $0x2b
popq %rsi
movq %r15, %rdi
callq 0x131d0
testq %rax, %rax
leaq 0x3a54b(%rip), %rax     # 0xc81d5
leaq 0x3bda8(%rip), %r12     # 0xc9a39
cmoveq %rax, %r12
movq %r12, %rdi
callq 0x9cc91
movq %rax, 0x20(%r14)
leaq 0x3bd8d(%rip), %rsi     # 0xc9a35
movq %rax, %rdi
callq 0x13750
movq (%r14), %rcx
testl %eax, %eax
je 0x8dcdc
movq %r14, %rdi
movq %rbx, %rsi
callq *0x68(%rcx)
xorl %ebp, %ebp
testl %eax, %eax
je 0x8dd00
movl 0x30(%r14), %edx
movq (%r14), %rax
movq %r14, %rdi
movq %rbx, %rsi
callq *0x78(%rax)
testl %eax, %eax
jne 0x8dcf9
jmp 0x8dd00
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq *0x70(%rcx)
testl %eax, %eax
je 0x8dd00
movq %rbx, %rdi
callq 0x9c473
movq %rax, 0x38(%r14)
movq %rbx, 0x8(%r14)
pushq $0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::CloseStream()
int R2PixelDatabase::
CloseStream(void)
{
  // Check if writing file
  if (strcmp(rwaccess, "rb")) {
    // Write entries
    if (!WriteEntries(fp, swap_endian)) return 0;

    // Get position at end of stream
    unsigned long long end_of_stream = RNFileTell(fp);
    
    // Write header again (now that the seek values have been filled in)
    if (!WriteHeader(fp, swap_endian)) return 0;

    // Seek back to end of stream
    RNFileSeek(fp, end_of_stream, RN_FILE_SEEK_SET);
  }

  // Reset filename
  if (filename) free(filename);
  filename = NULL;

  // Reset rwaccess
  if (rwaccess) free(rwaccess);
  rwaccess = NULL;

  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdi), %rax
cmpb $0x72, (%rax)
jne 0x8dd28
cmpb $0x62, 0x1(%rax)
jne 0x8dd28
cmpb $0x0, 0x2(%rax)
je 0x8dd6f
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rbx, %rdi
callq *0x80(%rax)
xorl %ebp, %ebp
testl %eax, %eax
je 0x8dd8e
movq 0x8(%rbx), %rdi
callq 0x9c473
movq %rax, %r14
movq (%rbx), %rax
movq 0x8(%rbx), %rsi
movl 0x30(%rbx), %edx
movq %rbx, %rdi
callq *0x70(%rax)
testl %eax, %eax
je 0x8dd8e
movq 0x8(%rbx), %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x9c462
movq 0x18(%rbx), %rdi
callq 0x13600
andq $0x0, 0x18(%rbx)
movq 0x20(%rbx), %rdi
callq 0x13600
andq $0x0, 0x20(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/R2Shapes/R2PixelDatabase.cpp
// Function: gaps::R2PixelDatabase::WriteHeader(_IO_FILE*, int)
int R2PixelDatabase::
WriteHeader(FILE *fp, int swap_endian)
{
  // Seek to beginning of file
  RNFileSeek(fp, 0, RN_FILE_SEEK_SET);

  // Get convenient variables
  unsigned int endian_test = 1;
  char magic[32] = { '\0' };
  strncpy(magic, "R2PixelDatabase", 32);
  char buffer[1024] = { '\0' };

  // Write header
  if (!RNWriteChar(fp, magic, 32, swap_endian)) return 0;
  if (!RNWriteUnsignedInt(fp, &endian_test, 1, swap_endian)) return 0;
  if (!RNWriteUnsignedInt(fp, &endian_test, 1, swap_endian)) return 0;
  if (!RNWriteUnsignedInt(fp, &major_version, 1, swap_endian)) return 0;
  if (!RNWriteUnsignedInt(fp, &minor_version, 1, swap_endian)) return 0;
  if (!RNWriteUnsignedLongLong(fp, &entries_seek, 1, swap_endian)) return 0;
  if (!RNWriteUnsignedInt(fp, &entries_count, 1, swap_endian)) return 0;
  if (!RNWriteChar(fp, buffer, 1024, swap_endian)) return 0;
  
  // Return success
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x430, %rsp            # imm = 0x430
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %r15
xorl %ebx, %ebx
movq %rsi, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x9c462
movl $0x1, 0xc(%rsp)
movups 0x430b5(%rip), %xmm0    # 0xd0fef
leaq 0x10(%rsp), %r12
movaps %xmm0, 0x10(%r12)
movups 0x43093(%rip), %xmm0    # 0xd0fdf
movaps %xmm0, (%r12)
leaq 0x30(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x132b0
pushq $0x20
popq %rdx
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %ecx
callq 0x9c7f2
testl %eax, %eax
je 0x8e01c
leaq 0xc(%rsp), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebp, %ecx
callq 0x9c99c
testl %eax, %eax
je 0x8e01c
leaq 0xc(%rsp), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebp, %ecx
callq 0x9c99c
testl %eax, %eax
je 0x8e01c
leaq 0x28(%r15), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebp, %ecx
callq 0x9c99c
testl %eax, %eax
je 0x8e01c
leaq 0x2c(%r15), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebp, %ecx
callq 0x9c99c
testl %eax, %eax
je 0x8e01c
leaq 0x38(%r15), %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movl %ebp, %ecx
callq 0x9cb44
testl %eax, %eax
je 0x8e01c
addq $0x34, %r15
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
movl %ebp, %ecx
callq 0x9c99c
testl %eax, %eax
je 0x8e01c
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
movl $0x400, %edx            # imm = 0x400
movl %ebp, %ecx
callq 0x9c7f2
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movl %ebx, %eax
addq $0x430, %rsp            # imm = 0x430
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNFileSize(char const*)
unsigned long long
RNFileSize(const char *filename)
{
#if 1
    // Return size of file in bytes
    FILE *fp = fopen(filename, "r");
    if (!fp) return 0;
    RNFileSeek(fp, 0, RN_FILE_SEEK_END);
    unsigned long long file_size = RNFileTell(fp);
    fclose(fp);
    return file_size;
#else
    // Requires "unistd.h"
    struct stat stat_buf;
    int rc = fstat(filename, &stat_buf);
    if (rc == 0) return 0;
    else return stat_buf.st_size;
#endif
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x3718d(%rip), %rsi     # 0xd35b3
callq 0x135f0
testq %rax, %rax
je 0x9c458
movq %rax, %rbx
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x9c462
movq %rbx, %rdi
callq 0x13650
movq %rax, %r14
movq %rbx, %rdi
callq 0x134e0
movq %r14, %rax
jmp 0x9c45a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteShort(_IO_FILE*, short const*, int, int)
int
RNWriteShort(FILE *fp, const short *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap2((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(short), count, fp) != (size_t) count) {
    RNFail("Unable to write short to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap2((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9c87e
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c53c
movslq %ebx, %r12
pushq $0x2
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9c89d
pushq $0x1
popq %r15
jmp 0x9c8ae
leaq 0x350ab(%rip), %rdi     # 0xd194f
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9c8bc
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c53c
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteUnsignedShort(_IO_FILE*, unsigned short const*, int, int)
int
RNWriteUnsignedShort(FILE *fp, const unsigned short *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap2((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(unsigned short), count, fp) != (size_t) count) {
    RNFail("Unable to write unsigned short to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap2((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9c8e8
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c53c
movslq %ebx, %r12
pushq $0x2
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9c907
pushq $0x1
popq %r15
jmp 0x9c918
leaq 0x35060(%rip), %rdi     # 0xd196e
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9c926
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c53c
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteInt(_IO_FILE*, int const*, int, int)
int
RNWriteInt(FILE *fp, const int *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(int), count, fp) != (size_t) count) {
    RNFail("Unable to write integer to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9c952
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movslq %ebx, %r12
pushq $0x4
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9c971
pushq $0x1
popq %r15
jmp 0x9c982
leaq 0x34f8f(%rip), %rdi     # 0xd1907
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9c990
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteUnsignedInt(_IO_FILE*, unsigned int const*, int, int)
int
RNWriteUnsignedInt(FILE *fp, const unsigned int *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(unsigned int), count, fp) != (size_t) count) {
    RNFail("Unable to write unsigned integer to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9c9bc
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movslq %ebx, %r12
pushq $0x4
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9c9db
pushq $0x1
popq %r15
jmp 0x9c9ec
leaq 0x34fb4(%rip), %rdi     # 0xd1996
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9c9fa
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteFloat(_IO_FILE*, float const*, int, int)
int
RNWriteFloat(FILE *fp, const float *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(float), count, fp) != (size_t) count) {
    RNFail("Unable to write float to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap4((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9ca26
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movslq %ebx, %r12
pushq $0x4
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9ca45
pushq $0x1
popq %r15
jmp 0x9ca56
leaq 0x34f74(%rip), %rdi     # 0xd19c0
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9ca64
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c603
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteDouble(_IO_FILE*, double const*, int, int)
int
RNWriteDouble(FILE *fp, const double *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(double), count, fp) != (size_t) count) {
    RNFail("Unable to write double to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9ca90
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movslq %ebx, %r12
pushq $0x8
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9caaf
pushq $0x1
popq %r15
jmp 0x9cac0
leaq 0x34f29(%rip), %rdi     # 0xd19df
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9cace
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteLongLong(_IO_FILE*, long long const*, int, int)
int
RNWriteLongLong(FILE *fp, const long long *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(long long), count, fp) != (size_t) count) {
    RNFail("Unable to write long long to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9cafa
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movslq %ebx, %r12
pushq $0x8
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9cb19
pushq $0x1
popq %r15
jmp 0x9cb2a
leaq 0x34edf(%rip), %rdi     # 0xd19ff
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9cb38
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tomfunkhouser[P]gaps/pkgs/RNBasics/RNFile.cpp
// Function: gaps::RNWriteUnsignedLongLong(_IO_FILE*, unsigned long long const*, int, int)
int
RNWriteUnsignedLongLong(FILE *fp, const unsigned long long *ptr, int count, int swap_endian)
{
  // Swap endian
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Write the values
  int status = 1;
  if (fwrite(ptr, sizeof(unsigned long long), count, fp) != (size_t) count) {
    RNFail("Unable to write unsigned long long to file\n");
    status = 0;
  }

  // Swap endian back
  if (swap_endian) RNSwap8((void *) ptr, count);

  // Return status
  return status;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0x9cb64
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movslq %ebx, %r12
pushq $0x8
popq %rsi
movq %r14, %rdi
movq %r12, %rdx
movq %r15, %rcx
callq 0x139e0
cmpq %r12, %rax
jne 0x9cb83
pushq $0x1
popq %r15
jmp 0x9cb94
leaq 0x34e98(%rip), %rdi     # 0xd1a22
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x9ce26
testl %ebp, %ebp
je 0x9cba2
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c725
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/main.cpp
// Function: main
int main(int argc, char *args[])
{
    App app;

    if(!app.init())
    {
        printf("Error initializing... bye!\n");
        return 666;
    }

    app.run();
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x78, %rsp
leaq -0x78(%rbp), %rbx
movq %rbx, %rdi
callq 0x1ee8
movq %rbx, %rdi
callq 0x1344
testb %al, %al
je 0x12ca
xorl %ebx, %ebx
leaq -0x78(%rbp), %rdi
callq 0x13dc
jmp 0x12db
leaq 0x1d33(%rip), %rdi      # 0x3004
callq 0x1160
movl $0x29a, %ebx            # imm = 0x29A
leaq -0x78(%rbp), %rdi
callq 0x1304
movl %ebx, %eax
addq $0x78, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x78(%rbp), %rdi
callq 0x1304
movq %rbx, %rdi
callq 0x1180
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/App.cpp
// Function: App::~App()
App::~App()
{
    if(gRenderer != NULL)
    {
        SDL_DestroyRenderer(gRenderer);
        gRenderer = NULL;
    }

    if(gWindow != NULL)
    {
        SDL_DestroyWindow(gWindow);
        gWindow = NULL;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq 0x3de9(%rip), %rdi      # 0x50f8
testq %rdi, %rdi
je 0x1321
callq 0x10d0
andq $0x0, 0x3dd7(%rip)      # 0x50f8
movq 0x3dc8(%rip), %rdi      # 0x50f0
testq %rdi, %rdi
je 0x133a
callq 0x1030
andq $0x0, 0x3db6(%rip)      # 0x50f0
popq %rbp
retq
movq %rax, %rdi
callq 0x145b
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/App.cpp
// Function: App::init()
bool App::init()
{
    if(SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        printf("Couldn't start SDL! SDL error: %s\n", SDL_GetError());
        return false;
    }

    gWindow = SDL_CreateWindow("Tic Tac Toe", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN);
    if(gWindow == NULL)
    {
        printf("Couldn't create Window! SDL error: %s\n", SDL_GetError());
        return false;
    }

    gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);
    if(gRenderer == NULL)
    {
        printf("Couldn't create Renderer! SDL error: %s\n", SDL_GetError());
        return false;
    }

    return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
pushq $0x20
popq %rdi
callq 0x1110
testl %eax, %eax
js 0x13ae
leaq 0x1ce4(%rip), %rdi      # 0x3042
pushq $0x4
popq %r9
movl $0x1fff0000, %esi       # imm = 0x1FFF0000
movl $0x1fff0000, %edx       # imm = 0x1FFF0000
movl $0x258, %ecx            # imm = 0x258
movl $0x258, %r8d            # imm = 0x258
callq 0x1060
movq %rax, 0x3d6d(%rip)      # 0x50f0
testq %rax, %rax
je 0x13b7
pushq $-0x1
popq %rsi
pushq $0x6
popq %rdx
movq %rax, %rdi
callq 0x1040
movq %rax, 0x3d5b(%rip)      # 0x50f8
movb $0x1, %r14b
testq %rax, %rax
jne 0x13d3
leaq 0x1cc9(%rip), %rbx      # 0x3075
jmp 0x13be
leaq 0x1c6a(%rip), %rbx      # 0x301f
jmp 0x13be
leaq 0x1c90(%rip), %rbx      # 0x304e
callq 0x1100
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x1050
movl %r14d, %eax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/App.cpp
// Function: App::run()
void App::run()
{
    bool quit = false;
    while(!quit)
    {
        // handle exit events
        while(SDL_PollEvent(&event))
        {
            if(event.type == SDL_QUIT)
                quit = true;
        }

        // update and render the game
        game.update(&event);
        game.render();
        game.checkWin();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
xorl %r15d, %r15d
movq %r14, %rdi
callq 0x10e0
testl %eax, %eax
je 0x140e
cmpl $0x100, (%r14)          # imm = 0x100
sete %al
orb %r15b, %al
movl %eax, %r15d
jmp 0x13f0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1f50
movq %rbx, %rdi
callq 0x2002
movq %rbx, %rdi
callq 0x205a
testb $0x1, %r15b
movl $0x0, %r15d
je 0x13f0
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::restart()
void Board::restart()
{
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
            m[i][j] = PIECE_EMPTY;

    occupiedPlaces = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
xorl %eax, %eax
movq %rdi, %rcx
cmpq $0x3, %rax
je 0x149f
xorl %edx, %edx
cmpq $0x3, %rdx
je 0x1496
andl $0x0, (%rcx,%rdx,4)
incq %rdx
jmp 0x1487
incq %rax
addq $0xc, %rcx
jmp 0x147f
andl $0x0, 0x24(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::renderBoard() const
void Board::renderBoard() const
{
    // vertical lines
    SDL_RenderDrawLine(App::getRenderer(),
        App::SCREEN_WIDTH/3, 0,
        App::SCREEN_WIDTH/3, App::SCREEN_HEIGHT);

    SDL_RenderDrawLine(App::getRenderer(),
        App::SCREEN_WIDTH/3*2, 0,
        App::SCREEN_WIDTH/3*2, App::SCREEN_HEIGHT);

    // horizontal lines
    SDL_RenderDrawLine(App::getRenderer(),
        0, App::SCREEN_HEIGHT/3,
        App::SCREEN_WIDTH, App::SCREEN_HEIGHT/3);

    SDL_RenderDrawLine(App::getRenderer(),
        0, App::SCREEN_HEIGHT/3*2,
        App::SCREEN_WIDTH, App::SCREEN_HEIGHT/3*2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
callq 0x144e
movq %rax, %rdi
movl $0xc8, %esi
xorl %edx, %edx
movl $0xc8, %ecx
movl $0x258, %r8d            # imm = 0x258
callq 0x10b0
callq 0x144e
movq %rax, %rdi
movl $0x190, %esi            # imm = 0x190
xorl %edx, %edx
movl $0x190, %ecx            # imm = 0x190
movl $0x258, %r8d            # imm = 0x258
callq 0x10b0
callq 0x144e
movq %rax, %rdi
xorl %esi, %esi
movl $0xc8, %edx
movl $0x258, %ecx            # imm = 0x258
movl $0xc8, %r8d
callq 0x10b0
callq 0x144e
movq %rax, %rdi
xorl %esi, %esi
movl $0x190, %edx            # imm = 0x190
movl $0x258, %ecx            # imm = 0x258
movl $0x190, %r8d            # imm = 0x190
popq %rbp
jmp 0x10b0
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::renderPieces() const
void Board::renderPieces() const
{
    for(int i=0; i<3; i++)
        for(int j=0; j<3; j++)
        {
            switch(m[i][j])
            {
                case PIECE_X:
                    Util::drawCross(i, j); break;
                case PIECE_O:
                    Util::drawCircle(i, j); break;
                default:
                    break;
            }
        }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x3, %r14
je 0x15b1
xorl %r15d, %r15d
cmpq $0x3, %r15
je 0x15a8
movl (%rbx,%r15,4), %eax
cmpl $0x2, %eax
je 0x1598
cmpl $0x1, %eax
jne 0x15a3
movl %r14d, %edi
movl %r15d, %esi
callq 0x208c
jmp 0x15a3
movl %r14d, %edi
movl %r15d, %esi
callq 0x20ee
incq %r15
jmp 0x1577
incq %r14
addq $0xc, %rbx
jmp 0x156e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::checkRows() const
bool Board::checkRows() const
{
    if(m[0][0] == m[0][1] && m[0][1] == m[0][2] && !isFieldEmpty(0,2))
        return true;
    else if(m[1][0] == m[1][1] && m[1][1] == m[1][2] && !isFieldEmpty(1,2))
        return true;
    else if(m[2][0] == m[2][1] && m[2][1] == m[2][2] && !isFieldEmpty(2,2))
        return true;

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x4(%rdi), %ecx
movb $0x1, %al
cmpl %ecx, (%rdi)
jne 0x160a
movl 0x8(%rdi), %edx
cmpl %edx, %ecx
jne 0x160a
testl %edx, %edx
jne 0x1639
movl 0x10(%rdi), %ecx
cmpl %ecx, 0xc(%rdi)
jne 0x161d
movl 0x14(%rdi), %edx
cmpl %edx, %ecx
jne 0x161d
testl %edx, %edx
jne 0x1639
movl 0x1c(%rdi), %eax
cmpl %eax, 0x18(%rdi)
sete %cl
movl 0x20(%rdi), %edx
cmpl %edx, %eax
sete %sil
testl %edx, %edx
setne %al
andb %sil, %al
andb %cl, %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::checkColumns() const
bool Board::checkColumns() const
{
    if(m[0][0] == m[1][0] && m[1][0] == m[2][0] && !isFieldEmpty(2,0))
        return true;
    else if(m[0][1] == m[1][1] && m[1][1] == m[2][1] && !isFieldEmpty(2,1))
        return true;
    else if(m[0][2] == m[1][2] && m[1][2] == m[2][2] && !isFieldEmpty(2,2))
        return true;

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0xc(%rdi), %ecx
movb $0x1, %al
cmpl %ecx, (%rdi)
jne 0x1654
movl 0x18(%rdi), %edx
cmpl %edx, %ecx
jne 0x1654
testl %edx, %edx
jne 0x1683
movl 0x10(%rdi), %ecx
cmpl %ecx, 0x4(%rdi)
jne 0x1667
movl 0x1c(%rdi), %edx
cmpl %edx, %ecx
jne 0x1667
testl %edx, %edx
jne 0x1683
movl 0x14(%rdi), %eax
cmpl %eax, 0x8(%rdi)
sete %cl
movl 0x20(%rdi), %edx
cmpl %edx, %eax
sete %sil
testl %edx, %edx
setne %al
andb %sil, %al
andb %cl, %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Board.cpp
// Function: Board::checkDiagonals() const
bool Board::checkDiagonals() const
{
    if(m[0][0] == m[1][1] && m[1][1] == m[2][2] && !isFieldEmpty(2,2))
        return true;
    else if(m[0][2] == m[1][1] && m[1][1] == m[2][0] && !isFieldEmpty(2,0))
        return true;

    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x10(%rdi), %ecx
cmpl %ecx, (%rdi)
jne 0x169e
movl 0x20(%rdi), %edx
cmpl %edx, %ecx
jne 0x169e
movb $0x1, %al
testl %edx, %edx
jne 0x16b5
cmpl %ecx, 0x8(%rdi)
movl 0x18(%rdi), %eax
sete %dl
cmpl %eax, %ecx
sete %cl
testl %eax, %eax
setne %al
andb %cl, %al
andb %dl, %al
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Game.cpp
// Function: Game::restartGame()
void Game::restartGame()
{
    bot.restart();
    board.restart();

    // randomly choose first player
    // 0=pc, 1=human
    humanTurn = (rand()&1) ? true : false;

    // corrects the game state
    state = STATE_RUNNING;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x4, %rdi
callq 0x1796
leaq 0x8(%rbx), %rdi
callq 0x1476
callq 0x1090
andb $0x1, %al
movb %al, 0x30(%rbx)
andl $0x0, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/t3nma[P]sdl2-TicTacToe/src/Game.cpp
// Function: Game::update(SDL_Event*)
void Game::update(SDL_Event *event)
{
    // have we reach the current game's end?
    if(state == STATE_STOPPED)
        restartGame();
    else
    {
        bool successfulPlay = false; // to handle change of player turn

        // process human or pc turn
        if(!humanTurn)
        {
            bot.play(board);
            successfulPlay = true;
        }
        else
        {
            // did the human play?
            if(event->type == SDL_MOUSEBUTTONDOWN)
            {
                // get mouse coordinates and normalize to row/col
                int x, y;
                SDL_GetMouseState(&x, &y);
                int row = y/(App::SCREEN_HEIGHT/3);
                int col = x/(App::SCREEN_WIDTH/3);

                // try to validate the move
                if(board.isFieldEmpty(row,col))
                {
                    board.place(row,col);
                    successfulPlay = true;
                }
            }
        }

        // change turns
        if(successfulPlay)
        {
            humanTurn = !humanTurn;
            SDL_Delay(100); // delay between turns
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpl $0x1, (%rdi)
jne 0x1f7b
movq %rbx, %rdi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1f20
cmpb $0x0, 0x30(%rbx)
je 0x1fdb
cmpl $0x401, (%rsi)          # imm = 0x401
jne 0x1ff4
leaq -0x28(%rbp), %r15
leaq -0x24(%rbp), %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0x1170
movl (%r14), %eax
movl $0xc8, %ecx
cltd
idivl %ecx
movl %eax, %r14d
movl (%r15), %eax
cltd
idivl %ecx
movl %eax, %r15d
leaq 0x8(%rbx), %r12
movq %r12, %rdi
movl %r14d, %esi
movl %eax, %edx
callq 0x1706
testb %al, %al
je 0x1ff4
pushq $0x1
popq %rcx
movq %r12, %rdi
movl %r14d, %esi
movl %r15d, %edx
callq 0x16c6
jmp 0x1fe8
leaq 0x4(%rbx), %rdi
leaq 0x8(%rbx), %rsi
callq 0x17b4
xorb $0x1, 0x30(%rbx)
pushq $0x64
popq %rdi
callq 0x10f0
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop