// File: /workspace/github_c_makefile_star2_O0/fanf2[P]luajit-2/src/buildvm_lib.c
// Function: emit_lib
void emit_lib(BuildCtx *ctx)
{
  const char *fname;

  if (ctx->mode == BUILD_ffdef || ctx->mode == BUILD_libdef ||
      ctx->mode == BUILD_recdef)
    fprintf(ctx->fp, "/* This is a generated file. DO NOT EDIT! */\n\n");
  else if (ctx->mode == BUILD_vmdef)
    fprintf(ctx->fp, "ffnames = {\n[0]=\"Lua\",\n\"C\",\n");
  if (ctx->mode == BUILD_recdef)
    fprintf(ctx->fp, "static const uint16_t recff_idmap[] = {\n0,\n0x0100");
  recffid = ffid = FF_C+1;
  ffasmfunc = 0;

  while ((fname = *ctx->args++)) {
    char buf[256];  /* We don't care about analyzing lines longer than that. */
    FILE *fp;
    if (fname[0] == '-' && fname[1] == '\0') {
      fp = stdin;
    } else {
      fp = fopen(fname, "r");
      if (!fp) {
	fprintf(stderr, "Error: cannot open input file '%s': %s\n",
		fname, strerror(errno));
	exit(1);
      }
    }
    modstate = 0;
    regfunc = REGFUNC_OK;
    while (fgets(buf, sizeof(buf), fp) != NULL) {
      char *p;
      for (p = buf; (p = strstr(p, LIBDEF_PREFIX)) != NULL; ) {
	const LibDefHandler *ldh;
	p += sizeof(LIBDEF_PREFIX)-1;
	for (ldh = libdef_handlers; ldh->suffix != NULL; ldh++) {
	  size_t n, len = strlen(ldh->suffix);
	  if (!strncmp(p, ldh->suffix, len)) {
	    p += len;
	    n = ldh->stop ? strcspn(p, ldh->stop) : 0;
	    if (!p[n]) break;
	    p[n] = '\0';
	    ldh->func(ctx, p, ldh->arg);
	    p += n+1;
	    break;
	  }
	}
	if (ldh->suffix == NULL) {
	  buf[strlen(buf)-1] = '\0';
	  fprintf(stderr, "Error: unknown library definition tag %s%s\n",
		  LIBDEF_PREFIX, p);
	  exit(1);
	}
      }
    }
    fclose(fp);
    if (ctx->mode == BUILD_libdef) {
      libdef_endmodule(ctx);
    }
  }

  if (ctx->mode == BUILD_ffdef) {
    fprintf(ctx->fp, "\n#undef FFDEF\n\n");
    fprintf(ctx->fp,
      "#ifndef FF_NUM_ASMFUNC\n#define FF_NUM_ASMFUNC %d\n#endif\n\n",
      ffasmfunc);
  } else if (ctx->mode == BUILD_vmdef) {
    fprintf(ctx->fp, "}\n\n");
  } else if (ctx->mode == BUILD_bcdef) {
    int i;
    fprintf(ctx->fp, "\n};\n\n");
    fprintf(ctx->fp, "LJ_DATADEF const uint16_t lj_bc_mode[] = {\n");
    fprintf(ctx->fp, "BCDEF(BCMODE)\n");
    for (i = ffasmfunc-1; i > 0; i--)
      fprintf(ctx->fp, "BCMODE_FF,\n");
    fprintf(ctx->fp, "BCMODE_FF\n};\n\n");
  } else if (ctx->mode == BUILD_recdef) {
    char *p = (char *)obuf;
    fprintf(ctx->fp, "\n};\n\n");
    fprintf(ctx->fp, "static const RecordFunc recff_func[] = {\n"
	    "recff_nyi,\n"
	    "recff_c");
    while (*p) {
      fprintf(ctx->fp, ",\nrecff_%s", p);
      p += strlen(p)+1;
    }
    fprintf(ctx->fp, "\n};\n\n");
  }
}

