// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq %rsi, 0x28(%rsp)
movl %edx, 0x24(%rsp)
cmpl $0x0, 0x24(%rsp)
je 0xd848
movl 0xc989(%rip), %eax      # 0x1a1c8
addl $0x1, %eax
movl %eax, 0xc980(%rip)      # 0x1a1c8
movq 0x30(%rsp), %rax
cmpl $0x7, 0x8(%rax)
jne 0xd9a1
cmpl $0x0, 0xc96e(%rip)      # 0x1a1cc
jne 0xd887
movq 0xc791(%rip), %rax      # 0x19ff8
movq (%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x8a95(%rip), %rsi      # 0x1630b
movb $0x0, %al
callq 0x5110
movl $0x1, %edi
callq 0x5190
cmpl $0x1, 0xc942(%rip)      # 0x1a1d0
jne 0xd8ed
movq 0xe949(%rip), %rax      # 0x1c1e0
addq $0x1, %rax
leaq 0xc93e(%rip), %rcx      # 0x1a1e0
addq $0x2000, %rcx           # imm = 0x2000
cmpq %rcx, %rax
jbe 0xd8d0
movq 0xc743(%rip), %rax      # 0x19ff8
movq (%rax), %rdi
leaq 0x8a79(%rip), %rsi      # 0x16338
movb $0x0, %al
callq 0x5110
movl $0x1, %edi
callq 0x5190
movq 0xe909(%rip), %rax      # 0x1c1e0
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0xe8fb(%rip)      # 0x1c1e0
movb $-0x2, (%rax)
jmp 0xd99c
cmpl $0x80, 0x24(%rsp)
je 0xd956
cmpl $0x1, 0xc8ce(%rip)      # 0x1a1cc
je 0xd917
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x87a4(%rip), %rsi      # 0x160b4
movb $0x0, %al
callq 0x5110
movl $0x2, 0xc8ab(%rip)      # 0x1a1cc
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x24(%rsp), %ecx
leaq 0x8a31(%rip), %rdx      # 0x16366
leaq 0x8a22(%rip), %rax      # 0x1635e
cmpl $0x0, %ecx
cmovneq %rax, %rdx
movq 0x28(%rsp), %rcx
leaq 0x8a08(%rip), %rsi      # 0x16357
movb $0x0, %al
callq 0x5110
cmpl $0x2, 0xc873(%rip)      # 0x1a1d0
je 0xd96d
movb 0xc87d(%rip), %al       # 0x1a1e2
addb $0x1, %al
movb %al, 0xc875(%rip)       # 0x1a1e2
cmpl $0x2, 0xc85c(%rip)      # 0x1a1d0
jne 0xd984
leaq 0x80e1(%rip), %rax      # 0x15a5e
movq %rax, 0x18(%rsp)
jmp 0xd98e
movq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x18(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0xdfb0
jmp 0xdb1a
movq 0x30(%rsp), %rax
cmpl $0x6, 0x8(%rax)
jne 0xd9cd
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x89ac(%rip), %rsi      # 0x1636d
movb $0x0, %al
callq 0x5110
jmp 0xdb18
movq 0x30(%rsp), %rax
cmpl $0x8, 0x8(%rax)
jne 0xda25
movq 0x28(%rsp), %rdi
callq 0x50a0
cmpq $0x4f, %rax
jbe 0xda0f
movq 0xc609(%rip), %rax      # 0x19ff8
movq (%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x897a(%rip), %rsi      # 0x16378
movb $0x0, %al
callq 0x5110
movl $0x1, %edi
callq 0x5190
movq 0x28(%rsp), %rsi
leaq 0xe825(%rip), %rdi      # 0x1c240
callq 0x5060
jmp 0xdb16
movq 0x30(%rsp), %rax
cmpl $0x9, 0x8(%rax)
jne 0xdacc
movl $0x1, 0x20(%rsp)
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, 0x17(%rsp)
je 0xda74
movl 0x20(%rsp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xe78a(%rip), %rax      # 0x1c1f0
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
setne %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xda7e
jmp 0xdaae
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5f, %eax
jne 0xda9f
movq 0x28(%rsp), %rax
movslq 0x20(%rsp), %rcx
movb $0x2e, (%rax,%rcx)
jmp 0xdaa1
movl 0x20(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20(%rsp)
jmp 0xda3c
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x28(%rsp), %rdx
leaq 0x8006(%rip), %rsi      # 0x15ac9
movb $0x0, %al
callq 0x5110
jmp 0xdb14
movq 0x30(%rsp), %rax
cmpl $0x5, 0x8(%rax)
jne 0xdb12
cmpl $0x0, 0x24(%rsp)
je 0xdb10
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0xe110
movq 0x8(%rsp), %rdi
movl %eax, %edx
leaq 0x8894(%rip), %rsi      # 0x1639d
movb $0x0, %al
callq 0x5110
jmp 0xdb12
jmp 0xdb14
jmp 0xdb16
jmp 0xdb18
jmp 0xdb1a
movl 0xc6a0(%rip), %eax      # 0x1a1c0
addl $0x1, %eax
movl %eax, 0xc697(%rip)      # 0x1a1c0
movl $0x0, 0xc69d(%rip)      # 0x1a1d0
addq $0x38, %rsp
retq
nopl (%rax,%rax)