LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__compute_transparency16(stbi__png*, unsigned short*, int)
static int stbi__compute_transparency16(stbi__png *z, stbi__uint16 tc[3], int out_n)
{
   stbi__context *s = z->s;
   stbi__uint32 i, pixel_count = s->img_x * s->img_y;
   stbi__uint16 *p = (stbi__uint16*) z->out;

   // compute color-based transparency, assuming we've
   // already got 65535 as the alpha value in the output
   STBI_ASSERT(out_n == 2 || out_n == 4);

   if (out_n == 2) {
      for (i = 0; i < pixel_count; ++i) {
         p[1] = (p[0] == tc[0] ? 0 : 65535);
         p += 2;
      }
   } else {
      for (i = 0; i < pixel_count; ++i) {
         if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
            p[3] = 0;
         p += 4;
      }
   }
   return 1;
}

// Assembly:
pushq %rax
movq (%rdi), %r8
movq 0x18(%rdi), %rax
movl 0x4(%r8), %ecx
imull (%r8), %ecx
cmpl $0x2, %edx
je 0x34a0d
cmpl $0x4, %edx
jne 0x34a35
testl %ecx, %ecx
je 0x34a33
movl %ecx, %ecx
xorl %edx, %edx
movzwl (%rax,%rdx,8), %edi
cmpw (%rsi), %di
jne 0x34a04
movzwl 0x2(%rax,%rdx,8), %edi
cmpw 0x2(%rsi), %di
jne 0x34a04
movzwl 0x4(%rax,%rdx,8), %edi
cmpw 0x4(%rsi), %di
jne 0x34a04
movw $0x0, 0x6(%rax,%rdx,8)
incq %rdx
cmpl %edx, %ecx
jne 0x349de
jmp 0x34a33
testl %ecx, %ecx
je 0x34a33
movl %ecx, %ecx
xorl %edx, %edx
movzwl (%rax,%rdx,4), %edi
xorl %r8d, %r8d
cmpw (%rsi), %di
setne %r8b
negl %r8d
movw %r8w, 0x2(%rax,%rdx,4)
incq %rdx
cmpl %edx, %ecx
jne 0x34a15
popq %rax
retq
leaq 0xb064(%rip), %rdi      # 0x3faa0
leaq 0xab68(%rip), %rsi      # 0x3f5ab
leaq 0xb06f(%rip), %rcx      # 0x3fab9
movl $0x124d, %edx           # imm = 0x124D
callq 0x6250
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__compute_transparency(stbi__png*, unsigned char*, int)
static int stbi__compute_transparency(stbi__png *z, stbi_uc tc[3], int out_n)
{
   stbi__context *s = z->s;
   stbi__uint32 i, pixel_count = s->img_x * s->img_y;
   stbi_uc *p = z->out;

   // compute color-based transparency, assuming we've
   // already got 255 as the alpha value in the output
   STBI_ASSERT(out_n == 2 || out_n == 4);

   if (out_n == 2) {
      for (i=0; i < pixel_count; ++i) {
         p[1] = (p[0] == tc[0] ? 0 : 255);
         p += 2;
      }
   } else {
      for (i=0; i < pixel_count; ++i) {
         if (p[0] == tc[0] && p[1] == tc[1] && p[2] == tc[2])
            p[3] = 0;
         p += 4;
      }
   }
   return 1;
}

// Assembly:
pushq %rax
movq (%rdi), %r8
movq 0x18(%rdi), %rax
movl 0x4(%r8), %ecx
imull (%r8), %ecx
cmpl $0x2, %edx
je 0x34aa3
cmpl $0x4, %edx
jne 0x34ac7
testl %ecx, %ecx
je 0x34ac5
movl %ecx, %ecx
xorl %edx, %edx
movb (%rax,%rdx,4), %dil
cmpb (%rsi), %dil
jne 0x34a9a
movb 0x1(%rax,%rdx,4), %dil
cmpb 0x1(%rsi), %dil
jne 0x34a9a
movb 0x2(%rax,%rdx,4), %dil
cmpb 0x2(%rsi), %dil
jne 0x34a9a
movb $0x0, 0x3(%rax,%rdx,4)
incq %rdx
cmpl %edx, %ecx
jne 0x34a76
jmp 0x34ac5
testl %ecx, %ecx
je 0x34ac5
movl %ecx, %ecx
xorl %edx, %edx
movb (%rax,%rdx,2), %dil
cmpb (%rsi), %dil
setne %dil
negb %dil
movb %dil, 0x1(%rax,%rdx,2)
incq %rdx
cmpl %edx, %ecx
jne 0x34aab
popq %rax
retq
leaq 0xafd2(%rip), %rdi      # 0x3faa0
leaq 0xaad6(%rip), %rsi      # 0x3f5ab
leaq 0xb020(%rip), %rcx      # 0x3fafc
movl $0x1234, %edx           # imm = 0x1234
callq 0x6250
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__shiftsigned(unsigned int, int, int)
static int stbi__shiftsigned(unsigned int v, int shift, int bits)
{
   static unsigned int mul_table[9] = {
      0,
      0xff/*0b11111111*/, 0x55/*0b01010101*/, 0x49/*0b01001001*/, 0x11/*0b00010001*/,
      0x21/*0b00100001*/, 0x41/*0b01000001*/, 0x81/*0b10000001*/, 0x01/*0b00000001*/,
   };
   static unsigned int shift_table[9] = {
      0, 0,0,1,0,2,4,6,0,
   };
   if (shift < 0)
      v <<= -shift;
   else
      v >>= shift;
   STBI_ASSERT(v >= 0 && v < 256);
   v >>= (8-bits);
   STBI_ASSERT(bits >= 0 && bits <= 8);
   return (int) ((unsigned) v * mul_table[bits]) >> shift_table[bits];
}

// Assembly:
pushq %rax
movl %esi, %ecx
negb %cl
movl %edi, %eax
shll %cl, %eax
movl %esi, %ecx
shrl %cl, %edi
testl %esi, %esi
cmovsl %eax, %edi
cmpl $0x100, %edi            # imm = 0x100
jae 0x35eaa
cmpl $0x9, %edx
jge 0x35ec9
movb $0x8, %cl
subb %dl, %cl
shrl %cl, %edi
movl %edx, %eax
leaq 0x795a(%rip), %rcx      # 0x3d7f0
imull (%rcx,%rax,4), %edi
leaq 0x797f(%rip), %rcx      # 0x3d820
movb (%rcx,%rax,4), %cl
sarl %cl, %edi
movl %edi, %eax
popq %rcx
retq
leaq 0x9dce(%rip), %rdi      # 0x3fc7f
leaq 0x96f3(%rip), %rsi      # 0x3f5ab
leaq 0x9dd2(%rip), %rcx      # 0x3fc91
movl $0x13f9, %edx           # imm = 0x13F9
callq 0x6250
leaq 0x9def(%rip), %rdi      # 0x3fcbf
leaq 0x96d4(%rip), %rsi      # 0x3f5ab
leaq 0x9db3(%rip), %rcx      # 0x3fc91
movl $0x13fb, %edx           # imm = 0x13FB
callq 0x6250
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__out_gif_code(stbi__gif*, unsigned short)
static void stbi__out_gif_code(stbi__gif *g, stbi__uint16 code)
{
   stbi_uc *p, *c;
   int idx; 

   // recurse to decode the prefixes, since the linked-list is backwards,
   // and working backwards through an interleaved image would be nasty
   if (g->codes[code].prefix >= 0)
      stbi__out_gif_code(g, g->codes[code].prefix);

   if (g->cur_y >= g->max_y) return;

   idx = g->cur_x + g->cur_y; 
   p = &g->out[idx];
   g->history[idx / 4] = 1;  

   c = &g->color_table[g->codes[code].suffix * 4];
   if (c[3] > 128) { // don't render transparent pixels; 
      p[0] = c[2];
      p[1] = c[1];
      p[2] = c[0];
      p[3] = c[3];
   }
   g->cur_x += 4;

   if (g->cur_x >= g->max_x) {
      g->cur_x = g->start_x;
      g->cur_y += g->step;

      while (g->cur_y >= g->max_y && g->parse > 0) {
         g->step = (1 << g->parse) * g->line_size;
         g->cur_y = g->start_y + (g->step >> 1);
         --g->parse;
      }
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %r14d
movzwl 0x834(%rdi,%r14,4), %eax
testw %ax, %ax
js 0x37265
movzwl %ax, %esi
movq %rbx, %rdi
callq 0x37242
movslq 0x8860(%rbx), %rcx
cmpl 0x8858(%rbx), %ecx
jge 0x37348
movslq 0x885c(%rbx), %rax
addq %rcx, %rax
movq 0x8(%rbx), %rcx
leal 0x3(%rax), %edx
testl %eax, %eax
cmovnsl %eax, %edx
movq 0x18(%rbx), %rsi
sarl $0x2, %edx
movslq %edx, %rdx
movb $0x1, (%rsi,%rdx)
movq 0x8838(%rbx), %rdx
movzbl 0x837(%rbx,%r14,4), %esi
cmpb $-0x7f, 0x3(%rdx,%rsi,4)
jb 0x372d7
movb 0x2(%rdx,%rsi,4), %dil
movb %dil, (%rcx,%rax)
movb 0x1(%rdx,%rsi,4), %dil
movb %dil, 0x1(%rcx,%rax)
movb (%rdx,%rsi,4), %dil
movb %dil, 0x2(%rcx,%rax)
movb 0x3(%rdx,%rsi,4), %dl
movb %dl, 0x3(%rcx,%rax)
movl 0x885c(%rbx), %eax
addl $0x4, %eax
movl %eax, 0x885c(%rbx)
cmpl 0x8854(%rbx), %eax
jl 0x37348
movl 0x884c(%rbx), %ecx
movl 0x8858(%rbx), %eax
movl %ecx, 0x885c(%rbx)
movl 0x8860(%rbx), %ecx
addl 0x8844(%rbx), %ecx
movl %ecx, 0x8860(%rbx)
cmpl %eax, %ecx
jl 0x37348
movl 0x8840(%rbx), %ecx
testl %ecx, %ecx
jle 0x37348
movl 0x8864(%rbx), %edx
shll %cl, %edx
movl %edx, 0x8844(%rbx)
sarl %edx
addl 0x8850(%rbx), %edx
movl %edx, 0x8860(%rbx)
decl %ecx
movl %ecx, 0x8840(%rbx)
cmpl %eax, %edx
jge 0x3731c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__malloc_mad4(int, int, int, int, int)
static int stbi__mul2sizes_valid(int a, int b)
{
   if (a < 0 || b < 0) return 0;
   if (b == 0) return 1; // mul-by-0 is always safe
   // portable way to check for no overflows in a*b
   return a <= INT_MAX/b;
}

// Assembly:
movl %esi, %eax
orl %edi, %eax
js 0x37cae
movl %edx, %ecx
testl %esi, %esi
je 0x37c7a
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
divl %esi
cmpl %edi, %eax
jl 0x37cae
imull %edi, %esi
movl %esi, %eax
orl %ecx, %eax
js 0x37cae
testl %ecx, %ecx
je 0x37c94
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
xorl %edx, %edx
divl %ecx
cmpl %esi, %eax
jl 0x37cae
movl %esi, %eax
imull %ecx, %eax
cmpl $0x1fffffff, %eax       # imm = 0x1FFFFFFF
ja 0x37cae
imull %ecx, %esi
shll $0x2, %esi
movslq %esi, %rdi
jmp 0x64c0
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__hdr_test_core(stbi__context*, char const*)
static int stbi__hdr_test_core(stbi__context *s, const char *signature)
{
   int i;
   for (i=0; signature[i]; ++i)
      if (stbi__get8(s) != signature[i])
          return 0;
   stbi__rewind(s);
   return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, (%rsi)
je 0x38122
movq %rsi, %r14
leaq 0x38(%rbx), %r15
leaq 0x39(%rbx), %r12
incq %r14
movq 0xb8(%rbx), %rax
cmpq 0xc0(%rbx), %rax
jb 0x380fd
cmpl $0x0, 0x30(%rbx)
je 0x380d9
movq 0x28(%rbx), %rdi
movl 0x34(%rbx), %edx
movq %r15, %rsi
callq *0x10(%rbx)
testl %eax, %eax
je 0x380dd
movq %r15, 0xb8(%rbx)
cltq
addq %r15, %rax
movq %rax, 0xc0(%rbx)
jmp 0x380f6
xorl %eax, %eax
jmp 0x3810b
movl $0x0, 0x30(%rbx)
movq %r15, 0xb8(%rbx)
movq %r12, 0xc0(%rbx)
movb $0x0, 0x38(%rbx)
movq 0xb8(%rbx), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0xb8(%rbx)
movzbl (%rax), %eax
movsbl -0x1(%r14), %ecx
cmpl %ecx, %eax
jne 0x38137
cmpb $0x0, (%r14)
leaq 0x1(%r14), %r14
jne 0x3809d
movups 0xc8(%rbx), %xmm0
movups %xmm0, 0xb8(%rbx)
movl $0x1, %eax
jmp 0x38139
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__psd_info(stbi__context*, int*, int*, int*)
static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
{
   int channelCount, dummy, depth;
   if (!x) x = &dummy;
   if (!y) y = &dummy;
   if (!comp) comp = &dummy;
   if (stbi__get32be(s) != 0x38425053) {
       stbi__rewind( s );
       return 0;
   }
   if (stbi__get16be(s) != 1) {
       stbi__rewind( s );
       return 0;
   }
   stbi__skip(s, 6);
   channelCount = stbi__get16be(s);
   if (channelCount < 0 || channelCount > 16) {
       stbi__rewind( s );
       return 0;
   }
   *y = stbi__get32be(s);
   *x = stbi__get32be(s);
   depth = stbi__get16be(s);
   if (depth != 8 && depth != 16) {
       stbi__rewind( s );
       return 0;
   }
   if (stbi__get16be(s) != 3) {
       stbi__rewind( s );
       return 0;
   }
   *comp = 4;
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
callq 0x31ea4
movl %eax, %ebp
shll $0x10, %ebp
movq %rbx, %rdi
callq 0x31ea4
orl %ebp, %eax
cmpl $0x38425053, %eax       # imm = 0x38425053
jne 0x38243
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x1, %eax
jne 0x38243
cmpq $0x0, 0x10(%rbx)
je 0x381bd
movq 0xc0(%rbx), %rcx
movl 0xb8(%rbx), %edx
movl %ecx, %eax
subl %edx, %eax
cmpl $0x5, %eax
jg 0x381bd
movq %rcx, 0xb8(%rbx)
movq 0x28(%rbx), %rdi
movl $0x6, %esi
subl %eax, %esi
callq *0x18(%rbx)
jmp 0x381c5
addq $0x6, 0xb8(%rbx)
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x11, %eax
jae 0x38243
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %ebp
movq %rbx, %rdi
callq 0x31ea4
testq %r12, %r12
je 0x381f2
shll $0x10, %ebp
orl %eax, %ebp
movl %ebp, (%r12)
movq %rbx, %rdi
callq 0x31ea4
movl %eax, %ebp
movq %rbx, %rdi
callq 0x31ea4
testq %r15, %r15
je 0x38211
shll $0x10, %ebp
orl %eax, %ebp
movl %ebp, (%r15)
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x8, %eax
je 0x38223
cmpl $0x10, %eax
jne 0x38243
movq %rbx, %rdi
callq 0x31ea4
cmpl $0x3, %eax
jne 0x38243
movl $0x1, %eax
testq %r14, %r14
je 0x38253
movl $0x4, (%r14)
jmp 0x38253
movups 0xc8(%rbx), %xmm0
movups %xmm0, 0xb8(%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__hdr_info(stbi__context*, int*, int*, int*)
static int stbi__hdr_info(stbi__context *s, int *x, int *y, int *comp)
{
   char buffer[STBI__HDR_BUFLEN];
   char *token;
   int valid = 0;
   int dummy;

   if (!x) x = &dummy;
   if (!y) y = &dummy;
   if (!comp) comp = &dummy;

   if (stbi__hdr_test(s) == 0) {
       stbi__rewind( s );
       return 0;
   }

   for(;;) {
      token = stbi__hdr_gettoken(s,buffer);
      if (token[0] == 0) break;
      if (strcmp(token, "FORMAT=32-bit_rle_rgbe") == 0) valid = 1;
   }

   if (!valid) {
       stbi__rewind( s );
       return 0;
   }
   token = stbi__hdr_gettoken(s,buffer);
   if (strncmp(token, "-Y ", 3)) {
       stbi__rewind( s );
       return 0;
   }
   token += 3;
   *y = (int) strtol(token, &token, 10);
   while (*token == ' ') ++token;
   if (strncmp(token, "+X ", 3)) {
       stbi__rewind( s );
       return 0;
   }
   token += 3;
   *x = (int) strtol(token, NULL, 10);
   *comp = 3;
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x418, %rsp            # imm = 0x418
movq %rcx, %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %r15
callq 0x252cd
testl %eax, %eax
je 0x38785
leaq 0x10(%rsp), %r13
movq %r15, %rdi
movq %r13, %rsi
callq 0x37a3d
cmpb $0x0, (%r13)
je 0x38781
movq %rbx, 0x8(%rsp)
xorl %ebp, %ebp
movl $0x1, %ebx
leaq 0x10(%rsp), %r13
movdqu 0x17(%rsp), %xmm0
pcmpeqb 0x4c38(%rip), %xmm0     # 0x3d2d0
movdqa 0x10(%rsp), %xmm1
pcmpeqb 0x4c3a(%rip), %xmm1     # 0x3d2e0
pand %xmm0, %xmm1
pmovmskb %xmm1, %eax
cmpl $0xffff, %eax           # imm = 0xFFFF
cmovel %ebx, %ebp
movq %r15, %rdi
movq %r13, %rsi
callq 0x37a3d
cmpb $0x0, 0x10(%rsp)
jne 0x3868a
movq %r13, (%rsp)
testl %ebp, %ebp
je 0x38785
movq %r15, %rdi
movq %r13, %rsi
callq 0x37a3d
movl $0x592d, %eax           # imm = 0x592D
xorl 0x10(%rsp), %eax
movq %r13, (%rsp)
movzbl 0x12(%rsp), %ecx
xorl $0x20, %ecx
orw %ax, %cx
jne 0x38785
leaq 0x13(%rsp), %rdi
movq %rsp, %rsi
movq %rdi, (%rsi)
movl $0xa, %edx
callq 0x6520
testq %r12, %r12
je 0x3871b
movl %eax, (%r12)
movq (%rsp), %r12
decq %r12
movq 0x8(%rsp), %rbx
cmpb $0x20, 0x1(%r12)
leaq 0x1(%r12), %r12
je 0x38727
movq %r12, (%rsp)
leaq 0x76fa(%rip), %rsi      # 0x3fe39
movl $0x3, %edx
movq %r12, %rdi
callq 0x61c0
testl %eax, %eax
jne 0x38785
addq $0x3, %r12
movq %r12, (%rsp)
movq %r12, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x6520
testq %r14, %r14
je 0x3876f
movl %eax, (%r14)
movl $0x1, %eax
testq %rbx, %rbx
je 0x38799
movl $0x3, (%rbx)
jmp 0x38799
movq %r13, (%rsp)
movdqu 0xc8(%r15), %xmm0
movdqu %xmm0, 0xb8(%r15)
xorl %eax, %eax
addq $0x418, %rsp            # imm = 0x418
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image.h
// Function: stbi__png_info_raw(stbi__png*, int*, int*, int*)
static int stbi__png_info_raw(stbi__png *p, int *x, int *y, int *comp)
{
   if (!stbi__parse_png_file(p, STBI__SCAN_header, 0)) {
      stbi__rewind( p->s );
      return 0;
   }
   if (x) *x = p->s->img_x;
   if (y) *y = p->s->img_y;
   if (comp) *comp = p->s->img_n;
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
xorl %ebp, %ebp
movl $0x2, %esi
xorl %edx, %edx
callq 0x32dd7
testl %eax, %eax
je 0x38d81
testq %r12, %r12
je 0x38d5f
movq (%r14), %rax
movl (%rax), %eax
movl %eax, (%r12)
testq %r15, %r15
je 0x38d6d
movq (%r14), %rax
movl 0x4(%rax), %eax
movl %eax, (%r15)
movl $0x1, %ebp
testq %rbx, %rbx
je 0x38d92
movq (%r14), %rax
movl 0x8(%rax), %eax
movl %eax, (%rbx)
jmp 0x38d92
movq (%r14), %rax
movups 0xc8(%rax), %xmm0
movups %xmm0, 0xb8(%rax)
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image_write.h
// Function: stbiw__write_pixel(stbi__write_context*, int, int, int, int, unsigned char*)
static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, int write_alpha, int expand_mono, unsigned char *d)
{
   unsigned char bg[3] = { 255, 0, 255}, px[3];
   int k;

   if (write_alpha < 0)
      s->func(s->context, &d[comp - 1], 1);

   switch (comp) {
      case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case
      case 1:
         if (expand_mono)
            stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp
         else
            s->func(s->context, d, 1);  // monochrome TGA
         break;
      case 4:
         if (!write_alpha) {
            // composite against pink background
            for (k = 0; k < 3; ++k)
               px[k] = bg[k] + ((d[k] - bg[k]) * d[3]) / 255;
            stbiw__write3(s, px[1 - rgb_dir], px[1], px[1 + rgb_dir]);
            break;
         }
         /* FALLTHROUGH */
      case 3:
         stbiw__write3(s, d[1 - rgb_dir], d[1], d[1 + rgb_dir]);
         break;
   }
   if (write_alpha > 0)
      s->func(s->context, &d[comp - 1], 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %r8, %r14
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
leal -0x1(%r15), %eax
cmpl $0x2, %eax
jb 0x390be
cmpl $0x3, %r15d
je 0x390a4
cmpl $0x4, %r15d
jne 0x390dd
testl %ebp, %ebp
je 0x3910f
movb 0x2(%r14), %al
movb (%r14), %cl
movb 0x1(%r14), %dl
leaq 0x15(%rsp), %rsi
movb %al, (%rsi)
movb %dl, 0x1(%rsi)
movb %cl, 0x2(%rsi)
jmp 0x390d2
testl %ecx, %ecx
je 0x39101
movb (%r14), %al
leaq 0xf(%rsp), %rsi
movb %al, (%rsi)
movb %al, 0x1(%rsi)
movb %al, 0x2(%rsi)
movq 0x8(%rbx), %rdi
movl $0x3, %edx
callq *(%rbx)
testl %ebp, %ebp
jle 0x390f6
movq 0x8(%rbx), %rdi
movslq %r15d, %rax
leaq (%r14,%rax), %rsi
decq %rsi
movl $0x1, %edx
callq *(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x8(%rbx), %rdi
movq %r14, %rsi
movl $0x1, %edx
jmp 0x390db
movzbl 0x3(%r14), %eax
xorl %ecx, %ecx
leaq 0x4a93(%rip), %rdx      # 0x3dbb0
movzbl (%rcx,%rdx), %esi
movzbl (%r14,%rcx), %edi
subl %esi, %edi
imull %eax, %edi
movslq %edi, %rdi
imulq $-0x7f7f7f7f, %rdi, %r8 # imm = 0x80808081
shrq $0x20, %r8
addl %r8d, %edi
movl %edi, %r8d
shrl $0x1f, %r8d
shrl $0x7, %edi
addl %r8d, %edi
addb %sil, %dil
movb %dil, 0xc(%rsp,%rcx)
incq %rcx
cmpq $0x3, %rcx
jne 0x3911d
movb 0xe(%rsp), %al
movb 0xc(%rsp), %cl
movb 0xd(%rsp), %dl
leaq 0x12(%rsp), %rsi
jmp 0x390b4
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image_write.h
// Function: stbiw__jpg_writeBits(stbi__write_context*, int*, int*, unsigned short const*)
static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) {
   int bitBuf = *bitBufP, bitCnt = *bitCntP;
   bitCnt += bs[1];
   bitBuf |= bs[0] << (24 - bitCnt);
   while(bitCnt >= 8) {
      unsigned char c = (bitBuf >> 16) & 255;
      stbiw__putc(s, c);
      if(c == 255) {
         stbiw__putc(s, 0);
      }
      bitBuf <<= 8;
      bitCnt -= 8;
   }
   *bitBufP = bitBuf;
   *bitCntP = bitCnt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movzwl 0x2(%rcx), %ebx
movq %rdx, 0x10(%rsp)
addl (%rdx), %ebx
movq %rsi, %r14
movzwl (%rcx), %ebp
movb $0x18, %cl
subb %bl, %cl
shll %cl, %ebp
orl (%rsi), %ebp
cmpl $0x8, %ebx
jl 0x395e5
movq %rdi, %r15
leaq 0xe(%rsp), %r12
leaq 0xf(%rsp), %r13
movl %ebp, %eax
shrl $0x10, %eax
movb %al, 0xe(%rsp)
movq 0x8(%r15), %rdi
movq %r12, %rsi
movl $0x1, %edx
callq *(%r15)
movl %ebp, %eax
notl %eax
testl $0xff0000, %eax         # imm = 0xFF0000
jne 0x395d6
movb $0x0, 0xf(%rsp)
movq 0x8(%r15), %rdi
movq %r13, %rsi
movl $0x1, %edx
callq *(%r15)
shll $0x8, %ebp
leal -0x8(%rbx), %eax
cmpl $0xf, %ebx
movl %eax, %ebx
jg 0x3959f
jmp 0x395e7
movl %ebx, %eax
movl %ebp, (%r14)
movq 0x10(%rsp), %rcx
movl %eax, (%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/stb_image_write.h
// Function: stbiw__jpg_DCT(float*, float*, float*, float*, float*, float*, float*, float*)
static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) {
   float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p;
   float z1, z2, z3, z4, z5, z11, z13;

   float tmp0 = d0 + d7;
   float tmp7 = d0 - d7;
   float tmp1 = d1 + d6;
   float tmp6 = d1 - d6;
   float tmp2 = d2 + d5;
   float tmp5 = d2 - d5;
   float tmp3 = d3 + d4;
   float tmp4 = d3 - d4;

   // Even part
   float tmp10 = tmp0 + tmp3;   // phase 2
   float tmp13 = tmp0 - tmp3;
   float tmp11 = tmp1 + tmp2;
   float tmp12 = tmp1 - tmp2;

   d0 = tmp10 + tmp11;       // phase 3
   d4 = tmp10 - tmp11;

   z1 = (tmp12 + tmp13) * 0.707106781f; // c4
   d2 = tmp13 + z1;       // phase 5
   d6 = tmp13 - z1;

   // Odd part
   tmp10 = tmp4 + tmp5;       // phase 2
   tmp11 = tmp5 + tmp6;
   tmp12 = tmp6 + tmp7;

   // The rotator is modified from fig 4-8 to avoid extra negations.
   z5 = (tmp10 - tmp12) * 0.382683433f; // c6
   z2 = tmp10 * 0.541196100f + z5; // c2-c6
   z4 = tmp12 * 1.306562965f + z5; // c2+c6
   z3 = tmp11 * 0.707106781f; // c4

   z11 = tmp7 + z3;      // phase 5
   z13 = tmp7 - z3;

   *d5p = z13 + z2;         // phase 6
   *d3p = z13 - z2;
   *d1p = z11 + z4;
   *d7p = z11 - z4;

   *d0p = d0;  *d2p = d2;  *d4p = d4;  *d6p = d6;
}

// Assembly:
movq 0x10(%rsp), %r10
movq 0x8(%rsp), %rax
movss (%rdi), %xmm2
movss (%rsi), %xmm0
movss (%rdx), %xmm4
movss (%rcx), %xmm3
movss (%r8), %xmm5
movss (%r9), %xmm6
movss (%rax), %xmm7
movss (%r10), %xmm8
movaps %xmm2, %xmm1
addss %xmm8, %xmm1
subss %xmm8, %xmm2
movaps %xmm0, %xmm8
addss %xmm7, %xmm8
subss %xmm7, %xmm0
movaps %xmm4, %xmm7
addss %xmm6, %xmm7
subss %xmm6, %xmm4
movaps %xmm3, %xmm6
addss %xmm5, %xmm6
subss %xmm5, %xmm3
movaps %xmm6, %xmm5
addss %xmm1, %xmm5
subss %xmm6, %xmm1
movaps %xmm7, %xmm9
addss %xmm8, %xmm9
subss %xmm7, %xmm8
movaps %xmm9, %xmm6
addss %xmm5, %xmm6
subss %xmm9, %xmm5
addss %xmm1, %xmm8
movss 0x3c1f(%rip), %xmm9     # 0x3d2b0
mulss %xmm9, %xmm8
movaps %xmm1, %xmm7
addss %xmm8, %xmm7
subss %xmm8, %xmm1
addss %xmm4, %xmm3
addss %xmm0, %xmm4
addss %xmm2, %xmm0
movaps %xmm3, %xmm8
subss %xmm0, %xmm8
mulss 0x3bf3(%rip), %xmm8     # 0x3d2b4
mulss 0x3bef(%rip), %xmm3     # 0x3d2b8
mulss 0x3beb(%rip), %xmm0     # 0x3d2bc
addss %xmm8, %xmm3
addss %xmm8, %xmm0
mulss %xmm9, %xmm4
movaps %xmm2, %xmm8
addss %xmm4, %xmm8
subss %xmm4, %xmm2
movaps %xmm2, %xmm4
addss %xmm3, %xmm4
movss %xmm4, (%r9)
subss %xmm3, %xmm2
movss %xmm2, (%rcx)
movaps %xmm8, %xmm2
addss %xmm0, %xmm2
movss %xmm2, (%rsi)
subss %xmm0, %xmm8
movss %xmm8, (%r10)
movss %xmm6, (%rdi)
movss %xmm7, (%rdx)
movss %xmm5, (%r8)
movss %xmm1, (%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/alan0201tw[P]RayTracer/include/ThreadPool.hpp
// Function: ThreadPool::~ThreadPool()
inline ThreadPool::~ThreadPool()
{
    {
        std::unique_lock<std::mutex> lock(queue_mutex);
        stop = true;
    }
    condition.notify_all();
    for(std::thread &worker: workers)
        worker.join();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x68(%rdi), %rax
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0x3a28e
movb $0x1, %al
leaq 0x8(%rsp), %rdi
movb %al, 0x8(%rdi)
movb %al, 0xc0(%rbx)
callq 0x3a278
leaq 0x90(%rbx), %r14
movq %r14, %rdi
callq 0x6690
movq (%rbx), %r15
movq 0x8(%rbx), %r12
cmpq %r12, %r15
je 0x39cc3
movq %r15, %rdi
callq 0x66a0
addq $0x8, %r15
jmp 0x39cb0
movq %r14, %rdi
callq 0x6700
leaq 0x18(%rbx), %rdi
callq 0x3a3e8
movq %rbx, %rdi
callq 0x39d28
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x39cea
movq %rax, %rdi
callq 0x1bd1a
// File: /workspace/github_cpp_makefile_star2_O1/aayush-jaiswal[P]covid-in/src/download_data.cpp
// Function: get_api_data[abi:cxx11](char const*)
std::string get_api_data(const char *api_url) {
    CURL *curl_handle = curl_easy_init();
    CURLcode return_code;

    if (!curl_handle) {
        std::cerr << "CURL ERROR! EXITING!";
        exit(2);
    }

    // setup
    curl_easy_setopt(curl_handle, CURLOPT_URL, api_url);
    curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, write_data);

    std::string data;
    
    curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, &data);
    return_code = curl_easy_perform(curl_handle);
    curl_easy_cleanup(curl_handle);

    if (return_code != CURLE_OK) {
        std::cerr << "An error occured! Make sure you have an active internet connection!\n";
        exit(2);
    }

    return data;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
callq 0x6500
testq %rax, %rax
je 0x7205
movq %rax, %r14
movq %rax, %rdi
movl $0x2712, %esi           # imm = 0x2712
movq %r15, %rdx
xorl %eax, %eax
callq 0x6450
leaq -0x51(%rip), %rdx       # 0x715c
movq %r14, %rdi
movl $0x4e2b, %esi           # imm = 0x4E2B
xorl %eax, %eax
callq 0x6450
leaq 0x10(%rbx), %r15
movq %r15, (%rbx)
movq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %r14, %rdi
movl $0x2711, %esi           # imm = 0x2711
movq %rbx, %rdx
xorl %eax, %eax
callq 0x6450
movq %r14, %rdi
callq 0x6350
movl %eax, %ebp
movq %r14, %rdi
callq 0x60c0
testl %ebp, %ebp
jne 0x721a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x3bdc4(%rip), %rdi     # 0x42fd0
leaq 0x26df1(%rip), %rsi     # 0x2e004
callq 0x62d0
jmp 0x722d
movq 0x3bdaf(%rip), %rdi     # 0x42fd0
leaq 0x26df1(%rip), %rsi     # 0x2e019
callq 0x62d0
movl $0x2, %edi
callq 0x6340
movq %rax, %r14
movq (%rbx), %rdi
cmpq %r15, %rdi
je 0x724d
movq (%r15), %rsi
incq %rsi
callq 0x60b0
movq %r14, %rdi
callq 0x6310
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/aayush-jaiswal[P]covid-in/include/cxxopts.hpp
// Function: void cxxopts::values::parse_value<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&)
void
    parse_value(const std::string& text, std::vector<T>& value)
    {
      std::stringstream in(text);
      std::string token;
      while(in.eof() == false && std::getline(in, token, CXXOPTS_VECTOR_DELIMITER)) {
        T v;
        parse_value(token, v);
        value.emplace_back(std::move(v));
      }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rsi, %rbx
movq %rdi, %rsi
leaq 0x40(%rsp), %r14
movq %r14, %rdi
movl $0x18, %edx
callq 0x6600
leaq 0x30(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq (%r14), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x60(%rsp,%rax)
jne 0x24690
leaq 0x10(%rsp), %rbp
leaq 0x40(%rsp), %r14
leaq 0x20(%rsp), %r15
movq %rsp, %r12
movq %r14, %rdi
movq %r15, %rsi
movl $0x2c, %edx
callq 0x6030
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x24690
movq %rbp, (%rsp)
movq $0x0, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
callq 0x65c0
movq %rbx, %rdi
movq %r12, %rsi
callq 0x24732
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x24680
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x60b0
movq 0x40(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x60(%rsp,%rax)
je 0x24624
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x246a7
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x60b0
movq 0x1e902(%rip), %rsi     # 0x42fb0
leaq 0x40(%rsp), %rdi
callq 0x63c0
leaq 0xc0(%rsp), %rdi
callq 0x6390
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x246f5
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %rbp, %rdi
je 0x246f5
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x60b0
movq 0x20(%rsp), %rdi
cmpq %r13, %rdi
je 0x2470c
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x60b0
movq 0x1e89d(%rip), %rsi     # 0x42fb0
leaq 0x40(%rsp), %rdi
callq 0x63c0
leaq 0xc0(%rsp), %rdi
callq 0x6390
movq %rbx, %rdi
callq 0x6310
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::operator<<(std::ostream&, lib605::Track&)
std::ostream& operator<< (std::ostream &out, Track &sTrack) {
		out << "Track bit length: ";
		switch(sTrack.GetTrackBitLength()) {
			case Track::TRACK_5_BIT: {
				out << "5" << std::endl;
				break;
			} case Track::TRACK_7_BIT: {
				out << "7" << std::endl;
				break;
			} case Track::TRACK_8_BIT: {
				out << "8" << std::endl;
				break;
			} default: break;
		}
		out << "Data length: " << sTrack.GetTrackDataLength();
		return out;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1bbb(%rip), %rsi      # 0x5000
movl $0x12, %edx
callq 0x3210
movl 0xc(%r14), %eax
cmpq $0x2, %rax
ja 0x349b
leaq 0x1cdc(%rip), %rcx      # 0x513c
movslq (%rcx,%rax,4), %rsi
addq %rcx, %rsi
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3130
leaq 0x1b77(%rip), %rsi      # 0x5019
movl $0xd, %edx
movq %rbx, %rdi
callq 0x3210
movl 0x8(%r14), %esi
movq %rbx, %rdi
callq 0x32d0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::Magstripe::~Magstripe()
Magstripe::~Magstripe(void) {
		// Clean up the tracks
		delete this->Track1;
		delete this->Track2;
		delete this->Track3;
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %r14
testq %r14, %r14
je 0x3540
movq %r14, %rdi
callq 0x32b0
movl $0x10, %esi
movq %r14, %rdi
callq 0x31e0
movq 0x8(%rbx), %r14
testq %r14, %r14
je 0x355e
movq %r14, %rdi
callq 0x32b0
movl $0x10, %esi
movq %r14, %rdi
callq 0x31e0
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
je 0x3583
movq %rbx, %rdi
callq 0x32b0
movl $0x10, %esi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x31e0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::CycleLED()
void MSR::CycleLED(void) noexcept {
		this->SetLED(MSR::MSR_LED::LED_RED);
		std::this_thread::sleep_for(std::chrono::milliseconds(1500));
		this->SetLED(MSR::MSR_LED::LED_YELLOW);
		std::this_thread::sleep_for(std::chrono::milliseconds(1500));
		this->SetLED(MSR::MSR_LED::LED_GREEN);
		std::this_thread::sleep_for(std::chrono::milliseconds(1500));
		this->SetLED(MSR::MSR_LED::LED_OFF);
	}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x4(%rdi)
jne 0x391b
movl (%rbx), %edi
leaq 0x17c5(%rip), %rsi      # 0x50d6
movl $0x8, %edx
callq 0x30b0
leaq 0x8(%rsp), %r14
movq $0x1, (%r14)
movq $0x1dcd6500, 0x8(%r14)  # imm = 0x1DCD6500
movq %r14, %rdi
movq %r14, %rsi
callq 0x3090
cmpl $-0x1, %eax
jne 0x3949
callq 0x3050
cmpl $0x4, (%rax)
je 0x392f
cmpb $0x1, 0x4(%rbx)
jne 0x3962
movl (%rbx), %edi
leaq 0x177b(%rip), %rsi      # 0x50d3
movl $0x8, %edx
callq 0x30b0
leaq 0x8(%rsp), %r14
movq $0x1, (%r14)
movq $0x1dcd6500, 0x8(%r14)  # imm = 0x1DCD6500
movq %r14, %rdi
movq %r14, %rsi
callq 0x3090
cmpl $-0x1, %eax
jne 0x3990
callq 0x3050
cmpl $0x4, (%rax)
je 0x3976
cmpb $0x1, 0x4(%rbx)
jne 0x39a9
movl (%rbx), %edi
leaq 0x1731(%rip), %rsi      # 0x50d0
movl $0x8, %edx
callq 0x30b0
leaq 0x8(%rsp), %r14
movq $0x1, (%r14)
movq $0x1dcd6500, 0x8(%r14)  # imm = 0x1DCD6500
movq %r14, %rdi
movq %r14, %rsi
callq 0x3090
cmpl $-0x1, %eax
jne 0x39d7
callq 0x3050
cmpl $0x4, (%rax)
je 0x39bd
cmpb $0x1, 0x4(%rbx)
jne 0x39f0
movl (%rbx), %edi
leaq 0x16f6(%rip), %rsi      # 0x50dc
movl $0x8, %edx
callq 0x30b0
addq $0x18, %rsp
popq %rbx
popq %r14
retq
jmp 0x39fe
jmp 0x39fe
jmp 0x39fe
movq %rax, %rdi
callq 0x4350
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::MSR()
MSR::MSR(void) noexcept {
		// Set the initial state
		this->MSRConected = false;
		// Give the default device
		this->Device = DEFAULT_DEV;
	}

// Assembly:
pushq %rax
leaq 0x8(%rdi), %rax
leaq 0x18(%rdi), %rcx
movq %rcx, 0x8(%rdi)
movq $0x0, 0x10(%rdi)
xorl %ecx, %ecx
movb %cl, 0x18(%rdi)
movb %cl, 0x4(%rdi)
leaq 0x1637(%rip), %rcx      # 0x5089
movl $0xc, %r8d
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3290
popq %rax
retq
movq %rax, %rdi
callq 0x4350
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::Disconnect()
void MSR::Disconnect(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to disconnect, not connect to device" << std::endl;
#endif
			return;
		}
#if defined(DEBUG)
		std::cout << "[*] Disconnecting from device" << std::end;
#endif
		this->SendReset();
		close(this->devhndl);
		this->MSRConected = false;
	}

// Assembly:
cmpb $0x1, 0x4(%rdi)
jne 0x3afd
pushq %rbx
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0x15e6(%rip), %rsi      # 0x50cd
movl $0x8, %edx
callq 0x30b0
movl (%rbx), %edi
callq 0x3310
movb $0x0, 0x4(%rbx)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::Connect(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool MSR::Connect(std::string Device) {
#if defined(DEBUG)
		std::cout << "[*] Connecting to device '" << Device <<"'" << std::end;
#endif
		if(Device == "") {
			std::cout << "[*] Null device name, unable to connect" << std::endl;
			return false;
		}
		struct termios options;
		if((this->devhndl = open(Device.c_str(), O_RDWR | O_NOCTTY)) < 0) {
#if defined(DEBUG)
			std::cout << "[*] Error opening device for use" << std::endl;
#endif
			return false;
		}
		tcgetattr(this->devhndl, &options);

		options.c_cflag = CS8 | CREAD | CLOCAL;
		options.c_oflag = 0;
		options.c_iflag = 0;

		cfsetispeed(&options, B9600);
		cfsetospeed(&options, B9600);

		tcsetattr(this->devhndl, TCSANOW, &options);

		return (this->MSRConected = true);
	}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x14af(%rip), %rsi      # 0x503e
movq %r14, %rdi
callq 0x3080
testl %eax, %eax
je 0x3c02
movq (%r14), %rdi
movl $0x102, %esi            # imm = 0x102
xorl %eax, %eax
callq 0x3160
movl %eax, (%rbx)
testl %eax, %eax
setns %bpl
js 0x3c46
leaq 0x4(%rsp), %r14
movl %eax, %edi
movq %r14, %rsi
callq 0x3200
movl $0x8b0, 0x8(%r14)       # imm = 0x8B0
movq $0x0, (%r14)
movq %r14, %rdi
movl $0xd, %esi
callq 0x3120
movq %r14, %rdi
movl $0xd, %esi
callq 0x31f0
movl (%rbx), %edi
xorl %esi, %esi
movq %r14, %rdx
callq 0x3230
movb $0x1, 0x4(%rbx)
jmp 0x3c46
movq 0x33cf(%rip), %rbx      # 0x6fd8
leaq 0x1486(%rip), %rsi      # 0x5096
movl $0x27, %edx
movq %rbx, %rdi
callq 0x3210
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x31b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x3040
movq %rax, %rdi
callq 0x3130
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::Initialize()
bool MSR::Initialize(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to initialize, not connect to device" << std::endl;
#endif
			return false;
		}
#if defined(DEBUG)
		std::cout << "[*] Initializing Device" << std::end;
#endif
		this->CycleLED();
#if defined(DEBUG)
		std::cout << "[*] Performing self test" << std::end;
#endif
		this->SetLED(MSR::MSR_LED::LED_YELLOW);
		if(this->TestCommunication() && (this->TestRAM() && this->TestSensor())) {
#if defined(DEBUG)
		std::cout << "[*] Self test succeeded" << std::end;
#endif
			this->SetLED(MSR::MSR_LED::LED_GREEN);
			this->SendReset();
			return true;
		} else {
#if defined(DEBUG)
		std::cout << "[*] Self test failed, RAM or Sensor Error" << std::end;
#endif
			this->SetLED(MSR::MSR_LED::LED_RED);
			return false;
		}
	}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpb $0x1, 0x4(%rdi)
jne 0x3ccb
movq %rdi, %rbx
callq 0x31c0
cmpb $0x1, 0x4(%rbx)
jne 0x3c7c
movl (%rbx), %edi
leaq 0x1461(%rip), %rsi      # 0x50d3
movl $0x8, %edx
callq 0x30b0
movq %rbx, %rdi
callq 0x3190
testb %al, %al
je 0x3ccf
movq %rbx, %rdi
callq 0x3260
testb %al, %al
je 0x3ccf
movq %rbx, %rdi
callq 0x3250
testb %al, %al
je 0x3ccf
cmpb $0x1, 0x4(%rbx)
jne 0x3cb9
movl (%rbx), %edi
leaq 0x1421(%rip), %rsi      # 0x50d0
movl $0x8, %edx
callq 0x30b0
movb $0x1, %bpl
cmpb $0x0, 0x4(%rbx)
je 0x3cea
leaq 0x1404(%rip), %rsi      # 0x50cd
jmp 0x3cde
xorl %ebp, %ebp
jmp 0x3cea
xorl %ebp, %ebp
cmpb $0x1, 0x4(%rbx)
jne 0x3cea
leaq 0x13f8(%rip), %rsi      # 0x50d6
movl (%rbx), %edi
movl $0x8, %edx
callq 0x30b0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::TestCommunication()
bool MSR::TestCommunication(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to test, not connect to device" << std::endl;
#endif
			return false;
		}
#if defined(DEBUG)
		std::cout << "[*] Performing communication test" << std::end;
#endif
		char resp[2];
		this->WriteAutoSize(MSR_COM_TEST);
		if(this->ReadBytes((char*)&resp, 2) != 2) {
#if defined(DEBUG)
			std::cout << "[*] Communication self test failed, expected back 2 bytes" << std::endl;
#endif
			return false;
		}
		if(memcmp(resp, (MSR_ESC "\x79"), 2) != 0) {
#if defined(DEBUG)
			std::cout << "[*] Communication self test failed, expected <ESC>\\x79 got other" << std::endl;
#endif
			return false;
		}
		return true;
	}

// Assembly:
cmpb $0x1, 0x4(%rdi)
jne 0x3d38
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0x13b3(%rip), %rsi      # 0x50be
movl $0x8, %edx
callq 0x30b0
leaq 0xe(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x30a0
cmpl $0x2, %eax
jne 0x3d3b
cmpw $0x791b, 0xe(%rsp)      # imm = 0x791B
sete %al
jmp 0x3d3d
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::TestSensor()
bool MSR::TestSensor(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to test, not connect to device" << std::endl;
#endif
			return false;
		}
#if defined(DEBUG)
		std::cout << "[*] Performing sensor test" << std::end;
#endif
		char resp[2];
		this->WriteAutoSize(MSR_SENS_TEST);
		// The device wont respond unless a reset is issued
		this->SendReset();
		if(this->ReadBytes((char*)&resp, 2) != 2) {
#if defined(DEBUG)
			std::cout << "[*] Sensor self test failed, expected back 2 bytes" << std::endl;
#endif
			return false;
		}
		if(memcmp(resp, MSR_OK, 2) != 0) {
#if defined(DEBUG)
			std::cout << "[*] Sensor self test failed, expected MSR_OK got something else" << std::endl;
#endif
			return false;
		}
		return true;
	}

// Assembly:
cmpb $0x1, 0x4(%rdi)
jne 0x3df1
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl (%rdi), %edi
leaq 0x1319(%rip), %rsi      # 0x50c4
movl $0x8, %edx
callq 0x30b0
cmpb $0x1, 0x4(%rbx)
jne 0x3dce
movl (%rbx), %edi
leaq 0x1309(%rip), %rsi      # 0x50cd
movl $0x8, %edx
callq 0x30b0
leaq 0xe(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x30a0
cmpl $0x2, %eax
jne 0x3df4
cmpw $0x301b, 0xe(%rsp)      # imm = 0x301B
sete %al
jmp 0x3df6
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::ReadBytes(char*, int)
int MSR::ReadBytes(char* buffer, int len) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to read from non-connected device" << std::endl;
#endif
			return -1;
		}
		int temp = 0;
		int count;

		if(buffer == NULL) return -1;

		while(temp != len) {
			count = read(this->devhndl, (buffer + temp), (len - temp));
			if(count < 0) return -1;
			if(count > 0) temp += count;
		}
    	return count;
	}

// Assembly:
testq %rsi, %rsi
je 0x3e80
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r15
cmpb $0x0, 0x4(%rdi)
je 0x3e70
movl %edx, %ebx
movq %rsi, %r14
xorl %ebp, %ebp
movl (%r15), %edi
movl %ebp, %esi
addq %r14, %rsi
movl %ebx, %eax
subl %ebp, %eax
movslq %eax, %rdx
callq 0x3270
testl %eax, %eax
js 0x3e70
addl %eax, %ebp
cmpl %ebx, %ebp
jne 0x3e50
jmp 0x3e75
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::GetModel[abi:cxx11]()
std::string MSR::GetModel(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to get model from non-connected device" << std::endl;
#endif
			return "ERROR";
		}
		char* model = new char[3];
		this->WriteAutoSize(MSR_REQ_MODEL);
		if(this->ReadBytes(model, 3) != 3) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to read model number, expected 3 bytes" << std::endl;
#endif
			return "ERROR";
		}
		if((memcmp((char*)model[0], MSR_ESC, 1) == 0) && model[2] == 'S') {
			model[0] = model[1];
			model[1] = '\0';
			std::string mdl(model);
			delete[] model;
			return mdl;
		}
		return "ERROR";
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x4(%rsi)
je 0x3f17
movq %rsi, %r15
movl $0x3, %edi
callq 0x3030
movq %rax, %r14
movl (%r15), %edi
leaq 0x1233(%rip), %rsi      # 0x50e5
movl $0x8, %edx
callq 0x30b0
movq %r15, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0x30a0
cmpl $0x3, %eax
jne 0x3f17
movsbq (%r14), %rax
cmpb $0x1b, (%rax)
jne 0x3f17
cmpb $0x53, 0x2(%r14)
jne 0x3f17
movb 0x1(%r14), %al
movb %al, (%r14)
movb $0x0, 0x1(%r14)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x3100
movq %r14, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x30c0
movq %r14, %rdi
callq 0x3240
jmp 0x3f34
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x11ba(%rip), %rsi      # 0x50df
leaq 0x11b8(%rip), %rdx      # 0x50e4
movq %rbx, %rdi
callq 0x30c0
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::GetFirmwareVersion[abi:cxx11]()
std::string MSR::GetFirmwareVersion(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to get firmware version from non-connected device" << std::endl;
#endif
			return "ERROR";
		}
		char* version = new char[9];
		this->WriteAutoSize(MSR_REQ_FIRM_VER);
		if(this->ReadBytes(version, 9) == 9) {
#if defined(DEBUG)
			std::cout << "[*] Error: unable to get firmware version" << std::endl;
#endif
			return "ERROR";
		}
		if(memcmp((char*)version[0], MSR_ESC, 1) == 0) {
			version[8] = '\0';
			memmove(version, version+1, strlen(version));
			std::string ver(version);
			delete[] version;
			return ver;
		}
		return "ERROR";
	}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpb $0x0, 0x4(%rsi)
je 0x3fdb
movq %rsi, %r15
movl $0x9, %edi
callq 0x3030
movq %rax, %r14
movl (%r15), %edi
leaq 0x117e(%rip), %rsi      # 0x50e8
movl $0x8, %edx
callq 0x30b0
movq %r15, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x30a0
cmpl $0x9, %eax
je 0x3fdb
movsbq (%r14), %rax
cmpb $0x1b, (%rax)
jne 0x3fdb
movb $0x0, 0x8(%r14)
leaq 0x1(%r14), %r15
movq %r14, %rdi
callq 0x3100
movq %r14, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x32a0
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
movq %r14, %rdi
callq 0x3100
movq %r14, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x30c0
movq %r14, %rdi
callq 0x3240
jmp 0x3ff8
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x10f6(%rip), %rsi      # 0x50df
leaq 0x10f4(%rip), %rdx      # 0x50e4
movq %rbx, %rdi
callq 0x30c0
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::SetCoercivity(lib605::MSR::COERCIVITY)
bool MSR::SetCoercivity(COERCIVITY co) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to set Coercivity, not connect to device" << std::endl;
#endif
			return false;
		}
		char resp[2];
		switch(co) {
			case HI_CO: {
				this->WriteAutoSize(MSR_SET_HI_CO);
				break;
			} case LO_CO: {
				this->WriteAutoSize(MSR_SET_LO_CO);
				break;
			} default: break;
		}
		if(this->ReadBytes(resp, 2) != 2) {
#if defined(DEBUG)
			std::cout << "[*] Error: Unable to set Coercivity, expected 2 bytes" << std::endl;
#endif
			return false;
		}
		if(memcmp(resp, MSR_OK, 2) == 0) {
			return true;
		}
		return false;
	}

// Assembly:
cmpb $0x1, 0x4(%rdi)
jne 0x4160
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testl %esi, %esi
je 0x4163
cmpl $0x1, %esi
jne 0x4176
leaq 0xf63(%rip), %rsi       # 0x50c1
jmp 0x416a
xorl %eax, %eax
retq
leaq 0xf99(%rip), %rsi       # 0x5103
movl (%rbx), %edi
movl $0x8, %edx
callq 0x30b0
leaq 0xe(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x30a0
cmpl $0x2, %eax
jne 0x4199
cmpw $0x301b, 0xe(%rsp)      # imm = 0x301B
sete %al
jmp 0x419b
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::GetCoercivity()
MSR::COERCIVITY MSR::GetCoercivity(void) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to get Coercivity, not connect to device" << std::endl;
#endif
			return MSR::COERCIVITY::ERR;
		}
		char resp[2];
		this->WriteAutoSize(MSR_GET_CO_STAT);
		if(this->ReadBytes(resp, 2) != 2) {
#if defined(DEBUG)
			std::cout << "[*] Error: Unable to get Coercivity, expected 2 bytes" << std::endl;
#endif
			return MSR::COERCIVITY::ERR;
		}
		if(memcmp(resp, MSR_ESC "H", 2) == 0) {
			return MSR::COERCIVITY::HI_CO;
		} else if(memcmp(resp, MSR_ESC "L", 2) == 0) {
			return MSR::COERCIVITY::LO_CO;
		} else {
#if defined(DEBUG)
			std::cout << "[*] Error: Unable to get Coercivity, unexpected value" << std::endl;
#endif
			return MSR::COERCIVITY::ERR;
		}
	}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0x2, %ebx
cmpb $0x1, 0x4(%rdi)
jne 0x41fe
movq %rdi, %r14
movl (%rdi), %edi
leaq 0xf49(%rip), %rsi       # 0x5106
movl $0x8, %edx
callq 0x30b0
leaq 0x6(%rsp), %rsi
movl $0x2, %ebx
movq %r14, %rdi
movl $0x2, %edx
callq 0x30a0
cmpl $0x2, %eax
jne 0x41fe
cmpw $0x481b, 0x6(%rsp)      # imm = 0x481B
je 0x41fc
xorl %ebx, %ebx
cmpw $0x4c1b, 0x6(%rsp)      # imm = 0x4C1B
setne %bl
incl %ebx
jmp 0x41fe
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/geoherna[P]lib605/./src/lib605.cpp
// Function: lib605::MSR::SetLeadingZero(unsigned char, unsigned char)
bool MSR::SetLeadingZero(unsigned char Track1_3, unsigned char Track2) {
		if(!this->MSRConected) {
#if defined(DEBUG)
			std::cout << "[*] Unable to Set leading zero, not connect to device" << std::endl;
#endif
			return false;
		}
		char resp[2];
		char zero_dat[4];

		memcpy(zero_dat, (void*)MSR_SET_LEAD_ZERO, 2);
		memcpy(&zero_dat[2], (void*)&Track1_3, 1);
		memcpy(&zero_dat[3], (void*)&Track2, 1);

		this->WriteBytes(zero_dat, 4);
		if(this->ReadBytes(resp, 2) != 2) {
#if defined(DEBUG)
			std::cout << "[*] Error: Unable to set leading zero, expected 2 bytes" << std::endl;
#endif
			return false;
		}
		if(memcmp(resp, MSR_OK, 2) == 0) {
			return true;
		}
		return false;
	}

// Assembly:
cmpb $0x1, 0x4(%rdi)
jne 0x4259
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0xc(%rsp), %rax
movw $0x7a1b, (%rax)         # imm = 0x7A1B
movb %sil, 0x2(%rax)
movb %dl, 0x3(%rax)
movl (%rdi), %edi
movl $0x4, %edx
movq %rax, %rsi
callq 0x30b0
leaq 0xa(%rsp), %rsi
movq %rbx, %rdi
movl $0x2, %edx
callq 0x30a0
cmpl $0x2, %eax
jne 0x425c
cmpw $0x301b, 0xa(%rsp)      # imm = 0x301B
sete %al
jmp 0x425e
xorl %eax, %eax
retq
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
retq