// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x3345d0
decl %eax
movl %eax, %ecx
movq %rcx, 0x10(%rsp)
subl $0x5, %eax
ja 0x35e7ea
movq 0x10(%rsp), %rax
leaq 0x23e492(%rip), %rcx    # 0x59c9c0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
leaq 0x28(%rsp), %rdx
callq 0x334f50
movq %rax, 0x20(%rsp)
movq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rsi
callq 0x35db20
movq %rax, 0x38(%rsp)
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
cmpq 0x28(%rsp), %rax
jae 0x35e5b3
movq 0x38(%rsp), %rdi
movq 0x30(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq 0x20(%rsp), %rax
movq 0x30(%rsp), %rcx
movzbl (%rax,%rcx), %ecx
movl $0x1, %esi
xorl %edx, %edx
callq 0x35dbc0
movq 0x30(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x30(%rsp)
jmp 0x35e56c
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334260
jmp 0x35e804
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334e60
movl %eax, 0x1c(%rsp)
cmpl $0x0, 0x1c(%rsp)
jne 0x35e5f7
movq 0x50(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x35db20
movq %rax, 0x38(%rsp)
jmp 0x35e6f4
cmpl $0x0, 0x1c(%rsp)
jle 0x35e61c
movq 0x50(%rsp), %rdi
movl 0x1c(%rsp), %esi
xorl %edx, %edx
xorl %eax, %eax
movl %eax, %ecx
callq 0x35ebe0
movq %rax, 0x38(%rsp)
jmp 0x35e6f2
xorl %eax, %eax
subl 0x1c(%rsp), %eax
cmpl $0xff, %eax
jg 0x35e670
movq 0x50(%rsp), %rdi
movl $0x2, %esi
callq 0x35db20
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
xorl %ecx, %ecx
subl 0x1c(%rsp), %ecx
xorl %esi, %esi
movl $0x2, %edx
callq 0x35dbc0
movq 0x38(%rsp), %rdi
addq $0x8, %rdi
movl $0xf, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x35dbc0
jmp 0x35e6f0
movl $0x2, 0x18(%rsp)
movq 0x50(%rsp), %rdi
xorl %esi, %esi
subl 0x1c(%rsp), %esi
subl $0xff, %esi
movl $0x3, %edx
leaq 0x18(%rsp), %rcx
callq 0x35ebe0
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movl 0x18(%rsp), %edx
addl $0x1, %edx
xorl %esi, %esi
movl $0xff, %ecx
callq 0x35dbc0
movq 0x38(%rsp), %rdi
addq $0x8, %rdi
movl 0x18(%rsp), %edx
movl $0x7, %esi
movl $0xff, %ecx
callq 0x35dbc0
movq 0x38(%rsp), %rdi
movslq 0x18(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movl $0xe, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x35dbc0
jmp 0x35e6f2
jmp 0x35e6f4
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334260
jmp 0x35e804
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334ee0
cmpl $0x0, %eax
je 0x35e72f
movq 0x50(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x35db20
movq %rax, 0x38(%rsp)
jmp 0x35e756
movq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0x35db20
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdi
movl $0xf, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x35dbc0
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334260
jmp 0x35e804
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x35ece0
movq %rax, 0x38(%rsp)
jmp 0x35e804
movq 0x50(%rsp), %rdi
movl $0x2, %esi
callq 0x35db20
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x35f1b0
movq 0x8(%rsp), %rdi
movl %eax, %edx
movl $0x15, %esi
movl $0xc, %ecx
callq 0x35dbc0
movq 0x38(%rsp), %rdi
addq $0x8, %rdi
movl $0x17, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x35dbc0
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334260
jmp 0x35e804
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
leaq 0x23e3b1(%rip), %rdx    # 0x59cbab
callq 0x33a790
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x40(%rsp)
je 0x35e82b
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x3350d0
shrq $0x3, %rax
subq $0x1, %rax
movl %eax, %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movq 0x38(%rsp), %rax
addq $0x58, %rsp
retq
nopw %cs:(%rax,%rax)