// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/lpeg-0.10.2/lpeg.c
// Function: getpatt
static Instruction *getpatt (lua_State *L, int idx, int *size) {
  Instruction *p;
  switch (lua_type(L, idx)) {
    case LUA_TSTRING: {
      size_t i, len;
      const char *s = lua_tolstring(L, idx, &len);
      p = newpatt(L, len);
      for (i = 0; i < len; i++)
        setinstaux(p + i, IChar, 0, (byte)s[i]);
      lua_replace(L, idx);
      break;
    }
    case LUA_TNUMBER: {
      int n = lua_tointeger(L, idx);
      if (n == 0)  /* empty pattern? */
        p = newpatt(L, 0);
      else if (n > 0)
        p = any(L, n, 0, NULL);
      else if (-n <= UCHAR_MAX) {
        p = newpatt(L, 2);
        setinstaux(p, IAny, 2, -n);
        setinst(p + 1, IFail, 0);
      }
      else {
        int offset = 2;  /* space for ITestAny & IChoice */
        p = any(L, -n - UCHAR_MAX, 3, &offset);
        setinstaux(p, IAny, offset + 1, UCHAR_MAX);
        setinstaux(p + 1, IChoice, offset, UCHAR_MAX);
        setinst(p + offset, IFailTwice, 0);
      }
      lua_replace(L, idx);
      break;
    }
    case LUA_TBOOLEAN: {
      if (lua_toboolean(L, idx))  /* true? */
        p = newpatt(L, 0);  /* empty pattern (always succeeds) */
      else {
        p = newpatt(L, 1);
        setinst(p, IFail, 0);
      }
      lua_replace(L, idx);
      break;
    }
    case LUA_TTABLE: {
      p = fix_l(L, idx);
      break;
    }
    case LUA_TFUNCTION: {
      p = newpatt(L, 2);
      setinstcap(p, IOpenCapture, value2fenv(L, idx), Cruntime, 0);
      setinstcap(p + 1, ICloseRunTime, 0, Cclose, 0);
      lua_replace(L, idx);
      break;
    }
    default: {
      p = checkpattern(L, idx);
      break;
    }
  }
  if (size) *size = pattsize(L, idx);
  return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbp
callq 0x223a4b
decl %eax
cmpl $0x5, %eax
ja 0x23ddf3
leaq 0x18b6c1(%rip), %rcx    # 0x3c9478
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
movq %rbp, 0x8(%rsp)
jmpq *%rax
movq %rbp, %rdi
movl %r15d, %esi
callq 0x223e82
testl %eax, %eax
jne 0x23de95
movl $0x1, %esi
movq %rbp, %rdi
callq 0x23d5e1
movq %rax, %r12
movl $0xf, (%rax)
jmp 0x23e04a
leaq 0x18b899(%rip), %rdx    # 0x3c9693
movq %rbp, %rdi
movl %r15d, %esi
callq 0x22712c
movq %rax, %r12
jmp 0x23e055
movl %r15d, %esi
leaq 0x58(%rsp), %r15
movq %rbp, %rdi
movq %rbp, %r12
movl %esi, %ebp
movq %r15, %rdx
callq 0x223ea8
movq %rax, %rbx
movq (%r15), %rsi
movq %r12, %rdi
callq 0x23d5e1
movq %rax, %r12
cmpq $0x0, (%r15)
je 0x23de5d
xorl %eax, %eax
movb (%rbx,%rax), %cl
movb $0x1, (%r12,%rax,8)
movw $0x0, 0x2(%r12,%rax,8)
movb %cl, 0x1(%r12,%rax,8)
incq %rax
cmpq 0x58(%rsp), %rax
jb 0x23de3e
movq 0x8(%rsp), %rdi
movl %ebp, %r15d
movq %rdi, %rbp
jmp 0x23e04d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x223e53
movq %rax, %rbx
testl %ebx, %ebx
je 0x23de95
jle 0x23e3fa
movq %rbp, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x23ea6b
jmp 0x23de9f
movq %rbp, %rdi
xorl %esi, %esi
callq 0x23d5e1
movq %rax, %r12
jmp 0x23e04a
movq %r14, 0x38(%rsp)
movq %rbp, %rdi
callq 0x2235ac
movl %eax, %r14d
movq %rbp, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x224be0
movl $0x1, %esi
movq %rbp, %rdi
callq 0x2241dd
movq %rbp, %rdi
callq 0x2241b4
movq %rbp, %rdi
movl %r15d, %esi
callq 0x2258a3
testl %eax, %eax
movq %r14, 0x18(%rsp)
je 0x23e080
leal 0x2(%r14), %ebx
leal 0x1(%r14), %r12d
movl $0x2, %r14d
movl $0x0, 0x4(%rsp)
movq %rbp, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x223e24
ucomisd 0x10830d(%rip), %xmm0   # 0x346228
jne 0x23df3f
jp 0x23df3f
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x223b1f
testl %eax, %eax
je 0x23df3f
movq %rbp, %rdi
movl %ebx, %esi
callq 0x22383a
jmp 0x23dffe
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x23eb40
testl %eax, %eax
jne 0x23df71
movq %rbp, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x23eba6
movq %rbp, %rdi
leaq 0x18b7cc(%rip), %rsi    # 0x3c9733
movq %rax, %rdx
xorl %eax, %eax
callq 0x226e43
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x223f77
movq %rax, %r13
shrq $0x3, %r13
movl $0x7ff5, %eax           # imm = 0x7FF5
subl %r13d, %eax
cmpl %eax, %r14d
jl 0x23dfa3
movq %rbp, %rdi
leaq 0x18b7ab(%rip), %rsi    # 0x3c9747
xorl %eax, %eax
callq 0x226e43
movq %rbp, %rdi
movl $0x14, %esi
leaq 0x18b7a7(%rip), %rdx    # 0x3c9759
callq 0x2271b2
movq %rbp, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x2237fd
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x223a2b
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x223a2b
movslq %r14d, %rsi
movq %rbp, %rdi
callq 0x2241dd
movq %rbp, %rdi
movl %r12d, %esi
callq 0x224d62
addl %r14d, %r13d
incl 0x4(%rsp)
movl %r13d, %r14d
movq %rbp, %rdi
movl %r15d, %esi
callq 0x2258a3
testl %eax, %eax
jne 0x23df06
cmpl $0x0, 0x4(%rsp)
jg 0x23e0a0
jmp 0x23e08e
movl $0x2, %esi
movq %rbp, %rdi
callq 0x23d5e1
movq %rax, %r12
movq %rbp, %rdi
movl %r15d, %esi
callq 0x23eafb
movl $0x10c15, (%r12)        # imm = 0x10C15
movl $0x17, 0x8(%r12)
movq %rbp, %rdi
movl %r15d, %esi
callq 0x22383a
testq %r14, %r14
je 0x23e06e
movq %rbp, %rdi
movl %r15d, %esi
callq 0x223f77
shrq $0x3, %rax
decl %eax
movl %eax, (%r14)
movq %r12, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0x4(%rsp)
movl $0x2, %r14d
leaq 0x18b6df(%rip), %rdx    # 0x3c9774
movq %rbp, %rdi
movl %r15d, %esi
callq 0x226d91
movslq %r14d, %rbx
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x23d5e1
leaq 0x10(%rax), %r12
movw $0x8, 0x8(%rax)
leal -0x1(%rbx), %ecx
movw %cx, 0xa(%rax)
movl 0x4(%rsp), %r14d
testl %r14d, %r14d
movl %r15d, 0x2c(%rsp)
jle 0x23e2c5
movq 0x18(%rsp), %rax
leal 0x1(%rax), %r13d
movq %rbp, %r15
leal 0x3(%rax), %ebp
movq %r15, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %r12
addq $0x8, %r12
movl $0x5, -0x8(%r12)
addl $0x2, %ebp
decl %r14d
jne 0x23e0e1
shlq $0x3, %rbx
subq %rbx, %r12
leaq -0x8(%r12), %rax
movq %rax, 0x48(%rsp)
movq 0x18(%rsp), %rax
leal 0x2(%rax), %ebx
movl $0x2, %edx
movl $0x1, %eax
movq %r15, %rbp
movq %r13, 0x30(%rsp)
movq %rbx, 0x40(%rsp)
movq %rdx, 0x20(%rsp)
leal (%r13,%rax,2), %esi
movq %rbp, %rdi
movq %rax, %r14
callq 0x223f77
movq 0x20(%rsp), %r8
shrq $0x3, %rax
leal (%r8,%rax), %r15d
movq %r14, 0x50(%rsp)
leal (%rbx,%r14,2), %r9d
movl %r8d, %ebx
testl %eax, %eax
jle 0x23e271
xorl %r13d, %r13d
movl %r8d, %ebx
movl %r15d, 0x14(%rsp)
movslq %ebx, %rax
leaq (%r12,%rax,8), %rbp
movb (%rbp), %dl
cmpb $0xc, %dl
jne 0x23e191
movswl 0x2(%rbp), %ecx
testl %ecx, %ecx
js 0x23e1c8
cmpb $0xa, %dl
cmovel %ebx, %r13d
movzbl (%rbp), %ecx
movl $0x5, %eax
leal -0x2(%rcx), %edx
cmpl $0x2, %edx
jb 0x23e1bc
cmpl $0x11, %ecx
jne 0x23e1b7
movzbl 0x1(%rbp), %eax
addl $0x2, %eax
jmp 0x23e1bc
movl $0x1, %eax
addl %eax, %ebx
cmpl %r15d, %ebx
jl 0x23e17a
jmp 0x23e271
addl %ebx, %ecx
movslq %ecx, %rdx
cmpb $0x7, -0x8(%r12,%rdx,8)
jne 0x23e48f
leal 0x1(%rax), %esi
cmpb $0x8, 0x8(%r12,%rax,8)
jne 0x23e1fe
incq %rax
movswq 0x2(%r12,%rax,8), %rdi
movslq %esi, %rax
addq %rdi, %rax
cmpb $0x8, (%r12,%rax,8)
movl %eax, %esi
je 0x23e1e7
jmp 0x23e200
movl %esi, %eax
leaq -0x1(%rdx), %rsi
movswl 0x2(%r12,%rsi,8), %edi
addl %esi, %edi
cmpl %eax, %edi
jne 0x23e48f
cmpl %r13d, %ecx
jg 0x23e198
leaq (%r12,%rdx,8), %rdx
movq 0x8(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %rbp, %rcx
movq 0x30(%rsp), %r8
movl %r9d, %r15d
callq 0x23ef3d
testl %eax, %eax
jne 0x23e25f
movq %r14, %rdi
movl %r15d, %esi
callq 0x23eba6
movq %r14, %rdi
leaq 0x18b5f8(%rip), %rsi    # 0x3c984d
movq %rax, %rdx
xorl %eax, %eax
callq 0x226e43
movq 0x20(%rsp), %r8
movl %r15d, %r9d
movl 0x14(%rsp), %r15d
jmp 0x23e198
movslq %ebx, %rax
movq 0x48(%rsp), %rcx
cmpb $0x5, (%rcx,%rax,8)
jne 0x23e4ae
movslq %r8d, %rax
leaq (%r12,%rax,8), %rdx
movslq %r15d, %rax
leaq (%rcx,%rax,8), %rcx
movq 0x8(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %r13
movl %r13d, %r8d
callq 0x23ef3d
movq 0x50(%rsp), %rcx
leal 0x1(%rcx), %eax
movl %r15d, %edx
cmpl 0x4(%rsp), %ecx
movq 0x40(%rsp), %rbx
jne 0x23e139
jmp 0x23e2de
shlq $0x3, %rbx
subq %rbx, %r12
movq 0x18(%rsp), %rax
leal 0x2(%rax), %ebx
leal 0x1(%rax), %r13d
movl $0x2, %r15d
movq %rbp, %rdi
movl %ebx, %esi
callq 0x223a2b
movq %rbp, %rdi
movl %r13d, %esi
callq 0x2248f5
movq %rbp, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x223e24
cvttsd2si %xmm0, %ebx
movq %rbp, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x2235b9
testl %ebx, %ebx
movq 0x38(%rsp), %r14
jne 0x23e32d
leaq 0x18b461(%rip), %rsi    # 0x3c9782
xorl %ebx, %ebx
movq %rbp, %rdi
xorl %eax, %eax
callq 0x226e43
movw $0x9, (%r12)
movw %bx, 0x2(%r12)
testl %r15d, %r15d
jle 0x23e3d0
xorl %ebx, %ebx
movl %ebx, %ebx
movb (%r12,%rbx,8), %cl
cmpb $0xa, %cl
jne 0x23e3a0
movswl 0x2(%r12,%rbx,8), %edx
movq %rbp, %rdi
movl %r13d, %esi
callq 0x23ecae
movslq %ebx, %rcx
movb 0x8(%r12,%rcx,8), %dl
cmpb $0x8, %dl
jne 0x23e38b
leal 0x1(%rcx), %esi
incq %rcx
movswq 0x2(%r12,%rcx,8), %rdx
movslq %esi, %rcx
addq %rdx, %rcx
movb (%r12,%rcx,8), %dl
movl %ecx, %esi
cmpb $0x8, %dl
je 0x23e374
cmpb $0x5, %dl
sete %cl
xorb $0x9, %cl
movb %cl, (%r12,%rbx,8)
subl %ebx, %eax
movw %ax, 0x2(%r12,%rbx,8)
movzbl %cl, %ecx
movl $0x5, %eax
leal -0x2(%rcx), %edx
cmpl $0x2, %edx
jb 0x23e3c5
cmpl $0x11, %ecx
jne 0x23e3c0
movzbl 0x1(%r12,%rbx,8), %eax
addl $0x2, %eax
jmp 0x23e3c5
movl $0x1, %eax
addl %eax, %ebx
cmpl %r15d, %ebx
jl 0x23e345
movq %r12, %rdi
callq 0x23ed3c
movq %rbp, %rdi
movl 0x2c(%rsp), %r15d
movl %r15d, %esi
callq 0x22383a
movq %rbp, %rdi
movq 0x18(%rsp), %rsi
callq 0x2235b9
jmp 0x23e055
cmpl $0xffffff01, %ebx       # imm = 0xFFFFFF01
jb 0x23e42c
movl $0x2, %esi
movq %rbp, %rdi
callq 0x23d5e1
movq %rax, %r12
movb $0x0, (%rax)
movw $0x2, 0x2(%rax)
negb %bl
movb %bl, 0x1(%rax)
movl $0xf, 0x8(%rax)
jmp 0x23e04a
movl %r15d, %ebp
leaq 0x64(%rsp), %r15
movl $0x2, (%r15)
movl $0xffffff01, %esi       # imm = 0xFFFFFF01
subl %ebx, %esi
movq 0x8(%rsp), %rdi
movl $0x3, %edx
movq %r15, %rcx
callq 0x23ea6b
movq %rax, %r12
movl (%r15), %eax
movw $0xff00, (%r12)         # imm = 0xFF00
incl %eax
movw %ax, 0x2(%r12)
movslq (%r15), %rax
movl %ebp, %r15d
movq 0x8(%rsp), %rbp
movw $0xff07, 0x8(%r12)      # imm = 0xFF07
movw %ax, 0xa(%r12)
movl $0xe, (%r12,%rax,8)
jmp 0x23e04a
leaq 0x18b32c(%rip), %rdi    # 0x3c97c2
leaq 0x18b245(%rip), %rsi    # 0x3c96e2
leaq 0x18b36a(%rip), %rcx    # 0x3c980e
movl $0x319, %edx            # imm = 0x319
callq 0x174d0
leaq 0x18b3b5(%rip), %rdi    # 0x3c986a
leaq 0x18b226(%rip), %rsi    # 0x3c96e2
leaq 0x18b34b(%rip), %rcx    # 0x3c980e
movl $0x322, %edx            # imm = 0x322
callq 0x174d0