// File: /workspace/github_c_makefile_star2_O1/zenkj[P]luajit-arm64/src/host/buildvm_fold.c
// Function: nexttoken
static uint32_t nexttoken(char **pp, int allowlit, int allowany)
{
  char *p = *pp;
  if (p) {
    uint32_t i;
    char *q = strchr(p, ' ');
    if (q) *q++ = '\0';
    *pp = q;
    if (allowlit && !strncmp(p, "IRFPM_", 6)) {
      for (i = 0; irfpm_names[i]; i++)
	if (!strcmp(irfpm_names[i], p+6))
	  return i;
    } else if (allowlit && !strncmp(p, "IRFL_", 5)) {
      for (i = 0; irfield_names[i]; i++)
	if (!strcmp(irfield_names[i], p+5))
	  return i;
    } else if (allowlit && !strncmp(p, "IRCALL_", 7)) {
      for (i = 0; ircall_names[i]; i++)
	if (!strcmp(ircall_names[i], p+7))
	  return i;
    } else if (allowlit && !strncmp(p, "IRCONV_", 7)) {
      for (i = 0; irt_names[i]; i++) {
	const char *r = strchr(p+7, '_');
	if (r && !strncmp(irt_names[i], p+7, r-(p+7))) {
	  uint32_t j;
	  for (j = 0; irt_names[j]; j++)
	    if (!strcmp(irt_names[j], r+1))
	      return (i << 5) + j;
	}
      }
    } else if (allowlit && *p >= '0' && *p <= '9') {
      for (i = 0; *p >= '0' && *p <= '9'; p++)
	i = i*10 + (*p - '0');
      if (*p == '\0')
	return i;
    } else if (allowany && !strcmp("any", p)) {
      return allowany;
    } else {
      for (i = 0; ir_names[i]; i++)
	if (!strcmp(ir_names[i], p))
	  return i;
    }
    fprintf(stderr, "Error: bad fold definition token \"%s\" at line %d\n", p, lineno);
    exit(1);
  }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq (%rdi), %rbx
testq %rbx, %rbx
je 0xb227
movl %edx, %r14d
movl %esi, %ebp
movq %rdi, %r15
movq %rbx, %rdi
movl $0x20, %esi
callq 0x50b0
testq %rax, %rax
je 0xb23c
movq %rax, %rcx
incq %rcx
movb $0x0, (%rax)
jmp 0xb23e
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
movq %rcx, (%r15)
testl %ebp, %ebp
je 0xb2f9
leaq 0x7366(%rip), %rsi      # 0x125b6
movl $0x6, %edx
movq %rbx, %rdi
callq 0x5050
testl %eax, %eax
je 0xb34c
leaq 0x7351(%rip), %rsi      # 0x125bd
movl $0x5, %edx
movq %rbx, %rdi
callq 0x5050
testl %eax, %eax
je 0xb388
leaq 0x733b(%rip), %rsi      # 0x125c3
movl $0x7, %edx
movq %rbx, %rdi
callq 0x5050
testl %eax, %eax
je 0xb3c4
leaq 0x7327(%rip), %rsi      # 0x125cb
movl $0x7, %edx
movq %rbx, %rdi
callq 0x5050
testl %eax, %eax
je 0xb400
movb (%rbx), %al
addb $-0x30, %al
cmpb $0x9, %al
ja 0xb2f9
movb (%rbx), %al
leal -0x30(%rax), %ecx
xorl %r14d, %r14d
cmpb $0x9, %cl
ja 0xb2ec
xorl %r14d, %r14d
leal (%r14,%r14,4), %ecx
addb $-0x30, %al
movzbl %al, %eax
leal (%rax,%rcx,2), %r14d
movb 0x1(%rbx), %al
incq %rbx
leal -0x30(%rax), %ecx
cmpb $0xa, %cl
jb 0xb2d1
testb %al, %al
je 0xb22a
jmp 0xb4cc
testl %r14d, %r14d
je 0xb315
leaq 0x72ce(%rip), %rdi      # 0x125d3
movq %rbx, %rsi
callq 0x5100
testl %eax, %eax
je 0xb22a
leaq 0xaa94(%rip), %r15      # 0x15db0
movq (%r15), %rdi
testq %rdi, %rdi
je 0xb4cc
xorl %r14d, %r14d
movq %rbx, %rsi
callq 0x5100
testl %eax, %eax
je 0xb22a
incl %r14d
movq (%r15,%r14,8), %rdi
testq %rdi, %rdi
jne 0xb32b
jmp 0xb4cc
leaq 0xae2d(%rip), %r12      # 0x16180
movq (%r12), %rdi
testq %rdi, %rdi
je 0xb4cc
leaq 0x6(%rbx), %r15
xorl %r14d, %r14d
movq %r15, %rsi
callq 0x5100
testl %eax, %eax
je 0xb22a
incl %r14d
movq (%r12,%r14,8), %rdi
testq %rdi, %rdi
jne 0xb367
jmp 0xb4cc
leaq 0xae61(%rip), %r12      # 0x161f0
movq (%r12), %rdi
testq %rdi, %rdi
je 0xb4cc
leaq 0x5(%rbx), %r15
xorl %r14d, %r14d
movq %r15, %rsi
callq 0x5100
testl %eax, %eax
je 0xb22a
incl %r14d
movq (%r12,%r14,8), %rdi
testq %rdi, %rdi
jne 0xb3a3
jmp 0xb4cc
leaq 0xaeb5(%rip), %r12      # 0x16280
movq (%r12), %rdi
testq %rdi, %rdi
je 0xb4cc
leaq 0x7(%rbx), %r15
xorl %r14d, %r14d
movq %r15, %rsi
callq 0x5100
testl %eax, %eax
je 0xb22a
incl %r14d
movq (%r12,%r14,8), %rdi
testq %rdi, %rdi
jne 0xb3df
jmp 0xb4cc
leaq 0xaca9(%rip), %rax      # 0x160b0
movq (%rax), %r15
testq %r15, %r15
je 0xb4cc
leaq 0x7(%rbx), %r14
movq %r14, %rdi
movl $0x5f, %esi
callq 0x50b0
movq %rax, %rcx
movq %r14, 0x8(%rsp)
subq %r14, %rcx
movq %rcx, (%rsp)
movq %rax, 0x10(%rsp)
leaq 0x1(%rax), %rbp
xorl %r12d, %r12d
movb $0x1, %r13b
cmpq $0x0, 0x10(%rsp)
je 0xb4ac
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq (%rsp), %rdx
callq 0x5050
testl %eax, %eax
jne 0xb4ac
leaq 0xac4a(%rip), %rax      # 0x160b0
movq (%rax), %rdi
testq %rdi, %rdi
sete %r13b
je 0xb4ac
movq %rbp, %rsi
callq 0x5100
xorl %r15d, %r15d
testl %eax, %eax
je 0xb4a2
incl %r15d
leaq 0xac25(%rip), %rax      # 0x160b0
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
sete %r13b
je 0xb4ac
movq %rbp, %rsi
callq 0x5100
jmp 0xb47d
movl %r12d, %r14d
shll $0x5, %r14d
addl %r15d, %r14d
testb %r13b, %r13b
je 0xb22a
incl %r12d
leaq 0xabf1(%rip), %rax      # 0x160b0
movq (%rax,%r12,8), %r15
testq %r15, %r15
jne 0xb43f
movq %rbx, %rdi
callq 0x5686