// File: /workspace/github_c_makefile_star2_O2/zenkj[P]luajit-arm64/src/host/buildvm.c
// Function: main
int main(int argc, char **argv)
{
  BuildCtx ctx_;
  BuildCtx *ctx = &ctx_;
  int status, binmode;

  if (sizeof(void *) != 4*LJ_32+8*LJ_64) {
    fprintf(stderr,"Error: pointer size mismatch in cross-build.\n");
    fprintf(stderr,"Try: make HOST_CC=\"gcc -m32\" CROSS=...\n\n");
    return 1;
  }

  UNUSED(argc);
  parseargs(ctx, argv);

  if ((status = build_code(ctx))) {
    fprintf(stderr,"Error: DASM error %08x\n", status);
    return 1;
  }

  switch (ctx->mode) {
  case BUILD_peobj:
  case BUILD_raw:
    binmode = 1;
    break;
  default:
    binmode = 0;
    break;
  }

  if (ctx->outname[0] == '-' && ctx->outname[1] == '\0') {
    ctx->fp = stdout;
#if defined(_WIN32)
    if (binmode)
      _setmode(_fileno(stdout), _O_BINARY);  /* Yuck. */
#endif
  } else if (!(ctx->fp = fopen(ctx->outname, binmode ? "wb" : "w"))) {
    fprintf(stderr, "Error: cannot open output file '%s': %s\n",
	    ctx->outname, strerror(errno));
    exit(1);
  }

  switch (ctx->mode) {
  case BUILD_elfasm:
  case BUILD_coffasm:
  case BUILD_machasm:
    emit_asm(ctx);
    emit_asm_debug(ctx);
    break;
  case BUILD_peobj:
    emit_peobj(ctx);
    break;
  case BUILD_raw:
    emit_raw(ctx);
    break;
  case BUILD_bcdef:
    emit_bcdef(ctx);
    emit_lib(ctx);
    break;
  case BUILD_vmdef:
    emit_vmdef(ctx);
    emit_lib(ctx);
    break;
  case BUILD_ffdef:
  case BUILD_libdef:
  case BUILD_recdef:
    emit_lib(ctx);
    break;
  case BUILD_folddef:
    emit_fold(ctx);
    break;
  default:
    break;
  }

  fflush(ctx->fp);
  if (ferror(ctx->fp)) {
    fprintf(stderr, "Error: cannot write to output file: %s\n",
	    strerror(errno));
    exit(1);
  }
  fclose(ctx->fp);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa58, %rsp            # imm = 0xA58
movq %rsi, %rbx
orl $-0x1, 0x18(%rsp)
leaq 0xb27d(%rip), %rax      # 0x11435
movq %rax, 0x28(%rsp)
pushq $0x1
popq %rbp
pushq $-0x1
popq %r15
leaq 0xf435(%rip), %r12      # 0x15600
movslq %ebp, %rax
movq (%rbx,%rax,8), %rcx
testq %rcx, %rcx
je 0x6282
cmpb $0x2d, (%rcx)
jne 0x6282
movzbl 0x1(%rcx), %edx
cmpl $0x6d, %edx
je 0x6215
cmpl $0x6f, %edx
jne 0x6266
cmpb $0x0, 0x2(%rcx)
jne 0x6b55
incl %ebp
movslq %ebp, %rax
movq (%rbx,%rax,8), %rax
testq %rax, %rax
je 0x6b55
movq %rax, 0x28(%rsp)
jmp 0x625f
cmpb $0x0, 0x2(%rcx)
jne 0x6b55
incl %ebp
movslq %ebp, %rax
movq (%rbx,%rax,8), %r14
testq %r14, %r14
je 0x6b55
movq %r12, %r13
xorl %r15d, %r15d
cmpq $0xb, %r15
je 0x6b55
movq (%r13), %rsi
movq %r14, %rdi
callq 0x5110
testl %eax, %eax
je 0x625a
incq %r15
addq $0x8, %r13
jmp 0x6237
movl %r15d, 0x18(%rsp)
incl %ebp
jmp 0x61cb
testl %edx, %edx
je 0x6282
cmpl $0x2d, %edx
jne 0x6b55
cmpb $0x0, 0x2(%rcx)
jne 0x6b55
incl %ebp
movslq %ebp, %rax
leaq (%rbx,%rax,8), %rax
movq %rax, 0x30(%rsp)
cmpl $-0x1, %r15d
je 0x6b55
movl $0xa3, 0x4c(%rsp)
pushq $0x1
popq %rdi
movl $0x518, %esi            # imm = 0x518
callq 0x5100
movq %rax, 0x60(%rsp)
andl $0x0, 0x54(%rsp)
leaq 0xf3a5(%rip), %r12      # 0x15660
movq %r12, 0x88(%rsp)
movl $0x128, %edi            # imm = 0x128
callq 0x5150
movq %rax, 0x70(%rsp)
andl $0x0, 0x58(%rsp)
xorl %eax, %eax
leaq 0xfe40(%rip), %rcx      # 0x16120
cmpq $0x94, %rax
je 0x62f2
orl $-0x1, (%rax,%rcx)
addq $0x4, %rax
jmp 0x62e0
leaq 0x9356(%rip), %rax      # 0xf64f
leaq 0x10(%rsp), %rbx
movq %rax, 0x80(%rbx)
leaq 0x9350(%rip), %rax      # 0xf65c
movq %rax, 0x88(%rbx)
pushq $0x2
popq %rsi
movq %rbx, %rdi
callq 0x52fc
movq 0x50(%rbx), %rsi
movl 0x3c(%rbx), %edx
movq %rbx, %rdi
callq 0x53d7
leaq 0x4f9c(%rip), %rsi      # 0xb2d0
movq %rbx, %rdi
callq 0x54a4
movq %rbx, %rdi
callq 0x6d0d
movl $0x5d, 0x38(%rbx)
pushq $-0x1
popq %rsi
movq %rbx, %rdi
callq 0x60d5
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x5a3f
testl %eax, %eax
jne 0x6652
leaq 0x10(%rsp), %rbx
movq 0x30(%rbx), %rdi
callq 0x5150
movq %rax, 0x28(%rbx)
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5c8b
testl %eax, %eax
jne 0x6652
leaq 0xa698(%rip), %rsi      # 0x10a2f
leaq 0x92c2(%rip), %rdx      # 0xf660
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x6bdf
movq %rax, 0x70(%rbx)
movslq 0x38(%rbx), %rbp
movl 0x3c(%rbx), %eax
addl %ebp, %eax
incl %eax
movslq %eax, %rdi
shlq $0x4, %rdi
callq 0x5150
movq %rax, 0x58(%rbx)
andl $0x0, 0x40(%rbx)
movq %rbp, %rdi
shlq $0x2, %rdi
callq 0x5150
movq %rax, 0x68(%rbx)
leaq 0xe6db(%rip), %r13      # 0x14ac0
xorl %r14d, %r14d
leaq 0x9281(%rip), %r15      # 0xf670
movslq %ebp, %rax
cmpq %rax, %r14
jge 0x6431
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6099
testl %eax, %eax
js 0x6b2e
movq 0x78(%rsp), %rcx
movl %eax, (%rcx,%r14,4)
movq (%r13), %rcx
movq %rbx, %rdi
movl %eax, %esi
movq %r15, %rdx
callq 0x8bb0
incq %r14
movl 0x48(%rsp), %ebp
addq $0x8, %r13
jmp 0x63ef
movl $0xfffffffe, %r13d      # imm = 0xFFFFFFFE
xorl %ebp, %ebp
leaq 0x9253(%rip), %rbx      # 0xf693
leaq 0x10(%rsp), %r14
movslq 0x4c(%rsp), %rax
cmpq %rax, %rbp
jge 0x64a4
movq (%r12), %r15
movq %r15, %rdi
callq 0x50a0
movq 0x60(%rsp), %rcx
movq (%rcx,%rbp,8), %rsi
testq %rsi, %rsi
je 0x6b5a
cmpl $0x2, %eax
jl 0x6489
leal (%rax,%r13), %ecx
cmpb $0x5f, (%r15,%rcx)
jne 0x6489
addl %r13d, %eax
incl %eax
cmpb $0x5a, (%r15,%rax)
je 0x649b
subl 0x38(%rsp), %esi
movq %r14, %rdi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x8bb0
incq %rbp
addq $0x8, %r12
jmp 0x6445
leaq 0x10(%rsp), %rbx
movl 0x30(%rbx), %esi
leaq 0xa57c(%rip), %rcx      # 0x10a2f
movq %rbx, %rdi
movq %rcx, %rdx
callq 0x8bb0
decl 0x40(%rbx)
movq %rbx, %rdi
callq 0x538f
movl 0x8(%rbx), %ecx
leal -0x3(%rcx), %eax
cmpl $0x2, %eax
leaq 0x8df3(%rip), %rax      # 0xf2cc
leaq 0x98f6(%rip), %rsi      # 0xfdd6
cmovbq %rax, %rsi
movq 0x18(%rbx), %rdi
cmpb $0x2d, (%rdi)
jne 0x64f7
cmpb $0x0, 0x1(%rdi)
je 0x663e
callq 0x5190
movq %rax, 0x20(%rsp)
testq %rax, %rax
je 0x6ba9
movl 0x18(%rsp), %ecx
cmpl $0xa, %ecx
ja 0x6ad3
movl %ecx, %ecx
leaq 0x4c04(%rip), %rdx      # 0xb124
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x8c40
movl 0x8(%rbx), %eax
cmpl $0x2, %eax
je 0x665a
testl %eax, %eax
jne 0x6ad3
movq 0x20(%rsp), %rcx
movq 0x60(%rsp), %rax
movl 0x4f8(%rax), %ebx
subl 0x38(%rsp), %ebx
leaq 0x9902(%rip), %rdi      # 0xfe67
pushq $0x24
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0x990c(%rip), %rdi      # 0xfe8c
movl $0xd2, %esi
movq %r14, %rdx
callq 0x51d0
movq 0x20(%rsp), %rdi
leaq 0x99c6(%rip), %rsi      # 0xff5f
pushq $0x50
popq %rbp
movl %ebx, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x5130
movq 0x20(%rsp), %rdi
movl 0x40(%rsp), %edx
subl %ebx, %edx
leaq 0x9a8f(%rip), %rsi      # 0x10048
xorl %eax, %eax
callq 0x5130
movq 0x20(%rsp), %rcx
leaq 0x9b51(%rip), %rdi      # 0x1011d
pushq $0x22
popq %rsi
movq %r14, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0x9b5d(%rip), %rdi      # 0x10140
movl $0x10d, %esi            # imm = 0x10D
movq %r14, %rdx
callq 0x51d0
movq 0x20(%rsp), %rdi
leaq 0x9c52(%rip), %rsi      # 0x1024e
movl %ebx, %edx
movl %ebp, %ecx
xorl %eax, %eax
callq 0x5130
movq 0x20(%rsp), %rcx
leaq 0x9d3b(%rip), %rdi      # 0x1034e
movl $0xe3, %esi
movq %r14, %rdx
callq 0x51d0
movq 0x20(%rsp), %rdi
movl 0x40(%rsp), %edx
subl %ebx, %edx
leaq 0x9e00(%rip), %rsi      # 0x10432
xorl %eax, %eax
callq 0x5130
jmp 0x6ad3
movq 0xf98b(%rip), %rax      # 0x15fd0
movq (%rax), %rax
movq %rax, 0x20(%rsp)
jmp 0x650e
movl %eax, %r14d
jmp 0x6b35
movq 0x20(%rsp), %rcx
leaq 0x9eb8(%rip), %rdi      # 0x1051e
pushq $0x4c
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0x9eeb(%rip), %rdi      # 0x1056b
movl $0x11c, %esi            # imm = 0x11C
movq %rbx, %rdx
callq 0x51d0
leaq 0x9ff4(%rip), %r14      # 0x10688
leaq 0x9ffd(%rip), %r15      # 0x10698
xorl %r12d, %r12d
movl $0x0, 0xc(%rsp)
movq %r12, %rbp
shlq $0x4, %rbp
movslq 0x50(%rsp), %rax
cmpq %rax, %r12
jge 0x6719
movq 0x68(%rsp), %rax
movl 0x18(%rax,%rbp), %ebx
subl 0x8(%rax,%rbp), %ebx
je 0x6707
movq (%rax,%rbp), %r13
movq %r13, %rdi
movq %r14, %rsi
callq 0x5110
testl %eax, %eax
je 0x6710
movq 0x20(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
movl %r12d, %ecx
movl %r12d, %r8d
movl %r12d, %r9d
xorl %eax, %eax
pushq %r12
pushq $0x50
pushq %rbx
pushq %r13
pushq %r12
pushq %r12
pushq %r12
pushq %r12
callq 0x5130
addq $0x40, %rsp
addq $0x10, %rbp
incq %r12
jmp 0x66ad
incq %r12
movl %ebx, 0xc(%rsp)
jmp 0x66a6
movl 0xc(%rsp), %ebx
testl %ebx, %ebx
je 0x674f
movq 0x20(%rsp), %rcx
leaq 0xa074(%rip), %rdi      # 0x107a1
pushq $0x1
popq %rdx
movl $0xe8, %esi
callq 0x51d0
movq 0x20(%rsp), %rdi
leaq 0xa144(%rip), %rsi      # 0x1088a
movl %ebx, %edx
xorl %eax, %eax
callq 0x5130
movq 0x20(%rsp), %rcx
leaq 0xa234(%rip), %rdi      # 0x1098f
pushq $0x1a
popq %rsi
pushq $0x1
popq %rdx
callq 0x51d0
jmp 0x6ad3
leaq 0xa292(%rip), %rdi      # 0x10a04
pushq $0x2b
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %rax, %rcx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa2a1(%rip), %rdi      # 0x10a30
pushq $0xd
popq %rsi
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa298(%rip), %rdi      # 0x10a3e
pushq $0xb
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xe308(%rip), %r14      # 0x14ac0
leaq 0xa28b(%rip), %rbx      # 0x10a4a
xorl %r15d, %r15d
cmpq $0x2e8, %r15            # imm = 0x2E8
je 0x67e4
movq (%r15,%r14), %rdx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5130
addq $0x8, %r15
jmp 0x67c2
movq 0x20(%rsp), %rcx
leaq 0xa25f(%rip), %rdi      # 0x10a4f
pushq $0x3
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa249(%rip), %rdi      # 0x10a53
pushq $0xb
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xe594(%rip), %r14      # 0x14db0
leaq 0xa227(%rip), %rbx      # 0x10a4a
xorl %r15d, %r15d
cmpq $0x2f0, %r15            # imm = 0x2F0
je 0x6848
movq (%r15,%r14), %rdx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5130
addq $0x8, %r15
jmp 0x6826
movq 0x20(%rsp), %rcx
leaq 0xa1fb(%rip), %rdi      # 0x10a4f
pushq $0x3
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa1f1(%rip), %rdi      # 0x10a5f
pushq $0xe
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xe900(%rip), %r12      # 0x15180
leaq 0xa00(%rsp), %rbx
leaq 0xa1df(%rip), %r14      # 0x10a6e
xorl %r13d, %r13d
cmpq $0x68, %r13
je 0x68c0
movq (%r13,%r12), %rsi
movq 0x20(%rsp), %r15
movq %rbx, %rdi
callq 0x8c10
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
addq $0x8, %r13
jmp 0x6892
movq 0x20(%rsp), %rcx
leaq 0xa1a9(%rip), %rdi      # 0x10a75
pushq $0x3
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa193(%rip), %rdi      # 0x10a79
pushq $0x10
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xe8f8(%rip), %r15      # 0x151f0
leaq 0xa00(%rsp), %rbx
pushq $0x5f
popq %rbp
leaq 0xa164(%rip), %r14      # 0x10a6e
xorl %r12d, %r12d
cmpq $0x88, %r12
je 0x694c
movq (%r12,%r15), %rsi
movq %rbx, %rdi
callq 0x8c10
movq %rbx, %rdi
movl %ebp, %esi
callq 0x50b0
testq %rax, %rax
je 0x6934
movb $0x2e, (%rax)
movq 0x20(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
addq $0x8, %r12
jmp 0x690d
movq 0x20(%rsp), %rcx
leaq 0xa11d(%rip), %rdi      # 0x10a75
pushq $0x3
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa118(%rip), %rdi      # 0x10a8a
pushq $0xf
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xe8fc(%rip), %r14      # 0x15280
leaq 0xa10f(%rip), %rbx      # 0x10a9a
xorl %r15d, %r15d
cmpq $0x240, %r15            # imm = 0x240
je 0x69b0
movq (%r15,%r14), %rdx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5130
addq $0x8, %r15
jmp 0x698e
movq 0x20(%rsp), %rcx
leaq 0xa0b9(%rip), %rdi      # 0x10a75
pushq $0x3
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0xa0cb(%rip), %rdi      # 0x10aa1
pushq $0x11
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xf198(%rip), %r14      # 0x15b80
leaq 0xa0ab(%rip), %rbx      # 0x10a9a
xorl %r15d, %r15d
cmpq $0x118, %r15            # imm = 0x118
je 0x6a14
movq (%r15,%r14), %rdx
movq 0x20(%rsp), %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5130
addq $0x8, %r15
jmp 0x69f2
leaq 0x10(%rsp), %rbx
movq 0x10(%rbx), %rcx
leaq 0xa051(%rip), %rdi      # 0x10a75
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x51d0
movq %rbx, %rdi
jmp 0x6ace
leaq 0x10(%rsp), %rdi
callq 0xa38c
jmp 0x6ad3
leaq 0x9f5d(%rip), %rdi      # 0x109aa
pushq $0x2e
popq %rsi
pushq $0x1
popq %rbx
movq %rbx, %rdx
movq %rax, %rcx
callq 0x51d0
movq 0x20(%rsp), %rcx
leaq 0x9f6f(%rip), %rdi      # 0x109d9
pushq $0x2a
popq %rsi
movq %rbx, %rdx
callq 0x51d0
leaq 0xa943(%rip), %r14      # 0x113bf
leaq 0xa66f(%rip), %r15      # 0x110f2
pushq $0x2
popq %r12
xorl %r13d, %r13d
movslq 0x48(%rsp), %rax
cmpq %rax, %r13
jge 0x6ac9
testq %r13, %r13
je 0x6aac
movq 0x20(%rsp), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x51d0
movq 0x20(%rsp), %rdi
movq 0x78(%rsp), %rax
movl (%rax,%r13,4), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x5130
incq %r13
jmp 0x6a8a
leaq 0x10(%rsp), %rdi
callq 0x96dc
movq 0x20(%rsp), %rdi
callq 0x5160
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x5070
testl %eax, %eax
jne 0x6b7d
movq %rbx, %rdi
callq 0x5090
xorl %eax, %eax
addq $0xa58, %rsp            # imm = 0xA58
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
movq 0x28(%rdi), %rsi
movq 0x30(%rdi), %rdx
callq 0x6149
jmp 0x6ad3
leaq 0x10(%rsp), %rdi
callq 0x9098
jmp 0x6ad3
orl $0x22000000, %r14d      # imm = 0x22000000
movq 0xf4bc(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x876e(%rip), %rsi      # 0xf2b4
movl %r14d, %edx
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %rax
jmp 0x6afc
callq 0x6c5c
movq 0xf497(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x8b0c(%rip), %rsi      # 0xf677
movq %r15, %rdx
xorl %eax, %eax
callq 0x5130
pushq $0x2
popq %rdi
callq 0x51c0
movq 0xf474(%rip), %rax      # 0x15ff8
movq (%rax), %rbx
callq 0x5040
movl (%rax), %edi
callq 0x51e0
leaq 0x7f4f(%rip), %rsi      # 0xeae9
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x5130
jmp 0x6bdb
movq 0xf448(%rip), %rax      # 0x15ff8
movq (%rax), %rbx
movq 0x28(%rsp), %r14
callq 0x5040
movl (%rax), %edi
callq 0x51e0
leaq 0x8704(%rip), %rsi      # 0xf2cf
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x5130
pushq $0x1
jmp 0x6b77