// File: /workspace/github_c_makefile_star2_O0/cogbee[P]vmir-latest/src/vmir_libc.c
// Function: dofmt2
static void
dofmt2(void (*output)(void *opaque, const char *str, int len),
       void *opaque,
       const char *start, const char *end, int num_field_args,
       int type, const void **va, ir_unit_t *iu)
{
  const void *vacopy = *va;
  size_t len = end - start;
  char fmt[len + 1];
  char tmpbuf[100];
  void *alloc = NULL;
  char *dst;
  size_t dz = sizeof(tmpbuf);
  memcpy(fmt, start, len);
  fmt[len] = 0;
  dst = tmpbuf;

  while(1) {
    int n = -1;
    int l1, l2;
    *va = vacopy;
    switch(type) {
    case FMT_TYPE_INT:
      switch(num_field_args) {
      case 0:
        n = snprintf(dst, dz, fmt, vmir_vm_vaarg32(va, iu));
        break;
      case 1:
        l1 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, vmir_vm_vaarg32(va, iu));
        break;
      case 2:
        l1 = vmir_vm_vaarg32(va, iu);
        l2 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, l2, vmir_vm_vaarg32(va, iu));
        break;
      default:
        goto done;
      }
      break;

    case FMT_TYPE_INT64:
      switch(num_field_args) {
      case 0:
        n = snprintf(dst, dz, fmt, vmir_vm_vaarg64(va, iu));
        break;
      case 1:
        l1 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, vmir_vm_vaarg64(va, iu));
        break;
      case 2:
        l1 = vmir_vm_vaarg32(va, iu);
        l2 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, l2, vmir_vm_vaarg64(va, iu));
        break;
      default:
        goto done;
      }
      break;

    case FMT_TYPE_PTR:
      switch(num_field_args) {
      case 0:
        n = snprintf(dst, dz, fmt, (void *)(intptr_t)vmir_vm_vaarg32(va, iu));
        break;
      case 1:
        l1 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1,
                     (void *)(intptr_t)vmir_vm_vaarg32(va, iu));
        break;
      case 2:
        l1 = vmir_vm_vaarg32(va, iu);
        l2 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, l2,
                     (void *)(intptr_t)vmir_vm_vaarg32(va, iu));
        break;
      default:
        goto done;
      }
      break;

    case FMT_TYPE_STR:
      switch(num_field_args) {
      case 0:
        n = snprintf(dst, dz, fmt, vmir_vm_vaptr(va, iu));
        break;
      case 1:
        l1 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, vmir_vm_vaptr(va, iu));
        break;
      case 2:
        l1 = vmir_vm_vaarg32(va, iu);
        l2 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, l2, vmir_vm_vaptr(va, iu));
        break;
      default:
        goto done;
      }
      break;

    case FMT_TYPE_DOUBLE:
      switch(num_field_args) {
      case 0:
        n = snprintf(dst, dz, fmt, vmir_vm_vaarg_dbl(va, iu));
        break;
      case 1:
        l1 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, vmir_vm_vaarg32(va, iu),
                     vmir_vm_vaarg_dbl(va, iu));
        break;
      case 2:
        l1 = vmir_vm_vaarg32(va, iu);
        l2 = vmir_vm_vaarg32(va, iu);
        n = snprintf(dst, dz, fmt, l1, l2, vmir_vm_vaarg_dbl(va, iu));
        break;
      default:
        goto done;
      }
      break;
    }

    if(n < 0)
      break;

    if(n < dz) {
      output(opaque, dst, n);
      break;
    }

    assert(alloc == NULL);
    dz = n + 1;
    alloc = malloc(dz);
    dst = alloc;
  }

 done:
  free(alloc);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movl %r8d, -0x24(%rbp)
