// File: /workspace/github_c_makefile_star2_O2/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 0x9d0a
incl 0xc4ce(%rip)            # 0x161d8
movl 0x8(%r14), %eax
leal -0x6(%rax), %ecx
cmpl $0x3, %ecx
ja 0x9df1
leaq 0x73a7(%rip), %rax      # 0x110c8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movq 0x10(%r14), %rdi
leaq 0x7658(%rip), %rsi      # 0x1138d
jmp 0x9d8b
movq %rbx, %rdi
callq 0x50a0
cmpq $0x50, %rax
jae 0x9f14
leaq 0xe500(%rip), %rdi      # 0x18250
movq %rbx, %rsi
callq 0x5060
jmp 0x9d95
xorl %eax, %eax
leaq 0xe49d(%rip), %rcx      # 0x18200
movb 0x1(%rbx,%rax), %dl
testb %dl, %dl
je 0x9d80
cmpb $0x0, (%rax,%rcx)
je 0x9d80
cmpb $0x5f, %dl
jne 0x9d7b
movb $0x2e, 0x1(%rbx,%rax)
incq %rax
jmp 0x9d63
movq 0x10(%r14), %rdi
leaq 0x6d0f(%rip), %rsi      # 0x10a9a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
incl 0xc435(%rip)            # 0x161d0
andl $0x0, 0xc43e(%rip)      # 0x161e0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0xc425(%rip), %eax      # 0x161dc
testl %eax, %eax
je 0x9f27
movl 0xc41b(%rip), %ecx      # 0x161e0
cmpl $0x1, %ecx
jne 0x9e49
movq 0xe41f(%rip), %rax      # 0x181f0
leaq 0x1(%rax), %rcx
leaq 0xe414(%rip), %rdx      # 0x181f0
cmpq %rdx, %rcx
ja 0x9f44
movq %rcx, 0xe404(%rip)      # 0x181f0
movb $-0x2, (%rax)
jmp 0x9d95
testl %ebp, %ebp
sete %cl
cmpl $0x5, %eax
setne %al
orb %cl, %al
jne 0x9d95
movq 0x10(%r14), %r15
movl 0x3c(%r14), %r13d
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
cmpq %r12, %r13
je 0x9eea
movq 0x78(%r14), %rax
movq (%rax,%r12,8), %rdi
cmpb $0x66, (%rdi)
jne 0x9e44
cmpb $0x66, 0x1(%rdi)
jne 0x9e44
cmpb $0x5f, 0x2(%rdi)
jne 0x9e44
addq $0x3, %rdi
movq %rbx, %rsi
callq 0x5110
testl %eax, %eax
je 0x9eb3
incq %r12
jmp 0x9e12
cmpl $0x80, %ebp
je 0x9ea5
cmpl $0x1, %eax
je 0x9e6c
movq 0x10(%r14), %rcx
leaq 0x7291(%rip), %rdi      # 0x110f2
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x51d0
testl %ebp, %ebp
movl $0x2, 0xc364(%rip)      # 0x161dc
movq 0x10(%r14), %rdi
leaq 0x74fb(%rip), %rax      # 0x1137e
leaq 0x74fc(%rip), %rdx      # 0x11386
cmovneq %rax, %rdx
leaq 0x74e2(%rip), %rsi      # 0x11377
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
movl 0xc33b(%rip), %ecx      # 0x161e0
cmpl $0x2, %ecx
jne 0x9ed5
leaq 0x6b7e(%rip), %rbx      # 0x10a2f
jmp 0x9edb
movq 0x50(%r14), %rax
movl (%rax,%r12,8), %edx
subl 0x28(%r14), %edx
leaq 0x74f7(%rip), %rsi      # 0x113bd
movq %r15, %rdi
xorl %eax, %eax
callq 0x5130
jmp 0x9d95
incb 0xc317(%rip)            # 0x161f2
movq %rbx, %rdi
movl %ebp, %esi
callq 0xa2a8
jmp 0x9d95
movq 0xc107(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x74e5(%rip), %rsi      # 0x113e0
leaq 0x7503(%rip), %rdx      # 0x11405
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
pushq $0x1
popq %rdi
callq 0x51c0
movq 0xc0dd(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x7473(%rip), %rsi      # 0x11398
jmp 0x9f38
movq 0xc0ca(%rip), %rax      # 0x15ff8
movq (%rax), %rdi
leaq 0x73f3(%rip), %rsi      # 0x1132b
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
jmp 0x9f0c
movq 0xc0ad(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x7403(%rip), %rdi      # 0x11358
pushq $0x1e
popq %rsi
pushq $0x1
popq %rdx
callq 0x51d0
jmp 0x9f0c