LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/redblack.c
// Function: rbdelete
RB_STATIC const RB_ENTRY(data_t) * 
RB_ENTRY(delete)(const RB_ENTRY(data_t) *key, struct RB_ENTRY(tree) *rbinfo)
{
	struct RB_ENTRY(node) *x;
	const RB_ENTRY(data_t) * y;

	if (rbinfo==NULL)
		return(NULL);

	x=RB_ENTRY(_traverse)(0, key, rbinfo);

	if (x==RBNULL)
	{
		return(NULL);
	}
	else
	{
		y=RB_GET(x, key);
		RB_ENTRY(_delete)(&rbinfo->rb_root, x);

		return(y);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
testq %rsi, %rsi
je 0x409aaa
movq %rdi, %rsi
xorl %r15d, %r15d
xorl %edi, %edi
movq %rbx, %rdx
callq 0x4096b9
leaq 0x10e901(%rip), %rdx    # 0x5181e8
cmpq %rdx, %rax
je 0x409abe
movq %rax, %r14
cmpq %rdx, (%rax)
je 0x40990c
movq 0x8(%rax), %rcx
movq %rax, %r14
cmpq %rdx, %rcx
je 0x40990c
movq %rcx, %r14
movq (%rcx), %rcx
jmp 0x4098ff
movq (%r14), %rcx
cmpq %rdx, %rcx
jne 0x409918
movq 0x8(%r14), %rcx
movq 0x20(%rax), %r15
addq $0x10, %rbx
movq 0x10(%r14), %rsi
movq %rsi, 0x10(%rcx)
movq 0x10(%r14), %rsi
movq %rbx, %rdi
cmpq %rdx, %rsi
je 0x409940
xorl %edx, %edx
cmpq (%rsi), %r14
setne %dl
leaq (%rsi,%rdx,8), %rdi
movq %rcx, (%rdi)
cmpq %rax, %r14
je 0x409950
movq 0x20(%r14), %rdx
movq %rdx, 0x20(%rax)
cmpl $0x0, 0x18(%r14)
jne 0x409ab6
cmpq %rcx, (%rbx)
je 0x409aaf
xorl %ebp, %ebp
cmpl $0x0, 0x18(%rcx)
jne 0x409aaf
leaq 0x10(%rcx), %r12
movq 0x10(%rcx), %rax
movq (%rax), %rsi
cmpq %rsi, %rcx
je 0x409a0a
cmpl $0x1, 0x18(%rsi)
jne 0x4099aa
movl $0x0, 0x18(%rsi)
movl $0x1, 0x18(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x409ec9
movq (%r12), %rax
movq (%rax), %rsi
movq 0x8(%rsi), %rax
cmpl $0x0, 0x18(%rax)
jne 0x4099c1
movq (%rsi), %rcx
cmpl $0x0, 0x18(%rcx)
je 0x409aa1
movq (%rsi), %rcx
cmpl $0x0, 0x18(%rcx)
jne 0x4099e7
movl $0x0, 0x18(%rax)
movl $0x1, 0x18(%rsi)
movq %rbx, %rdi
callq 0x409e86
movq (%r12), %rax
movq (%rax), %rsi
movq (%r12), %rax
movl 0x18(%rax), %ecx
movl %ecx, 0x18(%rsi)
movl %ebp, 0x18(%rax)
movq (%rsi), %rcx
movl %ebp, 0x18(%rcx)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x409ec9
jmp 0x409a8f
movq 0x8(%rax), %rsi
cmpl $0x1, 0x18(%rsi)
jne 0x409a35
movl $0x0, 0x18(%rsi)
movl $0x1, 0x18(%rax)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x409e86
movq (%r12), %rax
movq 0x8(%rax), %rsi
movq (%rsi), %rax
cmpl $0x0, 0x18(%rax)
jne 0x409a48
movq 0x8(%rsi), %rcx
cmpl $0x0, 0x18(%rcx)
je 0x409aa1
movq 0x8(%rsi), %rcx
cmpl $0x0, 0x18(%rcx)
jne 0x409a70
movl $0x0, 0x18(%rax)
movl $0x1, 0x18(%rsi)
movq %rbx, %rdi
callq 0x409ec9
movq (%r12), %rax
movq 0x8(%rax), %rsi
movq (%r12), %rax
movl 0x18(%rax), %ecx
movl %ecx, 0x18(%rsi)
movl %ebp, 0x18(%rax)
movq 0x8(%rsi), %rcx
movl %ebp, 0x18(%rcx)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x409e86
movq %rbx, %r12
movq (%r12), %rcx
cmpq (%rbx), %rcx
jne 0x409966
jmp 0x409aaf
movl $0x1, 0x18(%rsi)
jmp 0x409a92
xorl %r15d, %r15d
jmp 0x409abe
movl $0x0, 0x18(%rcx)
movq %r14, %rdi
callq 0x444d10
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/redblack.c
// Function: rb_walk
static void
RB_ENTRY(_walk)(const struct RB_ENTRY(node) *x, void (*action)(const RB_ENTRY(data_t) *, const VISIT, const int, void *), void *arg, int level)
{
	if (x==RBNULL)
		return;

	if (x->left==RBNULL && x->right==RBNULL)
	{
		/* leaf */
		(*action)(RB_GET(x, key), leaf, level, arg);
	}
	else
	{
		(*action)(RB_GET(x, key), preorder, level, arg);

		RB_ENTRY(_walk)(x->left, action, arg, level+1);

		(*action)(RB_GET(x, key), postorder, level, arg);

		RB_ENTRY(_walk)(x->right, action, arg, level+1);

		(*action)(RB_GET(x, key), endorder, level, arg);
	}
}

// Assembly:
leaq 0x10e709(%rip), %rax    # 0x5181e8
cmpq %rax, %rdi
je 0x409b7a
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %r14d
movq %rdx, %rbx
movq %rsi, %r8
movq %rdi, %r15
cmpq %rax, (%rdi)
jne 0x409b0a
cmpq %rax, 0x8(%r15)
je 0x409b7b
leaq 0x20(%r15), %r12
movq 0x20(%r15), %rdi
xorl %esi, %esi
movl %r14d, %edx
movq %rbx, %rcx
movq %r8, %r13
callq *%r8
movq (%r15), %rdi
leal 0x1(%r14), %ebp
movq %r13, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x409ad8
movq 0x20(%r15), %rdi
movl $0x1, %esi
movl %r14d, %edx
movq %rbx, %rcx
callq *%r13
movq 0x8(%r15), %rdi
movq %r13, %rsi
movq %rbx, %rdx
movl %ebp, %ecx
callq 0x409ad8
movq %r13, %r8
movl $0x2, %esi
movq (%r12), %rdi
movl %r14d, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmpq *%r8
retq
addq $0x20, %r15
movl $0x3, %esi
movq %r15, %r12
jmp 0x409b5f
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/sobol.c
// Function: sobol_get
int sobol_get(void * state, unsigned int dimension, double * v)
{
  sobol_state_t * s_state = (sobol_state_t *) state;

  unsigned int i_dimension;

  /* Find the position of the least-significant zero in count. */
  int ell = 0;
  int c = s_state->sequence_count;
  while(1) {
    ++ell;
    if((c % 2) == 1) c /= 2;
    else break;
  }

  /* Check for exhaustion. */
  if(ell > SOBOL_BIT_COUNT) {
    // return GSL_EFAILED; /* FIXME: good return code here */
    /////////////////
    sobol_init(state, dimension);

    /* Find the position of the least-significant zero in count. */
    int ell = 0;
    int c = s_state->sequence_count;
    while(1) {
      ++ell;
      if((c % 2) == 1) c /= 2;
      else break;
    }
    /////////////////
  }

  for(i_dimension=0; i_dimension<dimension; i_dimension++) {
    const int direction_i     = s_state->v_direction[ell-1][i_dimension];
    const int old_numerator_i = s_state->last_numerator_vec[i_dimension];
    const int new_numerator_i = old_numerator_i ^ direction_i;
    s_state->last_numerator_vec[i_dimension] = new_numerator_i;
    v[i_dimension] = new_numerator_i * s_state->last_denominator_inv;
  }

  s_state->sequence_count++;

  return GSL_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movl (%rdi), %eax
movl %eax, %ecx
andl $0x80000001, %ecx       # imm = 0x80000001
xorl %r15d, %r15d
cmpl $0x1, %ecx
jne 0x40a16a
xorl %r15d, %r15d
movl %eax, %ecx
incl %r15d
shrl %ecx
testb $0x2, %al
movl %ecx, %eax
jne 0x40a15f
cmpl $0x1e, %r15d
jb 0x40a18c
movq %r14, %rdi
movl %ebp, %esi
callq 0x409f0c
movl (%r14), %eax
movl %eax, %ecx
andl $0x80000001, %ecx       # imm = 0x80000001
shrl %eax
cmpl $0x1, %ecx
je 0x40a17d
testl %ebp, %ebp
je 0x40a1d0
movl %r15d, %ecx
movl %ebp, %eax
leaq (%rcx,%rcx,4), %rcx
shlq $0x5, %rcx
addq %r14, %rcx
addq $0xb0, %rcx
xorl %edx, %edx
movl 0x10(%r14,%rdx,4), %esi
xorl (%rcx,%rdx,4), %esi
movl %esi, 0x10(%r14,%rdx,4)
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd 0x8(%r14), %xmm0
movsd %xmm0, (%rbx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x40a1a9
incl (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi_loadf_main
float *stbi_loadf_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)
{
   unsigned char *data;
   #ifndef STBI_NO_HDR
   if (stbi__hdr_test(s))
      return stbi__hdr_load(s,x,y,comp,req_comp);
   #endif
   data = stbi_load_main(s, x, y, comp, req_comp);
   if (data)
      return stbi__ldr_to_hdr(data, *x, *y, req_comp ? req_comp : *comp);
   return stbi__errpf("unknown image type", "Image not of any known type, or corrupt");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
callq 0x40c871
movq %r14, %rdi
testl %eax, %eax
je 0x40c6f6
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movl %ebp, %r8d
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x40c8cd
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %rcx
movl %ebp, %r8d
callq 0x40a2df
movq %rax, (%rsp)
testq %rax, %rax
je 0x40c840
movl (%r13), %eax
movl (%r12), %ebx
testl %ebp, %ebp
jne 0x40c723
movl (%r15), %ebp
imull %eax, %ebx
movl %ebp, %eax
imull %ebx, %eax
movslq %eax, %rdi
shlq $0x2, %rdi
callq 0x4449d0
testq %rax, %rax
je 0x40c849
movq %rax, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
testl %ebx, %ebx
jle 0x40c830
movq 0x10(%rsp), %rcx
movl %ecx, %eax
andl $0x1, %eax
leal (%rcx,%rax), %r12d
decl %r12d
movslq %ecx, %r13
movl %ebx, %eax
movq %rax, 0x20(%rsp)
leaq (,%r13,4), %rax
movq %rax, 0x18(%rsp)
xorl %r15d, %r15d
movss 0xcab2b(%rip), %xmm1    # 0x4d72b0
movq (%rsp), %rbp
movq 0x8(%rsp), %r14
movl $0x0, %ebx
testl %r12d, %r12d
jle 0x40c7ea
xorl %ebx, %ebx
movzbl (%rbp,%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
cvtss2sd %xmm0, %xmm0
xorps %xmm1, %xmm1
cvtss2sd 0x10ba5f(%rip), %xmm1   # 0x518218
callq 0x417a70
xorps %xmm1, %xmm1
cvtss2sd 0x10ba53(%rip), %xmm1   # 0x51821c
mulsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsd2ss %xmm1, %xmm0
movss 0xcaad4(%rip), %xmm1    # 0x4d72b0
movss %xmm0, (%r14,%rbx,4)
incq %rbx
cmpq %rbx, %r12
jne 0x40c79a
cmpl 0x10(%rsp), %ebx
jge 0x40c81a
movq %r15, %rax
imulq %r13, %rax
movslq %ebx, %rcx
addq %rax, %rcx
movq (%rsp), %rax
movzbl (%rax,%rcx), %eax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
divss %xmm1, %xmm0
movq 0x8(%rsp), %rax
movss %xmm0, (%rax,%rcx,4)
incq %r15
addq 0x18(%rsp), %r14
addq %r13, %rbp
cmpq 0x20(%rsp), %r15
jne 0x40c78e
movq (%rsp), %rdi
callq 0x444d10
movq 0x8(%rsp), %rax
jmp 0x40c862
leaq 0xcaf15(%rip), %rax     # 0x4d775c
jmp 0x40c859
movq (%rsp), %rdi
callq 0x444d10
leaq 0xcb006(%rip), %rax     # 0x4d785f
movq %rax, 0x10ece0(%rip)    # 0x51b540
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: decode_jpeg_header
static int decode_jpeg_header(stbi__jpeg *z, int scan)
{
   int m;
   z->marker = STBI__MARKER_none; // initialize cached marker to empty
   m = stbi__get_marker(z);
   if (!stbi__SOI(m)) return stbi__err("no stbi__SOI","Corrupt JPEG");
   if (scan == SCAN_type) return 1;
   m = stbi__get_marker(z);
   while (!stbi__SOF(m)) {
      if (!stbi__process_marker(z,m)) return 0;
      m = stbi__get_marker(z);
      while (m == STBI__MARKER_none) {
         // some files have extra padding after their blocks, so ok, we'll scan
         if (stbi__at_eof(z->s)) return stbi__err("no stbi__SOF", "Corrupt JPEG");
         m = stbi__get_marker(z);
      }
   }
   if (!stbi__process_frame_header(z, scan)) return 0;
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movb $-0x1, 0x36c8(%rdi)
callq 0x40efc7
cmpb $-0x28, %al
jne 0x40ef3d
movl $0x1, %ebp
cmpl $0x1, %ebx
je 0x40ef4d
movq %r14, %rdi
callq 0x40efc7
movzbl %al, %esi
movl %esi, %eax
andl $-0x2, %eax
cmpl $0xc0, %eax
jne 0x40ef5a
movq %r14, %rdi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x40f2ef
leaq 0xc882b(%rip), %rax     # 0x4d776f
movq %rax, 0x10c5f5(%rip)    # 0x51b540
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
movq %r14, %rdi
callq 0x40effd
testl %eax, %eax
je 0x40ef4d
movq %r14, %rdi
callq 0x40efc7
cmpb $-0x1, %al
jne 0x40efa3
movq (%r14), %r15
cmpq $0x0, 0x10(%r15)
je 0x40ef91
movq 0x28(%r15), %rdi
callq *0x20(%r15)
testl %eax, %eax
je 0x40ef68
cmpl $0x0, 0x30(%r15)
je 0x40efb7
movq 0xb8(%r15), %rax
cmpq 0xc0(%r15), %rax
jb 0x40ef68
jmp 0x40efb7
movzbl %al, %esi
movl %esi, %eax
andl $-0x2, %eax
cmpl $0xc0, %eax
jne 0x40ef5c
jmp 0x40ef29
leaq 0xc87be(%rip), %rax     # 0x4d777c
movq %rax, 0x10c57b(%rip)    # 0x51b540
jmp 0x40ef4d
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__cleanup_jpeg
static void stbi__cleanup_jpeg(stbi__jpeg *j)
{
   int i;
   for (i=0; i < j->s->img_n; ++i) {
      if (j->img_comp[i].raw_data) {
         free(j->img_comp[i].raw_data);
         j->img_comp[i].raw_data = NULL;
         j->img_comp[i].data = NULL;
      }
      if (j->img_comp[i].linebuf) {
         free(j->img_comp[i].linebuf);
         j->img_comp[i].linebuf = NULL;
      }
   }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rax
cmpl $0x0, 0x8(%rax)
jle 0x40f911
movq %rdi, %rbx
leaq 0x35e0(%rdi), %r14
xorl %r15d, %r15d
movq -0x8(%r14), %rdi
testq %rdi, %rdi
je 0x40f8ea
callq 0x444d10
xorps %xmm0, %xmm0
movups %xmm0, -0x10(%r14)
movq (%r14), %rdi
testq %rdi, %rdi
je 0x40f8fe
callq 0x444d10
movq $0x0, (%r14)
incq %r15
movq (%rbx), %rax
movslq 0x8(%rax), %rax
addq $0x48, %r14
cmpq %rax, %r15
jl 0x40f8d4
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__jpeg_decode_block
static int stbi__jpeg_decode_block(stbi__jpeg *j, short data[64], stbi__huffman *hdc, stbi__huffman *hac, int b)
{
   int diff,dc,k;
   int t = stbi__jpeg_huff_decode(j, hdc);
   if (t < 0) return stbi__err("bad huffman code","Corrupt JPEG");

   // 0 all the ac values now so we can do it 32-bits at a time
   memset(data,0,64*sizeof(data[0]));

   diff = t ? stbi__extend_receive(j, t) : 0;
   dc = j->img_comp[b].dc_pred + diff;
   j->img_comp[b].dc_pred = dc;
   data[0] = (short) dc;

   // decode AC components, see JPEG spec
   k = 1;
   do {
      int r,s;
      int rs = stbi__jpeg_huff_decode(j, hac);
      if (rs < 0) return stbi__err("bad huffman code","Corrupt JPEG");
      s = rs & 15;
      r = rs >> 4;
      if (s == 0) {
         if (rs != 0xf0) break; // end block
         k += 16;
      } else {
         k += r;
         // decode into unzigzag'd location
         data[stbi__jpeg_dezigzag[k++]] = (short) stbi__extend_receive(j,s);
      }
   } while (k < 64);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %ebp
movq %rcx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rsi
callq 0x410128
testl %eax, %eax
js 0x40fb2f
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%r14)
movups %xmm0, 0x60(%r14)
movups %xmm0, 0x50(%r14)
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x30(%r14)
movups %xmm0, 0x20(%r14)
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
je 0x40fb42
movq %r15, %rdi
movl %eax, %esi
callq 0x410260
jmp 0x40fb44
leaq 0xc7d95(%rip), %rax     # 0x4d78cb
movq %rax, 0x10ba03(%rip)    # 0x51b540
jmp 0x40fbe4
xorl %eax, %eax
movslq %ebp, %rcx
leaq (%rcx,%rcx,8), %rcx
addl 0x35b8(%r15,%rcx,8), %eax
movl %eax, 0x35b8(%r15,%rcx,8)
movw %ax, (%r14)
movl $0x1, %ebp
leaq 0xc7885(%rip), %r13     # 0x4d73f0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x410128
testl %eax, %eax
js 0x40fba6
movl %eax, %esi
andl $0xf, %esi
je 0x40fbbb
shrl $0x4, %eax
movslq %ebp, %r12
addq %rax, %r12
movq %r15, %rdi
callq 0x410260
leal 0x1(%r12), %ebp
movzbl (%r13,%r12), %ecx
movw %ax, (%r14,%rcx,2)
xorl %ecx, %ecx
jmp 0x40fbcf
leaq 0xc7d1e(%rip), %rax     # 0x4d78cb
movq %rax, 0x10b98c(%rip)    # 0x51b540
movl $0x1, %ecx
jmp 0x40fbcf
leal 0x10(%rbp), %edx
xorl %ecx, %ecx
cmpl $0xf0, %eax
setne %cl
cmovnel %ebp, %edx
addl %ecx, %ecx
movl %edx, %ebp
movl $0x1, %eax
testl %ecx, %ecx
jne 0x40fbdf
cmpl $0x40, %ebp
jl 0x40fb6b
jmp 0x40fbe6
cmpl $0x2, %ecx
je 0x40fbe6
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__extend_receive
stbi_inline static int stbi__extend_receive(stbi__jpeg *j, int n)
{
   unsigned int m = 1 << (n-1);
   unsigned int k;
   if (j->code_bits < n) stbi__grow_buffer_unsafe(j);

   #if 1
   k = stbi_lrot(j->code_buffer, n);
   j->code_buffer = k & ~stbi__bmask[n];
   k &= stbi__bmask[n];
   j->code_bits -= n;
   #else
   k = (j->code_buffer >> (32 - n)) & stbi__bmask[n];
   j->code_bits -= n;
   j->code_buffer <<= n;
   #endif
   // the following test is probably a random branch that won't
   // predict well. I tried to table accelerate it but failed.
   // maybe it's compiling as a conditional move?
   if (k < m)
      return (-1 << n) + k + 1;
   else
      return k;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
cmpl %esi, 0x36c4(%rdi)
jge 0x410279
movq %r14, %rdi
callq 0x4100bf
movl 0x36c0(%r14), %edx
movl %ebx, %ecx
roll %cl, %edx
movl %ebx, %eax
leaq 0xc71b3(%rip), %rcx     # 0x4d7440
movl (%rcx,%rax,4), %eax
movl %eax, %ecx
notl %ecx
andl %edx, %ecx
movl %ecx, 0x36c0(%r14)
subl %ebx, 0x36c4(%r14)
andl %eax, %edx
leal -0x1(%rbx), %ecx
movl %edx, %esi
shrl %cl, %esi
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl %ebx, %ecx
shll %cl, %edi
incl %edi
xorl %eax, %eax
testl %esi, %esi
cmovel %edi, %eax
addl %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__zexpand
static int stbi__zexpand(stbi__zbuf *z, int n)  // need to make room for n bytes
{
   char *q;
   int cur, limit;
   if (!z->z_expandable) return stbi__err("output buffer limit","Corrupt PNG");
   cur   = (int) (z->zout     - z->zout_start);
   limit = (int) (z->zout_end - z->zout_start);
   while (cur + n > limit)
      limit *= 2;
   q = (char *) realloc(z->zout_start, limit);
   if (q == NULL) return stbi__err("outofmem", "Out of memory");
   z->zout_start = q;
   z->zout       = q + cur;
   z->zout_end   = q + limit;
   return 1;
}

// Assembly:
cmpl $0x0, 0x30(%rdi)
je 0x412439
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %r15
movq 0x20(%rdi), %rdi
subq %rdi, %r15
movl 0x28(%rbx), %eax
subl %edi, %eax
addl %r15d, %esi
movl %eax, %ecx
leal (%rcx,%rcx), %eax
cmpl %ecx, %esi
jg 0x412404
movslq %ecx, %r14
movq %r14, %rsi
callq 0x445060
testq %rax, %rax
je 0x41244a
movq %rax, 0x20(%rbx)
movslq %r15d, %rcx
addq %rax, %rcx
movq %rcx, 0x18(%rbx)
addq %rax, %r14
movq %r14, 0x28(%rbx)
movl $0x1, %eax
jmp 0x41245a
leaq 0xc5a4f(%rip), %rax     # 0x4d7e8f
movq %rax, 0x1090f9(%rip)    # 0x51b540
xorl %eax, %eax
retq
leaq 0xc540e(%rip), %rax     # 0x4d785f
movq %rax, 0x1090e8(%rip)    # 0x51b540
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image.c
// Function: stbi__zhuffman_decode
stbi_inline static int stbi__zhuffman_decode(stbi__zbuf *a, stbi__zhuffman *z)
{
   int b,s,k;
   if (a->num_bits < 16) stbi__fill_bits(a);
   b = z->fast[a->code_buffer & STBI__ZFAST_MASK];
   if (b < 0xffff) {
      s = z->size[b];
      a->code_buffer >>= s;
      a->num_bits -= s;
      return z->value[b];
   }

   // not resolved by fast table, so compute it the slow way
   // use jpeg approach, which requires MSbits at top
   k = stbi__bit_reverse(a->code_buffer, 16);
   for (s=STBI__ZFAST_BITS+1; ; ++s)
      if (k < z->maxcode[s])
         break;
   if (s == 16) return -1; // invalid code!
   // code size is s, so:
   b = (k >> (16-s)) - z->firstcode[s] + z->firstsymbol[s];
   STBI_ASSERT(z->size[b] == s);
   a->code_buffer >>= s;
   a->num_bits -= s;
   return z->value[b];
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
cmpl $0xf, 0x10(%rdi)
jg 0x412478
movq %r14, %rdi
callq 0x41238a
movl 0x14(%r14), %esi
movl %esi, %eax
andl $0x1ff, %eax            # imm = 0x1FF
movzwl (%rbx,%rax,2), %eax
cmpq $0xffff, %rax           # imm = 0xFFFF
je 0x41249c
movzbl 0x484(%rbx,%rax), %edx
jmp 0x412523
movl %esi, %eax
rolw $0x8, %ax
movl %eax, %ecx
shrl $0x4, %ecx
movl $0xf0f, %edx            # imm = 0xF0F
andl %edx, %ecx
andl %edx, %eax
shll $0x4, %eax
orl %ecx, %eax
movl $0x3333, %ecx           # imm = 0x3333
movl %eax, %edx
andl %ecx, %edx
shrl $0x2, %eax
andl %ecx, %eax
leal (%rax,%rdx,4), %eax
movl $0x5555, %ecx           # imm = 0x5555
movl %eax, %edx
andl %ecx, %edx
shrl %eax
andl %ecx, %eax
leal (%rax,%rdx,2), %edi
xorl %edx, %edx
movq %rdx, %rax
incq %rdx
cmpl %edi, 0x448(%rbx,%rax,4)
jle 0x4124d8
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $0x7, %rdx
je 0x412537
movb $0x7, %cl
subb %dl, %cl
shrl %cl, %edi
movzwl 0x412(%rbx,%rdx,2), %eax
subq %rax, %rdi
movzwl 0x476(%rbx,%rdx,2), %eax
addq %rdi, %rax
movzbl 0x484(%rbx,%rax), %ecx
addq $-0x9, %rcx
cmpq %rdx, %rcx
jne 0x41253f
addq $0x9, %rdx
movl %edx, %ecx
shrl %cl, %esi
movl %esi, 0x14(%r14)
subl %edx, 0x10(%r14)
movzwl 0x5a4(%rbx,%rax,2), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xc59fc(%rip), %rdi     # 0x4d7f42
leaq 0xc53e1(%rip), %rsi     # 0x4d792e
leaq 0xc59fe(%rip), %rcx     # 0x4d7f52
movl $0x70a, %edx            # imm = 0x70A
callq 0x41fae0
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image_write.c
// Function: stbiw__sbgrowf
static void *stbiw__sbgrowf(void **arr, int increment, int itemsize)
{
   int m = *arr ? 2*stbiw__sbm(*arr)+increment : increment+1;
   void *p = realloc(*arr ? stbiw__sbraw(*arr) : 0, itemsize * m + sizeof(int)*2);
   assert(p);
   if (p) {
      if (!*arr) ((int *) p)[1] = 0;
      *arr = (void *) ((int *) p + 2);
      stbiw__sbm(*arr) = m;
   }
   return *arr;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x4139cf
movl -0x8(%rax), %ecx
leal 0x1(,%rcx,2), %ebp
jmp 0x4139d4
movl $0x2, %ebp
leaq -0x8(%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
imull %ebp, %esi
movslq %esi, %rsi
addq $0x8, %rsi
callq 0x445060
testq %rax, %rax
je 0x413a13
cmpq $0x0, (%rbx)
jne 0x413a00
movl $0x0, 0x4(%rax)
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, (%rbx)
movl %ebp, (%rax)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xe4b94(%rip), %rdi     # 0x4f85ae
leaq 0xc4798(%rip), %rsi     # 0x4d81b9
leaq 0xc4887(%rip), %rcx     # 0x4d82af
movl $0x8c, %edx
callq 0x41fae0
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/stb_image_write.c
// Function: stbi_write_png
int stbi_write_png(char const *filename, int x, int y, int comp, const void *data, int stride_bytes)
{
   FILE *f;
   int len;
   unsigned char *png = stbi_write_png_to_mem((unsigned char *) data, stride_bytes, x, y, comp, &len);
   if (!png) return 0;
   f = fopen(filename, "wb");
   if (!f) { free(png); return 0; }
   fwrite(png, 1, len, f);
   fclose(f);
   free(png);
   return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %r9d, %r10d
movl %ecx, %eax
movl %edx, %ecx
movl %esi, %edx
movq %rdi, %r14
leaq 0xc(%rsp), %r9
movq %r8, %rdi
movl %r10d, %esi
movl %eax, %r8d
callq 0x413b1a
testq %rax, %rax
je 0x414114
movq %rax, %rbx
leaq 0xc1266(%rip), %rsi     # 0x4d5346
movq %r14, %rdi
callq 0x42e3b0
testq %rax, %rax
je 0x414118
movq %rax, %r14
movslq 0xc(%rsp), %rdx
movl $0x1, %esi
movq %rbx, %rdi
movq %rax, %rcx
callq 0x42e700
movq %r14, %rdi
callq 0x42dc80
movl $0x1, %ebp
jmp 0x41411a
xorl %ebp, %ebp
jmp 0x414122
xorl %ebp, %ebp
movq %rbx, %rdi
callq 0x444d10
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/timer.c
// Function: timer
double timer() {
  static bool inited=false;
  static uint64_t start;
  uint64_t stop, dif;

  if(!inited) {
    start=getRawTime();
    inited=true;
  }

  stop=getRawTime();
  dif=stop-start;
  return dif/1000000.0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
cmpb $0x0, 0x107929(%rip)    # 0x51ba90
jne 0x414194
xorl %ebx, %ebx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x480610
testl %eax, %eax
jne 0x414186
imulq $0xf4240, (%rsp), %rbx  # imm = 0xF4240
addq 0x8(%rsp), %rbx
movq %rbx, 0x10790b(%rip)    # 0x51ba98
movb $0x1, 0x1078fc(%rip)    # 0x51ba90
xorl %ebx, %ebx
movq %rsp, %rdi
xorl %esi, %esi
callq 0x480610
testl %eax, %eax
jne 0x4141b1
imulq $0xf4240, (%rsp), %rbx  # imm = 0xF4240
addq 0x8(%rsp), %rbx
subq 0x1078e0(%rip), %rbx    # 0x51ba98
movq %rbx, %xmm1
punpckldq 0xc411b(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0xc4123(%rip), %xmm1    # 0x4d82f0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
divsd 0xc0e2f(%rip), %xmm0    # 0x4d5010
addq $0x10, %rsp
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/tinycthread.c
// Function: thrd_create
int thrd_create(thrd_t *thr, thrd_start_t func, void *arg)
{
  /* Fill out the thread startup information (passed to the thread wrapper,
     which will eventually free it) */
  _thread_start_info* ti = (_thread_start_info*)malloc(sizeof(_thread_start_info));
  if (ti == NULL)
  {
    return thrd_nomem;
  }
  ti->mFunction = func;
  ti->mArg = arg;

  /* Create the thread */
#if defined(_TTHREAD_WIN32_)
  *thr = CreateThread(NULL, 0, _thrd_wrapper_function, (LPVOID) ti, 0, NULL);
#elif defined(_TTHREAD_POSIX_)
  if(pthread_create(thr, NULL, _thrd_wrapper_function, (void *)ti) != 0)
  {
    *thr = 0;
  }
#endif

  /* Did we fail to create the thread? */
  if(!*thr)
  {
    free(ti);
    return thrd_error;
  }

  return thrd_success;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r14
movl $0x10, %edi
callq 0x4449d0
testq %rax, %rax
je 0x41435c
movq %rax, %rbx
movq %r12, (%rax)
movq %r15, 0x8(%rax)
leaq 0x40(%rip), %rdx        # 0x41436d
movq %r14, %rdi
xorl %esi, %esi
movq %rax, %rcx
callq 0x43ada0
testl %eax, %eax
je 0x414345
movq $0x0, (%r14)
movl $0x1, %eax
cmpq $0x0, (%r14)
jne 0x414361
movq %rbx, %rdi
callq 0x444d10
xorl %eax, %eax
jmp 0x414361
movl $0x4, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/tinydir.c
// Function: tinydir_open_sorted
_TINYDIR_FUNC
int tinydir_open_sorted(tinydir_dir *dir, const char *path)
{
	/* Count the number of files first, to pre-allocate the files array */
	size_t n_files = 0;
	if (tinydir_open(dir, path) == -1)
	{
		return -1;
	}
	while (dir->has_next)
	{
		n_files++;
		if (tinydir_next(dir) == -1)
		{
			goto bail;
		}
	}
	tinydir_close(dir);

	if (tinydir_open(dir, path) == -1)
	{
		return -1;
	}

	dir->n_files = 0;
	dir->_files = (tinydir_file *)malloc(sizeof *dir->_files * n_files);
	if (dir->_files == NULL)
	{
		errno = ENOMEM;
		goto bail;
	}
	while (dir->has_next)
	{
		tinydir_file *p_file;
		dir->n_files++;

		p_file = &dir->_files[dir->n_files - 1];
		if (tinydir_readfile(dir, p_file) == -1)
		{
			goto bail;
		}

		if (tinydir_next(dir) == -1)
		{
			goto bail;
		}

		/* Just in case the number of files has changed between the first and
		second reads, terminate without writing into unallocated memory */
		if (dir->n_files == n_files)
		{
			break;
		}
	}

	qsort(dir->_files, dir->n_files, sizeof(tinydir_file), _tinydir_file_cmp);

	return 0;

bail:
	tinydir_close(dir);
	return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r14
callq 0x414448
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x4146af
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpl $0x0, 0x1000(%r14)
je 0x4145c8
incq %r13
movq %r14, %rdi
callq 0x4146c0
addq $0x11a0, %r12           # imm = 0x11A0
cmpl $-0x1, %eax
jne 0x41459a
movq %r14, %rdi
callq 0x414514
jmp 0x4146af
movq %r14, %rdi
callq 0x414514
movq %r14, %rdi
movq %r15, %rsi
callq 0x414448
cmpl $-0x1, %eax
je 0x4146af
movq $0x0, 0x1008(%r14)
movq %r12, %rdi
callq 0x4449d0
movq %rax, 0x1010(%r14)
testq %rax, %rax
je 0x41469f
movl $0x6, %ebp
cmpl $0x0, 0x1000(%r14)
je 0x41467c
movq 0x1008(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x1008(%r14)
imulq $0x11a0, %rax, %rsi     # imm = 0x11A0
addq 0x1010(%r14), %rsi
movq %r14, %rdi
callq 0x41471a
movl $0x4, %r15d
cmpl $-0x1, %eax
je 0x414667
movq %r14, %rdi
callq 0x4146c0
cmpl $-0x1, %eax
je 0x414667
cmpq %r13, 0x1008(%r14)
movl $0x0, %r15d
cmovel %ebp, %r15d
testl %r15d, %r15d
je 0x41460c
cmpl $0x2, %r15d
je 0x4146af
cmpl $0x4, %r15d
je 0x4145bb
movq 0x1008(%r14), %rsi
movq 0x1010(%r14), %rdi
leaq 0x1a8(%rip), %rcx       # 0x414839
movl $0x11a0, %edx           # imm = 0x11A0
callq 0x425ec0
xorl %ebx, %ebx
jmp 0x4146af
callq 0x41f970
movl $0xc, (%rax)
jmp 0x4145bb
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/tinydir.c
// Function: tinydir_get_ext
_TINYDIR_FUNC
void _tinydir_get_ext(tinydir_file *file)
{
	char *period = strrchr(file->name, '.');
	if (period == NULL)
	{
		file->extension = &(file->name[strlen(file->name)]);
	}
	else
	{
		file->extension = period + 1;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1000(%rdi), %r14
movq %r14, %rdi
movl $0x2e, %esi
callq 0x401080
testq %rax, %rax
je 0x414882
incq %rax
jmp 0x41488d
movq %r14, %rdi
callq 0x401138
addq %r14, %rax
movq %rax, 0x1100(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/tinydir.c
// Function: tinydir_readfile_n
_TINYDIR_FUNC
int tinydir_readfile_n(const tinydir_dir *dir, tinydir_file *file, size_t i)
{
	if (dir == NULL || file == NULL)
	{
		errno = EINVAL;
		return -1;
	}
	if (i >= dir->n_files)
	{
		errno = ENOENT;
		return -1;
	}

	memcpy(file, &dir->_files[i], sizeof(tinydir_file));
	_tinydir_get_ext(file);

	return 0;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
setne %al
testq %rsi, %rsi
setne %cl
testb %cl, %al
jne 0x4148ba
callq 0x41f970
movl $0x16, (%rax)
jmp 0x4148f8
cmpq %rdx, 0x1008(%rdi)
jbe 0x4148ed
movq %rsi, %rbx
imulq $0x11a0, %rdx, %rsi     # imm = 0x11A0
addq 0x1010(%rdi), %rsi
movl $0x11a0, %edx           # imm = 0x11A0
movq %rbx, %rdi
callq 0x401058
movq %rbx, %rdi
callq 0x41485d
xorl %eax, %eax
jmp 0x4148fd
callq 0x41f970
movl $0x2, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/tinydir.c
// Function: tinydir_open_subdir_n
_TINYDIR_FUNC
int tinydir_open_subdir_n(tinydir_dir *dir, size_t i)
{
	char path[_TINYDIR_PATH_MAX];
	if (dir == NULL)
	{
		errno = EINVAL;
		return -1;
	}
	if (i >= dir->n_files || !dir->_files[i].is_dir)
	{
		errno = ENOENT;
		return -1;
	}

	strcpy(path, dir->_files[i].path);
	tinydir_close(dir);
	if (tinydir_open_sorted(dir, path) == -1)
	{
		return -1;
	}

	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
testq %rdi, %rdi
je 0x414971
movq %rsi, %rax
movq %rdi, %rbx
cmpq %rsi, 0x1008(%rdi)
jbe 0x414964
movq 0x1010(%rbx), %rsi
imulq $0x11a0, %rax, %rax     # imm = 0x11A0
cmpl $0x0, 0x1108(%rsi,%rax)
je 0x414964
addq %rax, %rsi
movq %rsp, %r14
movq %r14, %rdi
callq 0x401020
movq %rbx, %rdi
callq 0x414514
movq %rbx, %rdi
movq %r14, %rsi
callq 0x414570
movl %eax, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
sete %al
negl %eax
jmp 0x414981
callq 0x41f970
movl $0x2, (%rax)
jmp 0x41497c
callq 0x41f970
movl $0x16, (%rax)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: bilinearTexSampling1
unsigned char bilinearTexSampling1(unsigned char *d, int width, int height,
                                   float u, float v) {
  //from jonolick.com
  int ww = width-1, hh = height-1;
  float fu = (u + 1000.0f) * ww; // NOTE: assumes less than 1000 repeats
  float fv = (v + 1000.0f) * hh;
  int u1 = ((int)fu) % ww;
  int v1 = ((int)fv) % hh;
  int u2 = (u1 + 1) % ww;
  int v2 = (v1 + 1) % hh;
  float fracu = fu - floorf( fu );
  float fracv = fv - floorf( fv );
  float w[4] = {(1 - fracu) * (1 - fracv), fracu * (1 - fracv), (1 - fracu) * fracv, fracu *  fracv};
  unsigned char c[4] = { d[v1*width + u1], d[v1*width + u2], d[v2*width + u1], d[v2*width + u2] };
  return (unsigned char)(c[0]*w[0] + c[1]*w[1] + c[2]*w[2] + c[3]*w[3]);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ecx
movl %esi, %r14d
movq %rdi, %rbx
leal -0x1(%r14), %edi
decl %ecx
movss 0xc382f(%rip), %xmm2    # 0x4d8300
addss %xmm2, %xmm0
cvtsi2ss %edi, %xmm3
mulss %xmm0, %xmm3
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
addss %xmm2, %xmm1
mulss %xmm1, %xmm0
movss %xmm0, 0x4(%rsp)
cvttss2si %xmm3, %eax
movss %xmm3, (%rsp)
cltd
cvttss2si %xmm0, %esi
idivl %edi
movl %edx, %r15d
movl %esi, %eax
cltd
idivl %ecx
movl %edx, %r12d
leal 0x1(%r15), %eax
cltd
idivl %edi
movl %edx, %ebp
leal 0x1(%r12), %eax
cltd
idivl %ecx
movl %edx, %r13d
movaps %xmm3, %xmm0
callq 0x401148
movss (%rsp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, (%rsp)
movss 0x4(%rsp), %xmm0
callq 0x401148
movss 0x4(%rsp), %xmm4
subss %xmm0, %xmm4
movss 0xc093c(%rip), %xmm1    # 0x4d5490
movaps %xmm1, %xmm0
movss (%rsp), %xmm3
subss %xmm3, %xmm0
subss %xmm4, %xmm1
movaps %xmm0, %xmm2
mulss %xmm1, %xmm2
mulss %xmm3, %xmm1
mulss %xmm4, %xmm0
mulss %xmm3, %xmm4
imull %r14d, %r12d
leal (%r12,%r15), %eax
cltq
movzbl (%rbx,%rax), %eax
addl %ebp, %r12d
movslq %r12d, %rcx
movzbl (%rbx,%rcx), %ecx
imull %r14d, %r13d
addl %r13d, %r15d
movslq %r15d, %rdx
movzbl (%rbx,%rdx), %edx
addl %ebp, %r13d
movslq %r13d, %rsi
xorps %xmm3, %xmm3
cvtsi2ss %eax, %xmm3
mulss %xmm2, %xmm3
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
mulss %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
movzbl (%rbx,%rsi), %eax
addss %xmm3, %xmm2
mulss %xmm0, %xmm1
addss %xmm2, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
mulss %xmm4, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: calcBounds
void calcBounds(struct Triangle *triangles,int trianglesNum,
                struct Sphere *spheres,int spheresNum,
                float *minBound,float *maxBound,
                struct BoundingBox *bounds) {
  int i,j;

  //triangle bounds
  for(i=0;i<trianglesNum;i++) {
    triangleBoundingBox(triangles[i].pt0,
                        triangles[i].pt1,
                        triangles[i].pt2,
                        bounds[i].start,
                        bounds[i].end);
  }

  //sphere bounds
  for(i=0;i<spheresNum;i++) {
    sphereBoundingBox(spheres[i].pos,spheres[i].radius,
                      bounds[trianglesNum+i].start,
                      bounds[trianglesNum+i].end);
  }

  //insert primitives here

  //min,max bounds
  if(trianglesNum+spheresNum > 0) {
    for(i=0;i<3;i++) {
      minBound[i]=bounds[0].start[i];
      maxBound[i]=bounds[0].end[i];

      for(j=1;j<trianglesNum+spheresNum;j++) {
        if(bounds[j].start[i] < minBound[i]) {
          minBound[i]=bounds[j].start[i];
        }

        if(bounds[j].end[i] > maxBound[i]) {
          maxBound[i]=bounds[j].end[i];
        }
      }
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r14
movl %ecx, 0x4(%rsp)
movq %rdx, %r12
movl %esi, (%rsp)
testl %esi, %esi
jle 0x415355
movq %rdi, %r13
movl (%rsp), %ebp
addq $0x34, %r13
movq 0x40(%rsp), %r15
leaq -0x18(%r13), %rdi
leaq -0xc(%r13), %rsi
leaq 0xc(%r15), %r8
movq %r13, %rdx
movq %r15, %rcx
callq 0x408b1e
addq $0x18, %r15
addq $0x74, %r13
decq %rbp
jne 0x415331
movl 0x4(%rsp), %ebp
testl %ebp, %ebp
jle 0x415398
movslq (%rsp), %rax
movl %ebp, %r15d
leaq (%rax,%rax,2), %rax
movq 0x40(%rsp), %rcx
leaq (%rcx,%rax,8), %r13
addq $0x1c, %r12
movss 0xc(%r12), %xmm0
leaq 0xc(%r13), %rdx
movq %r12, %rdi
movq %r13, %rsi
callq 0x408ba3
addq $0x18, %r13
addq $0x2c, %r12
decq %r15
jne 0x415375
addl (%rsp), %ebp
movq 0x40(%rsp), %r8
jle 0x41540b
movl %ebp, %eax
leaq 0x24(%r8), %rcx
decq %rax
xorl %edx, %edx
movss (%r8,%rdx,4), %xmm0
movss %xmm0, (%r14,%rdx,4)
movss 0xc(%r8,%rdx,4), %xmm0
movss %xmm0, (%rbx,%rdx,4)
cmpl $0x1, %ebp
je 0x4153fe
movq %rax, %rsi
movq %rcx, %rdi
movss -0xc(%rdi), %xmm0
movss (%r14,%rdx,4), %xmm1
ucomiss %xmm0, %xmm1
jbe 0x4153e6
movss %xmm0, (%r14,%rdx,4)
movss (%rdi), %xmm0
ucomiss (%rbx,%rdx,4), %xmm0
jbe 0x4153f5
movss %xmm0, (%rbx,%rdx,4)
addq $0x18, %rdi
decq %rsi
jne 0x4153d0
incq %rdx
addq $0x4, %rcx
cmpq $0x3, %rdx
jne 0x4153ad
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: calc_pointLight
void calc_pointLight(const struct PointLight *pointLight,
                     const float *toLightDir,
                     float lightDist,
                     const float *rayDir,
                     float shininess,float intensity,
                     const float *nor,
                     float *outCol,float *outSpec) {

  float fromLightDir[3],atten,eyeDir[3],reflectVec[3],NdotL,spec,diffuse;

  //
  vec3_mulScalar(fromLightDir,toLightDir,-1.0f);

  atten = 1.0f/(pointLight->constAtten+
                pointLight->linAtten*lightDist+
                pointLight->quadAtten*lightDist*lightDist);

  vec3_mulScalar(eyeDir,rayDir,-1.0f);

  reflect(reflectVec,fromLightDir,nor);

  NdotL = maxOf(0.0f, vec3_dot(nor, toLightDir));

  spec=0.0f;

  if(NdotL > 0.0f) {
    float EdotR;

    EdotR=maxOf(0.0f, vec3_dot(eyeDir, reflectVec));
    spec+=powf(EdotR,shininess*128.0f) *intensity;
    spec*=atten;
  }

  diffuse=NdotL*atten;

  outCol[0]=pointLight->col[0]*diffuse;
  outCol[1]=pointLight->col[1]*diffuse;
  outCol[2]=pointLight->col[2]*diffuse;

  *outSpec=spec;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, 0x18(%rsp)
movq %r8, %r14
movq %rcx, %r12
movss %xmm2, 0x14(%rsp)
movss %xmm1, 0x10(%rsp)
movq %rdx, %rbx
movss %xmm0, 0x8(%rsp)
movq %rsi, %r13
movq %rdi, %r15
leaq 0x3c(%rsp), %rbp
movss 0xc2ea9(%rip), %xmm0    # 0x4d8304
movq %rbp, %rdi
callq 0x40766c
movss 0x1c(%r15), %xmm0
movss 0x8(%rsp), %xmm2
mulss %xmm2, %xmm0
addss 0x18(%r15), %xmm0
movss 0x20(%r15), %xmm1
mulss %xmm2, %xmm1
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss 0xbfffd(%rip), %xmm0    # 0x4d5490
divss %xmm1, %xmm0
movss %xmm0, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
movq %rbx, %rsi
movss 0xc2e57(%rip), %xmm0    # 0x4d8304
callq 0x40766c
leaq 0x24(%rsp), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x4082e0
movq %r12, %rdi
movq %r13, %rsi
callq 0x407544
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x40834a
xorps %xmm2, %xmm2
ucomiss %xmm2, %xmm0
jbe 0x415530
leaq 0x30(%rsp), %rdi
leaq 0x24(%rsp), %rsi
movss %xmm0, 0xc(%rsp)
callq 0x407544
movaps %xmm0, %xmm1
xorps %xmm0, %xmm0
callq 0x40834a
movss 0x10(%rsp), %xmm1
mulss 0xc2dfa(%rip), %xmm1    # 0x4d8308
callq 0x401038
movaps %xmm0, %xmm2
movss 0xc(%rsp), %xmm0
mulss 0x14(%rsp), %xmm2
addss 0xbff92(%rip), %xmm2    # 0x4d54bc
mulss 0x8(%rsp), %xmm2
movss 0x8(%rsp), %xmm1
mulss %xmm0, %xmm1
movss (%r15), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, (%r14)
movss 0x4(%r15), %xmm0
mulss %xmm1, %xmm0
movss %xmm0, 0x4(%r14)
mulss 0x8(%r15), %xmm1
movss %xmm1, 0x8(%r14)
movq 0x18(%rsp), %rax
movss %xmm2, (%rax)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: lastFileNum
int lastFileNum(const char *folderName) {
  int num=-1;
  tinydir_dir dir;

  if(tinydir_open(&dir, folderName) != -1) {
    while(dir.has_next) {
      tinydir_file file;
      tinydir_readfile(&dir,&file);
      int fnLen=strlen(file.name);

      char numStr[256];
      numStr[0]='\0';
      memset(numStr,0,256);
      if(!file.is_dir) {
        int i,j=0;

        for(i=0;i<fnLen;i++) {

          // if(file.name[i]=='0' && j==0) {
          //   j++;
          // } else
          if(file.name[i]>='0' && file.name[i]<='9') {
            numStr[j++]=file.name[i];

          } else if(j>0) {
            break;
          }
        }

        if(numStr[0]!='\0') {
          // printf("%s\n",numStr);
          int num2=atoi(numStr);

          if(num2 > num) {
            num=num2;
          }
        }
      }

      tinydir_next(&dir);
    }

    tinydir_close(&dir);
  }

  return num;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x22c8, %rsp           # imm = 0x22C8
movq %rdi, %rsi
leaq 0x100(%rsp), %rdi
callq 0x414448
cmpl $-0x1, %eax
je 0x4166ca
cmpl $0x0, 0x1100(%rsp)
je 0x4166d1
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x2128(%rsp), %r14
leaq 0x100(%rsp), %r15
leaq 0x1128(%rsp), %r12
movq %rsp, %r13
movq %r15, %rdi
movq %r12, %rsi
callq 0x41471a
movq %r14, %rdi
callq 0x401138
movq %rax, %rbp
movl $0x100, %edx            # imm = 0x100
movq %r13, %rdi
xorl %esi, %esi
callq 0x4010e0
cmpl $0x0, 0x2230(%rsp)
jne 0x4166b2
testl %ebp, %ebp
jle 0x41669f
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
xorl %eax, %eax
xorl %ecx, %ecx
movb 0x2128(%rsp,%rax), %dl
leal -0x30(%rdx), %esi
cmpb $0x9, %sil
ja 0x416693
movslq %ecx, %rsi
incl %ecx
movb %dl, (%rsp,%rsi)
jmp 0x416697
testl %ecx, %ecx
jg 0x41669f
incq %rax
cmpq %rax, %rbp
jne 0x416679
cmpb $0x0, (%rsp)
je 0x4166b2
movq %r13, %rdi
callq 0x4256a0
cmpl %ebx, %eax
cmovgl %eax, %ebx
movq %r15, %rdi
callq 0x4146c0
cmpl $0x0, 0x1100(%rsp)
jne 0x41663c
jmp 0x4166d6
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4166e3
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
leaq 0x100(%rsp), %rdi
callq 0x414514
movl %ebx, %eax
addq $0x22c8, %rsp           # imm = 0x22C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: DecodeFloatRGBA
float DecodeFloatRGBA(const float *rgba) {
  //dot(rgba, vec4(1.0,1.0/255.0,1.0/65025.0,1.0/16581375.0));
  float x=rgba[0];
  float y=rgba[1]/255.0f;
  float z=rgba[2]/65025.0f;
  float w=rgba[3]/16581375.0f;
  return x+y+z+w;
}

// Assembly:
movss 0x4(%rdi), %xmm0
divss 0xc0b8d(%rip), %xmm0    # 0x4d72b0
movss 0x8(%rdi), %xmm1
divss 0xc1bec(%rip), %xmm1    # 0x4d831c
movss 0xc(%rdi), %xmm2
divss 0xc1be3(%rip), %xmm2    # 0x4d8320
addss (%rdi), %xmm0
addss %xmm1, %xmm0
addss %xmm2, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: EncodeFloatRGBA
void EncodeFloatRGBA(float v,float *out) {
//from aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/
  // 255^0 = 1
  // 255^1 = 255
  // 255^2 = 65025
  // 255^3 = 16581375

  float enc[4];

  //vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * v;
  enc[0]=v;
  enc[1]=v*255.0f;
  enc[2]=v*65025.0f;
  enc[3]=v*16581375.0f;

  //enc-=floor(enc); //enc = frac(enc);
  enc[0]-=floor(enc[0]);
  enc[1]-=floor(enc[1]);
  enc[2]-=floor(enc[2]);
  enc[3]-=floor(enc[3]);

  //enc -= enc.yzww * vec4(1.0/255.0,1.0/255.0,1.0/255.0,0.0);
  out[0]=enc[0]-enc[1]*(1.0f/255.0f);
  out[1]=enc[1]-enc[2]*(1.0f/255.0f);
  out[2]=enc[2]-enc[3]*(1.0f/255.0f);
  out[3]=enc[3];
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movss %xmm0, 0x8(%rsp)
movss 0xc0b50(%rip), %xmm1    # 0x4d72b0
mulss %xmm0, %xmm1
movss %xmm1, (%rsp)
movss 0xc1bab(%rip), %xmm1    # 0x4d831c
mulss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movss 0xc1b9d(%rip), %xmm1    # 0x4d8320
mulss %xmm0, %xmm1
movss %xmm1, 0xc(%rsp)
callq 0x401148
movss 0x8(%rsp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0x8(%rsp)
movss (%rsp), %xmm0
callq 0x401148
movss (%rsp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, (%rsp)
movss 0x4(%rsp), %xmm0
callq 0x401148
movss 0x4(%rsp), %xmm1
subss %xmm0, %xmm1
movss %xmm1, 0x4(%rsp)
movss 0xc(%rsp), %xmm0
callq 0x401148
movss 0xc(%rsp), %xmm4
subss %xmm0, %xmm4
movss 0xc1b32(%rip), %xmm0    # 0x4d8324
movss (%rsp), %xmm3
movaps %xmm3, %xmm1
mulss %xmm0, %xmm1
movss 0x8(%rsp), %xmm2
subss %xmm1, %xmm2
movss %xmm2, (%rbx)
movss 0x4(%rsp), %xmm2
movaps %xmm2, %xmm1
mulss %xmm0, %xmm1
subss %xmm1, %xmm3
movss %xmm3, 0x4(%rbx)
mulss %xmm4, %xmm0
subss %xmm0, %xmm2
movss %xmm2, 0x8(%rbx)
movss %xmm4, 0xc(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: encodeNorSphereMap
void encodeNorSphereMap(const float *n,float *out) {
  //from aras-p.info/texts/CompactNormalStorage.html
  float f = sqrt(8.0f*n[2]+8.0f);
  out[0]=n[0]/ f + 0.5f;
  out[1]=n[1]/ f + 0.5f;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movss 0xc0099(%rip), %xmm1    # 0x4d6950
movss 0x8(%rdi), %xmm0
mulss %xmm1, %xmm0
addss %xmm1, %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x4168d2
sqrtss %xmm0, %xmm0
jmp 0x4168d7
callq 0x4182c0
movss (%r14), %xmm1
divss %xmm0, %xmm1
movss 0xbebc4(%rip), %xmm2    # 0x4d54ac
addss %xmm2, %xmm1
movss %xmm1, (%rbx)
movss 0x4(%r14), %xmm1
divss %xmm0, %xmm1
addss %xmm2, %xmm1
movss %xmm1, 0x4(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: decodeNorSphereMap
void decodeNorSphereMap(const float *enc,float *out) {
  float fenc[2];
  fenc[0]=enc[0]*4.0f-2.0f;
  fenc[1]=enc[1]*4.0f-2.0f;

  float f = fenc[0]*fenc[0]+fenc[1]+fenc[1];
  float g = sqrtf(1.0f-f/4.0f);


  out[0]=fenc[0]*g;
  out[1]=fenc[1]*g;
  out[2]=1.0f-f/2.0f;

}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movss 0xc0016(%rip), %xmm2    # 0x4d6940
movss (%rdi), %xmm3
mulss %xmm2, %xmm3
movss 0xc030a(%rip), %xmm0    # 0x4d6c44
addss %xmm0, %xmm3
mulss 0x4(%rdi), %xmm2
addss %xmm0, %xmm2
movaps %xmm3, %xmm4
mulss %xmm3, %xmm4
addss %xmm2, %xmm4
addss %xmm2, %xmm4
movss 0xc19d2(%rip), %xmm0    # 0x4d8330
mulss %xmm4, %xmm0
addss 0xbeb26(%rip), %xmm0    # 0x4d5490
movq %rsi, %rbx
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jb 0x41697b
sqrtss %xmm0, %xmm0
jmp 0x4169a4
movss %xmm2, 0xc(%rsp)
movss %xmm3, 0x8(%rsp)
movss %xmm4, 0x4(%rsp)
callq 0x4182c0
movss 0x4(%rsp), %xmm4
movss 0x8(%rsp), %xmm3
movss 0xc(%rsp), %xmm2
mulss %xmm0, %xmm3
movss %xmm3, (%rbx)
mulss %xmm0, %xmm2
mulss 0xbeb00(%rip), %xmm4    # 0x4d54b8
movss %xmm2, 0x4(%rbx)
addss 0xbeacb(%rip), %xmm4    # 0x4d5490
movss %xmm4, 0x8(%rbx)
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: bitmapFlipVertical
void bitmapFlipVertical(unsigned char *data,int c, int w, int h) {
  unsigned char *tmp;
  tmp=(unsigned char*)malloc(w*c);
  int i;

  for(i=0;i<h/2;i++) {
    int x=i*c*w;
    int y=(h-1-i)*c*w;
    memcpy(tmp,&data[x],c*w);
    memcpy(&data[x],&data[y],c*w);
    memcpy(&data[y],tmp,c*w);
  }

  free(tmp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movq %rdi, %rbp
imull %edx, %esi
movl %esi, 0x4(%rsp)
movslq %esi, %r15
movq %r15, %rdi
callq 0x4449d0
movq %rax, %r14
cmpl $0x2, %ebx
jl 0x416a6f
movl %ebx, %eax
shrl %eax
decl %ebx
imull 0x4(%rsp), %ebx
xorl %r12d, %r12d
movq %r14, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movslq %r12d, %r12
leaq (%r12,%rbp), %r13
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %rdx
callq 0x401058
movslq %ebx, %rbx
movq %r15, %r14
movq %rbp, %r15
addq %rbx, %rbp
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x401058
movq %rbp, %rdi
movq %r15, %rbp
movq %r14, %r15
movq 0x8(%rsp), %r14
movq %r14, %rsi
movq %r15, %rdx
callq 0x401058
movq 0x10(%rsp), %rax
subl %r15d, %ebx
addl 0x4(%rsp), %r12d
decq %rax
jne 0x416a10
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x444d10
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/utils.c
// Function: stringFromFile
bool stringFromFile(const char *fn, char **str) {
  FILE *file;
  unsigned int dataSize;

  //open file
  file = fopen(fn, "rb");

  if(!file) {
    return false;
  }

  //get data size
  fseek(file,0L,SEEK_END);
  dataSize = ftell(file);
  fseek(file,0L,SEEK_SET);

  //
  (*str)=(char*)malloc(dataSize+1);

  //read data
  (*str)[dataSize]=0;//is not already null terminated?
  fread((*str),1,dataSize,file);

  //close file
  fclose(file);
  return true;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
leaq 0xbffa3(%rip), %rsi     # 0x4d6a37
callq 0x42e3b0
movq %rax, %rbx
testq %rax, %rax
je 0x416af2
movq %rbx, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x432630
movq %rbx, %rdi
callq 0x42e5b0
movq %rax, %r15
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x432630
leal 0x1(%r15), %edi
callq 0x4449d0
movq %rax, (%r14)
movl %r15d, %edx
movb $0x0, (%rax,%rdx)
movl $0x1, %esi
movq %rax, %rdi
movq %rbx, %rcx
callq 0x42e4b0
movq %rbx, %rdi
callq 0x42dc80
testq %rbx, %rbx
setne %al
popq %rbx
popq %r14
popq %r15
retq