// File: /workspace/github_c_makefile_star2_O3/genometools[P]genometools/src/external/lpeg-0.10.2/lpeg.c
// Function: star_l
static int star_l (lua_State *L) {
  int l1;
  int n = luaL_checkint(L, 2);
  Instruction *p1 = getpatt(L, 1, &l1);
  if (n >= 0) {
    CharsetTag st;
    Instruction *op;
    if (tocharset(p1, &st) == ISCHARSET)
      return repeatcharset(L, st.cs, l1, n);
    if (isheadfail(p1))
      op = repeatheadfail(L, l1, n);
    else
      op = repeats(L, p1, l1, n);
    optimizecaptures(op);
    optimizejumps(op);
  }
  else {
    if (isheadfail(p1))
      optionalheadfail(L, l1, -n);
    else
      optionals(L, l1, -n);
  }
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl $0x2, %esi
callq 0x2272f4
movq %rax, %r14
movq %rsp, %rdx
movq %rbx, %rdi
movl $0x1, %esi
callq 0x23dd8d
movq %rax, %r12
testl %r14d, %r14d
js 0x23d78b
leaq 0x4(%rsp), %rsi
movq %r12, %rdi
callq 0x23e4cd
cmpl $0x1, %eax
jne 0x23d7f3
movslq (%rsp), %rax
movslq %r14d, %rsi
imulq %rax, %rsi
addq $0x5, %rsi
movq %rbx, %rdi
callq 0x23d5e1
movq %rax, %r15
testl %r14d, %r14d
je 0x23d76b
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r15,%rax,8), %r15
decl %r14d
jne 0x23d750
movl $0x3, (%r15)
xorl %eax, %eax
movb 0x8(%rsp,%rax), %cl
movb %cl, 0x8(%r15,%rax)
incq %rax
cmpq $0x20, %rax
jne 0x23d774
jmp 0x23d98f
movq %r12, %rdi
callq 0x23f3f6
movslq (%rsp), %r12
testl %eax, %eax
je 0x23d879
movl %r14d, %eax
negl %eax
imull %r12d, %eax
movslq %eax, %rsi
movq %rbx, %rdi
callq 0x23d5e1
movq %rax, %r15
movq %r12, %r13
negq %r13
movl %r12d, %ebp
imull %r14d, %ebp
negl %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r15,%rax,8), %r15
leaq (%r15,%r13,8), %rdi
movl %ebp, %esi
callq 0x23f482
subl %r12d, %ebp
incl %r14d
jne 0x23d7c5
jmp 0x23d98f
movq %r12, %rdi
callq 0x23f3f6
movslq (%rsp), %r13
movslq %r14d, %rsi
incq %rsi
imulq %r13, %rsi
testl %eax, %eax
je 0x23d8df
incq %rsi
movq %rbx, %rdi
callq 0x23d5e1
movq %rax, %r15
movq %rax, %r12
testl %r14d, %r14d
je 0x23d845
movq %r15, %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %r12
decl %r14d
jne 0x23d82a
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %rbx
movq %r13, %rax
shlq $0x3, %rax
movq %rbx, %rdi
subq %rax, %rdi
leal 0x1(%r13), %esi
callq 0x23f482
movb $0x8, (%rbx)
jmp 0x23d973
notl %r12d
imull %r14d, %r12d
incl %r12d
movslq %r12d, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x23d5e1
movq %rax, %r15
movw $0x7, (%rax)
movw %r12w, 0x2(%rax)
movq %rax, %r12
leaq 0x8(%r12), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %r12
addq $0x8, %r12
movl $0x1000c, (%r12)        # imm = 0x1000C
incl %r14d
jne 0x23d8a1
movl $0x1000b, (%r12)        # imm = 0x1000B
movq %r15, %rdi
callq 0x23f4bf
jmp 0x23d98f
addl $0x2, %esi
movslq %esi, %rsi
movq %rbx, %rdi
callq 0x23d5e1
movq %rax, %r15
leaq (%r12,%r13,8), %rcx
movq %rbx, %rdi
movq %r12, %rsi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x23ef3d
testl %eax, %eax
jne 0x23d91d
leaq 0x18c1b1(%rip), %rsi    # 0x3c9ac4
movq %rbx, %rdi
xorl %eax, %eax
callq 0x226e43
movq %r15, %r12
testl %r14d, %r14d
je 0x23d943
movq %r15, %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %r12
decl %r14d
jne 0x23d928
leaq 0x8(%r12), %rsi
movw $0x7, (%r12)
leal 0x2(%r13), %eax
movw %ax, 0x2(%r12)
movq %rbx, %rdi
movl $0x1, %edx
callq 0x23ebf1
cltq
leaq (%r12,%rax,8), %rbx
addq $0x8, %rbx
movb $0xc, (%rbx)
negl %r13d
movw %r13w, 0x2(%rbx)
movb $0x0, 0x1(%rbx)
movq %r15, %rdi
callq 0x23f626
movq %r15, %rdi
callq 0x23ed3c
movl $0x1, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq