LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TIA.cxx
// Function: TIA::dump()
void TIA::dump()
{
  printf("TIA: pos_x=%d pos_y=%d  wait_for_hsync=%s\n",
    pos_x, pos_y, wait_for_hsync() ? "on" : "off");

  printf("playfield: ");
  for (int n = 0; n < 40; n++)
  {
    printf("%c", (playfield.data & (1ULL << n)) != 0 ? '*' : '.');
  }
  printf("\n");

  printf("player_0: ");
  for (int n = 0; n < 8; n++)
  {
    printf("%c", (player_0.data & (1 << n)) != 0 ? '*' : '.');
  }
  printf(" x=%d (move=%d)\n",
    player_0.start_pos,
    player_0.move);

  printf("player_1: ");
  for (int n = 0; n < 8; n++)
  {
    printf("%c", (player_1.data & (1 << n)) != 0 ? '*' : '.');
  }
  printf(" x=%d (move=%d)\n",
    player_1.start_pos,
    player_1.move);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl 0x8(%rdi), %esi
movl 0xc(%rdi), %edx
cmpb $0x0, 0x82(%rdi)
leaq 0x308b(%rip), %rax      # 0xab76
leaq 0x3081(%rip), %rcx      # 0xab73
cmoveq %rax, %rcx
leaq 0x304b(%rip), %rdi      # 0xab48
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4050
leaq 0x306c(%rip), %rdi      # 0xab7a
xorl %eax, %eax
callq 0x4050
cmpq $0x28, %r14
je 0x7b39
movq 0x20(%rbx), %rax
xorl %ecx, %ecx
btq %r14, %rax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42e0
incq %r14
jmp 0x7b15
pushq $0xa
popq %rdi
callq 0x42e0
leaq 0x303e(%rip), %rdi      # 0xab86
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4050
cmpl $0x8, %ebp
je 0x7b72
movzbl 0x30(%rbx), %eax
xorl %ecx, %ecx
btl %ebp, %eax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42e0
incl %ebp
jmp 0x7b51
movl 0x3c(%rbx), %esi
movl 0x40(%rbx), %edx
leaq 0x3012(%rip), %rdi      # 0xab91
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4050
leaq 0x3013(%rip), %rdi      # 0xaba2
xorl %eax, %eax
callq 0x4050
cmpl $0x8, %ebp
je 0x7bb7
movzbl 0x44(%rbx), %eax
xorl %ecx, %ecx
btl %ebp, %eax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42e0
incl %ebp
jmp 0x7b96
movl 0x50(%rbx), %esi
movl 0x54(%rbx), %edx
leaq 0x2fcd(%rip), %rdi      # 0xab91
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x4050
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TIA.h
// Function: TIA::Player::compute_pixel(int)
void compute_pixel(int pos_x)
    {
      //if (pos_x < 68) { return false; }
      if (pos_x < start_pos) { pixel_value = false; return; }
      int x = (pos_x - start_pos) / scale;
      if (x > 7) { pixel_value = false; return; }
      pixel_value = (data & (1 << x)) != 0;
    }

// Assembly:
subl 0xc(%rdi), %esi
jl 0x7be0
movl %esi, %eax
cltd
idivl 0x8(%rdi)
cmpl $0x8, %eax
jl 0x7be5
movb $0x0, 0x4(%rdi)
retq
movzbl (%rdi), %ecx
btl %eax, %ecx
setb 0x4(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TIA.h
// Function: TIA::set_pixel(int, int, unsigned char)
inline void set_pixel(int x, int y, uint8_t color)
  {
    x = x * 3;
    y = y * 2;

    const int width = television->get_width();
    int ptr = y * width + x;

    if (bitsize == 8)
    {
      color = color >> 1;
      image_8[ptr + 0] = color;
      image_8[ptr + 1] = color;
      image_8[ptr + 2] = color;
      ptr += width;
      image_8[ptr + 0] = color;
      image_8[ptr + 1] = color;
      image_8[ptr + 2] = color;
    }
      else
    {
      int c = ColorTable::get_color(color);
      image_32[ptr + 0] = c;
      image_32[ptr + 1] = c;
      image_32[ptr + 2] = c;
      ptr += width;
      image_32[ptr + 0] = c;
      image_32[ptr + 1] = c;
      image_32[ptr + 2] = c;
    }
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leal (%rsi,%rsi,2), %eax
movq (%rdi), %rsi
movl 0x8(%rsi), %ebp
imull %ebp, %edx
leal (%rax,%rdx,2), %r14d
cmpl $0x8, 0x1e0(%rdi)
jne 0x7c7f
shrb %cl
movq 0x1d8(%rbx), %rax
movslq %r14d, %rdx
movb %cl, (%rax,%rdx)
movq 0x1d8(%rbx), %rax
movb %cl, 0x1(%rax,%rdx)
movq 0x1d8(%rbx), %rax
movb %cl, 0x2(%rax,%rdx)
addl %r14d, %ebp
movq 0x1d8(%rbx), %rax
movslq %ebp, %rdx
movb %cl, (%rax,%rdx)
movq 0x1d8(%rbx), %rax
movb %cl, 0x1(%rax,%rdx)
movq 0x1d8(%rbx), %rax
movb %cl, 0x2(%rax,%rdx)
jmp 0x7cad
movzbl %cl, %edi
callq 0x4ae4
movq 0x1d0(%rbx), %rcx
movslq %r14d, %rdx
movl %eax, (%rcx,%rdx,4)
movl %eax, 0x4(%rcx,%rdx,4)
movl %eax, 0x8(%rcx,%rdx,4)
addl %r14d, %ebp
movslq %ebp, %rdx
movl %eax, (%rcx,%rdx,4)
movl %eax, 0x4(%rcx,%rdx,4)
movl %eax, 0x8(%rcx,%rdx,4)
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.cxx
// Function: TelevisionHttp::TelevisionHttp()
TelevisionHttp::TelevisionHttp() : gif{nullptr}, gif_length{0}, no_data_count{0}
{
  gif_compressor = new GifCompressor();
  gif_compressor->set_width(width);
  gif_compressor->set_height(height);

  image = (uint8_t *)malloc(width * height);

  memset(filename, 0, sizeof(filename));
  memset(query_string, 0, sizeof(query_string));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x7cb4
leaq 0x20(%rbx), %r14
movq %r14, %rdi
callq 0x6c6c
leaq 0x6ed9(%rip), %rax      # 0xebd8
movq %rax, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x150(%rbx)
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x16c(%rbx)
movups %xmm0, 0x38(%rbx)
pushq $0x20
popq %rdi
callq 0x41f0
movq %rax, %r12
movq %rax, %rdi
callq 0x4c94
movq %r12, 0x48(%rbx)
movl 0x8(%rbx), %eax
movw %ax, 0x6(%r12)
movl 0xc(%rbx), %ecx
movw %cx, 0x8(%r12)
imull %eax, %ecx
movslq %ecx, %rdi
callq 0x42b0
movq %rax, 0x30(%rbx)
addq $0x50, %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
xorl %esi, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4130
movq %rax, %r15
pushq $0x20
popq %rsi
movq %r12, %rdi
callq 0x4200
jmp 0x7d87
movq %rax, %r15
movq %r14, %rdi
callq 0x6c78
jmp 0x7d94
movq %rax, %r15
movq %rbx, %rdi
callq 0x7cd4
movq %r15, %rdi
callq 0x4370
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.cxx
// Function: TelevisionHttp::init()
int TelevisionHttp::init()
{
  if (net_open(port) != 0) { return -1; }
  if (read_http() != 0) { return -1; }
  if (send_index_html() != 0) { return -1; }

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x20, %rdi
movl 0x28(%rbx), %esi
callq 0x6cae
pushq $-0x1
popq %rbp
testl %eax, %eax
jne 0x7e4b
movq %rbx, %rdi
callq 0x7e54
testl %eax, %eax
jne 0x7e4b
movq %rbx, %rdi
callq 0x7fd8
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.cxx
// Function: TelevisionHttp::refresh()
bool TelevisionHttp::refresh()
{
  gif_compressor->compress(image, ColorTable::get_table());

  gif = gif_compressor->get_gif_data();
  gif_length = gif_compressor->get_gif_length();

  pause();

  return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x30(%rdi), %rsi
movq 0x48(%rdi), %rdi
leaq 0x710b(%rip), %rdx      # 0xf1f0
callq 0x4cf2
movq 0x48(%rbx), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x38(%rbx)
movl 0x1c(%rax), %eax
movl %eax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x83f0
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.cxx
// Function: TelevisionHttp::send_gif()
int TelevisionHttp::send_gif()
{
  std::string header =
    "HTTP/1.1 200 OK\n"
    "Content-Type: image/gif\n"
    "Cache-Control: no-cache, must-revalidate\n"
    "Pragma: no-cache\n"
    "Content-Length: " + std::to_string(gif_length) + "\n\n";

  net_send((uint8_t *)header.c_str(), header.size());
  net_send(gif, gif_length);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x40(%rdi), %esi
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x8553
leaq 0x2eec(%rip), %rsi      # 0xb17d
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x84ed
leaq 0x2e62(%rip), %rdx      # 0xb107
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x84ce
leaq 0x28(%rsp), %rdi
callq 0x4100
leaq 0x48(%rsp), %rdi
callq 0x4100
leaq 0x20(%rbx), %r14
movq 0x8(%rsp), %rsi
movl 0x10(%rsp), %edx
movq %r14, %rdi
callq 0x6d62
movq 0x38(%rbx), %rsi
movl 0x40(%rbx), %edx
movq %r14, %rdi
callq 0x6d62
leaq 0x8(%rsp), %rdi
callq 0x4100
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4100
jmp 0x8312
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x8321
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4100
movq %rbx, %rdi
callq 0x4370
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.cxx
// Function: TelevisionHttp::send_404()
int TelevisionHttp::send_404()
{
  const char *page = "<p>Not found</p>";

  std::string header =
    "HTTP/1.1 404 Not Found\n"
    "Content-Type: text/html\n"
    "Content-Length: " + std::to_string(strlen(page)) + "\n\n";

  net_send((uint8_t *)header.c_str(), header.size());
  net_send((uint8_t *)page, strlen(page));

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x48(%rsp), %r14
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x8511
leaq 0x2eb2(%rip), %rsi      # 0xb201
leaq 0x28(%rsp), %rdi
movq %r14, %rdx
callq 0x84ed
leaq 0x2da4(%rip), %rdx      # 0xb107
leaq 0x8(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x84ce
leaq 0x28(%rsp), %rdi
callq 0x4100
leaq 0x48(%rsp), %rdi
callq 0x4100
addq $0x20, %rbx
movq 0x8(%rsp), %rsi
movl 0x10(%rsp), %edx
movq %rbx, %rdi
callq 0x6d62
leaq 0x2e4e(%rip), %rsi      # 0xb1f0
pushq $0x10
popq %rdx
movq %rbx, %rdi
callq 0x6d62
leaq 0x8(%rsp), %rdi
callq 0x4100
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4100
jmp 0x83d3
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0x83e2
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4100
movq %rbx, %rdi
callq 0x4370
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/Television.h
// Function: Television::pause()
void pause()
  {
    struct timeval now;

    gettimeofday(&now, NULL);
    long time_diff = now.tv_usec - refresh_time.tv_usec;
    while (time_diff < 0) { now.tv_sec--; time_diff += 1000000; }
    time_diff += (now.tv_sec - refresh_time.tv_sec) * 1000000;

#if 0
    struct timespec now;
    clock_gettime(CLOCK_MONOTONIC, &now);
    long time_diff = now.tv_nsec - refresh_time.tv_nsec;
    while (time_diff < 0) { now.tv_sec--; time_diff += 1000000000; }
    time_diff += (now.tv_sec - refresh_time.tv_sec) * 1000000000;
    time_diff = time_diff / 1000;
#endif

    // 1,000,000 us / 60 fps = 16667
    // 1,000,000 us / 30 fps = 33333
    // FIXME: The TV should be 60fps, but for some reason 33333
    // is coming out at 60fps in the TIA.
    if (time_diff < 33333)
    {
      usleep(33333 - time_diff);
    }

    refresh_time = now;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
xorl %r15d, %r15d
movq %rsp, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x4360
movq 0x8(%r14), %rdi
movq 0x18(%rbx), %rcx
movq %rdi, %rax
subq %rcx, %rax
testq %rax, %rax
cmovleq %r15, %rax
movq (%r14), %rsi
addq %rcx, %rax
xorl %r8d, %r8d
cmpq %rdi, %rax
setne %r8b
subq %rdi, %rax
subq %r8, %rax
movl $0xf4240, %r9d          # imm = 0xF4240
xorl %edx, %edx
divq %r9
addq %r8, %rax
imulq $0xf4240, %rax, %rdx    # imm = 0xF4240
addq %rdi, %rdx
subq %rax, %rsi
subq %rcx, %rdx
movq %rsi, (%r14)
subq 0x10(%rbx), %rsi
addq $0x10, %rbx
imulq $0xf4240, %rsi, %rax    # imm = 0xF4240
addq %rdx, %rax
cmpq $0x8234, %rax           # imm = 0x8234
jg 0x847e
movl $0x8235, %edi           # imm = 0x8235
subl %eax, %edi
callq 0x4310
movups (%rsp), %xmm0
movups %xmm0, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionHttp.h
// Function: TelevisionHttp::KeyQueue::get_next()
char get_next()
    {
      char c = queue[head++];
      if (head == sizeof(queue)) { head = 0; }
      count--;
      return c;
    }

// Assembly:
movslq 0x4(%rdi), %rax
leal 0x1(%rax), %ecx
movl %ecx, 0x4(%rdi)
movb 0xc(%rdi,%rax), %al
xorl %edx, %edx
cmpl $0x20, %ecx
cmovnel %ecx, %edx
movl %edx, 0x4(%rdi)
decl (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::TelevisionVNC()
TelevisionVNC::TelevisionVNC() :
  needs_full_image{true},
  needs_color_table{true},
  image_page{0}
{
  image_packet_length = sizeof(ImagePacket) + (width * height * 4);
  image_packet[0] = (ImagePacket *)malloc(image_packet_length);
  image_packet[1] = (ImagePacket *)malloc(image_packet_length);

  memset(image_packet[0], 0, image_packet_length);
  memset(image_packet[1], 0, image_packet_length);

  image_packet[0]->number_of_rectangles = htons(1);
  image_packet[0]->width = htons(width);
  image_packet[0]->height = htons(height);
  image_packet[0]->encoding_type = htonl(ENCODING_RAW);

  image_packet[1]->number_of_rectangles = htons(1);
  image_packet[1]->width = htons(width);
  image_packet[1]->height = htons(height);
  image_packet[1]->encoding_type = htonl(ENCODING_RAW);

  diff_buffer_length = width * height * 4;
  diff_buffer = (uint8_t *)malloc(diff_buffer_length);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x7cb4
leaq 0x20(%rbx), %rdi
callq 0x6c6c
leaq 0x6549(%rip), %rax      # 0xecd8
movq %rax, (%rbx)
movw $0x101, 0x2c(%rbx)      # imm = 0x101
andl $0x0, 0x48(%rbx)
movl 0x8(%rbx), %ebp
movl 0xc(%rbx), %r13d
movl %ebp, %eax
imull %r13d, %eax
leal 0x10(,%rax,4), %ecx
movl %eax, %r15d
shll $0x2, %r15d
movl %ecx, 0x30(%rbx)
movslq %ecx, %r14
pushq $0x1
popq %rdi
movq %r14, %rsi
callq 0x4160
movq %rax, %r12
movq %rax, 0x38(%rbx)
pushq $0x1
popq %rdi
movq %r14, %rsi
callq 0x4160
movq %rax, 0x40(%rbx)
movw $0x100, %cx             # imm = 0x100
movw %cx, 0x2(%r12)
rolw $0x8, %bp
movw %bp, 0x8(%r12)
rolw $0x8, %r13w
movw %r13w, 0xa(%r12)
movw %cx, 0x2(%rax)
movw %bp, 0x8(%rax)
movw %r13w, 0xa(%rax)
movl %r15d, 0x58(%rbx)
movslq %r15d, %rdi
callq 0x42b0
movq %rax, 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x7cd4
movq %r14, %rdi
callq 0x4370
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::init()
int TelevisionVNC::init()
{
  if (net_open(port) != 0) { return -1; }

  if (send_protocol_version() != 0) { return -1; }
  if (get_client_protocol_version() != 0) { return -1; }
  if (send_security() != 0) { return -1; }
  if (get_client_init() != 0) { return -1; }
  if (send_server_init() != 0) { return -1; }
  //if (send_color_table() != 0) { return -1; }

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
addq $0x20, %rdi
movl 0x28(%r14), %esi
callq 0x6cae
pushq $-0x1
popq %rbx
testl %eax, %eax
jne 0x88f5
movq %r14, %rdi
callq 0x8900
testl %eax, %eax
jne 0x88f5
movq %r14, %rdi
callq 0x892e
testl %eax, %eax
jne 0x88f5
movq %r14, %rdi
callq 0x8970
movq %r14, %rdi
callq 0x898c
testl %eax, %eax
jne 0x88f5
movq %r14, %rdi
callq 0x89da
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::send_security()
int TelevisionVNC::send_security()
{
  // No password.
  const uint8_t security[] = { 0, 0, 0, 1 };
  //const uint8_t success[] = { 0, 0, 0, 0 };

  net_send(security, sizeof(security));
  //net_send(success, sizeof(security));

  return 0;
}

// Assembly:
pushq %rax
leaq 0x4(%rsp), %rsi
movl $0x1000000, (%rsi)      # imm = 0x1000000
addq $0x20, %rdi
pushq $0x4
popq %rdx
callq 0x6d62
xorl %eax, %eax
popq %rcx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::get_client_init()
int TelevisionVNC::get_client_init()
{
  uint8_t init[1] = { 0 };

  if (net_recv(init, sizeof(init)) != 1)
  {
    printf("Error: Client init improper response.\n");
    return -1;
  }

  printf("Client init response %d\n", init[0]);

  return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xf(%rsp), %rsi
movb $0x0, (%rsi)
addq $0x20, %rdi
pushq $0x1
popq %rcx
movl %ecx, %edx
callq 0x6e4a
cmpl $0x1, %eax
jne 0x89c3
movzbl 0xf(%rsp), %esi
leaq 0x2ac5(%rip), %rdi      # 0xb47d
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4050
jmp 0x89d2
leaq 0x2cc1(%rip), %rdi      # 0xb68b
callq 0x4340
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::refresh()
bool TelevisionVNC::refresh()
{
  pause();

  send_image_diff();

  image_page ^= 1;

  return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x83f0
movq %rbx, %rdi
callq 0x8a80
xorb $0x1, 0x48(%rbx)
movb $0x1, %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::print_pixel_format(unsigned char*)
void TelevisionVNC::print_pixel_format(uint8_t *buffer)
{
  buffer += 4;

  printf("  bits_per_pixel: %d\n", buffer[0]);
  printf("           depth: %d\n", buffer[1]);
  printf("      big_endian: %d\n", buffer[2]);
  printf("     true_colour: %d\n", buffer[3]);
  printf("         red_max: %d\n", (buffer[4] << 8) | buffer[5]);
  printf("       green_max: %d\n", (buffer[6] << 8) | buffer[7]);
  printf("        blue_max: %d\n", (buffer[8] << 8) | buffer[9]);
  printf("       red_shift: %d\n", buffer[10]);
  printf("     green_shift: %d\n", buffer[11]);
  printf("      blue_shift: %d\n", buffer[12]);
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
movzbl 0x4(%rsi), %esi
leaq 0x25c8(%rip), %rdi      # 0xb4c9
xorl %eax, %eax
callq 0x4050
movzbl 0x5(%rbx), %esi
leaq 0x25cc(%rip), %rdi      # 0xb4df
xorl %eax, %eax
callq 0x4050
movzbl 0x6(%rbx), %esi
leaq 0x25d0(%rip), %rdi      # 0xb4f5
xorl %eax, %eax
callq 0x4050
movzbl 0x7(%rbx), %esi
leaq 0x25d4(%rip), %rdi      # 0xb50b
xorl %eax, %eax
callq 0x4050
movzwl 0x8(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x25d1(%rip), %rdi      # 0xb521
xorl %eax, %eax
callq 0x4050
movzwl 0xa(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x25ce(%rip), %rdi      # 0xb537
xorl %eax, %eax
callq 0x4050
movzwl 0xc(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x25cb(%rip), %rdi      # 0xb54d
xorl %eax, %eax
callq 0x4050
movzbl 0xe(%rbx), %esi
leaq 0x25cf(%rip), %rdi      # 0xb563
xorl %eax, %eax
callq 0x4050
movzbl 0xf(%rbx), %esi
leaq 0x25d3(%rip), %rdi      # 0xb579
xorl %eax, %eax
callq 0x4050
movzbl 0x10(%rbx), %esi
leaq 0x25d7(%rip), %rdi      # 0xb58f
xorl %eax, %eax
popq %rbx
jmp 0x4050
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::print_encoding(unsigned char*)
void TelevisionVNC::print_encoding(uint8_t *buffer)
{
  int *i = (int *)buffer;
  int encoding = htonl(*i);

  switch (encoding)
  {
    case 0: printf("  %d Raw\n", encoding); break;
    case 1: printf("  %d CopyRect\n", encoding); break;
    case 2: printf("  %d RRE\n", encoding); break;
    case 4: printf("  %d CoRRE\n", encoding); break;
    case 5: printf("  %d Hextile\n", encoding); break;
    case 7: printf("  %d tight\n", encoding); break;
    case 8: printf("  %d zlibhex\n", encoding); break;
    case 15: printf("  %d TRLE\n", encoding); break;
    case 16: printf("  %d ZRLE\n", encoding); break;
    case 17: printf("  %d Hitachi ZYWRLE\n", encoding); break;
    case -239: printf("  %d Cursor\n", encoding); break;
    case -223: printf("  %d DesktopSize\n", encoding); break;
    default: printf("  %d Unknown\n", encoding); break;
  }
}

// Assembly:
movl (%rsi), %esi
bswapl %esi
cmpl $0x11, %esi
ja 0x8fe7
leaq 0x2448(%rip), %rax      # 0xb418
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x25c5(%rip), %rdi      # 0xb5a5
xorl %esi, %esi
jmp 0x9074
cmpl $0xffffff11, %esi       # imm = 0xFFFFFF11
je 0x907b
cmpl $0xffffff21, %esi       # imm = 0xFFFFFF21
jne 0x9009
leaq 0x2632(%rip), %rdi      # 0xb634
movl $0xffffff21, %esi       # imm = 0xFFFFFF21
jmp 0x9074
leaq 0x2636(%rip), %rdi      # 0xb646
jmp 0x9074
leaq 0x25e3(%rip), %rdi      # 0xb5fc
pushq $0xf
jmp 0x9073
leaq 0x25e3(%rip), %rdi      # 0xb607
pushq $0x10
jmp 0x9073
leaq 0x2599(%rip), %rdi      # 0xb5c8
pushq $0x4
jmp 0x9073
leaq 0x2575(%rip), %rdi      # 0xb5af
pushq $0x1
jmp 0x9073
leaq 0x2579(%rip), %rdi      # 0xb5be
pushq $0x2
jmp 0x9073
leaq 0x2584(%rip), %rdi      # 0xb5d4
pushq $0x5
jmp 0x9073
leaq 0x2593(%rip), %rdi      # 0xb5ee
pushq $0x8
jmp 0x9073
leaq 0x257c(%rip), %rdi      # 0xb5e2
pushq $0x7
jmp 0x9073
leaq 0x25a1(%rip), %rdi      # 0xb612
pushq $0x11
popq %rsi
xorl %eax, %eax
jmp 0x4050
leaq 0x25a5(%rip), %rdi      # 0xb627
movl $0xffffff11, %esi       # imm = 0xFFFFFF11
jmp 0x9074
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionVNC.cxx
// Function: TelevisionVNC::send_color_table()
int TelevisionVNC::send_color_table()
{
  struct
  {
    uint8_t message_type;
    uint8_t padding;
    uint16_t first_colour;
    uint16_t number_of_colours;
    uint16_t table[128 * 3];
  } packet;

  memset(&packet, 0, sizeof(packet));

  if (sizeof(packet) != 768 + 6)
  {
    printf("Error: sizeof() error  %s:%d\n", __FILE__, __LINE__);
    return -1;
  }

  packet.message_type = 1;
  packet.number_of_colours = htons(128);

  for (int n = 0; n < 128; n++)
  {
    uint32_t color = ColorTable::get_color(n);
    uint16_t red = color >> 16;
    uint16_t green = (color >> 8) & 0xff;
    uint16_t blue = color & 0xff;

    int index = n * 3;
    packet.table[index + 0] = htons(red);
    packet.table[index + 1] = htons(green);
    packet.table[index + 2] = htons(blue);
  }

  if (net_send((const uint8_t *)&packet, sizeof(packet)) != sizeof(packet))
  {
    printf("Error: Send packet %s:%d\n", __FILE__, __LINE__);
    return -1;
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x310, %rsp            # imm = 0x310
movq %rdi, %rbx
leaq 0xa(%rsp), %r15
xorl %r14d, %r14d
movl $0x306, %edx            # imm = 0x306
movq %r15, %rdi
xorl %esi, %esi
callq 0x4130
movb $0x1, (%r15)
movw $0x8000, 0x4(%r15)      # imm = 0x8000
leaq 0x14(%rsp), %r15
cmpq $0x80, %r14
je 0x9124
movl %r14d, %edi
callq 0x4ae4
movl %eax, %ecx
shrl $0x10, %ecx
rolw $0x8, %cx
movw %cx, -0x4(%r15)
movl %eax, %ecx
andl $0xff00, %ecx           # imm = 0xFF00
movw %cx, -0x2(%r15)
shll $0x8, %eax
movw %ax, (%r15)
incq %r14
addq $0x6, %r15
jmp 0x90e8
addq $0x20, %rbx
leaq 0xa(%rsp), %rsi
movq %rbx, %rdi
movl $0x306, %edx            # imm = 0x306
callq 0x6d62
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x306, %ecx            # imm = 0x306
je 0x9163
leaq 0x2349(%rip), %rdi      # 0xb496
leaq 0x235c(%rip), %rsi      # 0xb4b0
movl $0x16d, %edx            # imm = 0x16D
xorl %eax, %eax
callq 0x4050
pushq $-0x1
popq %rax
addq $0x310, %rsp            # imm = 0x310
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionSDL.cxx
// Function: TelevisionSDL::TelevisionSDL()
TelevisionSDL::TelevisionSDL()
{
  SDL_Init(SDL_INIT_EVERYTHING);

  window = SDL_CreateWindow(
    "Debug",
    SDL_WINDOWPOS_UNDEFINED,
    SDL_WINDOWPOS_UNDEFINED,
    width,
    height,
    0);

  background_rect.x = 0;
  background_rect.y = 0;
  background_rect.w = width;
  background_rect.h = height;

  // NOTE: It's possible to write directly to the surface, but requires
  // SDL_LockSurface() so it seems this might be a little simpler for now.
  image = (uint32_t *)malloc(width * height * 4);

  //SDL_RenderClear(renderer);
  screen = SDL_GetWindowSurface(window);

  background_color = SDL_MapRGB(screen->format, 50, 50, 100);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x7cb4
leaq 0x5b81(%rip), %rax      # 0xed60
movq %rax, (%rbx)
movl $0xf231, %edi           # imm = 0xF231
callq 0x4190
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
leaq 0x253a(%rip), %rdi      # 0xb734
movl $0x1fff0000, %esi       # imm = 0x1FFF0000
movl $0x1fff0000, %edx       # imm = 0x1FFF0000
xorl %r9d, %r9d
callq 0x4060
movq %rax, %r14
movq %rax, 0x28(%rbx)
andq $0x0, 0x38(%rbx)
movl 0x8(%rbx), %eax
movl 0xc(%rbx), %ecx
movl %eax, 0x40(%rbx)
movl %ecx, 0x44(%rbx)
imull %ecx, %eax
shll $0x2, %eax
movslq %eax, %rdi
callq 0x42b0
movq %rax, 0x50(%rbx)
movq %r14, %rdi
callq 0x42a0
movq %rax, 0x20(%rbx)
movq 0x8(%rax), %rdi
pushq $0x32
popq %rdx
pushq $0x64
popq %rcx
movl %edx, %esi
callq 0x4110
movl %eax, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x7cd4
movq %r14, %rdi
callq 0x4370
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionSDL.cxx
// Function: TelevisionSDL::~TelevisionSDL()
TelevisionSDL::~TelevisionSDL()
{
  free(image);

  if (screen != NULL) { SDL_FreeSurface(screen); }
  if (window != NULL) { SDL_DestroyWindow(window); }

  SDL_Quit();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x5ae3(%rip), %rax      # 0xed60
movq %rax, (%rdi)
movq 0x50(%rdi), %rdi
callq 0x4260
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x9297
callq 0x41b0
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x92a5
callq 0x4030
callq 0x4070
movq %rbx, %rdi
popq %rbx
jmp 0x7cd4
movq %rax, %rdi
callq 0x7028
nop
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionSDL.cxx
// Function: TelevisionSDL::refresh()
bool TelevisionSDL::refresh()
{
  pause();

#if 0
  SDL_Rect rect;
  rect.x = 0;
  rect.y = 0;
  rect.w = width;
  rect.h = height;
#endif

  // Copy the drawn image to the screen.
  SDL_LockSurface(screen);
  memcpy(screen->pixels, image, width * height * 4);
  SDL_UnlockSurface(screen);

  SDL_UpdateWindowSurface(window);

  return true;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x83f0
movq 0x20(%rbx), %rdi
callq 0x42c0
movq 0x20(%rbx), %rax
movq 0x20(%rax), %rdi
movq 0x50(%rbx), %rsi
movl 0x8(%rbx), %eax
imull 0xc(%rbx), %eax
shll $0x2, %eax
movslq %eax, %rdx
callq 0x4170
movq 0x20(%rbx), %rdi
callq 0x4320
movq 0x28(%rbx), %rdi
callq 0x4220
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/mikeakohn[P]cloudtari/build/../src/TelevisionSDL.cxx
// Function: TelevisionSDL::handle_events()
int TelevisionSDL::handle_events()
{
  SDL_Event event;

  if (SDL_PollEvent(&event))
  {
    switch(event.type)
    {
      case SDL_KEYDOWN:
        if (event.key.keysym.sym == SDLK_ESCAPE) { return KEY_QUIT; }
        if (event.key.keysym.sym == SDLK_TAB) { return KEY_SELECT_DOWN; }
        if (event.key.keysym.sym == SDLK_RETURN) { return KEY_RESET_DOWN; }
        if (event.key.keysym.sym == SDLK_LEFT) { return KEY_LEFT_DOWN; }
        if (event.key.keysym.sym == SDLK_RIGHT) { return KEY_RIGHT_DOWN; }
        if (event.key.keysym.sym == SDLK_UP) { return KEY_UP_DOWN; }
        if (event.key.keysym.sym == SDLK_DOWN) { return KEY_DOWN_DOWN; }
        if (event.key.keysym.sym == SDLK_SPACE) { return KEY_FIRE_DOWN; }
        break;

      case SDL_KEYUP:
        if (event.key.keysym.sym == SDLK_TAB) { return KEY_SELECT_UP; }
        if (event.key.keysym.sym == SDLK_RETURN) { return KEY_RESET_UP; }
        if (event.key.keysym.sym == SDLK_LEFT) { return KEY_LEFT_UP; }
        if (event.key.keysym.sym == SDLK_RIGHT) { return KEY_RIGHT_UP; }
        if (event.key.keysym.sym == SDLK_UP) { return KEY_UP_UP; }
        if (event.key.keysym.sym == SDLK_DOWN) { return KEY_DOWN_UP; }
        if (event.key.keysym.sym == SDLK_SPACE) { return KEY_FIRE_UP; }
        break;

        break;
      case SDL_QUIT:
        return KEY_QUIT;
    }
  }

#if 0
  const Uint8 *keystate = SDL_GetKeyboardState(NULL);

  //if (keystate[SDLK_ESCAPE])
  if (keystate[SDL_SCANCODE_ESCAPE])
  {
    return -1;
  }
#endif

  return 0;
}

// Assembly:
subq $0x38, %rsp
movq %rsp, %rdi
callq 0x4150
testl %eax, %eax
je 0x939b
pushq $0x1
popq %rax
movl (%rsp), %ecx
cmpl $0x100, %ecx            # imm = 0x100
je 0x93ee
cmpl $0x301, %ecx            # imm = 0x301
je 0x9379
cmpl $0x300, %ecx            # imm = 0x300
jne 0x939b
movl 0x14(%rsp), %ecx
leal -0x4000004f(%rcx), %edx
cmpl $0x3, %edx
jbe 0x93b3
cmpl $0x20, %ecx
je 0x93db
cmpl $0xd, %ecx
je 0x93eb
cmpl $0x1b, %ecx
je 0x93ee
cmpl $0x9, %ecx
jne 0x939b
pushq $0x2
jmp 0x93ed
movl 0x14(%rsp), %eax
leal -0x4000004f(%rax), %ecx
cmpl $0x3, %ecx
jbe 0x939f
cmpl $0x9, %eax
je 0x93cf
cmpl $0x20, %eax
je 0x93c7
cmpl $0xd, %eax
jne 0x939b
pushq $0x5
jmp 0x93ed
xorl %eax, %eax
jmp 0x93ee
leaq 0x235e(%rip), %rax      # 0xb704
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x9
jmp 0x93ed
leaq 0x235a(%rip), %rax      # 0xb714
movslq (%rax,%rdx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
pushq $0x8
jmp 0x93ed
pushq $0xf
jmp 0x93ed
pushq $0xd
jmp 0x93ed
pushq $0x3
jmp 0x93ed
pushq $0xb
jmp 0x93ed
pushq $0x7
jmp 0x93ed
pushq $0xe
jmp 0x93ed
pushq $0xc
jmp 0x93ed
pushq $0xa
jmp 0x93ed
pushq $0x6
jmp 0x93ed
pushq $0x4
popq %rax
addq $0x38, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/iZhangHui[P]CppPrimer/CH18_ToolsForLargePrograms/examples/spec.cc
// Function: main
int main()
{
    try {
		cout << "f: " << std::boolalpha << noexcept(f()) << endl;
		cout << "g: " << std::boolalpha << noexcept(g()) << endl;
		cout << "h: " << std::boolalpha << noexcept(h()) << endl;
		cout << "i: " << std::boolalpha << noexcept(i()) << endl;
        f();
    } catch (exception &e) {
        cout << "caught " << e.what() << endl;
    }
	
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq 0x2d51(%rip), %rdi      # 0x3fc8
leaq 0xd86(%rip), %rsi       # 0x2004
callq 0x1080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1050
movq 0x2d1f(%rip), %rdi      # 0x3fc8
leaq 0xd58(%rip), %rsi       # 0x2008
callq 0x1080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0x10b0
movq %rax, %rdi
callq 0x1050
movq 0x2cee(%rip), %rdi      # 0x3fc8
leaq 0xd2b(%rip), %rsi       # 0x200c
callq 0x1080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x10b0
movq %rax, %rdi
callq 0x1050
movq 0x2cbc(%rip), %rdi      # 0x3fc8
leaq 0xcfd(%rip), %rsi       # 0x2010
callq 0x1080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
orl $0x1, 0x18(%rax,%rcx)
movq %rax, %rdi
xorl %esi, %esi
callq 0x10b0
movq %rax, %rdi
callq 0x1050
callq 0x121c
movq %rax, %rbx
cmpl $0x1, %edx
jne 0x1394
movq %rbx, %rdi
callq 0x1040
movq %rax, %rbx
movq 0x2c73(%rip), %rdi      # 0x3fc8
leaq 0xcb8(%rip), %rsi       # 0x2014
callq 0x1080
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq %r14, %rdi
movq %rax, %rsi
callq 0x1080
movq %rax, %rdi
callq 0x1050
callq 0x10a0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
callq 0x10a0
movq %rbx, %rdi
callq 0x10d0
movq %rax, %rdi
callq 0x13a4
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: operator<<(std::ostream&, ROAGroup)
ostream& operator<<(ostream& os, ROAGroup g)
{
  set<int>* ASes = g.getASes();

  for( set<int>::iterator i = ASes->begin(); i != ASes->end(); ++i){
    int as = *i;
    PrefixRange* r = g.getByAS( as );
    
    os<<"AS:"<<as<<"={"<<endl;
    os<<*r<<endl;
    os<<"}"<<endl;

  }
  return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x60(%rsi), %r13
leaq 0x50(%rsi), %rbp
cmpq %rbp, %r13
je 0x273c
movl 0x20(%r13), %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x3a34
movq %rax, %r12
movq %rbx, %rdi
leaq 0x492c(%rip), %rsi      # 0x700a
callq 0x2230
movq %rax, %rdi
movl %r15d, %esi
callq 0x2340
movq %rax, %rdi
leaq 0x492c(%rip), %rsi      # 0x7024
callq 0x2230
movq %rax, %rdi
callq 0x2100
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2564
movq %rbx, %rdi
callq 0x2100
movq %rbx, %rdi
leaq 0x4900(%rip), %rsi      # 0x7022
callq 0x2230
movq %rax, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x2290
movq %rax, %r13
jmp 0x26bd
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: operator<<(std::ostream&, UnknownToInvalidDowngrade)
ostream& operator<<(ostream& os, UnknownToInvalidDowngrade g) //LEOCOM: should be a const &, but I can do that until I fix replace range
{

  for(unordered_map<int,PrefixRange*>::iterator i = g.getExceptions()->begin(); i != g.getExceptions()->end(); ++i){
    int as = i->first;
    PrefixRange* exception =  i->second;

    os<<"[";
      os<<"R:{";
        os<<"AS:"<<g.getROA()->getAS();
        os<<",";
        os<<"Prefix:"<<g.getROA()->getPrefix()<<"-"<<g.getROA()->getMaxlen();
      os<<"},";
      os<<"R.UnknownToKnown:{";
        os<<*g.getUnknownToKnown(); 
      os<<"},";
      os<<"Except:{";
        os<<"AS:"<<as;
      os<<",";
        os<<"Prefix:"<<*exception;
      os<<"}";
    os<<"]";
    os<<endl;
  }
  return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x58(%rsi), %r15
leaq 0x30(%rsi), %rax
movq %rax, (%rsp)
movq (%r15), %r15
testq %r15, %r15
je 0x28c7
movl 0x8(%r15), %r12d
movq 0x10(%r15), %rax
movq %rax, 0x8(%rsp)
movq %rbx, %rdi
leaq 0x4896(%rip), %rsi      # 0x7027
callq 0x2230
movq %rbx, %rdi
leaq 0x4889(%rip), %rsi      # 0x7029
callq 0x2230
movq %rbx, %rdi
leaq 0x485b(%rip), %rsi      # 0x700a
callq 0x2230
movl 0xc(%r14), %esi
movq %rax, %rdi
callq 0x2340
movq %rbx, %rdi
leaq 0x4864(%rip), %rbp      # 0x702e
movq %rbp, %rsi
callq 0x2230
movq %rbx, %rdi
leaq 0x4834(%rip), %rsi      # 0x7010
callq 0x2230
movq %rax, %r13
movq (%r14), %rax
movq %rax, 0x10(%rsp)
movq %r13, %rdi
leaq 0x10(%rsp), %rsi
callq 0x2527
movq %r13, %rdi
leaq 0x4815(%rip), %rsi      # 0x7018
callq 0x2230
movl 0x8(%r14), %esi
movq %rax, %rdi
callq 0x2340
movq %rbx, %rdi
leaq 0x480f(%rip), %r13      # 0x702d
movq %r13, %rsi
callq 0x2230
movq %rbx, %rdi
leaq 0x4800(%rip), %rsi      # 0x7030
callq 0x2230
movq %rbx, %rdi
movq (%rsp), %rsi
callq 0x2564
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2230
movq %rbx, %rdi
leaq 0x47ed(%rip), %rsi      # 0x7043
callq 0x2230
movq %rbx, %rdi
leaq 0x47a5(%rip), %rsi      # 0x700a
callq 0x2230
movq %rax, %rdi
movl %r12d, %esi
callq 0x2340
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2230
movq %rbx, %rdi
leaq 0x4786(%rip), %rsi      # 0x7010
callq 0x2230
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x2564
movq %rbx, %rdi
leaq 0x477c(%rip), %rsi      # 0x7022
callq 0x2230
movq %rbx, %rdi
leaq 0x499a(%rip), %rsi      # 0x724f
callq 0x2230
movq %rbx, %rdi
callq 0x2100
jmp 0x276e
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: ValidToInvalid(ROAGroup*, PrefixRange*, int)
void ValidToInvalid( ROAGroup* newPrefixes, PrefixRange* rOld, int as){
  bool argDense = false;  // most likely, known has many entries and the intersections have few entries

  PrefixRange noLongerValid =  PrefixRange(); 

  if( newPrefixes->hasAS( as ) ) { 

    // ( R.valid -  new.AS.Valid)
    PrefixRange* newASValid = newPrefixes->getByAS(as);
    PrefixRange newASUnknownOrInvalid = newASValid->complement();
    rOld->denseIntersectWith( newASUnknownOrInvalid, argDense); // LEOCOM: would it be more efficent to do a subtraction, ETHANCOM: unfortunately substraction only applies to IPPrefixes which don't have MaxLen

  } // if new.AS.valid doesn't exist then ( R.valid -  new.AS.valid) = (R.valid) and we can skip ahead

  // subtracting new.unknown is the same as intersecting with new.known
  rOld->denseIntersectWith( *(newPrefixes->getKnown()), argDense);
  
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x30, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x18(%rsp), %rdi
callq 0x3b0e
movq %r14, %rdi
movl %ebp, %esi
callq 0x3b1c
testb %al, %al
je 0x2942
movq %r14, %rdi
movl %ebp, %esi
callq 0x3a34
movq %rsp, %rdi
movq %rax, %rsi
callq 0x3b34
movq %rsp, %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3a9a
movq %rsp, %rdi
callq 0x3bf6
movq 0x38(%r14), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3a9a
leaq 0x18(%rsp), %rdi
callq 0x3bf6
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3bf6
jmp 0x2977
jmp 0x2974
jmp 0x2974
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x3bf6
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: NotValidToValid(ROAGroup, ROAGroup, std::unordered_map<int, PrefixRange*, std::hash<int>, std::equal_to<int>, std::allocator<std::pair<int const, PrefixRange*>>>*)
void NotValidToValid(ROAGroup newPrefixes, ROAGroup oldPrefixes, unordered_map<int, PrefixRange*>* notValidToValidPrefixes){ 
  set<int>* ASes = newPrefixes.getASes();

  for( set<int>::iterator i = ASes->begin(); i != ASes->end(); ++i) {
    int as = *i;

    PrefixRange* rPrimeValid = newPrefixes.getByAS(as); 

    PrefixRange empty = PrefixRange();

    PrefixRange* oldValid = &empty; 

    // If oldPrefixes has the as we are working on then set it
    if ( oldPrefixes.hasAS(as) ) oldValid = oldPrefixes.getByAS(as); 

    rPrimeValid->denseIntersectWith( oldValid->complement() , true);

    if ( ! rPrimeValid->empty() ) notValidToValidPrefixes->insert( make_pair(as, new PrefixRange( *rPrimeValid ) ) );
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, 0x8(%rsp)
movq 0x60(%rdi), %r13
movq %rdi, 0x18(%rsp)
leaq 0x50(%rdi), %rax
movq %rax, 0x20(%rsp)
leaq 0x40(%rsp), %r12
leaq 0x28(%rsp), %rbp
cmpq 0x20(%rsp), %r13
je 0x2a75
movl 0x20(%r13), %ebx
movq 0x18(%rsp), %rdi
movl %ebx, %esi
callq 0x3a34
movq %rax, %r15
movq %r12, %rdi
callq 0x3b0e
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x3b1c
movl %eax, %ecx
movq %r12, %rax
testb %cl, %cl
je 0x2a04
movq 0x8(%rsp), %rdi
movl %ebx, %esi
callq 0x3a34
movq %rbp, %rdi
movq %rax, %rsi
callq 0x3b34
movq %r15, %rdi
movq %rbp, %rsi
pushq $0x1
popq %rdx
callq 0x3a9a
movq %rbp, %rdi
callq 0x3bf6
movq %r15, %rdi
callq 0x3c52
testb %al, %al
jne 0x2a5d
pushq $0x18
popq %rdi
callq 0x2240
movq %rax, %r14
movq %rax, %rdi
movq %r15, %rsi
callq 0x3c86
movl %ebx, 0x28(%rsp)
movq %r14, 0x30(%rsp)
movq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x6380
movq %r12, %rdi
callq 0x3bf6
movq %r13, %rdi
callq 0x2290
movq %rax, %r13
jmp 0x29bd
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
pushq $0x18
popq %rsi
movq %r14, %rdi
callq 0x2250
jmp 0x2aaa
jmp 0x2aa7
jmp 0x2aa7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3bf6
jmp 0x2aaa
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x3bf6
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: UnknownToKnown(PrefixRange const*, ROA, PrefixRange*)
void UnknownToKnown(const PrefixRange* oldUnknown, ROA rNew, PrefixRange* unknownToKnown){
  bool argDense = true;
  assert(unknownToKnown->empty());

  unknownToKnown->addROA( rNew.getPrefix(), IPAddr::numBits);

  // unknownToKnown =  R.known INTERSECTS old
  unknownToKnown->denseIntersectWith( *oldUnknown, argDense);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq %rdx, %rdi
callq 0x3c52
testb %al, %al
je 0x2b08
movq (%r15), %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
pushq $0x20
popq %rdx
movq %rbx, %rdi
callq 0x3d6c
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a9a
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x453d(%rip), %rdi      # 0x704c
leaq 0x454e(%rip), %rsi      # 0x7064
leaq 0x4551(%rip), %rcx      # 0x706e
movl $0x380, %edx            # imm = 0x380
callq 0x2170
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/cli.cpp
// Function: main
int main(int argc, char* argv[]){

	bool U2I = false;

	if (argc == 5 ){ 
		if( string(argv[1]) == "-U2I" ){
			U2I = true;
		} else{
			cout<<"detector <old file> <new file> <outputfile>"<<endl; return 0; 
		}	
	} else if (argc != 4){ cout<<"detector <old file> <new file> <outputfile>"<<endl; return 0; }

	string oldFilepath = string(argv[1]);
	string newFilepath = string(argv[2]);
	string outputFilepath = string(argv[3]);

	vector<ROA*> oldROAs;
	vector<ROA*> newROAs;

	int success = readScanROAFile(&oldROAs, &oldFilepath);
	if (!success) { return 1; cout<<"Failed to load old roas :"<<oldFilepath<<endl;}

	success = readScanROAFile(&newROAs, &newFilepath);
	if (!success) { return 1; cout<<"Failed to load new roas :"<<newFilepath<<endl;}
	
	ofstream outputFile(outputFilepath.c_str());

	OutputDowngrades(&oldROAs, &newROAs, &outputFile, U2I);

	cout<<"finished sucessfully"<<endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x298, %rsp            # imm = 0x298
movq %rsi, %r14
movl %edi, %ebx
cmpl $0x5, %edi
jne 0x380b
movq 0x8(%r14), %rsi
leaq 0x98(%rsp), %r15
leaq 0x38(%rsp), %rdx
movq %r15, %rdi
callq 0x47b4
leaq 0x395d(%rip), %rsi      # 0x712f
movq %r15, %rdi
callq 0x483b
movl %eax, %ebp
movq %r15, %rdi
callq 0x20e0
testb %bpl, %bpl
jne 0x3810
movq 0x87e8(%rip), %rdi      # 0xbfd8
leaq 0x393d(%rip), %rsi      # 0x7134
callq 0x2230
movq %rax, %rdi
callq 0x2100
xorl %ebp, %ebp
jmp 0x391a
cmpl $0x4, %ebx
jne 0x37e9
movq 0x8(%r14), %rsi
leaq 0x38(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x47b4
movq 0x10(%r14), %rsi
leaq 0x78(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x47b4
movq 0x18(%r14), %rsi
leaq 0x58(%rsp), %rdi
leaq 0x98(%rsp), %rdx
callq 0x47b4
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
andq $0x0, 0x10(%rdi)
movaps %xmm0, (%rsp)
andq $0x0, 0x10(%rsp)
leaq 0x38(%rsp), %rsi
callq 0x33c5
pushq $0x1
popq %rbp
testl %eax, %eax
je 0x38ea
movq %rsp, %rdi
leaq 0x78(%rsp), %rsi
callq 0x33c5
testl %eax, %eax
je 0x38ea
movq 0x58(%rsp), %rsi
leaq 0x98(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x2270
xorl %ecx, %ecx
cmpl $0x5, %ebx
sete %cl
leaq 0x20(%rsp), %rdi
movq %rsp, %rsi
leaq 0x98(%rsp), %rdx
callq 0x2f87
movq 0x8711(%rip), %rdi      # 0xbfd8
leaq 0x3892(%rip), %rsi      # 0x7160
callq 0x2230
movq %rax, %rdi
callq 0x2100
leaq 0x98(%rsp), %rdi
callq 0x22e0
xorl %ebp, %ebp
movq %rsp, %rdi
callq 0x6612
leaq 0x20(%rsp), %rdi
callq 0x6612
leaq 0x58(%rsp), %rdi
callq 0x20e0
leaq 0x78(%rsp), %rdi
callq 0x20e0
leaq 0x38(%rsp), %rdi
callq 0x20e0
movl %ebp, %eax
addq $0x298, %rsp            # imm = 0x298
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3948
movq %rax, %rbx
jmp 0x3967
movq %rax, %rbx
jmp 0x3971
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x22e0
jmp 0x394b
movq %rax, %rbx
movq %rsp, %rdi
callq 0x6612
leaq 0x20(%rsp), %rdi
callq 0x6612
leaq 0x58(%rsp), %rdi
callq 0x20e0
leaq 0x78(%rsp), %rdi
callq 0x20e0
leaq 0x38(%rsp), %rdi
callq 0x20e0
movq %rbx, %rdi
callq 0x2350
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: std::ostream& operator<<<IPAddr>(std::ostream&, IntervalList<IPAddr> const&)
ostream& operator<< (ostream& os, const IntervalList<T> & l)
{
  typename map<T, T>::const_iterator it = l.m.begin();
  if (it==l.m.end()) {
    os << "empty ";
  }
  while (it!=l.m.end()) {
    os << "["<<it->first<<"-" << it->second<<"] ";
    ++it;
  }
  return os;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rsi), %r15
addq $0x8, %r14
cmpq %r14, %r15
jne 0x39b0
leaq 0x39a5(%rip), %rsi      # 0x734d
movq %rbx, %rdi
callq 0x2230
movq %rsp, %r12
leaq 0x399a(%rip), %r13      # 0x7354
cmpq %r14, %r15
je 0x3a22
movq %rbx, %rdi
leaq 0x365e(%rip), %rsi      # 0x7027
callq 0x2230
movq %rax, %rbp
movl 0x20(%r15), %eax
movl %eax, 0x4(%rsp)
movq %rbp, %rdi
leaq 0x4(%rsp), %rsi
callq 0x24bc
movq %rbp, %rdi
leaq 0x3628(%rip), %rsi      # 0x7018
callq 0x2230
movq %rax, %rbp
movl 0x24(%r15), %eax
movl %eax, (%rsp)
movq %rbp, %rdi
movq %r12, %rsi
callq 0x24bc
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2230
movq %r15, %rdi
callq 0x2290
movq %rax, %r15
jmp 0x39ba
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: PrefixRange::complement()
PrefixRange complement() {
    PrefixRange ret(bound, endLength);

    for (int i = bound.getLength(); i<=endLength; i++) { 
      lists[i-bound.getLength()].subtractFromInterval(bound.getPrefix(), bound.endAddress(i), ret.lists[i-bound.getLength()]);
    }
    return ret;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
leaq 0x8(%rsi), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rsi), %rax
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movl 0x10(%r14), %edx
movq %rdi, (%rsp)
callq 0x42f0
movslq 0xc(%r14), %r12
imulq $0x38, %r12, %rbx
leaq 0x1c(%rsp), %r13
cmpl 0x10(%r14), %r12d
jg 0x3bce
movq (%r14), %rbp
movslq 0xc(%r14), %r15
movl 0x8(%r14), %eax
movl %eax, 0xc(%rsp)
movq %r13, %rdi
movq 0x10(%rsp), %rsi
movl %r12d, %edx
callq 0x523c
imulq $-0x38, %r15, %rax
addq %rbx, %rbp
addq %rax, %rbp
movslq 0xc(%r14), %rax
imulq $-0x38, %rax, %rcx
movq (%rsp), %rax
addq (%rax), %rcx
addq %rbx, %rcx
movq %rbp, %rdi
leaq 0xc(%rsp), %rsi
movq %r13, %rdx
callq 0x50d0
incl %r12d
addq $0x38, %rbx
jmp 0x3b74
movq (%rsp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq (%rsp), %rdi
callq 0x3bf6
movq %r14, %rdi
callq 0x2350
nop
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: PrefixRange::empty()
bool empty () {
    for (int i = 0; i<len; i++)
      if (!lists[i].empty())
        return false;
    return true;
  }

// Assembly:
movslq 0x14(%rdi), %rax
movq (%rdi), %rcx
xorl %esi, %esi
testl %eax, %eax
movl $0x0, %edx
cmovgl %eax, %edx
addq $0x28, %rcx
movq %rsi, %rdi
cmpq %rsi, %rdx
je 0x3c7f
leaq 0x1(%rdi), %rsi
cmpq $0x0, (%rcx)
leaq 0x38(%rcx), %rcx
je 0x3c69
cmpq %rax, %rdi
setge %al
retq
// File: /workspace/github_cpp_makefile_star2_O2/BUSEC[P]RPKI_Downgrade_Detector/./exp.cpp
// Function: PrefixRange::PrefixRange(PrefixRange const&)
PrefixRange( const PrefixRange& original ) : bound(original.bound), endLength(original.endLength), len(original.len) {
    
    //copy everything in lists
    lists = new IntervalList<IPAddr>[len]; 
     for (int i = 0; i<len; i++){
       IntervalList<IPAddr> list = IntervalList<IPAddr>( original.lists[i] );
       lists[i] = list;
    }
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %rbx
movl 0x14(%rsi), %ebp
movslq %ebp, %r15
pushq $0x38
popq %rcx
movq %r15, %rax
mulq %rcx
movq %rdi, %r14
seto %cl
addq $0x8, %rax
pushq $-0x1
popq %rdi
cmovbq %rdi, %rax
movups 0x8(%rsi), %xmm0
movups %xmm0, 0x8(%r14)
testb %cl, %cl
cmoveq %rax, %rdi
callq 0x2030
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
testl %r15d, %r15d
je 0x3d05
addq $0x10, %rax
imulq $0x38, %r15, %rdx
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
movl $0x1, 0x28(%rax)
addq $0x38, %rax
addq $-0x38, %rdx
jne 0x3cdf
movq %rcx, (%r14)
xorl %r12d, %r12d
movq %rsp, %r15
xorl %r13d, %r13d
movslq %ebp, %rax
cmpq %rax, %r13
jge 0x3d4a
movq (%rbx), %rsi
addq %r12, %rsi
movq %r15, %rdi
callq 0x52f8
movq (%r14), %rdi
addq %r12, %rdi
movq %r15, %rsi
callq 0x5316
movq %r15, %rdi
callq 0x5040
incq %r13
movl 0x14(%r14), %ebp
addq $0x38, %r12
jmp 0x3d11
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5040
movq %rbx, %rdi
callq 0x2350