movl %r9d, -0x28(%rbp)
movq 0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq %rcx, %rax
incq %rax
movq %rsp, %rdx
movq %rdx, -0x40(%rbp)
addq $0x10, %rcx
andq $-0x10, %rcx
movq %rsp, %rdi
subq %rcx, %rdi
movq %rdi, -0xe0(%rbp)
movq %rdi, %rsp
movq %rax, -0x48(%rbp)
movq $0x0, -0xb8(%rbp)
movq $0x64, -0xc8(%rbp)
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x3330
movq -0xe0(%rbp), %rax
movq -0x38(%rbp), %rcx
movb $0x0, (%rax,%rcx)
leaq -0xb0(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x1ba44
movl $0xffffffff, -0xcc(%rbp) # imm = 0xFFFFFFFF
movq -0x30(%rbp), %rcx
movq 0x10(%rbp), %rax
movq %rcx, (%rax)
movl -0x28(%rbp), %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0xe8(%rbp)
subl $0x4, %eax
ja 0x1c2a6
movq -0xe8(%rbp), %rax
leaq 0x2139e(%rip), %rcx     # 0x3ce1c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x24(%rbp), %eax
movl %eax, -0xec(%rbp)
testl %eax, %eax
je 0x1bab7
jmp 0x1ba96
movl -0xec(%rbp), %eax
subl $0x1, %eax
je 0x1bb09
jmp 0x1baa3
movl -0xec(%rbp), %eax
subl $0x2, %eax
je 0x1bb81
jmp 0x1bc1c
movq -0xc0(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x100(%rbp), %rdi
movq -0xf8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl %eax, %ecx
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bc21
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x110(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x104(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x118(%rbp), %rdi
movq -0x110(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x104(%rbp), %ecx
movl %eax, %r8d
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bc21
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd4(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x128(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x120(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x11c(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x130(%rbp), %rdi
movq -0x128(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x120(%rbp), %ecx
movl -0x11c(%rbp), %r8d
movl %eax, %r9d
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bc21
jmp 0x1c342
jmp 0x1c2a6
movl -0x24(%rbp), %eax
movl %eax, -0x134(%rbp)
testl %eax, %eax
je 0x1bc56
jmp 0x1bc35
movl -0x134(%rbp), %eax
subl $0x1, %eax
je 0x1bca9
jmp 0x1bc42
movl -0x134(%rbp), %eax
subl $0x2, %eax
je 0x1bd21
jmp 0x1bdbc
movq -0xc0(%rbp), %rax
movq %rax, -0x148(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x140(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c3c0
movq -0x148(%rbp), %rdi
movq -0x140(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %rax, %rcx
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bdc1
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x160(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x158(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x14c(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c3c0
movq -0x160(%rbp), %rdi
movq -0x158(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x14c(%rbp), %ecx
movq %rax, %r8
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bdc1
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd4(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x178(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x170(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x168(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x164(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c3c0
movq -0x178(%rbp), %rdi
movq -0x170(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x168(%rbp), %ecx
movl -0x164(%rbp), %r8d
movq %rax, %r9
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bdc1
jmp 0x1c342
jmp 0x1c2a6
movl -0x24(%rbp), %eax
movl %eax, -0x17c(%rbp)
testl %eax, %eax
je 0x1bdf6
jmp 0x1bdd5
movl -0x17c(%rbp), %eax
subl $0x1, %eax
je 0x1be4a
jmp 0x1bde2
movl -0x17c(%rbp), %eax
subl $0x2, %eax
je 0x1bec4
jmp 0x1bf61
movq -0xc0(%rbp), %rax
movq %rax, -0x190(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x188(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x190(%rbp), %rdi
movq -0x188(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bf66
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x1a8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1a0(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x194(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x1a8(%rbp), %rdi
movq -0x1a0(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x194(%rbp), %ecx
movl %eax, %eax
movl %eax, %r8d
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bf66
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd4(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x1c0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1b8(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x1b0(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x1ac(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movq -0x1c0(%rbp), %rdi
movq -0x1b8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x1b0(%rbp), %ecx
movl -0x1ac(%rbp), %r8d
movl %eax, %eax
movl %eax, %r9d
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1bf66
jmp 0x1c342
jmp 0x1c2a6
movl -0x24(%rbp), %eax
movl %eax, -0x1c4(%rbp)
testl %eax, %eax
je 0x1bf9b
jmp 0x1bf7a
movl -0x1c4(%rbp), %eax
subl $0x1, %eax
je 0x1bfee
jmp 0x1bf87
movl -0x1c4(%rbp), %eax
subl $0x2, %eax
je 0x1c066
jmp 0x1c101
movq -0xc0(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1d0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c420
movq -0x1d8(%rbp), %rdi
movq -0x1d0(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %rax, %rcx
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c106
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x1f0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x1dc(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c420
movq -0x1f0(%rbp), %rdi
movq -0x1e8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x1dc(%rbp), %ecx
movq %rax, %r8
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c106
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd4(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x208(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x200(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x1f8(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x1f4(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c420
movq -0x208(%rbp), %rdi
movq -0x200(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x1f8(%rbp), %ecx
movl -0x1f4(%rbp), %r8d
movq %rax, %r9
movb $0x0, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c106
jmp 0x1c342
jmp 0x1c2a6
movl -0x24(%rbp), %eax
movl %eax, -0x20c(%rbp)
testl %eax, %eax
je 0x1c13b
jmp 0x1c11a
movl -0x20c(%rbp), %eax
subl $0x1, %eax
je 0x1c18b
jmp 0x1c127
movl -0x20c(%rbp), %eax
subl $0x2, %eax
je 0x1c207
jmp 0x1c29f
movq -0xc0(%rbp), %rax
movq %rax, -0x220(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x218(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c460
movq -0x220(%rbp), %rdi
movq -0x218(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movb $0x1, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c2a4
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x238(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x230(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0x224(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c460
movq -0x238(%rbp), %rdi
movq -0x230(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x224(%rbp), %ecx
movb $0x1, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c2a4
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd0(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c360
movl %eax, -0xd4(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x248(%rbp)
movl -0xd0(%rbp), %eax
movl %eax, -0x240(%rbp)
movl -0xd4(%rbp), %eax
movl %eax, -0x23c(%rbp)
movq 0x10(%rbp), %rdi
movq 0x18(%rbp), %rsi
callq 0x1c460
movq -0x250(%rbp), %rdi
movq -0x248(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movl -0x240(%rbp), %ecx
movl -0x23c(%rbp), %r8d
movb $0x1, %al
callq 0x3180
movl %eax, -0xcc(%rbp)
jmp 0x1c2a4
jmp 0x1c342
jmp 0x1c2a6
cmpl $0x0, -0xcc(%rbp)
jge 0x1c2b4
jmp 0x1c340
movslq -0xcc(%rbp), %rax
cmpq -0xc8(%rbp), %rax
jae 0x1c2dd
movq -0x8(%rbp), %rax
movq -0x10(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movl -0xcc(%rbp), %edx
callq *%rax
jmp 0x1c340
cmpq $0x0, -0xb8(%rbp)
jne 0x1c2e9
jmp 0x1c308
leaq 0x2228d(%rip), %rdi     # 0x3e57d
leaq 0x22254(%rip), %rsi     # 0x3e54b
movl $0x457, %edx            # imm = 0x457
leaq 0x22288(%rip), %rcx     # 0x3e58b
callq 0x31c0
movl -0xcc(%rbp), %eax
addl $0x1, %eax
cltq
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rdi
callq 0x3360
movq %rax, -0xb8(%rbp)
movq -0xb8(%rbp), %rax
movq %rax, -0xc0(%rbp)
jmp 0x1ba42
jmp 0x1c342
movq -0xb8(%rbp), %rdi
callq 0x3030
movq -0x40(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw (%rax,%rax)