// File: /workspace/github_c_makefile_star2_O1/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_func
static void libdef_func(BuildCtx *ctx, char *p, int arg)
{
  if (arg != LIBINIT_CF)
    ffasmfunc++;
  if (ctx->mode == BUILD_libdef) {
    if (modstate == 0) {
      fprintf(stderr, "Error: no module for function definition %s\n", p);
      exit(1);
    }
    if (regfunc == REGFUNC_NOREG) {
      if (optr+1 > obuf+sizeof(obuf)) {
	fprintf(stderr, "Error: output buffer overflow\n");
	exit(1);
      }
      *optr++ = LIBINIT_FFID;
    } else {
      if (arg != LIBINIT_ASM_) {
	if (modstate != 1) fprintf(ctx->fp, ",\n");
	modstate = 2;
	fprintf(ctx->fp, "  %s%s", arg ? LABEL_PREFIX_FFH : LABEL_PREFIX_CF, p);
      }
      if (regfunc != REGFUNC_NOREGUV) obuf[2]++;  /* Bump hash table size. */
      libdef_name(regfunc == REGFUNC_NOREGUV ? "" : p, arg);
    }
  } else if (ctx->mode == BUILD_ffdef) {
    fprintf(ctx->fp, "FFDEF(%s)\n", p);
  } else if (ctx->mode == BUILD_recdef) {
    if (strlen(p) > sizeof(funcname)-1) {
      fprintf(stderr, "Error: function name too long: '%s'\n", p);
      exit(1);
    }
    strcpy(funcname, p);
  } else if (ctx->mode == BUILD_vmdef) {
    int i;
    for (i = 1; p[i] && modname[i-1]; i++)
      if (p[i] == '_') p[i] = '.';
    fprintf(ctx->fp, "\"%s\",\n", p);
  } else if (ctx->mode == BUILD_bcdef) {
    if (arg != LIBINIT_CF)
      fprintf(ctx->fp, ",\n%d", find_ffofs(ctx, p));
  }
  ffid++;
  regfunc = REGFUNC_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0xa843
incl 0xc985(%rip)            # 0x171c8
movl 0x8(%r14), %eax
leal -0x6(%rax), %ecx
cmpl $0x3, %ecx
ja 0xa934
leaq 0x787e(%rip), %rax      # 0x120d8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r14), %rdi
leaq 0x7b2f(%rip), %rsi      # 0x1239d
jmp 0xa8c9
movq %rbx, %rdi
callq 0x50a0
cmpq $0x50, %rax
jae 0xaa49
leaq 0xe9b7(%rip), %rdi      # 0x19240
movq %rbx, %rsi
callq 0x5060
jmp 0xa8d3
movb 0x1(%rbx), %cl
testb %cl, %cl
je 0xa8be
xorl %eax, %eax
leaq 0xe94d(%rip), %rdx      # 0x191f0
cmpb $0x0, (%rax,%rdx)
je 0xa8be
cmpb $0x5f, %cl
jne 0xa8b3
movb $0x2e, 0x1(%rbx,%rax)
movb 0x2(%rbx,%rax), %cl
incq %rax
testb %cl, %cl
jne 0xa8a3
movq 0x10(%r14), %rdi
leaq 0x71f0(%rip), %rsi      # 0x11ab9
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5120
incl 0xc8e7(%rip)            # 0x171c0
movl $0x0, 0xc8ed(%rip)      # 0x171d0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xc8d4(%rip), %eax      # 0x171cc
testl %eax, %eax
je 0xaa51
cmpl $0x1, 0xc8c9(%rip)      # 0x171d0
jne 0xa9ac
movq 0xe8cc(%rip), %rax      # 0x191e0
leaq 0x1(%rax), %rcx
leaq 0xe8c1(%rip), %rdx      # 0x191e0
cmpq %rdx, %rcx
ja 0xaa59
movq %rcx, 0xe8b1(%rip)      # 0x191e0
movb $-0x2, (%rax)
jmp 0xa8d3
testl %ebp, %ebp
sete %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0xa8d3
movslq 0x3c(%r14), %r12
testq %r12, %r12
jle 0xa9a4
movq 0x10(%r14), %rax
movq %rax, 0x10(%rsp)
movq 0x78(%r14), %r13
xorl %r15d, %r15d
movq (%r13,%r15,8), %rdi
movb $0x1, %bpl
cmpb $0x66, (%rdi)
jne 0xa997
cmpb $0x66, 0x1(%rdi)
jne 0xa997
cmpb $0x5f, 0x2(%rdi)
jne 0xa997
addq $0x3, %rdi
movq %rbx, %rsi
callq 0x5100
testl %eax, %eax
jne 0xa997
movq 0x50(%r14), %rax
movl (%rax,%r15,8), %eax
subl 0x28(%r14), %eax
movl %eax, 0xc(%rsp)
xorl %ebp, %ebp
testb %bpl, %bpl
je 0xaa18
incq %r15
cmpq %r15, %r12
jne 0xa95c
movq %rbx, %rdi
callq 0x543c
cmpl $0x80, %ebp
je 0xaa06
cmpl $0x1, %eax
je 0xa9d3
movq 0x10(%r14), %rcx
leaq 0x773e(%rip), %rdi      # 0x12102
movl $0x2, %esi
movl $0x1, %edx
callq 0x51b0
testl %ebp, %ebp
movl $0x2, 0xc7ed(%rip)      # 0x171cc
movq 0x10(%r14), %rdi
leaq 0x79a4(%rip), %rax      # 0x1238e
leaq 0x79a5(%rip), %rdx      # 0x12396
cmovneq %rax, %rdx
leaq 0x798b(%rip), %rsi      # 0x12387
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5120
cmpl $0x2, 0xc7c3(%rip)      # 0x171d0
jne 0xaa34
leaq 0x7038(%rip), %rbx      # 0x11a4e
jmp 0xaa3a
leaq 0x79ae(%rip), %rsi      # 0x123cd
movq 0x10(%rsp), %rdi
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x5120
jmp 0xa8d3
incb 0xc7a8(%rip)            # 0x171e2
movq %rbx, %rdi
movl %ebp, %esi
callq 0xad85
jmp 0xa8d3
movq %rbx, %rdi
callq 0x53cf
movq %rbx, %rdi
callq 0x5418
callq 0x53f3