// Assembly:
subq $0x168, %rsp            # imm = 0x168
movq %rdi, 0x160(%rsp)
movq 0x160(%rsp), %rax
cmpl $0x6, 0x8(%rax)
je 0xcb69
movq 0x160(%rsp), %rax
cmpl $0x7, 0x8(%rax)
je 0xcb69
movq 0x160(%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0xcb85
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x77e2(%rip), %rsi      # 0x1435e
movb $0x0, %al
callq 0x4110
jmp 0xcbaf
movq 0x160(%rsp), %rax
cmpl $0x9, 0x8(%rax)
jne 0xcbad
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7e19(%rip), %rsi      # 0x149bf
movb $0x0, %al
callq 0x4110
jmp 0xcbaf
movq 0x160(%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0xcbd7
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7e0c(%rip), %rsi      # 0x149dc
movb $0x0, %al
callq 0x4110
movl $0x2, 0xb5cf(%rip)      # 0x181b0
movl $0x2, 0xb5c9(%rip)      # 0x181b4
movl $0x0, 0xb5c3(%rip)      # 0x181b8
movq 0x160(%rsp), %rcx
movq 0x20(%rcx), %rax
movq %rax, %rdx
addq $0x8, %rdx
movq %rdx, 0x20(%rcx)
movq (%rax), %rax
movq %rax, 0x158(%rsp)
cmpq $0x0, %rax
je 0xcea9
movq 0x158(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0xcc53
movq 0x158(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0xcc53
movq 0xb38f(%rip), %rax      # 0x17fd8
movq (%rax), %rax
movq %rax, 0x48(%rsp)
jmp 0xccc3
movq 0x158(%rsp), %rdi
leaq 0x6bae(%rip), %rsi      # 0x13810
callq 0x4160
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0xccc1
movq 0xb37d(%rip), %rax      # 0x17ff8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x158(%rsp), %rax
movq %rax, 0x10(%rsp)
callq 0x4040
movl (%rax), %edi
callq 0x41b0
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rdx
movq %rax, %rcx
leaq 0x7d5e(%rip), %rsi      # 0x14a0e
movb $0x0, %al
callq 0x4110
movl $0x1, %edi
callq 0x4190
jmp 0xccc3
movl $0x0, 0xb4ef(%rip)      # 0x181bc
movl $0x0, 0xb4e9(%rip)      # 0x181c0
leaq 0x50(%rsp), %rdi
movq 0x48(%rsp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x40e0
cmpq $0x0, %rax
je 0xce7f
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x7d2b(%rip), %rsi      # 0x14a36
callq 0x41c0
movq %rax, 0x40(%rsp)
cmpq $0x0, %rax
je 0xce7a
movq 0x40(%rsp), %rax
addq $0x6, %rax
movq %rax, 0x40(%rsp)
leaq 0xaf6c(%rip), %rax      # 0x17ca0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
cmpq $0x0, (%rax)
je 0xce29
movq 0x38(%rsp), %rax
movq (%rax), %rdi
callq 0x40a0
movq %rax, 0x28(%rsp)
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movq (%rax), %rsi
movq 0x28(%rsp), %rdx
callq 0x4050
cmpl $0x0, %eax
jne 0xce14
movq 0x28(%rsp), %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x38(%rsp), %rax
cmpq $0x0, 0x8(%rax)
je 0xcdae
movq 0x40(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x40d0
movq %rax, (%rsp)
jmp 0xcdb6
xorl %eax, %eax
movq %rax, (%rsp)
jmp 0xcdb6
movq (%rsp), %rax
movq %rax, 0x30(%rsp)
movq 0x40(%rsp), %rax
movq 0x30(%rsp), %rcx
cmpb $0x0, (%rax,%rcx)
jne 0xcdd1
jmp 0xce29
movq 0x40(%rsp), %rax
movq 0x30(%rsp), %rcx
movb $0x0, (%rax,%rcx)
movq 0x38(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x160(%rsp), %rdi
movq 0x40(%rsp), %rsi
movq 0x38(%rsp), %rcx
movl 0x18(%rcx), %edx
callq *%rax
movq 0x30(%rsp), %rax
addq $0x1, %rax
addq 0x40(%rsp), %rax
movq %rax, 0x40(%rsp)
jmp 0xce29
jmp 0xce16
movq 0x38(%rsp), %rax
addq $0x20, %rax
movq %rax, 0x38(%rsp)
jmp 0xcd39
movq 0x38(%rsp), %rax
cmpq $0x0, (%rax)
jne 0xce75
leaq 0x50(%rsp), %rdi
callq 0x40a0
subq $0x1, %rax
movb $0x0, 0x50(%rsp,%rax)
movq 0xb1aa(%rip), %rax      # 0x17ff8
movq (%rax), %rdi
movq 0x40(%rsp), %rcx
leaq 0x7be0(%rip), %rsi      # 0x14a3d
leaq 0x7bd2(%rip), %rdx      # 0x14a36
movb $0x0, %al
callq 0x4110
movl $0x1, %edi
callq 0x4190
jmp 0xccff
jmp 0xccd7
movq 0x48(%rsp), %rdi
callq 0x4090
movq 0x160(%rsp), %rax
cmpl $0x7, 0x8(%rax)
jne 0xcea4
movq 0x160(%rsp), %rdi
callq 0xd0a0
jmp 0xcbf5
movq 0x160(%rsp), %rax
cmpl $0x6, 0x8(%rax)
jne 0xcef6
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7b9f(%rip), %rsi      # 0x14a69
movb $0x0, %al
callq 0x4110
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0xb2d5(%rip), %edx      # 0x181b8
leaq 0x7b8f(%rip), %rsi      # 0x14a79
movb $0x0, %al
callq 0x4110
jmp 0xd092
movq 0x160(%rsp), %rax
cmpl $0x9, 0x8(%rax)
jne 0xcf23
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7512(%rip), %rsi      # 0x14429
movb $0x0, %al
callq 0x4110
jmp 0xd090
movq 0x160(%rsp), %rax
cmpl $0x5, 0x8(%rax)
jne 0xcfdd
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7bbb(%rip), %rsi      # 0x14b03
movb $0x0, %al
callq 0x4110
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7b51(%rip), %rsi      # 0x14ab3
movb $0x0, %al
callq 0x4110
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7b63(%rip), %rsi      # 0x14adf
movb $0x0, %al
callq 0x4110
movl 0xb22f(%rip), %eax      # 0x181b8
subl $0x1, %eax
movl %eax, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
jle 0xcfbe
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7b44(%rip), %rsi      # 0x14aee
movb $0x0, %al
callq 0x4110
movl 0x24(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0xcf90
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7b29(%rip), %rsi      # 0x14afa
movb $0x0, %al
callq 0x4110
jmp 0xd08e
movq 0x160(%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0xd08c
leaq 0xb1da(%rip), %rax      # 0x181d0
movq %rax, 0x18(%rsp)
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7af5(%rip), %rsi      # 0x14b03
movb $0x0, %al
callq 0x4110
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7ae1(%rip), %rsi      # 0x14b09
movb $0x0, %al
callq 0x4110
movq 0x18(%rsp), %rax
cmpb $0x0, (%rax)
je 0xd072
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x18(%rsp), %rdx
leaq 0x7af4(%rip), %rsi      # 0x14b45
movb $0x0, %al
callq 0x4110
movq 0x18(%rsp), %rdi
callq 0x40a0
addq $0x1, %rax
addq 0x18(%rsp), %rax
movq %rax, 0x18(%rsp)
jmp 0xd02f
movq 0x160(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x7a7e(%rip), %rsi      # 0x14b03
movb $0x0, %al
callq 0x4110
jmp 0xd08e
jmp 0xd090
jmp 0xd092
addq $0x168, %rsp            # imm = 0x168
retq
nopw (%rax,%rax)