LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_remove_tail
void obdeque_remove_tail(obdeque *deque){

  obdeque_node *temp_node;

  assert(deque);

  /* return NULL if the list is empty */
  if(!(temp_node = deque->tail)) return;

  /* repair deque after removal */
  deque->tail = deque->tail->prev;
  if(deque->tail) deque->tail->next = NULL;
  else deque->head = NULL;

  deque->length--;

  /* set temp_node next and prev to null, to separate the node completely from
   * the deque if it lives on through a reference in an iterator */
  temp_node->next = NULL;
  temp_node->prev = NULL;

  ob_release((obj *)temp_node);

  return;
}

// Assembly:
testq %rdi, %rdi
je 0x2a63
movq 0x10(%rdi), %rax
testq %rax, %rax
je 0x2a62
movq 0x18(%rax), %rcx
movq %rcx, 0x10(%rdi)
leaq 0x8(%rdi), %rdx
leaq 0x10(%rcx), %rsi
testq %rcx, %rcx
cmoveq %rdx, %rsi
movq $0x0, (%rsi)
decq 0x18(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq %rax, %rdi
jmp 0x345a
retq
pushq %rax
leaq 0x1d01(%rip), %rdi      # 0x476c
leaq 0x1ba6(%rip), %rsi      # 0x4618
leaq 0x1fbe(%rip), %rcx      # 0x4a37
movl $0x150, %edx            # imm = 0x150
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_remove_at_iterator
void obdeque_remove_at_iterator(obdeque *deque, obdeque_iterator *it){

  obdeque_node *temp_node;

  assert(deque);
  assert(it);
  assert(deque == it->deque); /* ensure that iterator is associated with given
                                 deque */
  if(!it->node) return; /* if iterator points to no node (an empty deque)
                           do nothing */

  if(it->node == deque->head) deque->head = it->node->next;
  if(it->node == deque->tail) deque->tail = it->node->prev;
  if(it->node->prev) it->node->prev->next = it->node->next;
  if(it->node->next) it->node->next->prev = it->node->prev;

  deque->length--;

  temp_node = it->node;

  /* advance iterator to next valid node */
  if(!obdeque_iterate_next(deque, it) && !obdeque_iterate_prev(deque, it))
    it->node = NULL;

  /* set temp_node next and prev to null, to separate the node completely from
   * the deque if it lives on through a reference in an iterator */
  temp_node->next = NULL;
  temp_node->prev = NULL;

  ob_release((obj *)temp_node); /* ob_release reference that deque holds on node */

  return;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2b49
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2b68
movq %rdi, %r15
cmpq %rdi, 0x8(%rbx)
jne 0x2b87
movq 0x10(%rbx), %r14
testq %r14, %r14
je 0x2b3d
cmpq 0x8(%r15), %r14
jne 0x2ac8
movq 0x10(%r14), %rax
movq %rax, 0x8(%r15)
cmpq 0x10(%r15), %r14
jne 0x2ad6
movq 0x18(%r14), %rax
movq %rax, 0x10(%r15)
movq 0x18(%r14), %rax
testq %rax, %rax
je 0x2ae7
movq 0x10(%r14), %rcx
movq %rcx, 0x10(%rax)
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0x2af4
movq %rax, 0x18(%rcx)
leaq 0x10(%r14), %r12
decq 0x18(%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x1ff7
testb %al, %al
jne 0x2b22
movq %r15, %rdi
movq %rbx, %rsi
callq 0x21ae
testb %al, %al
jne 0x2b22
movq $0x0, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x345a
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x1c1c(%rip), %rdi      # 0x476c
leaq 0x1ac1(%rip), %rsi      # 0x4618
leaq 0x1efd(%rip), %rcx      # 0x4a5b
movl $0x16b, %edx            # imm = 0x16B
callq 0x1050
leaq 0x1bed(%rip), %rdi      # 0x475c
leaq 0x1aa2(%rip), %rsi      # 0x4618
leaq 0x1ede(%rip), %rcx      # 0x4a5b
movl $0x16c, %edx            # imm = 0x16C
callq 0x1050
leaq 0x1f0c(%rip), %rdi      # 0x4a9a
leaq 0x1a83(%rip), %rsi      # 0x4618
leaq 0x1ebf(%rip), %rcx      # 0x4a5b
movl $0x16d, %edx            # imm = 0x16D
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_clear
void obdeque_clear(obdeque *deque){

  obdeque_node *tmp, *next;

  assert(deque);

  tmp = deque->head;

  while(tmp){

    next = tmp->next;

    /* remove references to other nodes, individual nodes may live on due to
     * references from iterators */
    tmp->next = NULL;
    tmp->prev = NULL;

    ob_release((obj *)tmp);
    tmp = next;
  }

  deque->head = NULL;
  deque->tail = NULL;
  deque->length = 0;

  return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2bed
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
addq $0x8, %rbx
testq %rdi, %rdi
je 0x2bd7
movq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
callq 0x345a
movq %r14, %rdi
testq %r14, %r14
jne 0x2bbf
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1b78(%rip), %rdi      # 0x476c
leaq 0x1a1d(%rip), %rsi      # 0x4618
leaq 0x1eab(%rip), %rcx      # 0x4aad
movl $0x18e, %edx            # imm = 0x18E
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_destroy_node
void obdeque_destroy_node(obj *to_dealloc){

  /* cast generic obj to obdeque_node */
  obdeque_node *instance = (obdeque_node *)to_dealloc;

  assert(to_dealloc);
  assert(ob_has_class(to_dealloc, "obdeque_node"));

  ob_release(instance->stored);

  return;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2c2f
movq %rdi, %rbx
leaq 0x21b4(%rip), %rsi      # 0x4dd0
callq 0x34d4
testb %al, %al
je 0x2c4e
movq 0x8(%rbx), %rdi
popq %rbx
jmp 0x345a
leaq 0x1ee1(%rip), %rdi      # 0x4b17
leaq 0x19db(%rip), %rsi      # 0x4618
leaq 0x1ede(%rip), %rcx      # 0x4b22
movl $0x1c8, %edx            # imm = 0x1C8
callq 0x1050
leaq 0x1eee(%rip), %rdi      # 0x4b43
leaq 0x19bc(%rip), %rsi      # 0x4618
leaq 0x1ebf(%rip), %rcx      # 0x4b22
movl $0x1c9, %edx            # imm = 0x1C9
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_destroy_iterator
void obdeque_destroy_iterator(obj *to_dealloc){

  /* cast generic obj to obdeque_node */
  obdeque_iterator *instance = (obdeque_iterator *)to_dealloc;

  assert(to_dealloc);
  assert(ob_has_class(to_dealloc, "obdeque_iterator"));

  ob_release((obj *)instance->node);

  return;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x2c90
movq %rdi, %rbx
leaq 0x2163(%rip), %rsi      # 0x4de0
callq 0x34d4
testb %al, %al
je 0x2caf
movq 0x10(%rbx), %rdi
popq %rbx
jmp 0x345a
leaq 0x1e80(%rip), %rdi      # 0x4b17
leaq 0x197a(%rip), %rsi      # 0x4618
leaq 0x1f1d(%rip), %rcx      # 0x4bc2
movl $0x1ef, %edx            # imm = 0x1EF
callq 0x1050
leaq 0x1f31(%rip), %rdi      # 0x4be7
leaq 0x195b(%rip), %rsi      # 0x4618
leaq 0x1efe(%rip), %rcx      # 0x4bc2
movl $0x1f0, %edx            # imm = 0x1F0
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_destroy
void obdeque_destroy(obj *to_dealloc){

  /* cast generic obj to obdeque */
  obdeque *instance = (obdeque *)to_dealloc;

  assert(to_dealloc);
  assert(ob_has_class(to_dealloc, "obdeque"));

  obdeque_clear(instance);

  return;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2d25
movq %rdi, %rbx
leaq 0x2110(%rip), %rsi      # 0x4df1
callq 0x34d4
testb %al, %al
je 0x2d44
movq 0x8(%rbx), %rdi
addq $0x8, %rbx
testq %rdi, %rdi
je 0x2d0f
movq 0x10(%rdi), %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
callq 0x345a
movq %r14, %rdi
testq %r14, %r14
jne 0x2cf7
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x0, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x1deb(%rip), %rdi      # 0x4b17
leaq 0x18e5(%rip), %rsi      # 0x4618
leaq 0x2047(%rip), %rcx      # 0x4d81
movl $0x2cf, %edx            # imm = 0x2CF
callq 0x1050
leaq 0x2052(%rip), %rdi      # 0x4d9d
leaq 0x18c6(%rip), %rsi      # 0x4618
leaq 0x2028(%rip), %rcx      # 0x4d81
movl $0x2d0, %edx            # imm = 0x2D0
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_hash
ob_hash_t obdeque_hash(const obj *to_hash){

  static int8_t init = 0;
  ob_hash_t value;
  static ob_hash_t seed = 0;
  obdeque *instance = (obdeque *)to_hash;
  obdeque_iterator *it;

  assert(to_hash);
  assert(ob_has_class(to_hash, "obdeque"));

  if(init == 0){
    srand(time(NULL));
    seed = rand();
    init = 1;
  }

  value = seed;

  it = obdeque_head_iterator(instance);
  if(!it) return value;

  do{
    value += ob_hash(obdeque_obj_at_iterator(instance, it));
    value += value << 10;
    value ^= value >> 6;
  }while(obdeque_iterate_next(instance, it));

  ob_release((obj *)it);

  value += value << 3;
  value ^= value >> 11;
  value += value << 15;

  return value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x2e59
movq %rdi, %rbx
leaq 0x2076(%rip), %rsi      # 0x4df1
callq 0x34d4
testb %al, %al
je 0x2e78
cmpb $0x0, 0x42f9(%rip)      # 0x7088
jne 0x2db4
xorl %edi, %edi
callq 0x10a0
movl %eax, %edi
callq 0x1070
callq 0x10d0
cltq
movq %rax, 0x42e3(%rip)      # 0x7090
movb $0x1, 0x42d4(%rip)      # 0x7088
movq 0x42d5(%rip), %r14      # 0x7090
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq 0x20f4
testq %rax, %rax
je 0x2e31
movq %rax, %r15
cmpq %rbx, 0x8(%r15)
jne 0x2e3a
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x2de4
movq 0x8(%rax), %rdi
jmp 0x2de6
xorl %edi, %edi
callq 0x3398
addq %r14, %rax
movq %rax, %rcx
shlq $0xa, %rcx
addq %rax, %rcx
movq %rcx, %r14
shrq $0x6, %r14
xorq %rcx, %r14
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1ff7
testb %al, %al
jne 0x2dcf
movq %r15, %rdi
callq 0x345a
leaq (%r14,%r14,8), %rax
movq %rax, %rcx
shrq $0xb, %rcx
xorq %rax, %rcx
movq %rcx, %r14
shlq $0xf, %r14
addq %rcx, %r14
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
leaq 0x191e(%rip), %rdi      # 0x475f
leaq 0x17d0(%rip), %rsi      # 0x4618
leaq 0x1b7c(%rip), %rcx      # 0x49cb
movl $0x12a, %edx            # imm = 0x12A
callq 0x1050
leaq 0x1dda(%rip), %rdi      # 0x4c3a
leaq 0x17b1(%rip), %rsi      # 0x4618
leaq 0x1dd4(%rip), %rcx      # 0x4c42
movl $0x26b, %edx            # imm = 0x26B
callq 0x1050
leaq 0x1de7(%rip), %rdi      # 0x4c66
leaq 0x1792(%rip), %rsi      # 0x4618
leaq 0x1db5(%rip), %rcx      # 0x4c42
movl $0x26c, %edx            # imm = 0x26C
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/theck01[P]offbrand_lib/src/classes/obdeque.c
// Function: obdeque_compare
int8_t obdeque_compare(const obj *a, const obj *b){

  int8_t retval = OB_EQUAL_TO; /* assume equality and disprove if not */
  const obdeque *comp_a = (obdeque *)a;
  const obdeque *comp_b = (obdeque *)b;
  obdeque_iterator *a_it, *b_it;

  assert(a);
  assert(b);
  assert(ob_has_class(a, "obdeque"));
  assert(ob_has_class(b, "obdeque"));

  if(comp_a->length != comp_b->length) return OB_NOT_EQUAL;

  a_it = obdeque_head_iterator(comp_a);
  b_it = obdeque_head_iterator(comp_b);

  if(!a_it && !b_it) return OB_EQUAL_TO;

  if(a_it && b_it){
    do{
      if(ob_compare(obdeque_obj_at_iterator(comp_a, a_it),
                    obdeque_obj_at_iterator(comp_b, b_it)) !=
       OB_EQUAL_TO){
      retval = OB_NOT_EQUAL;
      break;
    }
    }while(obdeque_iterate_next(comp_a, a_it) &&
           obdeque_iterate_next(comp_b, b_it));
  }
  else retval = OB_NOT_EQUAL;

  ob_release((obj *)a_it);
  ob_release((obj *)b_it);

  return retval;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x2fc3
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2fe2
movq %rdi, %r14
leaq 0x1f33(%rip), %rsi      # 0x4df1
callq 0x34d4
testb %al, %al
je 0x3001
leaq 0x1f1f(%rip), %rsi      # 0x4df1
movq %rbx, %rdi
callq 0x34d4
testb %al, %al
je 0x3020
movq 0x18(%r14), %rax
movb $0x2, %bpl
cmpq 0x18(%rbx), %rax
jne 0x2f99
movq 0x8(%r14), %rsi
movq %r14, %rdi
callq 0x20f4
movq %rax, %r15
movq 0x8(%rbx), %rsi
movq %rbx, %rdi
callq 0x20f4
movq %rax, %r12
movq %r15, %rax
orq %r12, %rax
je 0x2f97
testq %r12, %r12
sete %al
testq %r15, %r15
sete %cl
movb $0x2, %bpl
orb %al, %cl
jne 0x2f85
cmpq %r14, 0x8(%r15)
jne 0x2fa4
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x2f41
movq 0x8(%rax), %rdi
jmp 0x2f43
xorl %edi, %edi
cmpq %rbx, 0x8(%r12)
jne 0x2fa4
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x2f5a
movq 0x8(%rax), %rsi
jmp 0x2f5c
xorl %esi, %esi
callq 0x33d7
testb %al, %al
jne 0x2f85
movq %r14, %rdi
movq %r15, %rsi
callq 0x1ff7
testb %al, %al
je 0x2f83
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1ff7
testb %al, %al
jne 0x2f2c
xorl %ebp, %ebp
movq %r15, %rdi
callq 0x345a
movq %r12, %rdi
callq 0x345a
jmp 0x2f99
xorl %ebp, %ebp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17b4(%rip), %rdi      # 0x475f
leaq 0x1666(%rip), %rsi      # 0x4618
leaq 0x1a12(%rip), %rcx      # 0x49cb
movl $0x12a, %edx            # imm = 0x12A
callq 0x1050
leaq 0x1cbd(%rip), %rdi      # 0x4c87
leaq 0x1647(%rip), %rsi      # 0x4618
leaq 0x1cb1(%rip), %rcx      # 0x4c89
movl $0x290, %edx            # imm = 0x290
callq 0x1050
leaq 0x1cd1(%rip), %rdi      # 0x4cba
leaq 0x1628(%rip), %rsi      # 0x4618
leaq 0x1c92(%rip), %rcx      # 0x4c89
movl $0x291, %edx            # imm = 0x291
callq 0x1050
leaq 0x1cb4(%rip), %rdi      # 0x4cbc
leaq 0x1609(%rip), %rsi      # 0x4618
leaq 0x1c73(%rip), %rcx      # 0x4c89
movl $0x292, %edx            # imm = 0x292
callq 0x1050
leaq 0x1cb0(%rip), %rdi      # 0x4cd7
leaq 0x15ea(%rip), %rsi      # 0x4618
leaq 0x1c54(%rip), %rcx      # 0x4c89
movl $0x293, %edx            # imm = 0x293
callq 0x1050
// File: /workspace/github_c_makefile_star2_O1/waywardgeek[P]sonic/sonic_lite.c
// Function: sonicFlushStream
void sonicFlushStream(void) {
  int maxRequired = 2 * SONIC_MAX_PERIOD;
  int remainingSamples = sonicStream.numInputSamples;
  float speed = sonicStream.speed;
  int expectedOutputSamples = sonicStream.numOutputSamples + (int)((remainingSamples / speed) + 0.5f);

  memset(sonicStream.inputBuffer + remainingSamples, 0,
      sizeof(short) * (SONIC_INPUT_BUFFER_SIZE - remainingSamples));
  sonicStream.numInputSamples += 2 * maxRequired;
  sonicWriteShortToStream(NULL, 0);
  /* Throw away any extra samples we generated due to the silence we added */
  if (sonicStream.numOutputSamples > expectedOutputSamples) {
    sonicStream.numOutputSamples = expectedOutputSamples;
  }
  /* Empty input buffer */
  sonicStream.numInputSamples = 0;
  sonicStream.remainingInputToCopy = 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movslq 0x4148(%rip), %rax      # 0x5624
leaq 0x3bc9(%rip), %rcx      # 0x50ac
cvtsi2ss %eax, %xmm0
divss 0x412d(%rip), %xmm0     # 0x561c
addss 0x1b0d(%rip), %xmm0     # 0x3004
cvttss2si %xmm0, %ebx
addl 0x4127(%rip), %ebx      # 0x5628
leaq (%rcx,%rax,2), %rdi
movl $0x146, %edx            # imm = 0x146
subq %rax, %rdx
addq %rdx, %rdx
xorl %r14d, %r14d
xorl %esi, %esi
callq 0x1090
addl $0x1ec, 0x4100(%rip)    # imm = 0x1EC
xorl %edi, %edi
xorl %esi, %esi
callq 0x1551
cmpl %ebx, 0x40f5(%rip)      # 0x5628
jle 0x153b
movl %ebx, 0x40ed(%rip)      # 0x5628
movl %r14d, 0x40e2(%rip)     # 0x5624
movl %r14d, 0x40e3(%rip)     # 0x562c
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/vi[P]simple_cbor_stream_parse/extract_strings.cpp
// Function: main
int main() {
    // Note; on Windows you should also set std::cin to binary mode
    std::ios::sync_with_stdio(false);
    
    MyHandler mh;
    if (!scsp::parse_from_istream(std::cin, mh)) {
        std::cerr << "Error" << std::endl;
        return 1;
    }
    return 0;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x2050
leaq 0x3997(%rip), %rax      # 0x5c18
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movq 0x3d48(%rip), %rdi      # 0x5fd8
callq 0x23a6
testb %al, %al
jne 0x22e0
movq 0x3d50(%rip), %rbx      # 0x5ff0
leaq 0x1d5d(%rip), %rsi      # 0x4004
movl $0x5, %edx
movq %rbx, %rdi
callq 0x20c0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2090
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2070
movl $0x1, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_print_error
void AVI_print_error(char *str)
{
   int aerrno;

   aerrno = (AVI_errno>=0 && AVI_errno<num_avi_errors) ? AVI_errno : num_avi_errors-1;

   fprintf(stderr,"%s: %s\n",str,avi_errors[aerrno]);

   /* for the following errors, perror should report a more detailed reason: */

   if(AVI_errno == AVI_ERR_OPEN ||
      AVI_errno == AVI_ERR_READ ||
      AVI_errno == AVI_ERR_WRITE ||
      AVI_errno == AVI_ERR_WRITE_INDEX ||
      AVI_errno == AVI_ERR_CLOSE )
   {
      perror("REASON");
   }
}

// Assembly:
pushq %rax
movq %rdi, %rdx
movq 0x1193a5(%rip), %rax    # 0x51a530
movl %eax, %ecx
cmpq $0xf, %rax
pushq $0xe
popq %rax
cmovbq %rcx, %rax
movq $0x518868, %rcx         # imm = 0x518868
movq (%rcx), %rdi
leaq 0x116fc7(%rip), %rcx    # 0x518170
movq (%rcx,%rax,8), %rcx
leaq 0xd4177(%rip), %rsi     # 0x4d532b
xorl %eax, %eax
callq 0x427380
movq 0x11936e(%rip), %rax    # 0x51a530
addq $-0x2, %rax
cmpq $0x4, %rax
jbe 0x4011ce
popq %rax
retq
leaq 0xd415e(%rip), %rdi     # 0x4d5333
popq %rax
jmp 0x427800
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_open_output_file
avi_t* AVI_open_output_file(char * filename)
{
   avi_t *AVI;
   int i;

   int mask;

   unsigned char AVI_header[HEADERBYTES];

   /* Allocate the avi_t struct and zero it */

   AVI = (avi_t *) malloc(sizeof(avi_t));
   if(AVI==0)
   {
      AVI_errno = AVI_ERR_NO_MEM;
      return 0;
   }
   memset((void *)AVI,0,sizeof(avi_t));

   /* Since Linux needs a long time when deleting big files,
      we do not truncate the file when we open it.
      Instead it is truncated when the AVI file is closed */

   mask = umask (0);
   umask (mask);

#ifdef WIN32
   AVI->fdes = open(filename, O_RDWR|O_CREAT|O_BINARY, (S_IRUSR | S_IWUSR) &~ mask);
#else
   AVI->fdes = open(filename, O_RDWR|O_CREAT, (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) &~ mask);
#endif
   if (AVI->fdes < 0)
   {
      AVI_errno = AVI_ERR_OPEN;
      free(AVI);
      return 0;
   }

   /* Write out HEADERBYTES bytes, the header will go here
      when we are finished with writing */

   for (i=0;i<HEADERBYTES;i++) AVI_header[i] = 0;
   i = avi_write(AVI->fdes,(char *)AVI_header,HEADERBYTES);
   if (i != HEADERBYTES)
   {
      close(AVI->fdes);
      AVI_errno = AVI_ERR_WRITE;
      free(AVI);
      return 0;
   }

   AVI->pos  = HEADERBYTES;
   AVI->mode = AVI_MODE_WRITE; /* open for writing */

   //init
   AVI->anum = 0;
   AVI->aptr = 0;

   return AVI;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movq %rdi, %r14
movl $0x488, %edi            # imm = 0x488
callq 0x4449d0
testq %rax, %rax
je 0x401a63
movq %rax, %rbx
movl $0x488, %edx            # imm = 0x488
movq %rax, %rdi
xorl %esi, %esi
callq 0x4010e0
xorl %edi, %edi
callq 0x4815b0
movl %eax, %ebp
notl %ebp
movl %eax, %edi
callq 0x4815b0
andl $0x1a4, %ebp            # imm = 0x1A4
movq %r14, %rdi
movl $0x42, %esi
movl %ebp, %edx
xorl %eax, %eax
callq 0x4815f0
movl %eax, %ebp
cltq
movq %rax, (%rbx)
testl %ebp, %ebp
js 0x401a70
movq %rsp, %rdi
xorl %r14d, %r14d
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x4010e0
leaq (%rsp,%r14), %rsi
movl $0x800, %edx            # imm = 0x800
subq %r14, %rdx
movl %ebp, %edi
callq 0x4817c0
testq %rax, %rax
js 0x401a7d
addq %rax, %r14
cmpq $0x800, %r14            # imm = 0x800
jb 0x401a3d
jmp 0x401a80
movq $0x8, 0x118ac2(%rip) # 0x51a530
jmp 0x401abd
movq $0x2, 0x118ab5(%rip) # 0x51a530
jmp 0x401ab5
movq %rax, %r14
cmpl $0x800, %r14d           # imm = 0x800
jne 0x401aa3
movq $0x800, 0x3e0(%rbx) # imm = 0x800
xorl %eax, %eax
movq %rax, 0x8(%rbx)
movq %rax, 0x438(%rbx)
jmp 0x401abf
movl %ebp, %edi
callq 0x4819c0
movq $0x4, 0x118a7b(%rip) # 0x51a530
movq %rbx, %rdi
callq 0x444d10
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_set_video
void AVI_set_video(avi_t *AVI, int width, int height, double fps, const char *compressor)
{
   /* may only be called if file is open for writing */

   if(AVI->mode==AVI_MODE_READ) return;

   AVI->width  = width;
   AVI->height = height;
   AVI->fps    = fps;

   if(strncmp(compressor, "RGB", 3)==0) {
     memset(AVI->compressor, 0, 4);
   } else {
     memcpy(AVI->compressor,compressor,4);
   }

   AVI->compressor[4] = 0;

   avi_update_header(AVI);
}

// Assembly:
cmpq $0x1, 0x8(%rdi)
jne 0x401ad6
retq
pushq %r14
pushq %rbx
pushq %rax
movq %rcx, %r14
movq %rdi, %rbx
movslq %esi, %rax
movq %rax, 0x10(%rdi)
movslq %edx, %rax
movq %rax, 0x18(%rdi)
movsd %xmm0, 0x20(%rdi)
leaq 0xd3576(%rip), %rsi     # 0x4d5070
movl $0x3, %edx
movq %rcx, %rdi
callq 0x4010b0
testl %eax, %eax
je 0x401b10
movl (%r14), %eax
jmp 0x401b12
xorl %eax, %eax
movl %eax, 0x28(%rbx)
movb $0x0, 0x2c(%rbx)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x401b28
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_write_frame
int AVI_write_frame(avi_t *AVI, char *data, long bytes, int keyframe)
{
  unsigned long pos;

  if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }

  pos = AVI->pos;

  if(avi_write_data(AVI,data,bytes,0,keyframe)) return -1;

  AVI->last_pos = pos;
  AVI->last_len = bytes;
  AVI->video_frames++;
  return 0;
}

// Assembly:
cmpq $0x1, 0x8(%rdi)
jne 0x4021cd
movq $0x7, 0x118369(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %r15
pushq %r14
pushq %rbx
movl %ecx, %r8d
movq %rdx, %rbx
movq %rdi, %r14
movq 0x3e0(%rdi), %r15
xorl %ecx, %ecx
callq 0x40220e
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x402208
movq %r15, 0x418(%r14)
movq %rbx, 0x420(%r14)
incq 0x40(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: avi_write_data
static int avi_write_data(avi_t *AVI, char *data, unsigned long length, int audio, int keyframe)
{
   int n;

   unsigned char astr[5];

   /* Check for maximum file length */

   if ( (AVI->pos + 8 + length + 8 + (AVI->n_idx+1)*16) > AVI_MAX_LEN ) {
     AVI_errno = AVI_ERR_SIZELIM;
     return -1;
   }

   /* Add index entry */

   //set tag for current audio track
   sprintf((char *)astr, "0%1dwb", (int)(AVI->aptr+1));

   if(audio)
     n = avi_add_index_entry(AVI,astr,0x00,AVI->pos,length);
   else
     n = avi_add_index_entry(AVI,(unsigned char *)"00db",((keyframe)?0x10:0x0),AVI->pos,length);

   if(n) return -1;

   /* Output tag and data */

   if(audio)
     n = avi_add_chunk(AVI,astr,(unsigned char *)data,length);
   else
     n = avi_add_chunk(AVI,(unsigned char *)"00db",(unsigned char *)data,length);

   if (n) return -1;

   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq 0x3e8(%rdi), %rax
shlq $0x4, %rax
movq 0x3e0(%rdi), %rcx
addq %rdx, %rcx
addq %rax, %rcx
movabsq $-0xfefff800, %rax      # imm = 0xFFFFFFFF01000800
addq %rax, %rcx
addq $0x20, %rcx
cmpq %rax, %rcx
jae 0x40225e
movq $0x1, 0x1182dc(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x4022f3
movl %r8d, %r13d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl 0x43c(%rdi), %edx
incl %edx
leaq 0xd30c9(%rip), %rsi     # 0x4d5342
leaq 0x3(%rsp), %r12
movq %r12, %rdi
xorl %eax, %eax
callq 0x4275d0
testl %ebp, %ebp
je 0x40229f
movq 0x3e0(%r15), %rcx
leaq 0x3(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
jmp 0x4022bb
xorl %edx, %edx
testl %r13d, %r13d
setne %dl
shll $0x4, %edx
movq 0x3e0(%r15), %rcx
leaq 0xd2e45(%rip), %rsi     # 0x4d50fd
movq %r15, %rdi
movq %rbx, %r8
callq 0x402364
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x4022f3
testl %ebp, %ebp
leaq 0xd2e26(%rip), %rax     # 0x4d50fd
cmoveq %rax, %r12
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
movl %ebx, %ecx
callq 0x404729
movl %eax, %ecx
xorl %eax, %eax
negl %ecx
sbbl %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/avilib.c
// Function: AVI_dup_frame
int AVI_dup_frame(avi_t *AVI)
{
   if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }

   if(AVI->last_pos==0) return 0; /* No previous real frame */
   if(avi_add_index_entry(AVI,(unsigned char *)"00db",0x10,AVI->last_pos,AVI->last_len)) return -1;
   AVI->video_frames++;
   AVI->must_use_index = 1;
   return 0;
}

// Assembly:
cmpq $0x1, 0x8(%rdi)
jne 0x40231a
movq $0x7, 0x11821c(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %rbx
movq %rdi, %rbx
movq 0x418(%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x402362
movq 0x420(%rbx), %r8
leaq 0xd2dc3(%rip), %rsi     # 0x4d50fd
movl $0x10, %edx
movq %rbx, %rdi
callq 0x402364
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x402362
incq 0x40(%rbx)
movl $0x1, 0x428(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: avi_add_index_entry
static int avi_add_index_entry(avi_t *AVI, unsigned char *tag, long flags, unsigned long pos, unsigned long len)
{
   void *ptr;

   if(AVI->n_idx>=AVI->max_idx) {
     ptr = realloc((void *)AVI->idx,(AVI->max_idx+4096)*16);

     if(ptr == 0) {
       AVI_errno = AVI_ERR_NO_MEM;
       return -1;
     }
     AVI->max_idx += 4096;
     AVI->idx = (unsigned char((*)[16]) ) ptr;
   }

   /* Add index entry */

   //   fprintf(stderr, "INDEX %s %ld %lu %lu\n", tag, flags, pos, len);

   memcpy(AVI->idx[AVI->n_idx],tag,4);
   long2str(AVI->idx[AVI->n_idx]+ 4,flags);
   long2str(AVI->idx[AVI->n_idx]+ 8, pos);
   long2str(AVI->idx[AVI->n_idx]+12, len);

   /* Update counter */

   AVI->n_idx++;

   if(len>AVI->max_len) AVI->max_len=len;

   return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %r8, %rbx
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r14
movq 0x3f0(%rdi), %rsi
cmpq %rsi, 0x3e8(%rdi)
jl 0x4023be
movq 0x408(%r14), %rdi
shlq $0x4, %rsi
addq $0x10000, %rsi          # imm = 0x10000
callq 0x445060
testq %rax, %rax
je 0x402430
addq $0x1000, 0x3f0(%r14) # imm = 0x1000
movq %rax, 0x408(%r14)
movq 0x3e8(%r14), %rax
movq 0x408(%r14), %rcx
shlq $0x4, %rax
movl (%r13), %edx
movl %edx, (%rcx,%rax)
movq 0x3e8(%r14), %rax
movq 0x408(%r14), %rcx
shlq $0x4, %rax
movl %r12d, 0x4(%rcx,%rax)
movq 0x3e8(%r14), %rax
movq 0x408(%r14), %rcx
shlq $0x4, %rax
movl %r15d, 0x8(%rcx,%rax)
movq 0x3e8(%r14), %rax
movq 0x408(%r14), %rcx
shlq $0x4, %rax
movl %ebx, 0xc(%rcx,%rax)
incq 0x3e8(%r14)
xorl %eax, %eax
cmpq %rbx, 0x58(%r14)
jae 0x402440
movq %rbx, 0x58(%r14)
jmp 0x402440
movq $0x8, 0x1180f5(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_append_audio
int AVI_append_audio(avi_t *AVI, char *data, long bytes)
{

  long i, length, pos;
  unsigned char c[4];

  if(AVI->mode==AVI_MODE_READ) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }

  // update last index entry:

  --AVI->n_idx;
  length = str2ulong(AVI->idx[AVI->n_idx]+12);
  pos    = str2ulong(AVI->idx[AVI->n_idx]+8);

  //update;
  long2str(AVI->idx[AVI->n_idx]+12,length+bytes);

  ++AVI->n_idx;

  AVI->track[AVI->aptr].audio_bytes += bytes;

  //update chunk header
  lseek(AVI->fdes, pos+4, SEEK_SET);
  long2str(c, length+bytes);
  avi_write(AVI->fdes, (char *)c, 4);

  lseek(AVI->fdes, pos+8+length, SEEK_SET);

  i=PAD_EVEN(length + bytes);

  bytes = i - length;
  avi_write(AVI->fdes, data, bytes);
  AVI->pos = pos + 8 + i;

  return 0;
}

// Assembly:
cmpq $0x1, 0x8(%rdi)
jne 0x4024b9
movq $0x7, 0x11807d(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x3e8(%rdi), %rax
movq 0x408(%rdi), %rcx
decq %rax
movq %rax, 0x3e8(%rdi)
shlq $0x4, %rax
movslq 0xc(%rcx,%rax), %rsi
movslq 0x8(%rcx,%rax), %r13
movq %rsi, 0x8(%rsp)
leaq (%rsi,%rdx), %r12
movl %r12d, 0xc(%rcx,%rax)
incq 0x3e8(%rdi)
movslq 0x43c(%rdi), %rax
imulq $0x70, %rax, %rax
addq %rdx, 0x90(%rdi,%rax)
movl (%rdi), %edi
leaq 0x4(%r13), %rsi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x481860
movl %r12d, 0x4(%rsp)
movl (%rbx), %ebp
leaq (%rsp,%r15), %rsi
addq $0x4, %rsi
movl $0x4, %edx
subq %r15, %rdx
movl %ebp, %edi
callq 0x4817c0
testq %rax, %rax
js 0x402557
addq %rax, %r15
cmpq $0x4, %r15
jb 0x402532
movl (%rbx), %edi
movq 0x8(%rsp), %r15
leaq (%r15,%r13), %rsi
addq $0x8, %rsi
addq $0x8, %r13
movq %r13, 0x10(%rsp)
xorl %edx, %edx
callq 0x481860
incq %r12
andq $-0x2, %r12
movq %r12, %r13
subq %r15, %r13
je 0x4025a9
movl (%rbx), %r15d
xorl %ebp, %ebp
leaq (%r14,%rbp), %rsi
movq %r13, %rdx
subq %rbp, %rdx
movl %r15d, %edi
callq 0x4817c0
testq %rax, %rax
js 0x4025a9
addq %rax, %rbp
cmpq %r13, %rbp
jb 0x40258a
movq 0x10(%rsp), %rax
addq %r12, %rax
movq %rax, 0x3e0(%rbx)
xorl %eax, %eax
addq $0x18, %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/avilib.c
// Function: AVI_open_input_file
avi_t *AVI_open_input_file(const char *filename, int getIndex)
{
  avi_t *AVI=NULL;

  /* Create avi_t structure */

  AVI = (avi_t *) malloc(sizeof(avi_t));
  if(AVI==NULL)
    {
      AVI_errno = AVI_ERR_NO_MEM;
      return 0;
    }
  memset((void *)AVI,0,sizeof(avi_t));

  AVI->mode = AVI_MODE_READ; /* open for reading */

  /* Open the file */

#ifdef WIN32
  AVI->fdes = open(filename,O_RDONLY|O_BINARY);
#else
  AVI->fdes = open(filename,O_RDONLY);
#endif
  if(AVI->fdes < 0)
    {
      AVI_errno = AVI_ERR_OPEN;
      free(AVI);
      return 0;
    }

  avi_parse_input_file(AVI, getIndex);

  AVI->aptr=0; //reset

  return AVI;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl $0x488, %edi            # imm = 0x488
callq 0x4449d0
testq %rax, %rax
je 0x402ec6
movq %rax, %rbx
movl $0x488, %edx            # imm = 0x488
movq %rax, %rdi
xorl %esi, %esi
callq 0x4010e0
movq $0x1, 0x8(%rbx)
movq %r14, %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x4815f0
cltq
movq %rax, (%rbx)
testl %eax, %eax
js 0x402ed3
movq %rbx, %rdi
movl %ebp, %esi
callq 0x402ef0
movl $0x0, 0x43c(%rbx)
jmp 0x402ee8
movq $0x8, 0x11765f(%rip) # 0x51a530
jmp 0x402ee6
movq $0x2, 0x117652(%rip) # 0x51a530
movq %rbx, %rdi
callq 0x444d10
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_open_fd
avi_t *AVI_open_fd(int fd, int getIndex)
{
  avi_t *AVI=NULL;

  /* Create avi_t structure */

  AVI = (avi_t *) malloc(sizeof(avi_t));
  if(AVI==NULL)
    {
      AVI_errno = AVI_ERR_NO_MEM;
      return 0;
    }
  memset((void *)AVI,0,sizeof(avi_t));

  AVI->mode = AVI_MODE_READ; /* open for reading */

  // file alread open
  AVI->fdes = fd;

  avi_parse_input_file(AVI, getIndex);

  AVI->aptr=0; //reset

  return AVI;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movl %edi, %r14d
movl $0x488, %edi            # imm = 0x488
callq 0x4449d0
testq %rax, %rax
je 0x403e27
movq %rax, %rbx
movl $0x488, %edx            # imm = 0x488
movq %rax, %rdi
xorl %esi, %esi
callq 0x4010e0
movq $0x1, 0x8(%rbx)
movslq %r14d, %rax
movq %rax, (%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x402ef0
movl $0x0, 0x43c(%rbx)
jmp 0x403e34
movq $0x8, 0x1166fe(%rip) # 0x51a530
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_frame_size
long AVI_frame_size(avi_t *AVI, long frame)
{
   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->video_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if(frame < 0 || frame >= AVI->video_frames) return 0;
   return(AVI->video_index[frame].len);
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x403f3d
movq 0x410(%rdi), %rax
testq %rax, %rax
je 0x403f4d
testq %rsi, %rsi
js 0x403f4a
cmpq %rsi, 0x40(%rdi)
jle 0x403f4a
leaq (%rsi,%rsi,2), %rcx
movq 0x10(%rax,%rcx,8), %rax
retq
movq $0x7, 0x1165e8(%rip) # 0x51a530
jmp 0x403f58
xorl %eax, %eax
retq
movq $0xd, 0x1165d8(%rip) # 0x51a530
movq $-0x1, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_audio_size
long AVI_audio_size(avi_t *AVI, long frame)
{
  if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
  if(!AVI->track[AVI->aptr].audio_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

  if(frame < 0 || frame >= AVI->track[AVI->aptr].audio_chunks) return 0;
  return(AVI->track[AVI->aptr].audio_index[frame].len);
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x403f9b
movslq 0x43c(%rdi), %rax
imulq $0x70, %rax, %rcx
movq 0xc8(%rdi,%rcx), %rax
testq %rax, %rax
je 0x403fab
testq %rsi, %rsi
js 0x403fa8
addq %rdi, %rcx
addq $0x60, %rcx
cmpq %rsi, 0x38(%rcx)
jle 0x403fa8
leaq (%rsi,%rsi,2), %rcx
movq 0x8(%rax,%rcx,8), %rax
retq
movq $0x7, 0x11658a(%rip) # 0x51a530
jmp 0x403fb6
xorl %eax, %eax
retq
movq $0xd, 0x11657a(%rip) # 0x51a530
movq $-0x1, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_get_video_position
long AVI_get_video_position(avi_t *AVI, long frame)
{
   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->video_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if(frame < 0 || frame >= AVI->video_frames) return 0;
   return(AVI->video_index[frame].pos);
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x403fe6
movq 0x410(%rdi), %rax
testq %rax, %rax
je 0x403ff6
testq %rsi, %rsi
js 0x403ff3
cmpq %rsi, 0x40(%rdi)
jle 0x403ff3
leaq (%rsi,%rsi,2), %rcx
movq 0x8(%rax,%rcx,8), %rax
retq
movq $0x7, 0x11653f(%rip) # 0x51a530
jmp 0x404001
xorl %eax, %eax
retq
movq $0xd, 0x11652f(%rip) # 0x51a530
movq $-0x1, %rax
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_seek_start
int AVI_seek_start(avi_t *AVI)
{
   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }

   lseek(AVI->fdes,AVI->movi_start,SEEK_SET);
   AVI->video_pos = 0;
   return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x404032
movq %rdi, %rbx
movl (%rdi), %edi
movq 0x430(%rbx), %rsi
xorl %ebp, %ebp
xorl %edx, %edx
callq 0x481860
movq $0x0, 0x50(%rbx)
jmp 0x404042
movq $0x7, 0x1164f3(%rip) # 0x51a530
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_set_video_position
int AVI_set_video_position(avi_t *AVI, long frame)
{
   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->video_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if (frame < 0 ) frame = 0;
   AVI->video_pos = frame;
   return 0;
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x40406a
cmpq $0x0, 0x410(%rdi)
je 0x404077
xorl %eax, %eax
testq %rsi, %rsi
cmovleq %rax, %rsi
movq %rsi, 0x50(%rdi)
retq
movq $0x7, 0x1164bb(%rip) # 0x51a530
jmp 0x404082
movq $0xd, 0x1164ae(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_read_frame
long AVI_read_frame(avi_t *AVI, char *vidbuf, int *keyframe)
{
   long n;

   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->video_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if(AVI->video_pos < 0 || AVI->video_pos >= AVI->video_frames) return -1;
   n = AVI->video_index[AVI->video_pos].len;

   *keyframe = (AVI->video_index[AVI->video_pos].key==0x10) ? 1:0;

   lseek(AVI->fdes, AVI->video_index[AVI->video_pos].pos, SEEK_SET);

   if (avi_read(AVI->fdes,vidbuf,n) != n)
   {
      AVI_errno = AVI_ERR_READ;
      return -1;
   }

   AVI->video_pos++;

   return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x40415f
movq %rdi, %r14
movq 0x410(%rdi), %rax
testq %rax, %rax
je 0x40416c
movq 0x50(%r14), %rcx
movq $-0x1, %rbx
testq %rcx, %rcx
js 0x40417e
cmpq 0x40(%r14), %rcx
jge 0x40417e
movq %rsi, %r15
leaq (%rcx,%rcx,2), %rcx
movq 0x10(%rax,%rcx,8), %r12
xorl %esi, %esi
cmpq $0x10, (%rax,%rcx,8)
sete %sil
movl %esi, (%rdx)
movl (%r14), %edi
movq 0x8(%rax,%rcx,8), %rsi
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x481860
testq %r12, %r12
je 0x404151
movl (%r14), %ebp
xorl %r13d, %r13d
leaq (%r15,%r13), %rsi
movq %r12, %rdx
subq %r13, %rdx
movl %ebp, %edi
callq 0x481720
testq %rax, %rax
jle 0x404151
addq %rax, %r13
cmpq %r12, %r13
jb 0x404133
cmpq %r12, %r13
jne 0x404190
incq 0x50(%r14)
movq %r12, %rbx
jmp 0x40417e
movq $0x7, 0x1163c6(%rip) # 0x51a530
jmp 0x404177
movq $0xd, 0x1163b9(%rip) # 0x51a530
movq $-0x1, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x3, 0x116395(%rip) # 0x51a530
jmp 0x40417e
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_set_audio_position
int AVI_set_audio_position(avi_t *AVI, long byte)
{
   long n0, n1, n;

   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->track[AVI->aptr].audio_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if(byte < 0) byte = 0;

   /* Binary search in the audio chunks */

   n0 = 0;
   n1 = AVI->track[AVI->aptr].audio_chunks;

   while(n0<n1-1)
   {
      n = (n0+n1)/2;
      if(AVI->track[AVI->aptr].audio_index[n].tot>byte)
         n1 = n;
      else
         n0 = n;
   }

   AVI->track[AVI->aptr].audio_posc = n0;
   AVI->track[AVI->aptr].audio_posb = byte - AVI->track[AVI->aptr].audio_index[n0].tot;

   return 0;
}

// Assembly:
cmpq $0x0, 0x8(%rdi)
je 0x404237
movslq 0x43c(%rdi), %rax
imulq $0x70, %rax, %rdx
movq 0xc8(%rdi,%rdx), %rcx
testq %rcx, %rcx
je 0x404244
pushq %r14
pushq %rbx
leaq (%rdi,%rdx), %r8
addq $0x60, %r8
addq $0x60, %rdi
xorl %eax, %eax
testq %rsi, %rsi
cmovleq %rax, %rsi
movq 0x38(%r8), %r9
movl $0x0, %r10d
cmpq $0x2, %r9
jl 0x404221
movq 0x68(%rdi,%rdx), %r11
xorl %r10d, %r10d
leaq (%r9,%r10), %r14
movq %r14, %rbx
shrq $0x3f, %rbx
addq %r14, %rbx
sarq %rbx
leaq (%rbx,%rbx,2), %r14
cmpq %rsi, 0x10(%r11,%r14,8)
jg 0x404215
movq %rbx, %r10
jmp 0x404218
movq %rbx, %r9
leaq -0x1(%r9), %rbx
cmpq %rbx, %r10
jl 0x4041f4
movq %r10, 0x48(%rdi,%rdx)
leaq (%r10,%r10,2), %rdx
subq 0x10(%rcx,%rdx,8), %rsi
movq %rsi, 0x50(%r8)
popq %rbx
popq %r14
retq
movq $0x7, 0x1162ee(%rip) # 0x51a530
jmp 0x40424f
movq $0xd, 0x1162e1(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_read_audio
long AVI_read_audio(avi_t *AVI, char *audbuf, long bytes)
{
   long nr, pos, left, todo;

   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->track[AVI->aptr].audio_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   nr = 0; /* total number of bytes read */

   while(bytes>0)
   {
      left = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].len - AVI->track[AVI->aptr].audio_posb;
      if(left==0)
      {
         if(AVI->track[AVI->aptr].audio_posc>=AVI->track[AVI->aptr].audio_chunks-1) return nr;
         AVI->track[AVI->aptr].audio_posc++;
         AVI->track[AVI->aptr].audio_posb = 0;
         continue;
      }
      if(bytes<left)
         todo = bytes;
      else
         todo = left;
      pos = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos + AVI->track[AVI->aptr].audio_posb;
      lseek(AVI->fdes, pos, SEEK_SET);
      if (avi_read(AVI->fdes,audbuf+nr,todo) != todo)
      {
         AVI_errno = AVI_ERR_READ;
         return -1;
      }
      bytes -= todo;
      nr    += todo;
      AVI->track[AVI->aptr].audio_posb += todo;
   }

   return nr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
cmpq $0x0, 0x8(%rdi)
je 0x40438e
movq %rdi, %r15
movslq 0x43c(%rdi), %rax
imulq $0x70, %rax, %rax
cmpq $0x0, 0xc8(%rdi,%rax)
je 0x404395
testq %rdx, %rdx
setg %al
jle 0x4043ba
movq %rsi, %rbx
leaq 0x60(%r15), %r11
xorl %r12d, %r12d
movslq 0x43c(%r15), %rcx
imulq $0x70, %rcx, %rsi
leaq (%r11,%rsi), %rcx
leaq (%r11,%rsi), %rdi
addq $0x50, %rdi
movq 0x18(%rdi), %r10
movq -0x8(%rdi), %r8
movq (%rdi), %rsi
leaq (%r8,%r8,2), %r9
leaq (%r10,%r9,8), %r9
addq $0x8, %r9
movq (%r9), %r14
subq %rsi, %r14
jne 0x404307
movq 0x38(%rcx), %rsi
decq %rsi
cmpq %rsi, %r8
jge 0x4043a8
incq %r8
movq %r8, 0x48(%rcx)
movq $0x0, (%rdi)
addq $0x18, %r9
movl $0x0, %esi
testb $0x1, %al
jne 0x4042cf
jmp 0x4043a8
movq %r11, (%rsp)
cmpq %r14, %rdx
movq %rdx, 0x10(%rsp)
cmovlq %rdx, %r14
addq -0x8(%r9), %rsi
movl (%r15), %edi
xorl %edx, %edx
callq 0x481860
movl (%r15), %ebp
movq %rbx, 0x8(%rsp)
addq %r12, %rbx
xorl %r13d, %r13d
leaq (%rbx,%r13), %rsi
movq %r14, %rdx
subq %r13, %rdx
movl %ebp, %edi
callq 0x481720
testq %rax, %rax
jle 0x404351
addq %rax, %r13
cmpq %r14, %r13
jb 0x404333
cmpq %r14, %r13
jne 0x4043bf
addq %r14, %r12
movslq 0x43c(%r15), %rax
imulq $0x70, %rax, %rax
movq (%rsp), %r11
addq %r14, 0x50(%r11,%rax)
movq 0x10(%rsp), %rdx
movq %rdx, %rax
subq %r14, %rax
testq %rax, %rax
setg %al
subq %r14, %rdx
movq 0x8(%rsp), %rbx
jg 0x4042a1
jmp 0x4043a8
movl $0x7, %eax
jmp 0x40439a
movl $0xd, %eax
movq %rax, 0x11618f(%rip)    # 0x51a530
movq $-0x1, %r12
movq %r12, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r12d, %r12d
jmp 0x4043a8
movl $0x3, %eax
jmp 0x40439a
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_read_audio_chunk
long AVI_read_audio_chunk(avi_t *AVI, char *audbuf)
{
   long pos, left;

   if(AVI->mode==AVI_MODE_WRITE) { AVI_errno = AVI_ERR_NOT_PERM; return -1; }
   if(!AVI->track[AVI->aptr].audio_index)         { AVI_errno = AVI_ERR_NO_IDX;   return -1; }

   if (AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].len == 0) return 0;
   left = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].len - AVI->track[AVI->aptr].audio_posb;

   if (audbuf == NULL) return left;

   if(left==0) return 0;

   pos = AVI->track[AVI->aptr].audio_index[AVI->track[AVI->aptr].audio_posc].pos + AVI->track[AVI->aptr].audio_posb;
   lseek(AVI->fdes, pos, SEEK_SET);
   if (avi_read(AVI->fdes,audbuf,left) != left)
   {
      AVI_errno = AVI_ERR_READ;
      return -1;
   }
   AVI->track[AVI->aptr].audio_posc++;
   AVI->track[AVI->aptr].audio_posb = 0;

   return left;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0x0, 0x8(%rdi)
je 0x40448a
movq %rdi, %r14
movslq 0x43c(%rdi), %rax
imulq $0x70, %rax, %rcx
movq 0xc8(%rdi,%rcx), %rax
testq %rax, %rax
je 0x404497
leaq (%r14,%rcx), %rdx
addq $0x60, %rdx
movq 0x48(%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x8(%rax,%rcx,8), %rbx
testq %rbx, %rbx
je 0x4044ab
movq %rsi, %r15
movq 0x50(%rdx), %rsi
subq %rsi, %rbx
testq %r15, %r15
je 0x4044ad
testq %rbx, %rbx
je 0x4044ab
leaq 0x60(%r14), %r12
leaq (%rax,%rcx,8), %rax
addq (%rax), %rsi
movl (%r14), %edi
xorl %r13d, %r13d
xorl %edx, %edx
callq 0x481860
movl (%r14), %ebp
leaq (%r15,%r13), %rsi
movq %rbx, %rdx
subq %r13, %rdx
movl %ebp, %edi
callq 0x481720
testq %rax, %rax
jle 0x40446a
addq %rax, %r13
cmpq %rbx, %r13
jb 0x40444c
cmpq %rbx, %r13
jne 0x4044bf
movslq 0x43c(%r14), %rax
imulq $0x70, %rax, %rax
incq 0x48(%r12,%rax)
movq $0x0, 0x50(%r12,%rax)
jmp 0x4044ad
movq $0x7, 0x11609b(%rip) # 0x51a530
jmp 0x4044a2
movq $0xd, 0x11608e(%rip) # 0x51a530
movq $-0x1, %rbx
jmp 0x4044ad
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq $0x3, 0x116066(%rip) # 0x51a530
jmp 0x4044a2
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: AVI_strerror
const char *AVI_strerror()
{
   int aerrno;

   aerrno = (AVI_errno>=0 && AVI_errno<num_avi_errors) ? AVI_errno : num_avi_errors-1;

   if(AVI_errno == AVI_ERR_OPEN ||
      AVI_errno == AVI_ERR_READ ||
      AVI_errno == AVI_ERR_WRITE ||
      AVI_errno == AVI_ERR_WRITE_INDEX ||
      AVI_errno == AVI_ERR_CLOSE )
   {
      sprintf(error_string,"%s - %s",avi_errors[aerrno],strerror(errno));
      return error_string;
   }
   else
   {
      return avi_errors[aerrno];
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x115e69(%rip), %rax    # 0x51a530
movl %eax, %ecx
cmpq $0xf, %rax
movl $0xe, %edx
cmovbq %rcx, %rdx
addq $-0x2, %rax
leaq 0x113a8f(%rip), %rcx    # 0x518170
movq (%rcx,%rdx,8), %rbx
cmpq $0x4, %rax
ja 0x404718
callq 0x41f970
movl (%rax), %edi
callq 0x447170
leaq 0x115e42(%rip), %r14    # 0x51a540
leaq 0xd0c35(%rip), %rsi     # 0x4d533a
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x4275d0
movq %r14, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/avilib.c
// Function: avi_add_chunk
static int avi_add_chunk(avi_t *AVI, unsigned char *tag, unsigned char *data, int length)
{
   unsigned char c[8];

   /* Copy tag and length int c, so that we need only 1 write system call
      for these two values */

   memcpy(c,tag,4);
   long2str(c+4,length);

   /* Output tag, length and data, restore previous position
      if the write fails */

   length = PAD_EVEN(length);

   if( avi_write(AVI->fdes,(char *)c,8) != 8 ||
       avi_write(AVI->fdes,(char *)data,length) != length )
   {
      lseek(AVI->fdes,AVI->pos,SEEK_SET);
      AVI_errno = AVI_ERR_WRITE;
      return -1;
   }

   /* Update file position */

   AVI->pos += 8 + length;

   //fprintf(stderr, "pos=%lu %s\n", AVI->pos, tag);

   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rdi, %r15
movl (%rsi), %eax
movl %eax, (%rsp)
movb %bl, 0x4(%rsp)
movb %bh, 0x5(%rsp)
movl %ecx, %eax
shrl $0x10, %eax
movb %al, 0x6(%rsp)
movl %ecx, %eax
shrl $0x18, %eax
movb %al, 0x7(%rsp)
incl %ebx
andl $-0x2, %ebx
movl (%rdi), %ebp
xorl %r12d, %r12d
leaq (%rsp,%r12), %rsi
movl $0x8, %edx
subq %r12, %rdx
movl %ebp, %edi
callq 0x4817c0
testq %rax, %rax
js 0x404788
addq %rax, %r12
cmpq $0x8, %r12
jb 0x404765
jmp 0x40478b
movq %rax, %r12
cmpq $0x8, %r12
jne 0x4047e5
movslq %ebx, %r12
testl %r12d, %r12d
je 0x4047bf
movl (%r15), %ebx
xorl %r13d, %r13d
leaq (%r14,%r13), %rsi
movq %r12, %rdx
subq %r13, %rdx
movl %ebx, %edi
callq 0x4817c0
testq %rax, %rax
js 0x4047c4
addq %rax, %r13
cmpq %r12, %r13
jb 0x40479f
jmp 0x4047c7
xorl %r13d, %r13d
jmp 0x4047c7
movq %rax, %r13
cmpq %r12, %r13
jne 0x4047e5
movq 0x3e0(%r15), %rax
addq %r12, %rax
addq $0x8, %rax
movq %rax, 0x3e0(%r15)
xorl %eax, %eax
jmp 0x404806
movl (%r15), %edi
movq 0x3e0(%r15), %rsi
xorl %edx, %edx
callq 0x481860
movq $0x4, 0x115d2f(%rip) # 0x51a530
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/archer1357[P]Offline-Raytracer/jo_jpeg.c
// Function: jo_writeBits
static void jo_writeBits(FILE *fp,
                         int *bitBuf, int *bitCnt,
                         const unsigned short *bs) {
  (*bitCnt) += bs[1];
  (*bitBuf) |= bs[0] << (24 - (*bitCnt));
  while((*bitCnt) >= 8) {
    unsigned char c = ((*bitBuf) >> 16) & 255;
    putc(c, fp);
    if(c == 255) {
      putc(0, fp);
    }
    (*bitBuf) <<= 8;
    (*bitCnt) -= 8;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movzwl 0x2(%rcx), %eax
addl (%rdx), %eax
movl %eax, (%rdx)
movzwl (%rcx), %edx
movb $0x18, %cl
subb %al, %cl
shll %cl, %edx
orl %edx, (%rsi)
cmpl $0x8, (%rbx)
jl 0x4056dc
movq %rsi, %r14
movq %rdi, %r15
movzbl 0x2(%r14), %ebp
movl %ebp, %edi
movq %r15, %rsi
callq 0x432710
cmpl $0xff, %ebp
jne 0x4056cc
xorl %edi, %edi
movq %r15, %rsi
callq 0x432710
shll $0x8, (%r14)
movl (%rbx), %eax
leal -0x8(%rax), %ecx
movl %ecx, (%rbx)
cmpl $0xf, %eax
jg 0x4056ab
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq