// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/lpeg-0.10.2/lpeg.c
// Function: pushcapture
static int pushcapture (CapState *cs) {
  luaL_checkstack(cs->L, 4, "too many captures");
  switch (captype(cs->cap)) {
    case Cposition: {
      lua_pushinteger(cs->L, cs->cap->s - cs->s + 1);
      cs->cap++;
      return 1;
    }
    case Cconst: {
      pushluaval(cs);
      cs->cap++;
      return 1;
    }
    case Carg: {
      int arg = (cs->cap++)->idx;
      if (arg + FIXEDARGS > cs->ptop)
        return luaL_error(cs->L, "reference to absent argument #%d", arg);
      lua_pushvalue(cs->L, arg + FIXEDARGS);
      return 1;
    }
    case Csimple: {
      int k = pushallvalues(cs, 1);
      if (k > 1)
        lua_insert(cs->L, -k);  /* whole match is first result */
      return k;
    }
    case Cruntime: {
      int n = 0;
      while (!isclosecap(cs->cap++)) {
        luaL_checkstack(cs->L, 4, "too many captures");
        lua_pushvalue(cs->L, (cs->cap - 1)->idx);
        n++;
      }
      return n;
    }
    case Cstring: {
      luaL_Buffer b;
      luaL_buffinit(cs->L, &b);
      stringcap(&b, cs);
      luaL_pushresult(&b);
      return 1;
    }
    case Csubst: {
      luaL_Buffer b;
      luaL_buffinit(cs->L, &b);
      substcap(&b, cs);
      luaL_pushresult(&b);
      return 1;
    }
    case Cgroup: {
      if (cs->cap->idx == 0)  /* anonymous group? */
        return pushallvalues(cs, 0);  /* add all nested values */
      else {  /* named group: add no values */
        cs->cap = nextcap(cs->cap);  /* skip capture */
        return 0;
      }
    }
    case Cbackref: return backrefcap(cs);
    case Ctable: return tablecap(cs);
    case Cfunction: return functioncap(cs);
    case Cquery: return querycap(cs);
    case Cfold: return foldcap(cs);
    default: assert(0); return 0;
  }
}

// Assembly:
subq $0x4058, %rsp           # imm = 0x4058
movq %rdi, 0x4048(%rsp)
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x23837f(%rip), %rdx    # 0x59c241
movl $0x4, %esi
callq 0x33a840
movq 0x4048(%rsp), %rax
movq (%rax), %rax
movzbl 0xa(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, (%rsp)
subl $0xc, %eax
ja 0x364270
movq (%rsp), %rax
leaq 0x238ba1(%rip), %rcx    # 0x59ca98
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x4048(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rsi
movq 0x4048(%rsp), %rax
movq 0x20(%rax), %rax
subq %rax, %rsi
addq $0x1, %rsi
callq 0x3354f0
movq 0x4048(%rsp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movl $0x1, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x4048(%rsp), %rax
movl 0x18(%rax), %esi
addl $0x3, %esi
movq 0x4048(%rsp), %rax
movq (%rax), %rax
movswl 0x8(%rax), %edx
callq 0x336650
movq 0x4048(%rsp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movl $0x1, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x10, %rdx
movq %rdx, (%rcx)
movswl 0x8(%rax), %eax
movl %eax, 0x4044(%rsp)
movl 0x4044(%rsp), %eax
addl $0x3, %eax
movq 0x4048(%rsp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x364008
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x4044(%rsp), %edx
leaq 0x2392da(%rip), %rsi    # 0x59d2cf
movb $0x0, %al
callq 0x33a320
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movl 0x4044(%rsp), %esi
addl $0x3, %esi
callq 0x334560
movl $0x1, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
movl $0x1, %esi
callq 0x363d90
movl %eax, 0x4040(%rsp)
cmpl $0x1, 0x4040(%rsp)
jle 0x364070
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
xorl %esi, %esi
subl 0x4040(%rsp), %esi
callq 0x3341a0
movl 0x4040(%rsp), %eax
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movl $0x0, 0x403c(%rsp)
movq 0x4048(%rsp), %rcx
movq (%rcx), %rax
movq %rax, %rdx
addq $0x10, %rdx
movq %rdx, (%rcx)
movzbl 0xa(%rax), %eax
cmpl $0x0, %eax
sete %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x3640b5
jmp 0x364105
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movl $0x4, %esi
leaq 0x238174(%rip), %rdx    # 0x59c241
callq 0x33a840
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
movq 0x4048(%rsp), %rax
movq (%rax), %rax
movswl -0x8(%rax), %esi
callq 0x334560
movl 0x403c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x403c(%rsp)
jmp 0x36408e
movl 0x403c(%rsp), %eax
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x2020(%rsp), %rsi
callq 0x33b0b0
movq 0x4048(%rsp), %rsi
leaq 0x2020(%rsp), %rdi
callq 0x3642a0
leaq 0x2020(%rsp), %rdi
callq 0x33b1e0
movl $0x1, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq 0x10(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x33b0b0
movq 0x4048(%rsp), %rsi
leaq 0x8(%rsp), %rdi
callq 0x364550
leaq 0x8(%rsp), %rdi
callq 0x33b1e0
movl $0x1, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq (%rax), %rax
movswl 0x8(%rax), %eax
cmpl $0x0, %eax
jne 0x3641d4
movq 0x4048(%rsp), %rdi
xorl %esi, %esi
callq 0x363d90
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rax
movq (%rax), %rdi
callq 0x364690
movq %rax, %rcx
movq 0x4048(%rsp), %rax
movq %rcx, (%rax)
movl $0x0, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
callq 0x364720
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
callq 0x3647a0
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
callq 0x364940
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
callq 0x3649c0
movl %eax, 0x4054(%rsp)
jmp 0x36428f
movq 0x4048(%rsp), %rdi
callq 0x364a90
movl %eax, 0x4054(%rsp)
jmp 0x36428f
leaq 0x1dc476(%rip), %rdi    # 0x5406ed
leaq 0x23897c(%rip), %rsi    # 0x59cbfa
movl $0x8b3, %edx            # imm = 0x8B3
leaq 0x239066(%rip), %rcx    # 0x59d2f0
callq 0x19490
movl 0x4054(%rsp), %eax
addq $0x4058, %rsp           # imm = 0x4058
retq
nop