// File: /workspace/github_c_makefile_star2_O1/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, %r13
movq %rdi, %r12
movl %esi, 0x8(%rsp)
callq 0x22d7b8
decl %eax
cmpl $0x5, %eax
movq %r12, 0x10(%rsp)
ja 0x2467e4
leaq 0x18c3ef(%rip), %rcx    # 0x3d2b98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x22db78
testl %eax, %eax
jne 0x24687b
movl $0x1, %esi
movq %r12, %rdi
callq 0x245fcd
movq %r12, %rdi
movq %rax, %r12
movl $0xf, (%rax)
jmp 0x24688b
leaq 0x18c5c8(%rip), %rdx    # 0x3d2db3
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x230dae
movq %rax, %r12
jmp 0x246a3f
leaq 0x58(%rsp), %r15
movq %r12, %rdi
movl 0x8(%rsp), %esi
movq %r15, %rdx
callq 0x22db9e
movq %rax, %rbx
movq (%r15), %rsi
movq %r12, %rdi
callq 0x245fcd
movq %rax, %r12
cmpq $0x0, (%r15)
je 0x24684b
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 0x24682c
movq 0x10(%rsp), %rdi
jmp 0x24688b
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x22db49
movq %rax, %rbx
testl %ebx, %ebx
je 0x24687b
jle 0x246df7
movq %r12, %rdi
movl %ebx, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x247473
jmp 0x246885
movq %r12, %rdi
xorl %esi, %esi
callq 0x245fcd
movq %r12, %rdi
movq %rax, %r12
movl 0x8(%rsp), %esi
jmp 0x246a3a
movq %r13, 0x38(%rsp)
movq %r12, %rdi
callq 0x22d421
movl %eax, %r14d
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x22e8fc
movl $0x1, %esi
movq %r12, %rdi
callq 0x22ded3
movq %r12, %rdi
callq 0x22deaa
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x22f58f
testl %eax, %eax
movq %r14, 0x28(%rsp)
je 0x246a6e
leal 0x2(%r14), %ebx
leal 0x1(%r14), %r15d
movl $0x2, %ebp
leaq 0x18c587(%rip), %r13    # 0x3d2e79
movl $0x0, 0xc(%rsp)
movq %r12, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x22db1a
ucomisd 0x108919(%rip), %xmm0   # 0x34f228
jne 0x246933
jp 0x246933
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x22d88c
testl %eax, %eax
je 0x246933
movq %r12, %rdi
movl %ebx, %esi
callq 0x22d59f
jmp 0x2469ed
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x247548
testl %eax, %eax
jne 0x246965
movq %r12, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x2475ae
movq %r12, %rdi
leaq 0x18c4f8(%rip), %rsi    # 0x3d2e53
movq %rax, %rdx
xorl %eax, %eax
callq 0x230abd
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x22dc6d
movq %rax, %r14
shrq $0x3, %r14
movl $0x7ff5, %eax           # imm = 0x7FF5
subl %r14d, %eax
cmpl %eax, %ebp
jl 0x246996
movq %r12, %rdi
leaq 0x18c4d8(%rip), %rsi    # 0x3d2e67
xorl %eax, %eax
callq 0x230abd
movq %r12, %rdi
movl $0x14, %esi
movq %r13, %rdx
callq 0x230e39
movq %r12, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x22d562
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x22d798
movq %r12, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x22d798
movslq %ebp, %rsi
movq %r12, %rdi
callq 0x22ded3
movq %r12, %rdi
movl %r15d, %esi
callq 0x22ea7e
addl %ebp, %r14d
incl 0xc(%rsp)
movl %r14d, %ebp
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x22f58f
testl %eax, %eax
jne 0x2468fa
jmp 0x246a7b
movl $0x2, %esi
movq %r12, %rdi
callq 0x245fcd
movq %r12, %r14
movq %rax, %r12
movq %r14, %rdi
movl 0x8(%rsp), %ebx
movl %ebx, %esi
callq 0x247503
movl $0x10c15, (%r12)        # imm = 0x10C15
movl $0x17, 0x8(%r12)
movq %r14, %rdi
movl %ebx, %esi
callq 0x22d59f
testq %r13, %r13
je 0x246a5c
movq 0x10(%rsp), %rdi
movl 0x8(%rsp), %esi
callq 0x22dc6d
shrq $0x3, %rax
decl %eax
movl %eax, (%r13)
movq %r12, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x0, 0xc(%rsp)
movl $0x2, %ebp
movl 0xc(%rsp), %r14d
testl %r14d, %r14d
jg 0x246a98
leaq 0x18c408(%rip), %rdx    # 0x3d2e94
movq %r12, %rdi
movl 0x8(%rsp), %esi
callq 0x230a08
movslq %ebp, %rbx
movq %r12, %rdi
movq %rbx, %rsi
callq 0x245fcd
leaq 0x10(%rax), %r12
movw $0x8, 0x8(%rax)
leal -0x1(%rbx), %ecx
movw %cx, 0xa(%rax)
testl %r14d, %r14d
movq 0x28(%rsp), %r13
jle 0x246af6
leal 0x3(%r13), %r15d
movl %r14d, %ebp
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movl %r15d, %edx
callq 0x2475f9
cltq
leaq (%r12,%rax,8), %r12
addq $0x8, %r12
movl $0x5, -0x8(%r12)
addl $0x2, %r15d
decl %ebp
jne 0x246acd
shlq $0x3, %rbx
subq %rbx, %r12
cmpl $0x0, 0xc(%rsp)
jle 0x246cbc
leaq -0x8(%r12), %rbx
leal 0x1(%r13), %r14d
leal 0x2(%r13), %eax
movq %rax, 0x48(%rsp)
movl $0x2, %edx
movl $0x1, %r13d
movq 0x10(%rsp), %r15
movq %rbx, 0x40(%rsp)
movq %r14, 0x30(%rsp)
movq %rdx, 0x20(%rsp)
leal (%r14,%r13,2), %esi
movq %r15, %rdi
callq 0x22dc6d
movq 0x20(%rsp), %r8
shrq $0x3, %rax
leal (%r8,%rax), %ebp
movq 0x48(%rsp), %rcx
movq %r13, 0x50(%rsp)
leal (%rcx,%r13,2), %r9d
movl %r8d, %ebx
testl %eax, %eax
jle 0x246c6b
xorl %r13d, %r13d
movl %r8d, %ebx
movl %ebp, 0x1c(%rsp)
movslq %ebx, %rax
leaq (%r12,%rax,8), %r15
movb (%r15), %dl
cmpb $0xc, %dl
jne 0x246b8d
movswl 0x2(%r15), %ecx
testl %ecx, %ecx
js 0x246bc4
cmpb $0xa, %dl
cmovel %ebx, %r13d
movzbl (%r15), %ecx
movl $0x5, %eax
leal -0x2(%rcx), %edx
cmpl $0x2, %edx
jb 0x246bb9
cmpl $0x11, %ecx
jne 0x246bb4
movzbl 0x1(%r15), %eax
addl $0x2, %eax
jmp 0x246bb9
movl $0x1, %eax
addl %eax, %ebx
cmpl %ebp, %ebx
jl 0x246b75
jmp 0x246c6b
addl %ebx, %ecx
movslq %ecx, %rdx
cmpb $0x7, -0x8(%r12,%rdx,8)
jne 0x246e85
leal 0x1(%rax), %esi
cmpb $0x8, 0x8(%r12,%rax,8)
jne 0x246bfa
incq %rax
movswq 0x2(%r12,%rax,8), %rdi
movslq %esi, %rax
addq %rdi, %rax
cmpb $0x8, (%r12,%rax,8)
movl %eax, %esi
je 0x246be3
jmp 0x246bfc
movl %esi, %eax
leaq -0x1(%rdx), %rsi
movswl 0x2(%r12,%rsi,8), %edi
addl %esi, %edi
cmpl %eax, %edi
jne 0x246e85
cmpl %r13d, %ecx
jg 0x246b94
leaq (%r12,%rdx,8), %rdx
movq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rcx
movq 0x30(%rsp), %r8
movl %r9d, %ebp
callq 0x247942
testl %eax, %eax
jne 0x246c5a
movq %r14, %rdi
movl %ebp, %esi
callq 0x2475ae
movq %r14, %rdi
leaq 0x18c31d(%rip), %rsi    # 0x3d2f6d
movq %rax, %rdx
xorl %eax, %eax
callq 0x230abd
movq 0x20(%rsp), %r8
movl %ebp, %r9d
movl 0x1c(%rsp), %ebp
jmp 0x246b94
movslq %ebx, %rax
movq 0x40(%rsp), %rbx
cmpb $0x5, (%rbx,%rax,8)
jne 0x246ea4
movslq %r8d, %rax
leaq (%r12,%rax,8), %rdx
movslq %ebp, %rax
leaq (%rbx,%rax,8), %rcx
movq 0x10(%rsp), %r15
movq %r15, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %r14
movl %r14d, %r8d
callq 0x247942
movq 0x50(%rsp), %rcx
leal 0x1(%rcx), %eax
movl %ebp, %edx
cmpl 0xc(%rsp), %ecx
movl %eax, %r13d
jne 0x246b34
jmp 0x246cc6
movl $0x2, %ebp
movq 0x10(%rsp), %r15
movq 0x28(%rsp), %r13
leal 0x2(%r13), %esi
movq %r15, %rdi
callq 0x22d798
leal 0x1(%r13), %ebx
movq %r15, %rdi
movl %ebx, %esi
callq 0x22e5c2
movq %r15, %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x22db1a
cvttsd2si %xmm0, %r14d
movq %r15, %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x22d42e
testl %r14d, %r14d
jne 0x246d1c
leaq 0x18c192(%rip), %rsi    # 0x3d2ea2
movq 0x10(%rsp), %rdi
xorl %eax, %eax
callq 0x230abd
movw $0x9, (%r12)
movw %r14w, 0x2(%r12)
testl %ebp, %ebp
jle 0x246dc9
xorl %r14d, %r14d
movl %r14d, %r14d
cmpb $0xa, (%r12,%r14,8)
jne 0x246d96
movswl 0x2(%r12,%r14,8), %edx
movq 0x10(%rsp), %rdi
movl %ebx, %esi
callq 0x2476b8
movslq %r14d, %rcx
leal 0x1(%r14), %edx
cmpb $0x8, 0x8(%r12,%rcx,8)
jne 0x246d79
incq %rcx
movswq 0x2(%r12,%rcx,8), %rsi
movslq %edx, %rcx
addq %rsi, %rcx
cmpb $0x8, (%r12,%rcx,8)
movl %ecx, %edx
je 0x246d62
jmp 0x246d7b
movl %edx, %ecx
movslq %ecx, %rcx
cmpb $0x5, (%r12,%rcx,8)
sete %cl
xorb $0x9, %cl
movb %cl, (%r12,%r14,8)
subl %r14d, %eax
movw %ax, 0x2(%r12,%r14,8)
movzbl (%r12,%r14,8), %ecx
movl $0x5, %eax
leal -0x2(%rcx), %edx
cmpl $0x2, %edx
jb 0x246dbd
cmpl $0x11, %ecx
jne 0x246db8
movzbl 0x1(%r12,%r14,8), %eax
addl $0x2, %eax
jmp 0x246dbd
movl $0x1, %eax
addl %eax, %r14d
cmpl %ebp, %r14d
jl 0x246d34
movq %r12, %rdi
callq 0x247746
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
movl 0x8(%rsp), %esi
callq 0x22d59f
movq %rbx, %rdi
movl %r13d, %esi
callq 0x22d42e
movq 0x38(%rsp), %r13
jmp 0x246a3f
cmpl $0xffffff01, %ebx       # imm = 0xFFFFFF01
jl 0x246e2c
movl $0x2, %esi
movq %r12, %rdi
callq 0x245fcd
movq %r12, %rdi
movq %rax, %r12
movb $0x0, (%rax)
movw $0x2, 0x2(%rax)
negb %bl
movb %bl, 0x1(%rax)
movl $0xf, 0x8(%rax)
jmp 0x24688b
leaq 0x64(%rsp), %r15
movl $0x2, (%r15)
movl $0xffffff01, %esi       # imm = 0xFFFFFF01
subl %ebx, %esi
movq %r12, %rdi
movl $0x3, %edx
movq %r15, %rcx
callq 0x247473
movq %r12, %rdi
movq %rax, %r12
movl (%r15), %eax
movw $0xff00, (%r12)         # imm = 0xFF00
incl %eax
movw %ax, 0x2(%r12)
movslq (%r15), %rax
movw $0xff07, 0x8(%r12)      # imm = 0xFF07
movw %ax, 0xa(%r12)
movl $0xe, (%r12,%rax,8)
jmp 0x24688b
leaq 0x18c056(%rip), %rdi    # 0x3d2ee2
leaq 0x18bf6f(%rip), %rsi    # 0x3d2e02
leaq 0x18c094(%rip), %rcx    # 0x3d2f2e
movl $0x319, %edx            # imm = 0x319
callq 0x174d0
leaq 0x18c0df(%rip), %rdi    # 0x3d2f8a
leaq 0x18bf50(%rip), %rsi    # 0x3d2e02
leaq 0x18c075(%rip), %rcx    # 0x3d2f2e
movl $0x322, %edx            # imm = 0x322
callq 0x174d0