LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir.c
// Function: parser_error0
static void __attribute__((noreturn))
parser_error0(ir_unit_t *iu, const char *file, int line,
              const char *fmt, ...)
{
  va_list ap;
  va_start(ap, fmt);
  vsnprintf(iu->iu_err_buf, sizeof(iu->iu_err_buf), fmt, ap);
  va_end(ap);
  iu->iu_err_file = file;
  iu->iu_err_line = line;

  vmir_log(iu, VMIR_LOG_ERROR, "Parser error: %s:%d : %s",
           file, line, iu->iu_err_buf);

  if(iu->iu_failed) {
    printf("Double failure\n");
  } else {
    iu->iu_failed = 1;
  }

  longjmp(iu->iu_parser_jmp, 1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x20(%rsp), %rdx
movq %r8, 0x20(%rdx)
movq %r9, 0x28(%rdx)
testb %al, %al
je 0xcad0
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rax
movq %rdx, 0x10(%rax)
leaq 0x100(%rsp), %rdx
movq %rdx, 0x8(%rax)
movabsq $0x3000000020, %rdx     # imm = 0x3000000020
movq %rdx, (%rax)
leaq 0x468(%rdi), %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movq %rcx, %rdx
movq %rax, %rcx
callq 0x3120
movq %r14, 0x568(%rbx)
movl %ebp, 0x570(%rbx)
leaq 0x1b679(%rip), %rdx     # 0x28197
movq %rbx, %rdi
movl $0x1, %esi
movq %r14, %rcx
movl %ebp, %r8d
movq %r15, %r9
xorl %eax, %eax
callq 0x4045
cmpl $0x0, 0x574(%rbx)
jne 0xcb4b
movl $0x1, 0x574(%rbx)
jmp 0xcb57
leaq 0x1b670(%rip), %rdi     # 0x281c2
callq 0x30e0
addq $0x370, %rbx            # imm = 0x370
movq %rbx, %rdi
movl $0x1, %esi
callq 0x33e0
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir.c
// Function: vmir_instrumentation_dump
void
vmir_instrumentation_dump(ir_unit_t *iu)
{
  VECTOR_SORT(&iu->iu_instrumentation, instrumentation_cmp);
  for(int i = 0; i < VECTOR_LEN(&iu->iu_instrumentation); i++) {
    const ir_instrumentation_t *ii = &VECTOR_ITEM(&iu->iu_instrumentation, i);
    printf("%10"PRId64" %10"PRId64" %s.%d\n",
           ii->ii_count,
           ii->ii_count * ii->ii_instructions,
           ii->ii_func->if_name, ii->ii_bb);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x110(%rdi), %rdi
movq 0x118(%rbx), %rsi
leaq 0x6c(%rip), %rcx        # 0xcbf7
movl $0x18, %edx
callq 0x30f0
cmpq $0x0, 0x118(%rbx)
je 0xcbeb
movl $0x10, %r15d
leaq 0x183a4(%rip), %r14     # 0x24f50
xorl %r12d, %r12d
movq 0x110(%rbx), %rax
movq (%rax,%r15), %rsi
movslq -0x4(%rax,%r15), %rdx
imulq %rsi, %rdx
movq -0x10(%rax,%r15), %rcx
movq 0x20(%rcx), %rcx
movl -0x8(%rax,%r15), %r8d
movq %r14, %rdi
xorl %eax, %eax
callq 0x3190
incq %r12
addq $0x18, %r15
cmpq %r12, 0x118(%rbx)
ja 0xcbaf
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir.c
// Function: vmir_mem_copy
uint32_t
vmir_mem_copy(ir_unit_t *iu, const void *data, size_t len)
{
  void *hostaddr;
  uint32_t addr = vmir_mem_alloc(iu, len, &hostaddr);
  if(hostaddr != NULL)
    memcpy(hostaddr, data, len);

  return addr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl %ebx, %esi
callq 0xa084
testq %rax, %rax
je 0xcc40
movl 0x20(%r15), %ecx
movl %eax, %ebp
subl %ecx, %ebp
jmp 0xcc44
xorl %eax, %eax
xorl %ebp, %ebp
testq %rax, %rax
je 0xcc57
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3360
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir.c
// Function: vmir_run
int
vmir_run(ir_unit_t *iu, int *retptr, int argc, char **argv)
{
  ir_function_t *f;
  f = vmir_find_function(iu, "main");
  if(f == NULL) {
    return VM_STOP_BAD_FUNCTION;
  }

  int vm_argv = vmir_argv_copy(iu, argc, argv);

  union {
    uint32_t u32;
    uint64_t u64;
  } ret;

  int r = vmir_vm_function_call(iu, f, &ret, argc, vm_argv);


  if(r == VM_STOP_EXIT)
    ret.u32 = iu->iu_exit_code;

  if(retptr != NULL)
    *retptr = ret.u32;

  switch(r) {
  case 0:
    vmir_log(iu, VMIR_LOG_DEBUG, "Program returned normally: 0x%x", ret.u32);
    break;
  case VM_STOP_EXIT:
    vmir_log(iu, VMIR_LOG_DEBUG, "Program exit(): 0x%x", iu->iu_exit_code);
    break;
  case VM_STOP_ABORT:
    vmir_log(iu, VMIR_LOG_ERROR, "Program abort");
    break;
  case VM_STOP_UNREACHABLE:
    vmir_log(iu, VMIR_LOG_ERROR, "Unreachable instruction");
    break;
  case VM_STOP_BAD_INSTRUCTION:
    vmir_log(iu, VMIR_LOG_ERROR, "Bad instruction");
    break;
  case VM_STOP_BAD_FUNCTION:
    vmir_log(iu, VMIR_LOG_ERROR, "Bad function %d", iu->iu_exit_code);
    break;
  case VM_STOP_UNCAUGHT_EXCEPTION:
    vmir_log(iu, VMIR_LOG_ERROR, "Uncaught exception");
    break;
  }
  return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x18285(%rip), %rsi     # 0x24f63
callq 0x3b17
testq %rax, %rax
je 0xcd17
movq %rax, 0x18(%rsp)
leal 0x4(,%r15,4), %esi
movq %rbx, %rdi
callq 0xa084
testq %rax, %rax
movq %r14, 0x20(%rsp)
je 0xcd21
movq %rax, %rbp
movl 0x20(%rbx), %eax
movl %ebp, %ecx
subl %eax, %ecx
movl %ecx, 0xc(%rsp)
jmp 0xcd2b
movl $0x5, %ebp
jmp 0xce0d
xorl %ebp, %ebp
movl $0x0, 0xc(%rsp)
testl %r15d, %r15d
jle 0xcd4f
movl %r15d, %r14d
xorl %r13d, %r13d
movq (%r12,%r13,8), %rsi
movq %rbx, %rdi
callq 0xcc64
movl %eax, (%rbp,%r13,4)
incq %r13
cmpq %r13, %r14
jne 0xcd36
leaq 0x10(%rsp), %rdx
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
movl %r15d, %ecx
movl 0xc(%rsp), %r8d
xorl %eax, %eax
callq 0x3c22
movl %eax, %ebp
cmpl $0x1, %eax
jne 0xcd79
movl 0x40(%rbx), %eax
movl %eax, 0x10(%rsp)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0xcd89
movl 0x10(%rsp), %eax
movl %eax, (%rcx)
cmpl $0x6, %ebp
ja 0xce0d
movl %ebp, %eax
leaq 0x16e85(%rip), %rcx     # 0x23c1c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x10(%rsp), %ecx
leaq 0x181bd(%rip), %rdx     # 0x24f68
jmp 0xcdd2
leaq 0x181f7(%rip), %rdx     # 0x24fab
jmp 0xcdfe
leaq 0x181e0(%rip), %rdx     # 0x24f9d
jmp 0xcdfe
leaq 0x180fe(%rip), %rdx     # 0x24ec4
jmp 0xcdfe
movl 0x40(%rbx), %ecx
leaq 0x181b6(%rip), %rdx     # 0x24f88
movq %rbx, %rdi
movl $0x3, %esi
jmp 0xcdee
movl 0x40(%rbx), %ecx
leaq 0x181d5(%rip), %rdx     # 0x24fbb
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x4045
jmp 0xce0d
leaq 0x18102(%rip), %rdx     # 0x24f00
movq %rbx, %rdi
movl $0x1, %esi
xorl %eax, %eax
callq 0x4045
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir.c
// Function: tmpstr
static char * __attribute__((warn_unused_result))
tmpstr(ir_unit_t *iu, int len)
{
  int idx = (iu->iu_tmp_str_ptr++) & (IU_MAX_TMP_STR - 1);
  free(iu->iu_tmp_str[idx]);
  iu->iu_tmp_str[idx] = malloc(len + 1);
  iu->iu_tmp_str[idx][len] = 0;
  return iu->iu_tmp_str[idx];
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movl 0x2d0(%rdi), %r15d
leal 0x1(%r15), %eax
movl %eax, 0x2d0(%rdi)
andl $0x1f, %r15d
movq 0x1d0(%rdi,%r15,8), %rdi
callq 0x3030
leal 0x1(%rbx), %eax
movslq %eax, %rdi
callq 0x3380
movq %rax, 0x1d0(%r14,%r15,8)
movslq %ebx, %rcx
movb $0x0, (%rax,%rcx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_type.c
// Function: type_print_id
static int
type_print_id(char **dstp, const ir_unit_t *iu, int id)
{
  char tmpbuf[128];

  if(id < VECTOR_LEN(&iu->iu_types))
    return type_print(dstp, iu, &VECTOR_ITEM(&iu->iu_types, id));

  snprintf(tmpbuf, sizeof(tmpbuf), "[TypeId-%d]", id);
  return addstr(dstp, tmpbuf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
movslq %edx, %rax
cmpq %rax, 0x170(%rsi)
jbe 0xd2ff
leaq (%rax,%rax,4), %rdx
shlq $0x3, %rdx
addq 0x168(%rsi), %rdx
movq %rbx, %rdi
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xce99
movl %edx, %ecx
leaq 0x17d18(%rip), %rdx     # 0x25020
movq %rsp, %r14
movl $0x80, %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x31a0
movq %r14, %rdi
callq 0x3170
movq %rax, %r14
testq %rbx, %rbx
je 0xd33e
movq (%rbx), %rdi
movslq %r14d, %r15
movq %rsp, %rsi
movq %r15, %rdx
callq 0x3360
addq %r15, (%rbx)
movl %r14d, %eax
addq $0x80, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_vm.c
// Function: vm_strchr
static uint32_t __attribute__((noinline))
vm_strchr(uint32_t a, int b, void *mem)
{
  void *s = mem + a;
  void *r = strchr(s, b);
  int ret = r ? r - mem : 0;
  return ret;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
movl %edi, %edi
addq %rdx, %rdi
callq 0x3180
movl %eax, %edx
subl %ebx, %edx
xorl %ecx, %ecx
testq %rax, %rax
cmovnel %edx, %ecx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_vm.c
// Function: vm_strrchr
static uint32_t __attribute__((noinline))
vm_strrchr(uint32_t a, int b, void *mem)
{
  void *s = mem + a;
  void *r = strrchr(s, b);
  int ret = r ? r - mem : 0;
  return ret;
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
movl %edi, %edi
addq %rdx, %rdi
callq 0x31b0
movl %eax, %edx
subl %ebx, %edx
xorl %ecx, %ecx
testq %rax, %rax
cmovnel %edx, %ecx
movl %ecx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_vm.c
// Function: vmir_traceback
static void
vmir_traceback(struct ir_unit *iu, const char *info)
{
  const vm_frame_t *f;

  vmir_log(iu, VMIR_LOG_INFO, "--- Traceback (%s) ---", info);
  for(f = iu->iu_current_frame; f != NULL; f = f->prev) {
    vmir_log(iu, VMIR_LOG_INFO, "%s()", f->func->if_name);
  }
  vmir_log(iu, VMIR_LOG_INFO, "--- Traceback end ---");
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rcx
movq %rdi, %rbx
leaq 0x17c3b(%rip), %rdx     # 0x25052
movl $0x2, %esi
xorl %eax, %eax
callq 0x4045
movq 0x78(%rbx), %r15
testq %r15, %r15
je 0xd456
leaq 0x17a2b(%rip), %r14     # 0x24e5e
movq 0x10(%r15), %rax
movq 0x20(%rax), %rcx
movq %rbx, %rdi
movl $0x2, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4045
movq 0x18(%r15), %r15
testq %r15, %r15
jne 0xd433
leaq 0x17c0c(%rip), %rdx     # 0x25069
movq %rbx, %rdi
movl $0x2, %esi
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x4045
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_atoi
static int
vmir_atoi(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *str = vmir_vm_ptr(&rf, iu);
  int r = atoi(str);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl -0x4(%rsi), %edi
addq 0x20(%rdx), %rdi
callq 0x3480
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_malloc
static int
vmir_malloc(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t size = vmir_vm_arg32(&rf);
  MEMTRACE("malloc(%d) = ...\n", size);
  void *p = vmir_heap_malloc(iu, size);
  vmir_vm_retptr(ret, p, iu);
  MEMTRACE("malloc(%d) = 0x%x\n", size, *(uint32_t *)ret);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movl -0x4(%rsi), %esi
movq %rdx, %rdi
callq 0xa084
testq %rax, %rax
je 0xd53c
subl 0x20(%r14), %eax
jmp 0xd53e
xorl %eax, %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_realloc
static int
vmir_realloc(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t ptr = vmir_vm_arg32(&rf);
  uint32_t size = vmir_vm_arg32(&rf);

  MEMTRACE("realloc(0x%x, %d) = ...\n", ptr, size);
  void *p = vmir_heap_realloc(iu, ptr ? iu->iu_mem + ptr : NULL, size);
  vmir_vm_retptr(ret, p, iu);
  MEMTRACE("realloc(0x%x, %d) = 0x%x\n", ptr, size, *(uint32_t *)ret);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rax
movq %rdi, %rbx
movl -0x8(%rsi), %esi
movl -0x4(%rax), %r15d
testq %r15, %r15
je 0xd58c
addq 0x20(%r14), %r15
jmp 0xd58f
xorl %r15d, %r15d
testl %esi, %esi
je 0xd5b0
cmpl $0xa110ced, -0x18(%r15) # imm = 0xA110CED
jne 0xd618
movl -0x14(%r15), %ebp
addl $-0x18, %ebp
cmpl %esi, %ebp
jle 0xd5b5
xorl %r12d, %r12d
movq %r15, %rax
jmp 0xd5e2
xorl %r12d, %r12d
jmp 0xd5ea
movq %r14, %rdi
callq 0xa084
testq %rax, %rax
je 0xd5dd
movq %rax, %r12
movb $0x1, %r13b
testq %r15, %r15
je 0xd5db
movslq %ebp, %rdx
movq %r12, %rdi
movq %r15, %rsi
callq 0x3360
jmp 0xd5e5
xorl %r12d, %r12d
xorl %eax, %eax
xorl %r13d, %r13d
testb %r13b, %r13b
je 0xd5f8
movq %r14, %rdi
movq %r15, %rsi
callq 0xa10c
movq %r12, %rax
testq %rax, %rax
je 0xd603
subl 0x20(%r14), %eax
jmp 0xd605
xorl %eax, %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x17c86(%rip), %rdi     # 0x252a5
leaq 0x17ca0(%rip), %rsi     # 0x252c6
leaq 0x17ca9(%rip), %rcx     # 0x252d6
movl $0xf4, %edx
callq 0x31e0
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_calloc
static int
vmir_calloc(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t nmemb = vmir_vm_arg32(&rf);
  uint32_t size = vmir_vm_arg32(&rf);
  MEMTRACE("calloc(%d, %d) = ...\n", nmemb, size);
  void *p = vmir_heap_malloc(iu, size * nmemb);
  if(p != NULL)
    memset(p, 0, size * nmemb);
  vmir_vm_retptr(ret, p, iu);
  MEMTRACE("calloc(%d, %d) = 0x%x\n", nmemb, size, *(uint32_t *)ret);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rdi, %rbx
movl -0x8(%rsi), %ebp
imull -0x4(%rsi), %ebp
movq %rdx, %rdi
movl %ebp, %esi
callq 0xa084
testq %rax, %rax
je 0xd66f
movq %rax, %r15
movl %ebp, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x3210
subl 0x20(%r14), %r15d
jmp 0xd672
xorl %r15d, %r15d
movl %r15d, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_open
static int
vmir_open(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *path = vmir_vm_ptr(&rf, iu);
  uint32_t flags = vmir_vm_arg32(&rf);

  uint32_t vmir_flags = 0;
  if(flags & 0100) // O_CREAT
    vmir_flags |= VMIR_FS_OPEN_CREATE;

  if(flags & 2)
    vmir_flags |= VMIR_FS_OPEN_RW;
  else if(flags & 1)
    vmir_flags |= VMIR_FS_OPEN_WRITE;
  else
    vmir_flags |= VMIR_FS_OPEN_READ;

  int fd = vfd_open(iu, path, vmir_flags);
  vmir_vm_ret32(ret, fd);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdx, %rax
movq %rdi, %rbx
movl -0x8(%rsi), %ecx
movl %ecx, %edi
shrl $0x4, %edi
andl $0x4, %edi
movl %ecx, %r8d
andl $0x1, %r8d
incl %r8d
testb $0x2, %cl
movl $0x3, %edx
cmovel %r8d, %edx
movl -0x4(%rsi), %esi
orl %edi, %edx
addq 0x20(%rax), %rsi
movq %rax, %rdi
callq 0xe2e1
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_read
static int
vmir_read(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t fd = vmir_vm_arg32(&rf);
  void *buf = vmir_vm_ptr(&rf, iu);
  uint32_t nbyte = vmir_vm_arg32(&rf);
  vmir_vm_ret32(ret, vfd_read(iu, fd, buf, nbyte));
  return 0;
}

// Assembly:
pushq %rbx
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movl -0xc(%rsi), %ecx
movl -0x8(%rsi), %edx
addq 0x20(%r8), %rdx
movq %r8, %rdi
movl %eax, %esi
callq 0xe325
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_write
static int
vmir_write(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t fd = vmir_vm_arg32(&rf);
  const void *buf = vmir_vm_ptr(&rf, iu);
  uint32_t nbyte = vmir_vm_arg32(&rf);
  vmir_vm_ret32(ret, vfd_write(iu, fd, buf, nbyte));
  return 0;
}

// Assembly:
pushq %rbx
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movl -0xc(%rsi), %ecx
movl -0x8(%rsi), %edx
addq 0x20(%r8), %rdx
movq %r8, %rdi
movl %eax, %esi
callq 0xe379
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_lseek
static int
vmir_lseek(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t fd = vmir_vm_arg32(&rf);
  int64_t offset = vmir_vm_arg64(&rf);
  uint32_t whence = vmir_vm_arg32(&rf);
  vmir_vm_ret64(ret, vfd_seek(iu, fd, offset, whence));
  return 0;
}

// Assembly:
pushq %rbx
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq -0xc(%rsi), %rdx
movl -0x10(%rsi), %ecx
movq %r8, %rdi
movl %eax, %esi
callq 0xe3cd
movq %rax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_close
static int
vmir_close(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t fd = vmir_vm_arg32(&rf);
  vmir_fd_close(iu, fd);
  vmir_vm_ret32(ret, 0);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl -0x4(%rsi), %esi
movq %rdx, %rdi
callq 0x9f22
movl $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fopen
static int
vmir_fopen(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *path = vmir_vm_ptr(&rf, iu);
  const char *mode = vmir_vm_ptr(&rf, iu);
  vFILE_t *vfile = vFILE_open(iu, path, mode, 0);
  vmir_vm_retptr(ret, vfile, iu);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movl -0x8(%rsi), %edx
movl -0x4(%rsi), %esi
movq 0x20(%r14), %rax
addq %rax, %rsi
addq %rax, %rdx
xorl %ebp, %ebp
movq %r14, %rdi
xorl %ecx, %ecx
callq 0xe421
testq %rax, %rax
je 0xd775
subl 0x20(%r14), %eax
movl %eax, %ebp
movl %ebp, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fdopen
static int
vmir_fdopen(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t fd = vmir_vm_arg32(&rf);
  const char *mode = vmir_vm_ptr(&rf, iu);
  vFILE_t *vfile = vFILE_open_fd(iu, fd, 0, mode);
  vmir_vm_retptr(ret, vfile, iu);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movq %rdi, %rbx
movl -0x8(%rsi), %ecx
movl -0x4(%rsi), %esi
addq 0x20(%rdx), %rcx
xorl %ebp, %ebp
movq %rdx, %rdi
xorl %edx, %edx
callq 0xe4a3
testq %rax, %rax
je 0xd7a9
subl 0x20(%r14), %eax
movl %eax, %ebp
movl %ebp, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fseek
static int
vmir_fseek(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr_nullchk(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, -1);
    return 0;
  }
  uint32_t offset = vmir_vm_arg32(&rf);
  uint32_t whence = vmir_vm_arg32(&rf);
  int r = fseek(vfile->fp, offset, whence);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl -0x4(%rsi), %eax
testq %rax, %rax
je 0xd7c4
addq 0x20(%rdx), %rax
jmp 0xd7c6
xorl %eax, %eax
testq %rax, %rax
je 0xd7db
movl -0xc(%rsi), %edx
movl -0x8(%rsi), %esi
movq (%rax), %rdi
callq 0x33b0
jmp 0xd7e0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fseeko
static int
vmir_fseeko(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr_nullchk(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret64(ret, -1);
    return 0;
  }
  uint64_t offset = vmir_vm_arg64(&rf);
  uint32_t whence = vmir_vm_arg32(&rf);
  int64_t r = fseeko(vfile->fp, offset, whence);
  vmir_vm_ret64(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl -0x4(%rsi), %ecx
testq %rcx, %rcx
je 0xd7f8
addq 0x20(%rdx), %rcx
jmp 0xd7fa
xorl %ecx, %ecx
testq %rcx, %rcx
je 0xd815
movq -0xc(%rsi), %rax
movl -0x10(%rsi), %edx
movq (%rcx), %rdi
movq %rax, %rsi
callq 0x3420
cltq
jmp 0xd81c
movq $-0x1, %rax
movq %rax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fread
static int
vmir_fread(void *ret, const void *rf, ir_unit_t *iu)
{
  void *buf = vmir_vm_ptr(&rf, iu);
  uint32_t size = vmir_vm_arg32(&rf);
  uint32_t nmemb = vmir_vm_arg32(&rf);
  vFILE_t *vfile = vmir_vm_ptr_nullchk(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, -1);
    return 0;
  }
  int r = fread(buf, size, nmemb, vfile->fp);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rcx
movl -0x10(%rsi), %r8d
testq %r8, %r8
sete %al
testq %rcx, %rcx
sete %dl
orb %al, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0xd85c
movl -0xc(%rsi), %edx
movl -0x8(%rsi), %eax
movl -0x4(%rsi), %edi
addq %rcx, %rdi
movq (%rcx,%r8), %rcx
movq %rax, %rsi
callq 0x3110
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fwrite
static int
vmir_fwrite(void *ret, const void *rf, ir_unit_t *iu)
{
  void *buf = vmir_vm_ptr(&rf, iu);
  uint32_t size = vmir_vm_arg32(&rf);
  uint32_t nmemb = vmir_vm_arg32(&rf);
  vFILE_t *vfile = vmir_vm_ptr_nullchk(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, -1);
    return 0;
  }
  int r = fwrite(buf, size, nmemb, vfile->fp);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rcx
movl -0x10(%rsi), %r8d
testq %r8, %r8
sete %al
testq %rcx, %rcx
sete %dl
orb %al, %dl
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jne 0xd89b
movl -0xc(%rsi), %edx
movl -0x8(%rsi), %eax
movl -0x4(%rsi), %edi
addq %rcx, %rdi
movq (%rcx,%r8), %rcx
movq %rax, %rsi
callq 0x34b0
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_feof
static int
vmir_feof(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, 1);
    return 0;
  }
  int r = feof(vfile->fp);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rax
testq %rax, %rax
je 0xd8bc
movl -0x4(%rsi), %ecx
movq (%rax,%rcx), %rdi
callq 0x3350
jmp 0xd8c1
movl $0x1, %eax
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fflush
static int
vmir_fflush(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, 1);
    return 0;
  }
  int r = fflush(vfile->fp);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rax
testq %rax, %rax
je 0xd8e2
movl -0x4(%rsi), %ecx
movq (%rax,%rcx), %rdi
callq 0x3390
jmp 0xd8e7
movl $0x1, %eax
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_ftell
static int
vmir_ftell(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile == NULL) {
    vmir_vm_ret32(ret, -1);
    return 0;
  }
  int r = ftell(vfile->fp);
  vmir_vm_ret32(ret, r);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rax
testq %rax, %rax
je 0xd908
movl -0x4(%rsi), %ecx
movq (%rax,%rcx), %rdi
callq 0x3330
jmp 0xd90d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fclose
static int
vmir_fclose(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile != NULL)
    fclose(vfile->fp);
  vmir_vm_ret32(ret, 0);
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x20(%rdx), %rax
testq %rax, %rax
je 0xd947
movl -0x4(%rsi), %ecx
movq (%rax,%rcx), %rdi
callq 0x3160
movl $0x0, (%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_puts
static int
vmir_puts(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *str = vmir_vm_ptr(&rf, iu);
  if(iu->iu_stdout != NULL) {
    fwrite(str, strlen(str), 1, iu->iu_stdout->fp);
    fwrite("\n", 1, 1, iu->iu_stdout->fp);    
  }
  vmir_vm_ret32(ret, 0);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xb8(%rdx), %r12
testq %r12, %r12
je 0xd9a3
movq %rdx, %r14
movl -0x4(%rsi), %r15d
addq 0x20(%rdx), %r15
movq %r15, %rdi
callq 0x3170
movq (%r12), %rcx
movl $0x1, %edx
movq %r15, %rdi
movq %rax, %rsi
callq 0x34b0
movq 0xb8(%r14), %rax
movq (%rax), %rsi
movl $0xa, %edi
callq 0x3280
movl $0x0, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fputc
static int
vmir_fputc(void *ret, const void *rf, ir_unit_t *iu)
{
  char c = vmir_vm_arg32(&rf);
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile != NULL)
    fwrite(&c, 1, 1, vfile->fp);
  vmir_vm_ret32(ret, c);
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl -0x4(%rsi), %ebp
movq 0x20(%rdx), %rax
testq %rax, %rax
je 0xd9d9
movl -0x8(%rsi), %ecx
movq (%rax,%rcx), %rsi
movsbl %bpl, %edi
callq 0x3280
movsbl %bpl, %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fgetc
static int
vmir_fgetc(void *ret, const void *rf, ir_unit_t *iu)
{
  uint8_t c;
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  if(vfile == NULL || fread(&c, 1, 1, vfile->fp) != 1) {
    vmir_vm_ret32(ret, -1);
    return 0;
  }
  vmir_vm_ret32(ret, c);
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x20(%rdx), %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0xda22
movl -0x4(%rsi), %ecx
movq (%rax,%rcx), %rcx
leaq 0x7(%rsp), %rdi
movl $0x1, %esi
movl $0x1, %edx
callq 0x3110
cmpq $0x1, %rax
jne 0xda22
movzbl 0x7(%rsp), %ebp
movl %ebp, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_putchar
static int
vmir_putchar(void *ret, const void *rf, ir_unit_t *iu)
{
  char c = vmir_vm_arg32(&rf);
  if(iu->iu_stdout != NULL)
    fwrite(&c, 1, 1, iu->iu_stdout->fp);
  vmir_vm_ret32(ret, c);
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl -0x4(%rsi), %ebp
movq 0xb8(%rdx), %rax
testq %rax, %rax
je 0xda4e
movq (%rax), %rsi
movsbl %bpl, %edi
callq 0x3280
movsbl %bpl, %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_vsnprintf
static int
vmir_vsnprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  char *dst = vmir_vm_ptr(&rf, iu);
  int dstlen = vmir_vm_arg32(&rf);
  const char *fmt = vmir_vm_ptr(&rf, iu);
  const void *va_rf = vmir_valist(&rf, iu);

  fmt_sn_aux_t aux;
  aux.dst = dst;
  aux.remain = dstlen;
  aux.total = 0;
  dofmt(fmt_sn, &aux, fmt, va_rf, iu);
  // Nul termination
  if(aux.remain)
    *aux.dst = 0;
  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %r9
addq %r9, %rax
movl -0x8(%rsi), %edi
movl -0x10(%rsi), %ecx
movl -0xc(%rsi), %edx
addq %r9, %rdx
addq %r9, %rcx
cmpl $0x1, 0x64(%r8)
je 0xda9d
movq (%rcx), %rcx
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl %edi, 0x8(%r14)
movl $0x0, 0xc(%r14)
leaq 0xd57(%rip), %rdi       # 0xe80f
movq %r14, %rsi
callq 0xe600
cmpl $0x0, 0x8(%r14)
je 0xdacf
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movl 0x14(%rsp), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_snprintf
static int
vmir_snprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  char *dst = vmir_vm_ptr(&rf, iu);
  int dstlen = vmir_vm_arg32(&rf);
  const char *fmt = vmir_vm_ptr(&rf, iu);

  if(iu->iu_mode == VMIR_WASM)
    rf = (const void *)vmir_vm_ptr(&rf, iu);

  fmt_sn_aux_t aux;
  aux.dst = dst;
  aux.remain = dstlen;
  aux.total = 0;

  dofmt(fmt_sn, &aux, fmt, rf, iu);

  // Nul termination
  if(aux.remain)
    *aux.dst = 0;
  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %rdi
addq %rdi, %rax
movl -0xc(%rsi), %edx
movl -0x8(%rsi), %esi
addq %rdi, %rdx
cmpl $0x1, 0x64(%r8)
jne 0xdb14
movl -0x10(%rcx), %ecx
addq %rcx, %rdi
movq %rdi, %rcx
jmp 0xdb18
addq $-0xc, %rcx
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl %esi, 0x8(%r14)
movl $0x0, 0xc(%r14)
leaq 0xcdc(%rip), %rdi       # 0xe80f
movq %r14, %rsi
callq 0xe600
cmpl $0x0, 0x8(%r14)
je 0xdb4a
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movl 0x14(%rsp), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_vsprintf
static int
vmir_vsprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  char *dst = vmir_vm_ptr(&rf, iu);
  const char *fmt = vmir_vm_ptr(&rf, iu);
  const void *va_rf = vmir_valist(&rf, iu);

  fmt_sn_aux_t aux;
  aux.dst = dst;
  aux.remain = INT32_MAX;
  aux.total = 0;
  dofmt(fmt_sn, &aux, fmt, va_rf, iu);

  // Nul termination
  if(aux.remain)
    *aux.dst = 0;
  vmir_vm_ret32(ret, aux.total);
  return 0;

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %rdi
addq %rdi, %rax
movl -0xc(%rsi), %ecx
movl -0x8(%rsi), %edx
addq %rdi, %rdx
addq %rdi, %rcx
cmpl $0x1, 0x64(%r8)
je 0xdb87
movq (%rcx), %rcx
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq $0x7fffffff, 0x8(%r14)  # imm = 0x7FFFFFFF
leaq 0xc71(%rip), %rdi       # 0xe80f
movq %r14, %rsi
callq 0xe600
cmpl $0x0, 0x8(%r14)
je 0xdbb5
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movl 0x14(%rsp), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_vprintf
static int
vmir_vprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *fmt = vmir_vm_ptr(&rf, iu);
  const void *va_rf = vmir_valist(&rf, iu);

  fmt_file_aux_t aux;
  aux.vfile = iu->iu_stdout;
  aux.total = 0;
  dofmt(fmt_file, &aux, fmt, va_rf, iu);

  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rdi, %rbx
movl -0x8(%rsi), %ecx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %rdx
addq %rdx, %rcx
cmpl $0x1, 0x64(%r8)
je 0xdc5d
movq (%rcx), %rcx
addq %rax, %rdx
movq 0xb8(%r8), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0x1223(%rip), %rdi      # 0xeea1
movq %r14, %rsi
callq 0xe600
movl 0x8(%r14), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_printf
static int
vmir_printf(void *ret, const void *rf, ir_unit_t *iu)
{
  const char *fmt = vmir_vm_ptr(&rf, iu);

  if(iu->iu_mode == VMIR_WASM)
    rf = (const void *)vmir_vm_ptr(&rf, iu);

  fmt_file_aux_t aux;
  aux.vfile = iu->iu_stdout;
  aux.total = 0;
  dofmt(fmt_file, &aux, fmt, rf, iu);

  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %rdx
cmpl $0x1, 0x64(%r8)
jne 0xdcbc
movl -0x8(%rcx), %ecx
addq %rdx, %rcx
jmp 0xdcc0
addq $-0x4, %rcx
addq %rax, %rdx
movq 0xb8(%r8), %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0x11c0(%rip), %rdi      # 0xeea1
movq %r14, %rsi
callq 0xe600
movl 0x8(%r14), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_vfprintf
static int
vmir_vfprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  const char *fmt = vmir_vm_ptr(&rf, iu);
  const void *va_rf = vmir_valist(&rf, iu);

  fmt_file_aux_t aux;
  aux.vfile = vfile;
  aux.total = 0;
  dofmt(fmt_file, &aux, fmt, va_rf, iu);

  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rdi, %rbx
movl -0x4(%rsi), %eax
movq 0x20(%rdx), %rdi
movl -0xc(%rsi), %ecx
movl -0x8(%rsi), %edx
addq %rdi, %rcx
cmpl $0x1, 0x64(%r8)
je 0xdd20
movq (%rcx), %rcx
addq %rdi, %rdx
addq %rdi, %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0x1164(%rip), %rdi      # 0xeea1
movq %r14, %rsi
callq 0xe600
movl 0x8(%r14), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_fprintf
static int
vmir_fprintf(void *ret, const void *rf, ir_unit_t *iu)
{
  vFILE_t *vfile = vmir_vm_ptr(&rf, iu);
  const char *fmt = vmir_vm_ptr(&rf, iu);

  if(iu->iu_mode == VMIR_WASM)
    rf = (const void *)vmir_vm_ptr(&rf, iu);

  fmt_file_aux_t aux;
  aux.vfile = vfile;
  aux.total = 0;
  dofmt(fmt_file, &aux, fmt, rf, iu);

  vmir_vm_ret32(ret, aux.total);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r8
movq %rsi, %rcx
movq %rdi, %rbx
movl -0x8(%rsi), %edx
movl -0x4(%rsi), %eax
movq 0x20(%r8), %rsi
cmpl $0x1, 0x64(%r8)
jne 0xdd7e
movl -0xc(%rcx), %ecx
addq %rsi, %rcx
jmp 0xdd82
addq $-0x8, %rcx
addq %rsi, %rdx
addq %rsi, %rax
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movl $0x0, 0x8(%r14)
leaq 0x1102(%rip), %rdi      # 0xeea1
movq %r14, %rsi
callq 0xe600
movl 0x8(%r14), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_strtok_r
static int
vmir_strtok_r(void *retreg, const void *rf, ir_unit_t *iu)
{
  char *str         = vmir_vm_ptr(&rf, iu);
  const char *delim = vmir_vm_ptr(&rf, iu);
  uint32_t nextp = vmir_vm_arg32(&rf);

  if(str == NULL)
    str = mem_rdptr(iu, nextp);

  str += strspn(str, delim);

  if(*str == '\0') {
    vmir_vm_ret32(retreg, 0);
    return 0;
  }

  char *ret = str;
  str += strcspn(str, delim);
  if(*str)
    *str++ = '\0';

  mem_wrptr(iu, nextp, str);

  vmir_vm_retptr(retreg, ret, iu);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %r15
movq %rdi, %rbx
movq 0x20(%rdx), %r14
movl -0xc(%rsi), %r13d
movl -0x8(%rsi), %r12d
addq %r14, %r12
testq %r14, %r14
je 0xdde2
movl -0x4(%rsi), %eax
addq %rax, %r14
jmp 0xddf0
movl (%r14,%r13), %eax
addq %rax, %r14
testq %rax, %rax
cmoveq %rax, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3260
cmpb $0x0, (%r14,%rax)
je 0xde30
addq %rax, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3290
leaq (%r14,%rax), %rcx
cmpb $0x0, (%r14,%rax)
je 0xde21
movb $0x0, (%rcx)
incq %rcx
movq 0x20(%r15), %rax
subl %eax, %ecx
movl %ecx, (%rax,%r13)
subl %eax, %r14d
jmp 0xde33
xorl %r14d, %r14d
movl %r14d, (%rbx)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_strtok
static int
vmir_strtok(void *retreg, const void *rf, ir_unit_t *iu)
{
  char *str         = vmir_vm_ptr(&rf, iu);
  const char *delim = vmir_vm_ptr(&rf, iu);

  if(str == NULL)
    str = iu->iu_strtok_tmp;

  str += strspn(str, delim);

  if(*str == '\0') {
    vmir_vm_ret32(retreg, 0);
    return 0;
  }

  char *ret = str;
  str += strcspn(str, delim);
  if(*str)
    *str++ = '\0';

  iu->iu_strtok_tmp = str;

  vmir_vm_retptr(retreg, ret, iu);
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rdi, %rbx
movl -0x8(%rsi), %r12d
movq 0x20(%rdx), %r14
addq %r14, %r12
testq %r14, %r14
je 0xde68
movl -0x4(%rsi), %eax
addq %rax, %r14
jmp 0xde6f
movq 0xf8(%r15), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3260
cmpb $0x0, (%r14,%rax)
je 0xdead
addq %rax, %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x3290
leaq (%r14,%rax), %rcx
cmpb $0x0, (%r14,%rax)
je 0xdea0
movb $0x0, (%rcx)
incq %rcx
movq %rcx, 0xf8(%r15)
subl 0x20(%r15), %r14d
jmp 0xdeb0
xorl %r14d, %r14d
movl %r14d, (%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_heap_print
static void
vmir_heap_print0(ir_unit_t *iu)
{
  heap_block_t *hb;
  heap_t *h = iu->iu_heap;
  printf(" --- Heap allocation dump ---\n");
  TAILQ_FOREACH(hb, &h->h_blocks, hb_link) {
    printf("%s 0x%x bytes\n",
           hb->hb_magic == HEAP_MAGIC_ALLOC ? "use " :
           hb->hb_magic == HEAP_MAGIC_FREE  ? "free" :
           "????",
           hb->hb_size);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq 0x90(%rdx), %rbx
leaq 0x1a2f0(%rip), %rdi     # 0x281d1
callq 0x30e0
movq (%rbx), %r14
testq %r14, %r14
je 0xdf3a
leaq 0x171d9(%rip), %r15     # 0x250ce
leaq 0x17499(%rip), %r12     # 0x25395
leaq 0x1748d(%rip), %r13     # 0x25390
leaq 0x17477(%rip), %rbx     # 0x25381
movl (%r14), %eax
movq %r15, %rsi
cmpl $0xf4eef4ee, %eax       # imm = 0xF4EEF4EE
je 0xdf1a
movq %r12, %rsi
movl 0x4(%r14), %edx
cmpl $0xa110ced, %eax        # imm = 0xA110CED
cmoveq %r13, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3190
movq 0x8(%r14), %r14
testq %r14, %r14
jne 0xdf0a
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_libc_hexdump
static int
vmir_libc_hexdump(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t addr = vmir_vm_arg32(&rf);
  uint32_t size = vmir_vm_arg32(&rf);
  printf("Hexdump of 0x%x\n", addr);
  vmir_hexdump("hexdump", iu->iu_mem + addr, size);
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r14
movl -0x4(%rsi), %ebx
movslq -0x8(%rsi), %r15
leaq 0x1741f(%rip), %rdi     # 0x253b2
movl %ebx, %esi
xorl %eax, %eax
callq 0x3190
testq %r15, %r15
jle 0xe186
addq 0x20(%r14), %rbx
movl $0x1, %r14d
leaq 0x40(%rsp), %r12
xorl %ecx, %ecx
xorl %r8d, %r8d
movq %r15, 0x10(%rsp)
movq %r14, 0x38(%rsp)
movq %rbx, 0x20(%rsp)
movq %r8, %rax
orq $0x1, %rax
cmpq %r15, %rax
cmovbeq %r15, %rax
movq %rcx, 0x30(%rsp)
shlq $0x4, %rcx
notq %rcx
addq %rax, %rcx
cmpq $0xf, %rcx
movl $0xf, %eax
cmovaeq %rax, %rcx
leaq (%rcx,%rcx,2), %rax
negq %rax
movq %rax, 0x28(%rsp)
movl $0x64, %esi
movq %r12, %rdi
leaq 0x173b6(%rip), %rdx     # 0x253c3
movq %r8, 0x18(%rsp)
movl %r8d, %ecx
xorl %eax, %eax
callq 0x31a0
movl %eax, %r13d
movl $0xffffffcd, %r15d      # imm = 0xFFFFFFCD
movq $-0x1, %rbx
movl $0x33, %r12d
leaq 0x1(%rbx), %r14
movl %r13d, 0xc(%rsp)
movslq %r13d, %r13
leaq (%rsp,%r13), %rdi
addq $0x40, %rdi
movl $0x64, %esi
subq %r13, %rsi
cmpq $0x7, %rbx
leaq 0x17da3(%rip), %rcx     # 0x25dfc
leaq 0x17b2a(%rip), %rax     # 0x25b8a
cmoveq %rax, %rcx
movq 0x20(%rsp), %rax
movzbl 0x1(%rax,%rbx), %r8d
leaq 0x17356(%rip), %rdx     # 0x253cc
xorl %eax, %eax
callq 0x31a0
movl %eax, %ebp
addl %eax, %r13d
addl $0x3, %r15d
addl $-0x3, %r12d
cmpq $0xe, %r14
ja 0xe0a6
movq 0x18(%rsp), %rax
addq %rbx, %rax
addq $0x2, %rax
movq %r14, %rbx
cmpq 0x10(%rsp), %rax
jb 0xe032
xorl %ebx, %ebx
cmpq $0x7, %r14
setb %bl
movl %ebx, %eax
subl %r15d, %eax
testl %eax, %eax
jle 0xe0dc
movslq %r13d, %rax
leaq (%rsp,%rax), %rdi
addq $0x40, %rdi
movl %ebx, %eax
movq 0x28(%rsp), %rcx
leaq (%rcx,%rax), %rdx
addq $0x30, %rdx
movl $0x20, %esi
callq 0x3210
addl %ebp, %ebx
movl 0xc(%rsp), %eax
addl %r12d, %eax
addl %ebx, %eax
cltq
leaq (%rsp,%rax), %rcx
addq $0x40, %rcx
shlq $0x20, %rax
xorl %edx, %edx
movq 0x20(%rsp), %rbx
movq 0x10(%rsp), %r15
movq 0x38(%rsp), %r14
leaq 0x40(%rsp), %r12
movabsq $0x100000000, %r9       # imm = 0x100000000
movzbl (%rbx,%rdx), %esi
leal -0x7f(%rsi), %r8d
movl $0x2e, %edi
cmpb $-0x5f, %r8b
jb 0xe12a
movl %esi, %edi
movb %dil, (%rcx,%rdx)
addq %r9, %rax
cmpq $0xe, %rdx
ja 0xe143
leaq (%r14,%rdx), %rsi
incq %rdx
cmpq %r15, %rsi
jb 0xe115
sarq $0x20, %rax
movb $0x0, 0x40(%rsp,%rax)
leaq 0x17281(%rip), %rdi     # 0x253d4
leaq 0x17064(%rip), %rsi     # 0x251be
movq %r12, %rdx
xorl %eax, %eax
callq 0x3190
movq 0x18(%rsp), %r8
addq $0x10, %r8
movq 0x30(%rsp), %rcx
incq %rcx
addq $0x10, %rbx
addq $0x10, %r14
cmpl %r8d, %r15d
jg 0xdfbe
xorl %eax, %eax
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir___cxa_allocate_exception
static int
vmir___cxa_allocate_exception(void *ret, const void *rf, ir_unit_t *iu)
{
  uint32_t size = vmir_vm_arg32(&rf);
  void *p = vmir_heap_malloc(iu, size + sizeof(vmir_cxx_exception_t));
  memset(p, 0, sizeof(vmir_cxx_exception_t));
  vmir_vm_retptr(ret, p + sizeof(vmir_cxx_exception_t), iu);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
movl -0x4(%rsi), %esi
addl $0xc, %esi
movq %rdx, %rdi
callq 0xa084
movq $0x0, (%rax)
movl $0x0, 0x8(%rax)
subl 0x20(%rbx), %eax
addl $0xc, %eax
movl %eax, (%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir___cxa_end_catch
static int
vmir___cxa_end_catch(void *ret, const void *rf, ir_unit_t *iu)
{
  vmir_cxx_exception_t *exc = iu->iu_mem + iu->iu_exception.caught;

  if(--exc->handlers == 0) {
    iu->iu_exception.caught = exc->next;
    vmir_heap_free(iu, exc);
  }
  return 0;
}

// Assembly:
movq 0x20(%rdx), %rsi
movl 0x74(%rdx), %eax
decl 0x4(%rsi,%rax)
jne 0xe282
pushq %rax
addq %rax, %rsi
movl (%rsi), %eax
movl %eax, 0x74(%rdx)
movq %rdx, %rdi
callq 0xa10c
addq $0x8, %rsp
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vfd_open
static int
vfd_open(ir_unit_t *iu, const char *path, vmir_openflags_t flags)
{
  intptr_t fh;
  vmir_errcode_t err = iu->iu_fsops->open(iu->iu_opaque, path, flags, &fh);
  if(err)
    return -1;
  return vmir_fd_create_fh(iu, fh, 1);
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
movq 0xc8(%rbx), %rax
leaq 0x8(%rsp), %rcx
callq *(%rax)
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0xe31f
movq 0x8(%rsp), %rsi
leaq -0x4404(%rip), %rcx     # 0x9f0e
movq %rbx, %rdi
movl $0x1, %edx
callq 0x9e2c
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vFILE_open
static vFILE_t *
vFILE_open(ir_unit_t *iu, const char *path, const char *mode,
           int line_buffered)
{
  vmir_openflags_t flags = 0;
  for(int i = 0; i < VMIR_ARRAYSIZE(modetable); i++) {
    if(!strcmp(mode, modetable[i].mode)) {
      flags = modetable[i].flags;
      break;
    }
  }
  if(flags == 0)
    return NULL;

  int fd = vfd_open(iu, path, flags);
  if(fd == -1)
    return NULL;
  return vFILE_open_fd(iu, fd, line_buffered, mode);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorl %r12d, %r12d
leaq 0x164df(%rip), %r13     # 0x24920
leaq (%r12,%r13), %rsi
movq %rbx, %rdi
callq 0x3300
testl %eax, %eax
je 0xe45f
addq $0x8, %r12
cmpq $0x78, %r12
jne 0xe441
xorl %edx, %edx
jmp 0xe464
movl 0x4(%r12,%r13), %edx
testl %edx, %edx
je 0xe492
movq %r14, %rdi
movq %r15, %rsi
callq 0xe2e1
cmpl $-0x1, %eax
je 0xe492
movq %r14, %rdi
movl %eax, %esi
movl %ebp, %edx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe4a3
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/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vFILE_open_fd
static void *
vFILE_open_fd(ir_unit_t *iu, int fd, int line_buffered, const char *mode)
{
  vFILE_t *vfile = vmir_heap_malloc(iu, sizeof(vFILE_t));
  if(vfile == NULL) {
    vmir_fd_close(iu, fd);
    return NULL;
  }
  vfile->iu = iu;
  vfile->fd = fd;

#if USE_FUNOPEN
  vfile->fp = funopen(vfile, fun_read, fun_write, fun_seek, vFILE_close);
#else
  vfile->fp = fopencookie(vfile, mode, cookiefuncs);
#endif
  if(vfile->fp == NULL) {
    vmir_fd_close(iu, fd);
    vmir_heap_free(iu, vfile);
    return NULL;
  }
  if(line_buffered)
    setlinebuf(vfile->fp);
  LIST_INSERT_HEAD(&iu->iu_vfiles, vfile, link);
  return vfile;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r12
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
movl $0x28, %esi
callq 0xa084
testq %rax, %rax
je 0xe535
movq %rax, %rbx
movq %r14, 0x8(%rax)
movl %ebp, 0x10(%rax)
movups 0x1f4c6(%rip), %xmm0    # 0x2d9a0
movups %xmm0, 0x10(%rsp)
movups 0x1f4aa(%rip), %xmm0    # 0x2d990
movups %xmm0, (%rsp)
movq %rax, %rdi
movq %r12, %rsi
callq 0x30a0
movq %rax, (%rbx)
testq %rax, %rax
je 0xe541
testl %r15d, %r15d
je 0xe50a
movq %rax, %rdi
callq 0x31f0
movq 0xf0(%r14), %rax
addq $0xf0, %r14
movq %rax, 0x18(%rbx)
testq %rax, %rax
je 0xe52c
movq %rbx, %rcx
addq $0x18, %rcx
movq %rcx, 0x20(%rax)
movq %rbx, (%r14)
movq %r14, 0x20(%rbx)
jmp 0xe558
movq %r14, %rdi
movl %ebp, %esi
callq 0x9f22
jmp 0xe556
movq %r14, %rdi
movl %ebp, %esi
callq 0x9f22
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa10c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vFILE_close
static int
vFILE_close(void *fh)
{
  vFILE_t *vf = fh;
  ir_unit_t *iu = vf->iu;
  vmir_fd_close(vf->iu, vf->fd);
  LIST_REMOVE(vf, link);
  vmir_heap_free(iu, vf);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8(%rdi), %r14
movl 0x10(%rdi), %esi
movq %r14, %rdi
callq 0x9f22
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xe5e4
movq 0x20(%rbx), %rcx
movq %rcx, 0x20(%rax)
movq 0x20(%rbx), %rcx
movq %rax, (%rcx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa10c
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: fmt_sn
static void
fmt_sn(void *opaque, const char *str, int len)
{
  fmt_sn_aux_t *aux = opaque;
  aux->total += len;
  if(aux->remain == 0)
    return;

  // Figure out how much to copy, we always reserve one byte for trailing 0
  int to_copy = VMIR_MIN(aux->remain - 1, len);

  memcpy(aux->dst, str, to_copy);
  aux->dst += to_copy;
  aux->remain -= to_copy;
}

// Assembly:
addl %edx, 0xc(%rdi)
movl 0x8(%rdi), %eax
testl %eax, %eax
je 0xe843
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
decl %eax
cmpl %edx, %eax
cmovael %edx, %eax
movq (%rdi), %rdi
movslq %eax, %r14
movq %r14, %rdx
callq 0x3360
addq %r14, (%rbx)
subl %r14d, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: vmir_heap_merge_next
static void
vmir_heap_merge_next(heap_t *h, heap_block_t *hb)
{
  heap_block_t *next = TAILQ_NEXT(hb, hb_link);
  if(next == NULL || next->hb_magic != HEAP_MAGIC_FREE)
    return;
  assert(next > hb);
  TAILQ_REMOVE(&h->h_blocks, next, hb_link);
  hb->hb_size += next->hb_size;
}

// Assembly:
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0xef00
cmpl $0xf4eef4ee, (%rax)     # imm = 0xF4EEF4EE
jne 0xef00
cmpq %rsi, %rax
jbe 0xef01
movq 0x8(%rax), %rcx
addq $0x8, %rdi
leaq 0x10(%rcx), %rdx
testq %rcx, %rcx
cmoveq %rdi, %rdx
movq 0x10(%rax), %rdi
movq %rdi, (%rdx)
movq 0x10(%rax), %rdx
movq %rcx, (%rdx)
movl 0x4(%rax), %eax
addl %eax, 0x4(%rsi)
retq
pushq %rax
leaq 0x16553(%rip), %rdi     # 0x2545c
leaq 0x163b6(%rip), %rsi     # 0x252c6
leaq 0x1654f(%rip), %rcx     # 0x25466
movl $0xd7, %edx
callq 0x31e0