// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/lpeg-0.10.2/lpeg.c
// Function: stringcap
static void stringcap (luaL_Buffer *b, CapState *cs) {
  StrAux cps[MAXSTRCAPS];
  int n;
  size_t len, i;
  const char *c;
  updatecache(cs, cs->cap->idx);
  c = lua_tolstring(cs->L, subscache(cs), &len);
  n = getstrcaps(cs, cps, 0) - 1;
  for (i = 0; i < len; i++) {
    if (c[i] != '%' || c[++i] < '0' || c[i] > '9')
      luaL_addchar(b, c[i]);
    else {
      int l = c[i] - '0';
      if (l > n)
        luaL_error(cs->L, "invalid capture index (%d)", l);
      else if (cps[l].isstring)
        luaL_addlstring(b, cps[l].u.s.s, cps[l].u.s.e - cps[l].u.s.s);
      else {
        Capture *curr = cs->cap;
        cs->cap = cps[l].u.cp;
        if (addonestring(b, cs, "capture") == 0)
          luaL_error(cs->L, "no values in capture index %d", l);
        cs->cap = curr;
      }
    }
  }
}

// Assembly:
subq $0x148, %rsp            # imm = 0x148
movq %rdi, 0x140(%rsp)
movq %rsi, 0x138(%rsp)
movq 0x138(%rsp), %rax
movq (%rax), %rax
movswl 0x8(%rax), %eax
movq 0x138(%rsp), %rcx
cmpl 0x28(%rcx), %eax
je 0x3642ef
movq 0x138(%rsp), %rdi
movq 0x138(%rsp), %rax
movq (%rax), %rax
movswl 0x8(%rax), %esi
callq 0x364be0
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x138(%rsp), %rax
movl 0x18(%rax), %esi
addl $0x1, %esi
leaq 0x30(%rsp), %rdx
callq 0x334f50
movq %rax, 0x20(%rsp)
movq 0x138(%rsp), %rdi
leaq 0x40(%rsp), %rsi
xorl %edx, %edx
callq 0x364c40
subl $0x1, %eax
movl %eax, 0x3c(%rsp)
movq $0x0, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
jae 0x364541
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x25, %eax
jne 0x364392
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, 0x28(%rsp)
movsbl 0x1(%rax,%rcx), %eax
cmpl $0x30, %eax
jl 0x364392
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x39, %eax
jle 0x364400
movq 0x140(%rsp), %rax
movq (%rax), %rcx
movq 0x140(%rsp), %rdx
addq $0x18, %rdx
addq $0x2000, %rdx           # imm = 0x2000
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, 0xf(%rsp)
jb 0x3643d3
movq 0x140(%rsp), %rdi
callq 0x33b210
cmpq $0x0, %rax
setne %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movb (%rax,%rcx), %cl
movq 0x140(%rsp), %rdx
movq (%rdx), %rax
movq %rax, %rsi
addq $0x1, %rsi
movq %rsi, (%rdx)
movb %cl, (%rax)
jmp 0x36452c
movq 0x20(%rsp), %rax
movq 0x28(%rsp), %rcx
movsbl (%rax,%rcx), %eax
subl $0x30, %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
cmpl 0x3c(%rsp), %eax
jle 0x364442
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x1c(%rsp), %edx
leaq 0x238ed6(%rip), %rsi    # 0x59d30c
movb $0x0, %al
callq 0x33a320
jmp 0x36452a
movslq 0x1c(%rsp), %rcx
leaq 0x40(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpl $0x0, (%rax)
je 0x3644a9
movq 0x140(%rsp), %rdi
movslq 0x1c(%rsp), %rcx
leaq 0x40(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movslq 0x1c(%rsp), %rcx
leaq 0x40(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rdx
movslq 0x1c(%rsp), %rcx
leaq 0x40(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
subq %rax, %rdx
callq 0x33b0f0
jmp 0x364528
movq 0x138(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movslq 0x1c(%rsp), %rcx
leaq 0x40(%rsp), %rax
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
movq 0x138(%rsp), %rax
movq %rcx, (%rax)
movq 0x140(%rsp), %rdi
movq 0x138(%rsp), %rsi
leaq 0x25fb65(%rip), %rdx    # 0x5c4055
callq 0x364dd0
cmpl $0x0, %eax
jne 0x364518
movq 0x138(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x1c(%rsp), %edx
leaq 0x238e16(%rip), %rsi    # 0x59d327
movb $0x0, %al
callq 0x33a320
movq 0x10(%rsp), %rcx
movq 0x138(%rsp), %rax
movq %rcx, (%rax)
jmp 0x36452a
jmp 0x36452c
jmp 0x36452e
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
jmp 0x36433c
addq $0x148, %rsp            # imm = 0x148
retq
nopl (%rax)