// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
testl %edx, %edx
je 0xa7c5
incl 0xba13(%rip)            # 0x161d8
movl 0x8(%r14), %eax
leal -0x6(%rax), %ecx
cmpl $0x3, %ecx
ja 0xa8b8
leaq 0x78ec(%rip), %rax      # 0x120c8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r14), %rdi
leaq 0x7b9d(%rip), %rsi      # 0x1238d
jmp 0xa84b
movq %rbx, %rdi
callq 0x50a0
cmpq $0x50, %rax
jae 0xa9b6
leaq 0xda45(%rip), %rdi      # 0x18250
movq %rbx, %rsi
callq 0x5060
jmp 0xa855
movb 0x1(%rbx), %cl
testb %cl, %cl
je 0xa840
xorl %eax, %eax
leaq 0xd9db(%rip), %rdx      # 0x18200
cmpb $0x0, (%rax,%rdx)
je 0xa840
cmpb $0x5f, %cl
jne 0xa835
movb $0x2e, 0x1(%rbx,%rax)
movb 0x2(%rbx,%rax), %cl
incq %rax
testb %cl, %cl
jne 0xa825
movq 0x10(%r14), %rdi
leaq 0x724f(%rip), %rsi      # 0x11a9a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
incl 0xb975(%rip)            # 0x161d0
movl $0x0, 0xb97b(%rip)      # 0x161e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xb962(%rip), %eax      # 0x161dc
testl %eax, %eax
je 0xa9be
movl 0xb958(%rip), %ecx      # 0x161e0
cmpl $0x1, %ecx
jne 0xa911
movq 0xd958(%rip), %rax      # 0x181f0
leaq 0x1(%rax), %rcx
leaq 0xd94d(%rip), %rdx      # 0x181f0
cmpq %rdx, %rcx
ja 0xa9c6
movq %rcx, 0xd93d(%rip)      # 0x181f0
movb $-0x2, (%rax)
jmp 0xa855
testl %ebp, %ebp
sete %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0xa855
movslq 0x3c(%r14), %r12
testq %r12, %r12
jle 0xa909
movq 0x10(%r14), %r15
movq 0x78(%r14), %rbp
xorl %r13d, %r13d
movq (%rbp,%r13,8), %rdi
cmpb $0x66, (%rdi)
jne 0xa901
cmpb $0x66, 0x1(%rdi)
jne 0xa901
cmpb $0x5f, 0x2(%rdi)
jne 0xa901
addq $0x3, %rdi
movq %rbx, %rsi
callq 0x5110
testl %eax, %eax
je 0xa97f
incq %r13
cmpq %r13, %r12
jne 0xa8db
movq %rbx, %rdi
callq 0x541b
cmpl $0x80, %ebp
je 0xa971
cmpl $0x1, %eax
je 0xa938
movq 0x10(%r14), %rcx
leaq 0x77c9(%rip), %rdi      # 0x120f2
movl $0x2, %esi
movl $0x1, %edx
callq 0x51c0
testl %ebp, %ebp
movl $0x2, 0xb898(%rip)      # 0x161dc
movq 0x10(%r14), %rdi
leaq 0x7a2f(%rip), %rax      # 0x1237e
leaq 0x7a30(%rip), %rdx      # 0x12386
cmovneq %rax, %rdx
leaq 0x7a16(%rip), %rsi      # 0x12377
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
movl 0xb86f(%rip), %ecx      # 0x161e0
cmpl $0x2, %ecx
jne 0xa9a1
leaq 0x70b2(%rip), %rbx      # 0x11a2f
jmp 0xa9a7
movq 0x50(%r14), %rax
movl (%rax,%r13,8), %edx
subl 0x28(%r14), %edx
leaq 0x7a2b(%rip), %rsi      # 0x123bd
movq %r15, %rdi
xorl %eax, %eax
callq 0x5130
jmp 0xa855
incb 0xb84b(%rip)            # 0x161f2
movq %rbx, %rdi
movl %ebp, %esi
callq 0xace7
jmp 0xa855
movq %rbx, %rdi
callq 0x53ae
movq %rbx, %rdi
callq 0x53f7
callq 0x53d2