// File: /workspace/github_c_makefile_star2_O2/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:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %r13
movl 0x8(%rdi), %eax
leal -0x6(%rax), %ecx
cmpl $0x3, %ecx
jae 0x8ad2
movq 0x10(%r13), %rcx
leaq 0x6861(%rip), %rdi      # 0xf32f
pushq $0x2e
jmp 0x8ae4
cmpl $0x9, %eax
jne 0x8b0a
movq 0x10(%r13), %rcx
leaq 0x6f16(%rip), %rdi      # 0xf9f8
pushq $0x1c
popq %rsi
pushq $0x1
popq %rdx
callq 0x41d0
cmpl $0x8, 0x8(%r13)
jne 0x8b0a
movq 0x10(%r13), %rcx
leaq 0x6f16(%rip), %rdi      # 0xfa15
pushq $0x31
popq %rsi
pushq $0x1
popq %rdx
callq 0x41d0
pushq $0x2
popq %rax
movl %eax, 0xb6ad(%rip)      # 0x141c0
movl %eax, 0xb6ab(%rip)      # 0x141c4
andl $0x0, 0xb6a8(%rip)      # 0x141c8
leaq 0x6f48(%rip), %r15      # 0xfa6f
movq %r13, %rbx
movq 0x20(%r13), %rax
leaq 0x8(%rax), %rcx
movq %rcx, 0x20(%r13)
movq (%rax), %rbp
testq %rbp, %rbp
je 0x8c6b
cmpb $0x2d, (%rbp)
jne 0x8b52
cmpb $0x0, 0x1(%rbp)
je 0x8c57
movq %rbp, %rdi
leaq 0x5ca4(%rip), %rsi      # 0xe800
callq 0x4190
movq %rax, 0x8(%rsp)
testq %rax, %rax
je 0x8e17
andl $0x0, 0xb656(%rip)      # 0x141cc
andl $0x0, 0xb653(%rip)      # 0x141d0
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movl $0x100, %esi            # imm = 0x100
movq 0x8(%rsp), %rdx
callq 0x40f0
testq %rax, %rax
je 0x8c33
movq %r14, %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x41f0
testq %rax, %rax
je 0x8b7d
movq %rax, %rbp
addq $0x6, %rbp
leaq 0xb0fa(%rip), %r13      # 0x13cb8
movq -0x18(%r13), %r14
testq %r14, %r14
je 0x8d01
movq %r14, %rdi
callq 0x40a0
movq %rax, %r12
movq %rbp, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x4050
testl %eax, %eax
je 0x8bee
addq $0x20, %r13
jmp 0x8bbe
addq %r12, %rbp
movq -0x10(%r13), %rsi
testq %rsi, %rsi
je 0x8c07
movq %rbp, %rdi
callq 0x40e0
movq %rax, %r12
jmp 0x8c0a
xorl %r12d, %r12d
cmpb $0x0, (%rbp,%r12)
je 0x8ba0
addq %rbp, %r12
movb $0x0, (%r12)
movl (%r13), %edx
movq %rbx, %rdi
movq %rbp, %rsi
callq *-0x8(%r13)
incq %r12
movq %r12, %rbp
jmp 0x8ba0
movq 0x8(%rsp), %rdi
callq 0x4090
movq %rbx, %r13
cmpl $0x7, 0x8(%rbx)
jne 0x8b2a
movq %r13, %rdi
callq 0x8e42
jmp 0x8b2a
movq 0xb37a(%rip), %rax      # 0x13fd8
movq (%rax), %rax
movq %rax, 0x8(%rsp)
jmp 0x8b6f
movl 0x8(%r13), %eax
addl $-0x5, %eax
cmpl $0x4, %eax
ja 0x8e05
leaq 0x6d52(%rip), %rcx      # 0xf9d4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x10(%r13), %rcx
leaq 0x6ea6(%rip), %rdi      # 0xfb3c
pushq $0x5
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x41d0
movq 0x10(%r13), %rcx
leaq 0x6e3c(%rip), %rdi      # 0xfaec
pushq $0x2b
popq %rsi
movq %r14, %rdx
callq 0x41d0
movq 0x10(%r13), %rcx
leaq 0x6e52(%rip), %rdi      # 0xfb18
pushq $0xe
popq %rsi
movq %r14, %rdx
callq 0x41d0
movl 0xb4f1(%rip), %ebx      # 0x141c8
leaq 0x6e49(%rip), %r15      # 0xfb27
pushq $0xb
popq %r12
cmpl $0x2, %ebx
jl 0x8db0
decl %ebx
movq 0x10(%r13), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x41d0
jmp 0x8ce2
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x40a0
movb $0x0, -0x1(%rax,%rbx)
movq 0xb2de(%rip), %rax      # 0x13ff8
movq (%rax), %rdi
leaq 0x6d52(%rip), %rsi      # 0xfa76
leaq 0x6d44(%rip), %rdx      # 0xfa6f
movq %rbp, %rcx
xorl %eax, %eax
callq 0x4130
pushq $0x1
popq %rdi
callq 0x41c0
movq 0x10(%r13), %rcx
leaq 0x6df4(%rip), %rdi      # 0xfb3c
pushq $0x5
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
callq 0x41d0
movq 0x10(%r13), %rcx
leaq 0x6de0(%rip), %rdi      # 0xfb42
pushq $0x3b
popq %rsi
movq %r14, %rdx
callq 0x41d0
leaq 0xb46c(%rip), %r14      # 0x141e0
leaq 0x6e03(%rip), %r15      # 0xfb7e
cmpb $0x0, (%r14)
movq 0x10(%r13), %rcx
je 0x8da5
movq %rcx, %rdi
movq %r15, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4130
movq %r14, %rdi
callq 0x40a0
addq %rax, %r14
incq %r14
jmp 0x8d7b
leaq 0x6d90(%rip), %rdi      # 0xfb3c
pushq $0x5
jmp 0x8dfc
movq 0x10(%r13), %rcx
leaq 0x6d78(%rip), %rdi      # 0xfb33
pushq $0xe
jmp 0x8dfc
movq 0x10(%r13), %rcx
leaq 0x6cd8(%rip), %rdi      # 0xfaa2
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
callq 0x41d0
movq 0x10(%r13), %rdi
movl 0xb3e9(%rip), %edx      # 0x141c8
leaq 0x6ccc(%rip), %rsi      # 0xfab2
xorl %eax, %eax
callq 0x4130
jmp 0x8e05
movq 0x10(%r13), %rcx
leaq 0x6600(%rip), %rdi      # 0xf3fa
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x41d0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xb1da(%rip), %rax      # 0x13ff8
movq (%rax), %rbx
callq 0x4040
movl (%rax), %edi
callq 0x41e0
leaq 0x6c13(%rip), %rsi      # 0xfa47
movq %rbx, %rdi
movq %rbp, %rdx
movq %rax, %rcx
jmp 0x8d2e