LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/Network.cxx
// Function: Network::net_recv(unsigned char*, int, bool)
int Network::net_recv(uint8_t *buffer, int length, bool wait_for_full_buffer)
{
  struct timeval tv;
  fd_set readset;
  int empty_count = 0;

  int bytes_received = 0;

  while (bytes_received < length)
  {
    FD_ZERO(&readset);
    FD_SET(client, &readset);

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

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

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

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

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

    if (!FD_ISSET(client, &readset)) { continue; }

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

    bytes_received += n;

    if (bytes_received == 0)
    {
      empty_count++;

      if (empty_count == 1) { continue; }
    }

    if (!wait_for_full_buffer) { break; }
  }

  return bytes_received;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %ecx, 0xc(%rsp)
testl %edx, %edx
jle 0x7488
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
xorl %ebx, %ebx
leaq 0x20(%rsp), %r13
leaq 0x10(%rsp), %rbp
movl $0x0, 0x8(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x90(%rsp)
movaps %xmm0, 0x80(%rsp)
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movl 0x4(%r12), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %edx
andl $-0x40, %edx
movl %edi, %ecx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
sarl $0x6, %eax
cltq
orq %rdx, 0x20(%rsp,%rax,8)
movq $0xa, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
incl %edi
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %rbp, %r8
callq 0x41b0
cmpl $-0x1, %eax
je 0x7467
testl %eax, %eax
je 0x748c
movl 0x4(%r12), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
sarl $0x6, %eax
cltq
movq 0x20(%rsp,%rax,8), %rax
btq %rdi, %rax
jae 0x7471
movl %ebx, %esi
addq %r15, %rsi
movl %r14d, %eax
subl %ebx, %eax
movslq %eax, %rdx
xorl %ecx, %ecx
callq 0x40d0
testl %eax, %eax
js 0x7493
addl %eax, %ebx
jne 0x745e
movl 0x8(%rsp), %eax
testl %eax, %eax
je 0x747c
incl %eax
movl %eax, 0x8(%rsp)
cmpb $0x0, 0xc(%rsp)
jne 0x7471
jmp 0x7498
callq 0x4040
cmpl $0x4, (%rax)
jne 0x74ac
cmpl %r14d, %ebx
jl 0x7392
jmp 0x7498
xorl %ebx, %ebx
movl $0x1, 0x8(%rsp)
jmp 0x7471
xorl %ebx, %ebx
jmp 0x7498
movl $0xfffffffd, %ebx       # imm = 0xFFFFFFFD
jmp 0x7498
movl $0xfffffffc, %ebx       # imm = 0xFFFFFFFC
movl %ebx, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x44fd(%rip), %rdi      # 0xb9b0
callq 0x4160
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7498
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/Network.cxx
// Function: Network::net_has_data()
bool Network::net_has_data()
{
  struct timeval tv;
  fd_set readset;

  FD_ZERO(&readset);
  FD_SET(client, &readset);

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

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

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

    perror("Problem with select in Network");
    net_close();
    return false;
  }

  return FD_ISSET(client, &readset);
}

// Assembly:
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, 0x70(%rsi)
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, (%rsi)
movl 0x4(%rdi), %edi
leal 0x3f(%rdi), %eax
testl %edi, %edi
cmovnsl %edi, %eax
movl %eax, %edx
andl $-0x40, %edx
movl %edi, %ecx
subl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
sarl $0x6, %eax
cltq
orq %rdx, 0x10(%rsp,%rax,8)
incl %edi
movq %rsp, %r8
movaps %xmm0, (%r8)
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x41b0
cmpl $-0x1, %eax
je 0x754e
movl 0x4(%rbx), %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
sarl $0x6, %ecx
movslq %ecx, %rcx
movq 0x10(%rsp,%rcx,8), %rcx
btq %rax, %rcx
setb %al
jmp 0x755a
callq 0x4040
cmpl $0x4, (%rax)
jne 0x7563
xorl %eax, %eax
addq $0x90, %rsp
popq %rbx
retq
leaq 0x4466(%rip), %rdi      # 0xb9d0
callq 0x4160
movq %rbx, %rdi
callq 0x7150
jmp 0x7558
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/RIOT.cxx
// Function: RIOT::clock(int)
void RIOT::clock(int ticks)
{
  while (ticks > 0)
  {
    interrupt_timer--;

    if (interrupt_timer == 0)
    {
      prescale_shift = 0;
    }

    ticks--;
  }

  riot[4] = (interrupt_timer >> prescale_shift) & 0xff;
}

// Assembly:
testl %esi, %esi
jle 0x7767
movl 0x34(%rdi), %eax
leal 0x3(%rsi), %ecx
andl $-0x4, %ecx
leal -0x1(%rsi), %edx
movd %eax, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
paddd 0x4379(%rip), %xmm0     # 0xba50
movd %edx, %xmm1
pshufd $0x0, %xmm1, %xmm1      # xmm1 = xmm1[0,0,0,0]
xorl %edx, %edx
movdqa 0x4376(%rip), %xmm2     # 0xba60
movdqa 0x3d7e(%rip), %xmm3     # 0xb470
pxor %xmm3, %xmm1
movdqa 0x4372(%rip), %xmm4     # 0xba70
movdqa 0x437a(%rip), %xmm5     # 0xba80
movd %edx, %xmm6
pshufd $0x0, %xmm6, %xmm6      # xmm6 = xmm6[0,0,0,0]
por %xmm2, %xmm6
pxor %xmm3, %xmm6
pcmpgtd %xmm1, %xmm6
movdqa %xmm0, %xmm7
pcmpeqd %xmm4, %xmm7
pandn %xmm7, %xmm6
pshufd $0x50, %xmm6, %xmm7     # xmm7 = xmm6[0,0,1,1]
movmskpd %xmm7, %r8d
testl %r8d, %r8d
setne %r8b
movdqa %xmm6, -0x18(%rsp)
orb -0x10(%rsp), %r8b
orb -0xc(%rsp), %r8b
testb $0x1, %r8b
je 0x7755
movl $0x0, 0x30(%rdi)
addl $0x4, %edx
paddd %xmm5, %xmm0
cmpl %edx, %ecx
jne 0x7706
subl %esi, %eax
movl %eax, 0x34(%rdi)
jmp 0x776a
movl 0x34(%rdi), %eax
movb 0x30(%rdi), %cl
sarl %cl, %eax
movb %al, 0x3c(%rdi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/ROM.cxx
// Function: ROM::load(char const*)
int ROM::load(const char *filename)
{
  struct stat statbuf;
  memset(&statbuf, 0, sizeof(statbuf));
  stat(filename, &statbuf);

  const int file_size = statbuf.st_size;

  if (file_size != 2048 &&
      file_size != 4096 &&
      file_size != 8192)
  {
    printf("Error: ROM size is not 2048, 4096, 8192 (%d)\n", file_size);
    return -1;
  }

  FILE *in = fopen(filename, "rb");

  if (in == NULL)
  {
    printf("Error: Couldn't open file %s\n", filename);
    return -1;
  }

  size = fread(full, 1, statbuf.st_size, in);
  fclose(in);

  if (size != statbuf.st_size)
  {
    printf("Error: Could not load ROM %d/%d\n", size, file_size);
    return -2;
  }

  if (size == 2048)
  {
    memcpy(memory +    0, full, 2048);
    memcpy(memory + 2048, full, 2048);
  }
    else
  {
    memcpy(memory, full, 4096);
  }

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x4110
movq %r15, %rdi
movq %r14, %rsi
callq 0x4180
movq 0x30(%r14), %r14
cmpl $0x800, %r14d           # imm = 0x800
je 0x77e2
cmpl $0x1000, %r14d          # imm = 0x1000
je 0x77e2
cmpl $0x2000, %r14d          # imm = 0x2000
jne 0x7866
leaq 0x3ada(%rip), %rsi      # 0xb2c3
movq %r15, %rdi
callq 0x4230
testq %rax, %rax
je 0x7853
movq %rax, %r12
leaq 0x1000(%rbx), %r15
movl $0x1, %esi
movq %r15, %rdi
movq %r14, %rdx
movq %rax, %rcx
callq 0x4300
movl %eax, 0x3000(%rbx)
movq %r12, %rdi
callq 0x41c0
movslq 0x3000(%rbx), %rsi
cmpq %rsi, %r14
jne 0x787e
cmpl $0x800, %esi            # imm = 0x800
jne 0x7896
movl $0x800, %edx            # imm = 0x800
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4150
addq $0x800, %rbx            # imm = 0x800
movl $0x800, %edx            # imm = 0x800
jmp 0x789b
leaq 0x4274(%rip), %rdi      # 0xbace
movq %r15, %rsi
xorl %eax, %eax
callq 0x4050
jmp 0x7877
leaq 0x4233(%rip), %rdi      # 0xbaa0
movl %r14d, %esi
xorl %eax, %eax
callq 0x4050
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x78a8
leaq 0x4267(%rip), %rdi      # 0xbaec
movl %r14d, %edx
xorl %eax, %eax
callq 0x4050
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x78a8
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
movq %r15, %rsi
callq 0x4150
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/TIA.cxx
// Function: TIA::build_playfield()
void TIA::build_playfield()
{
  playfield.data =
    ((write_regs[PF0] >> 4) & 0x0f) |
     (reverse[write_regs[PF1]] << 4) |
     (write_regs[PF2] << 12);

  if ((write_regs[CTRLPF] & 1) == 0)
  {
    // Non-mirroed playfield
    playfield.data |= playfield.data << 20;
  }
    else
  {
    // Mirrored playfield.
    playfield.data |=
      (((uint64_t)reverse[write_regs[PF0]] & 0x0f) << 36) |
       ((uint64_t)write_regs[PF1] << 28) |
       ((uint64_t)reverse[write_regs[PF2]] << 20);
  }
}

// Assembly:
movzbl 0x8d(%rdi), %edx
movl %edx, %eax
shrl $0x4, %eax
movzbl 0x8e(%rdi), %ecx
movzbl 0xd0(%rdi,%rcx), %r8d
shll $0x4, %r8d
orl %eax, %r8d
movzbl 0x8f(%rdi), %esi
movl %esi, %eax
shll $0xc, %eax
orl %r8d, %eax
testb $0x1, 0x8a(%rdi)
jne 0x7fe0
movq %rax, %rdx
shlq $0x14, %rdx
jmp 0x8004
movzbl 0xd0(%rdi,%rdx), %edx
andl $0xf, %edx
shlq $0x24, %rdx
shlq $0x1c, %rcx
orq %rdx, %rcx
movzbl 0xd0(%rdi,%rsi), %edx
shll $0x14, %edx
orq %rcx, %rdx
orq %rax, %rdx
movq %rdx, 0x20(%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/TIA.cxx
// Function: TIA::draw_pixel()
void TIA::draw_pixel()
{
  uint8_t color = write_regs[COLUBK];

  if ((write_regs[CTRLPF] & 4) == 0)
  {
    // Sprites have priority.
    do
    {
      if (player_0.is_pixel_on())  { color = write_regs[COLUP0]; break; }
      if (missile_0.is_pixel_on()) { color = write_regs[COLUP0]; break; }
      if (player_1.is_pixel_on())  { color = write_regs[COLUP1]; break; }
      if (missile_1.is_pixel_on()) { color = write_regs[COLUP1]; break; }
      if (playfield.is_pixel_on()) { color = write_regs[COLUPF]; break; }
      if (ball.is_pixel_on())      { color = write_regs[COLUPF]; break; }
    } while (false);
  }
    else
  {
    // Playfield has priority.
    do
    {
      if (playfield.is_pixel_on()) { color = write_regs[COLUPF]; break; }
      if (ball.is_pixel_on())      { color = write_regs[COLUPF]; break; }
      if (player_0.is_pixel_on())  { color = write_regs[COLUP0]; break; }
      if (missile_0.is_pixel_on()) { color = write_regs[COLUP0]; break; }
      if (player_1.is_pixel_on())  { color = write_regs[COLUP1]; break; }
      if (missile_1.is_pixel_on()) { color = write_regs[COLUP1]; break; }
    } while (false);
  }

  set_pixel(get_x(), get_y(), color);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movb 0x89(%rdi), %al
testb $0x4, 0x8a(%rdi)
jne 0x81fa
cmpb $0x1, 0x34(%rbx)
je 0x821e
cmpb $0x1, 0x5b(%rbx)
je 0x821e
cmpb $0x1, 0x48(%rbx)
je 0x82e1
cmpb $0x1, 0x67(%rbx)
je 0x82e1
cmpb $0x1, 0x18(%rbx)
je 0x8206
cmpb $0x1, 0x73(%rbx)
je 0x8206
jmp 0x8224
cmpb $0x1, 0x18(%rbx)
je 0x8206
cmpb $0x1, 0x73(%rbx)
jne 0x820e
movb 0x88(%rbx), %al
jmp 0x8224
cmpb $0x1, 0x34(%rbx)
je 0x821e
cmpb $0x1, 0x5b(%rbx)
jne 0x82d1
movb 0x86(%rbx), %al
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %edx
leal (%rcx,%rcx,2), %ecx
leal -0x50(,%rdx,2), %edx
movq (%rbx), %rsi
movl 0x8(%rsi), %ebp
imull %ebp, %edx
leal (%rdx,%rcx), %r14d
addl $0xffffff34, %r14d      # imm = 0xFFFFFF34
cmpl $0x8, 0x1e0(%rbx)
jne 0x829e
shrb %al
movq 0x1d8(%rbx), %rcx
movslq %r14d, %rdx
movb %al, (%rcx,%rdx)
movq 0x1d8(%rbx), %rcx
movb %al, 0x1(%rcx,%rdx)
movq 0x1d8(%rbx), %rcx
movb %al, 0x2(%rcx,%rdx)
addl %r14d, %ebp
movq 0x1d8(%rbx), %rcx
movslq %ebp, %rdx
movb %al, (%rcx,%rdx)
movq 0x1d8(%rbx), %rcx
movb %al, 0x1(%rcx,%rdx)
movq 0x1d8(%rbx), %rcx
movb %al, 0x2(%rcx,%rdx)
jmp 0x82cc
movzbl %al, %edi
callq 0x4ae0
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
cmpb $0x1, 0x48(%rbx)
je 0x82e1
cmpb $0x1, 0x67(%rbx)
jne 0x8224
movb 0x87(%rbx), %al
jmp 0x8224
// File: /workspace/github_cpp_makefile_star2_O3/mikeakohn[P]cloudtari/build/../src/TIA.cxx
// Function: TIA::clock(int)
void TIA::clock(int ticks)
{
  // Every CPU cycle is 3 pixels.
  ticks = ticks * 3;

  while (ticks > 0)
  {
    clock();
    ticks--;
  }

  // For some reason (according to some forum) the TIA delays setting the
  // X position for player sprites by 5 TIA clocks and ball / missile by 4.
  if (player_0.need_set_position())  { player_0.set_position(pos_x + 5); }
  if (player_1.need_set_position())  { player_1.set_position(pos_x + 5); }
  if (missile_0.need_set_position()) { missile_0.set_position(pos_x + 4); }
  if (missile_1.need_set_position()) { missile_1.set_position(pos_x + 4); }
  if (ball.need_set_position())      { ball.set_position(pos_x + 4); }

  if (hsync_latch)
  {
    write_regs[WSYNC] = 1;
    hsync_latch = false;
  }
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
jle 0x83ec
leal (%rsi,%rsi,2), %ebp
incl %ebp
movq %rbx, %rdi
callq 0x800c
decl %ebp
cmpl $0x1, %ebp
ja 0x83dd
cmpb $0x1, 0x31(%rbx)
jne 0x83ff
movl 0x8(%rbx), %eax
addl $0x5, %eax
movl %eax, 0x3c(%rbx)
movb $0x0, 0x31(%rbx)
cmpb $0x1, 0x45(%rbx)
jne 0x8412
movl 0x8(%rbx), %eax
addl $0x5, %eax
movl %eax, 0x50(%rbx)
movb $0x0, 0x45(%rbx)
cmpb $0x1, 0x59(%rbx)
jne 0x8425
movl 0x8(%rbx), %eax
addl $0x4, %eax
movl %eax, 0x5c(%rbx)
movb $0x0, 0x59(%rbx)
cmpb $0x1, 0x65(%rbx)
jne 0x8438
movl 0x8(%rbx), %eax
addl $0x4, %eax
movl %eax, 0x68(%rbx)
movb $0x0, 0x65(%rbx)
cmpb $0x1, 0x71(%rbx)
jne 0x844b
movl 0x8(%rbx), %eax
addl $0x4, %eax
movl %eax, 0x74(%rbx)
movb $0x0, 0x71(%rbx)
cmpb $0x1, 0x10(%rbx)
jne 0x845c
movb $0x1, 0x82(%rbx)
movb $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x3867(%rip), %rax      # 0xbce6
leaq 0x385d(%rip), %rcx      # 0xbce3
cmoveq %rax, %rcx
leaq 0x3827(%rip), %rdi      # 0xbcb8
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x4050
leaq 0x3848(%rip), %rdi      # 0xbcea
xorl %eax, %eax
callq 0x4050
movq 0x20(%rbx), %rax
xorl %ecx, %ecx
btq %r14, %rax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42b0
incq %r14
cmpq $0x28, %r14
jne 0x84a9
movl $0xa, %edi
callq 0x42b0
leaq 0x381a(%rip), %rdi      # 0xbcf6
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4050
movzbl 0x30(%rbx), %eax
xorl %ecx, %ecx
btl %ebp, %eax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42b0
incl %ebp
cmpl $0x8, %ebp
jne 0x84e5
movl 0x3c(%rbx), %esi
movl 0x40(%rbx), %edx
leaq 0x37f0(%rip), %rdi      # 0xbd01
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x4050
leaq 0x37f1(%rip), %rdi      # 0xbd12
xorl %eax, %eax
callq 0x4050
movzbl 0x44(%rbx), %eax
xorl %ecx, %ecx
btl %ebp, %eax
setae %cl
leal 0x2a(,%rcx,4), %edi
callq 0x42b0
incl %ebp
cmpl $0x8, %ebp
jne 0x8528
movl 0x50(%rbx), %esi
movl 0x54(%rbx), %edx
leaq 0x37ad(%rip), %rdi      # 0xbd01
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x4050
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8560
leaq 0x20(%rbx), %r14
movq %r14, %rdi
callq 0x7130
leaq 0x762d(%rip), %rax      # 0xfbd8
movq %rax, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x150(%rbx)
movups %xmm0, 0x160(%rbx)
movups %xmm0, 0x16c(%rbx)
movups %xmm0, 0x38(%rbx)
movl $0x20, %edi
callq 0x41d0
movq %rax, %r12
movq %rax, %rdi
callq 0x4c98
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 0x4280
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 0x4110
movq %rax, %r15
movl $0x20, %esi
movq %r12, %rdi
callq 0x41e0
jmp 0x8637
movq %rax, %r15
movq %r14, %rdi
callq 0x7140
jmp 0x8644
movq %rax, %r15
movq %rbx, %rdi
callq 0x8580
movq %r15, %rdi
callq 0x4340
// File: /workspace/github_cpp_makefile_star2_O3/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 0x717c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x86ff
movq %rbx, %rdi
callq 0x8708
testl %eax, %eax
jne 0x86ff
movq %rbx, %rdi
callq 0x8880
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x7739(%rip), %rdx      # 0x101e0
callq 0x4cfa
movq 0x48(%rbx), %rax
movq 0x10(%rax), %rcx
movq %rcx, 0x38(%rbx)
movl 0x1c(%rax), %eax
movl %eax, 0x40(%rbx)
movq %rbx, %rdi
callq 0x9090
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movl 0x40(%rdi), %r13d
movl %r13d, %ebp
negl %ebp
cmovsl %r13d, %ebp
movl $0x1, %r14d
cmpl $0xa, %ebp
jb 0x8d20
movl $0x4, %r14d
movl $0xd1b71759, %eax       # imm = 0xD1B71759
movl %ebp, %ecx
cmpl $0x63, %ecx
jbe 0x8d17
cmpl $0x3e7, %ecx            # imm = 0x3E7
jbe 0x8d1d
cmpl $0x2710, %ecx           # imm = 0x2710
jb 0x8d20
movl %ecx, %edx
imulq %rax, %rdx
shrq $0x2d, %rdx
addl $0x4, %r14d
cmpl $0x1869f, %ecx          # imm = 0x1869F
movl %edx, %ecx
ja 0x8ce4
addl $-0x3, %r14d
jmp 0x8d20
addl $-0x2, %r14d
jmp 0x8d20
decl %r14d
shrl $0x1f, %r13d
movl %r13d, %esi
addl %r14d, %esi
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x48(%rsp), %r15
movq %r15, %rdi
movl $0x2d, %edx
callq 0x4220
movq (%r15), %rdi
addq %r13, %rdi
movl %r14d, %esi
movl %ebp, %edx
callq 0x91dd
leaq 0x3590(%rip), %rcx      # 0xc2ed
movl $0x72, %r8d
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4210
leaq 0x38(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8d96
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x8d9d
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x34b7(%rip), %rsi      # 0xc277
callq 0x4350
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8dec
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x8df3
movups (%rcx), %xmm0
movups %xmm0, (%r15)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x8e22
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x41e0
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x8e39
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x41e0
leaq 0x20(%rbx), %r14
movq 0x8(%rsp), %rsi
movl 0x10(%rsp), %edx
movq %r14, %rdi
callq 0x7242
movq 0x38(%rbx), %rsi
movl 0x40(%rbx), %edx
movq %r14, %rdi
callq 0x7242
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8e74
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x41e0
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r14, %rdi
je 0x8ea4
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x41e0
jmp 0x8ea4
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x8ecf
movq 0x58(%rsp), %rsi
jmp 0x8ec7
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x8ecf
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x41e0
movq %rbx, %rdi
callq 0x4340
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
leaq 0x58(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x48(%rsp), %r14
movl $0x2, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x4220
movq (%r14), %rax
movw $0x3631, (%rax)         # imm = 0x3631
leaq 0x345f(%rip), %rcx      # 0xc371
movl $0x3f, %r8d
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x4210
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8f4c
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
jmp 0x8f54
movups (%rcx), %xmm0
movups %xmm0, (%r12)
movq 0x8(%rax), %rdx
leaq 0x28(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x3300(%rip), %rsi      # 0xc277
callq 0x4350
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
je 0x8fa3
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
jmp 0x8faa
movups (%rcx), %xmm0
movups %xmm0, (%r14)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x8fd9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x41e0
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x8ff0
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x41e0
addq $0x20, %rbx
movq 0x8(%rsp), %rsi
movl 0x10(%rsp), %edx
movq %rbx, %rdi
callq 0x7242
leaq 0x3354(%rip), %rsi      # 0xc360
movq %rbx, %rdi
movl $0x10, %edx
callq 0x7242
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9030
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x41e0
xorl %eax, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x905d
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x41e0
jmp 0x905d
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %r15, %rdi
je 0x9088
movq 0x58(%rsp), %rsi
jmp 0x9080
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x9088
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x41e0
movq %rbx, %rdi
callq 0x4340
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8560
leaq 0x20(%rbx), %rdi
callq 0x7130
leaq 0x69d5(%rip), %rax      # 0xfcd8
movq %rax, (%rbx)
movw $0x101, 0x2c(%rbx)      # imm = 0x101
movl $0x0, 0x48(%rbx)
movl 0x8(%rbx), %ebp
movl 0xc(%rbx), %r12d
movl %ebp, %eax
imull %r12d, %eax
leal 0x10(,%rax,4), %ecx
movl %eax, %r13d
shll $0x2, %r13d
movl %ecx, 0x30(%rbx)
movslq %ecx, %r14
movl $0x1, %edi
movq %r14, %rsi
callq 0x4140
movq %rax, %r15
movq %rax, 0x38(%rbx)
movl $0x1, %edi
movq %r14, %rsi
callq 0x4140
movq %rax, 0x40(%rbx)
movw $0x100, %cx             # imm = 0x100
movw %cx, 0x2(%r15)
rolw $0x8, %bp
movw %bp, 0x8(%r15)
rolw $0x8, %r12w
movw %r12w, 0xa(%r15)
movw %cx, 0x2(%rax)
movw %bp, 0x8(%rax)
movw %r12w, 0xa(%rax)
movl %r13d, 0x58(%rbx)
movslq %r13d, %rdi
callq 0x4280
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 0x8580
movq %r14, %rdi
callq 0x4340
// File: /workspace/github_cpp_makefile_star2_O3/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x20(%rdi), %r15
movl 0x28(%rdi), %esi
movq %r15, %rdi
callq 0x717c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x94b3
movq %r14, %rdi
callq 0x94c2
testl %eax, %eax
jne 0x94b3
leaq 0x4(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl $0xc, %edx
movl $0x1, %ecx
callq 0x7358
movl %eax, %ebp
cmpl $0xc, %eax
leaq 0x3368(%rip), %rdi      # 0xc7db
cmoveq %r12, %rdi
callq 0x4310
cmpl $0xc, %ebp
jne 0x94b3
leaq 0x4(%rsp), %rsi
movl $0x1000000, (%rsi)      # imm = 0x1000000
movq %r15, %rdi
movl $0x4, %edx
callq 0x7242
movq %r14, %rdi
callq 0x9558
testl %eax, %eax
jne 0x94b3
movq %r14, %rdi
callq 0x95ae
xorl %ebx, %ebx
negl %eax
sbbl %ebx, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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
movl $0x1, %edx
movl $0x1, %ecx
callq 0x7358
cmpl $0x1, %eax
jne 0x9594
movzbl 0xf(%rsp), %esi
leaq 0x3064(%rip), %rdi      # 0xc5ed
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x4050
jmp 0x95a5
leaq 0x3260(%rip), %rdi      # 0xc7fb
callq 0x4310
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9090
movq %rbx, %rdi
callq 0x9658
xorb $0x1, 0x48(%rbx)
movb $0x1, %al
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2acc(%rip), %rdi      # 0xc639
xorl %eax, %eax
callq 0x4050
movzbl 0x5(%rbx), %esi
leaq 0x2ad0(%rip), %rdi      # 0xc64f
xorl %eax, %eax
callq 0x4050
movzbl 0x6(%rbx), %esi
leaq 0x2ad4(%rip), %rdi      # 0xc665
xorl %eax, %eax
callq 0x4050
movzbl 0x7(%rbx), %esi
leaq 0x2ad8(%rip), %rdi      # 0xc67b
xorl %eax, %eax
callq 0x4050
movzwl 0x8(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x2ad5(%rip), %rdi      # 0xc691
xorl %eax, %eax
callq 0x4050
movzwl 0xa(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x2ad2(%rip), %rdi      # 0xc6a7
xorl %eax, %eax
callq 0x4050
movzwl 0xc(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x2acf(%rip), %rdi      # 0xc6bd
xorl %eax, %eax
callq 0x4050
movzbl 0xe(%rbx), %esi
leaq 0x2ad3(%rip), %rdi      # 0xc6d3
xorl %eax, %eax
callq 0x4050
movzbl 0xf(%rbx), %esi
leaq 0x2ad7(%rip), %rdi      # 0xc6e9
xorl %eax, %eax
callq 0x4050
movzbl 0x10(%rbx), %esi
leaq 0x2adb(%rip), %rdi      # 0xc6ff
xorl %eax, %eax
popq %rbx
jmp 0x4050
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9c53
leaq 0x294c(%rip), %rax      # 0xc588
movslq (%rax,%rsi,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x2ac9(%rip), %rdi      # 0xc715
xorl %esi, %esi
jmp 0x9d0e
cmpl $0xffffff11, %esi       # imm = 0xFFFFFF11
je 0x9d02
cmpl $0xffffff21, %esi       # imm = 0xFFFFFF21
jne 0x9c78
leaq 0x2b36(%rip), %rdi      # 0xc7a4
movl $0xffffff21, %esi       # imm = 0xFFFFFF21
jmp 0x9d0e
leaq 0x2b37(%rip), %rdi      # 0xc7b6
jmp 0x9d0e
leaq 0x2ae1(%rip), %rdi      # 0xc76c
movl $0xf, %esi
jmp 0x9d0e
leaq 0x2ade(%rip), %rdi      # 0xc777
movl $0x10, %esi
jmp 0x9d0e
leaq 0x2a91(%rip), %rdi      # 0xc738
movl $0x4, %esi
jmp 0x9d0e
leaq 0x2a6a(%rip), %rdi      # 0xc71f
movl $0x1, %esi
jmp 0x9d0e
leaq 0x2a6b(%rip), %rdi      # 0xc72e
movl $0x2, %esi
jmp 0x9d0e
leaq 0x2a73(%rip), %rdi      # 0xc744
movl $0x5, %esi
jmp 0x9d0e
leaq 0x2a7f(%rip), %rdi      # 0xc75e
movl $0x8, %esi
jmp 0x9d0e
leaq 0x2a65(%rip), %rdi      # 0xc752
movl $0x7, %esi
jmp 0x9d0e
leaq 0x2a87(%rip), %rdi      # 0xc782
movl $0x11, %esi
jmp 0x9d0e
leaq 0x2a8e(%rip), %rdi      # 0xc797
movl $0xffffff11, %esi       # imm = 0xFFFFFF11
xorl %eax, %eax
jmp 0x4050
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4110
movb $0x1, (%r15)
movw $0x8000, 0x4(%r15)      # imm = 0x8000
leaq 0x14(%rsp), %r15
movl %r14d, %edi
callq 0x4ae0
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
cmpq $0x80, %r14
jne 0x9d74
addq $0x20, %rbx
leaq 0xa(%rsp), %rsi
movq %rbx, %rdi
movl $0x306, %edx            # imm = 0x306
callq 0x7242
movl %eax, %ecx
xorl %eax, %eax
cmpl $0x306, %ecx            # imm = 0x306
je 0x9def
leaq 0x282f(%rip), %rdi      # 0xc606
leaq 0x2842(%rip), %rsi      # 0xc620
movl $0x16d, %edx            # imm = 0x16D
xorl %eax, %eax
callq 0x4050
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x310, %rsp            # imm = 0x310
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x8560
leaq 0x5ef1(%rip), %rax      # 0xfd60
movq %rax, (%rbx)
movl $0xf231, %edi           # imm = 0xF231
callq 0x4170
movl 0x8(%rbx), %ecx
movl 0xc(%rbx), %r8d
leaq 0x2a1a(%rip), %rdi      # 0xc8a4
movl $0x1fff0000, %esi       # imm = 0x1FFF0000
movl $0x1fff0000, %edx       # imm = 0x1FFF0000
xorl %r9d, %r9d
callq 0x4060
movq %rax, %r14
movq %rax, 0x28(%rbx)
movq $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 0x4280
movq %rax, 0x50(%rbx)
movq %r14, %rdi
callq 0x4270
movq %rax, 0x20(%rbx)
movq 0x8(%rax), %rdi
movl $0x32, %esi
movl $0x32, %edx
movl $0x64, %ecx
callq 0x40f0
movl %eax, 0x48(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x8580
movq %r14, %rdi
callq 0x4340
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5e49(%rip), %rax      # 0xfd60
movq %rax, (%rdi)
movq 0x50(%rdi), %rdi
callq 0x4240
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x9f31
callq 0x4190
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x9f3f
callq 0x4030
callq 0x4070
movq %rbx, %rdi
popq %rbx
jmp 0x8580
movq %rax, %rdi
callq 0x7579
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x9090
movq 0x20(%rbx), %rdi
callq 0x4290
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 0x4150
movq 0x20(%rbx), %rdi
callq 0x42f0
movq 0x28(%rbx), %rdi
callq 0x41f0
movb $0x1, %al
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x4130
testl %eax, %eax
je 0xa090
movl $0x1, %eax
movl (%rsp), %ecx
cmpl $0x100, %ecx            # imm = 0x100
je 0xa092
cmpl $0x301, %ecx            # imm = 0x301
je 0xa012
cmpl $0x300, %ecx            # imm = 0x300
jne 0xa090
movl 0x14(%rsp), %ecx
cmpl $0x1f, %ecx
jg 0xa03e
cmpl $0x9, %ecx
je 0xa076
cmpl $0xd, %ecx
je 0xa07d
cmpl $0x1b, %ecx
je 0xa092
jmp 0xa090
movl 0x14(%rsp), %eax
cmpl $0x4000004e, %eax       # imm = 0x4000004E
jle 0xa060
addl $0xbfffffb1, %eax       # imm = 0xBFFFFFB1
cmpl $0x3, %eax
ja 0xa090
leaq 0x2846(%rip), %rcx      # 0xc874
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x9, %eax
jmp 0xa092
leal -0x4000004f(%rcx), %eax
cmpl $0x3, %eax
ja 0xa084
leaq 0x2834(%rip), %rcx      # 0xc884
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x8, %eax
jmp 0xa092
cmpl $0x9, %eax
je 0xa097
cmpl $0xd, %eax
je 0xa0b3
cmpl $0x20, %eax
jne 0xa090
movl $0xf, %eax
jmp 0xa092
movl $0x2, %eax
jmp 0xa092
movl $0x4, %eax
jmp 0xa092
cmpl $0x20, %ecx
jne 0xa090
movl $0xe, %eax
jmp 0xa092
xorl %eax, %eax
addq $0x38, %rsp
retq
movl $0x3, %eax
jmp 0xa092
movl $0xd, %eax
jmp 0xa092
movl $0xb, %eax
jmp 0xa092
movl $0x7, %eax
jmp 0xa092
movl $0x5, %eax
jmp 0xa092
movl $0xc, %eax
jmp 0xa092
movl $0xa, %eax
jmp 0xa092
movl $0x6, %eax
jmp 0xa092
nop
// File: /workspace/github_cpp_makefile_star2_O3/aalto-speech[P]ftk/src/defs.hh
// Function: add_log_domain_probs(double, double)
static flt_type add_log_domain_probs(flt_type a, flt_type b) {
    flt_type delta = a - b;
    if (delta > 0) {
      b = a;
      delta = -delta;
    }
    return b + log1p(exp(delta));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movapd %xmm0, %xmm4
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
movapd 0x2139a(%rip), %xmm0    # 0x27020
xorpd %xmm2, %xmm0
movapd %xmm0, %xmm3
cmpltsd %xmm2, %xmm3
andpd %xmm3, %xmm4
andnpd %xmm1, %xmm3
orpd %xmm3, %xmm4
movapd %xmm4, -0x10(%rbp)
minsd %xmm2, %xmm0
callq 0x4660
callq 0x46e0
addsd -0x10(%rbp), %xmm0
addq $0x10, %rsp
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 %rdi, %rbx
movq 0x60(%rsi), %r15
leaq 0x50(%rsi), %r13
cmpq %r13, %r15
je 0x28c2
movq %rsi, %r14
movl 0x20(%r15), %r12d
movl %r12d, (%rsp)
movl %r12d, 0x4(%rsp)
movq %r14, %rdi
leaq 0x4(%rsp), %rsi
callq 0x619e
testq %rax, %rax
je 0x28d4
movq %r14, %rdi
movq %rsp, %rsi
callq 0x710e
movq (%rax), %rbp
movl $0x3, %edx
movq %rbx, %rdi
leaq 0x5834(%rip), %rsi      # 0x8026
callq 0x2280
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2340
movq %rax, %r12
movl $0x2, %edx
movq %rax, %rdi
leaq 0x582c(%rip), %rsi      # 0x8040
callq 0x2280
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x25da
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x57bc(%rip), %rsi      # 0x803e
callq 0x2280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq %r15, %rdi
callq 0x2290
movq %rax, %r15
cmpq %r13, %rax
jne 0x27b2
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58b6(%rip), %rdi      # 0x8191
leaq 0x579e(%rip), %rsi      # 0x8080
leaq 0x58b2(%rip), %rcx      # 0x819b
movl $0x2d9, %edx            # imm = 0x2D9
callq 0x2150
// File: /workspace/github_cpp_makefile_star2_O3/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 $0x28, %rsp
movq %rdi, %rbx
movq %rsi, 0x8(%rsp)
movq 0x58(%rsi), %r13
testq %r13, %r13
je 0x2ae5
movq 0x8(%rsp), %rax
addq $0x30, %rax
movq %rax, 0x10(%rsp)
movl 0x8(%r13), %r12d
movq 0x10(%r13), %rax
movq %rax, 0x18(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x5703(%rip), %rsi      # 0x8043
callq 0x2280
movl $0x3, %edx
movq %rbx, %rdi
leaq 0x56f1(%rip), %rsi      # 0x8045
callq 0x2280
movl $0x3, %edx
movq %rbx, %rdi
leaq 0x56be(%rip), %rsi      # 0x8026
callq 0x2280
movq 0x8(%rsp), %r15
movl 0xc(%r15), %esi
movq %rbx, %rdi
callq 0x2340
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x56bd(%rip), %rbp      # 0x804a
movq %rbp, %rsi
callq 0x2280
movl $0x7, %edx
movq %rbx, %rdi
leaq 0x5688(%rip), %r14      # 0x802c
movq %r14, %rsi
callq 0x2280
movq (%r15), %rax
movq %rax, 0x20(%rsp)
movq %rbx, %rdi
leaq 0x20(%rsp), %rsi
callq 0x2598
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x5664(%rip), %rsi      # 0x8034
callq 0x2280
movl 0x8(%r15), %esi
movq %rbx, %rdi
callq 0x2340
movl $0x2, %edx
movq %rbx, %rdi
leaq 0x5659(%rip), %r15      # 0x8049
movq %r15, %rsi
callq 0x2280
movl $0x12, %edx
movq %rbx, %rdi
leaq 0x5645(%rip), %rsi      # 0x804c
callq 0x2280
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x25da
movl $0x2, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2280
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x5627(%rip), %rsi      # 0x805f
callq 0x2280
movl $0x3, %edx
movq %rbx, %rdi
leaq 0x55da(%rip), %rsi      # 0x8026
callq 0x2280
movq %rbx, %rdi
movl %r12d, %esi
callq 0x2340
movl $0x1, %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2280
movl $0x7, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2280
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x25da
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x55a6(%rip), %rsi      # 0x803e
callq 0x2280
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x57bf(%rip), %rsi      # 0x826b
callq 0x2280
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2170
movq (%r13), %r13
testq %r13, %r13
jne 0x2924
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq