// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/external/lpeg-0.10.2/lpeg.c
// Function: fix_l
static Instruction *fix_l (lua_State *L, int t) {
  Instruction *p;
  int i;
  int totalsize = 2;  /* include initial call and jump */
  int n = 0;  /* number of rules */
  int base = lua_gettop(L);
  lua_newtable(L);  /* to store relative positions of each rule */
  lua_pushinteger(L, 1);  /* default initial rule */
  /* collect patterns and compute sizes */
  lua_pushnil(L);
  while (lua_next(L, t) != 0) {
    int l;
    if (lua_tonumber(L, -2) == 1 && lua_isstring(L, -1)) {
      lua_replace(L, base + 2);  /* use this value as initial rule */
      continue;
    }
    if (!testpattern(L, -1))
      luaL_error(L, "%s is not a pattern", val2str(L, -2));
    l = pattsize(L, -1) + 1;  /* space for pattern + ret */
    if (totalsize >= MAXPATTSIZE - l)
      luaL_error(L, "grammar too large");
    luaL_checkstack(L, LUA_MINSTACK, "grammar has too many rules");
    lua_insert(L, -2);  /* put key on top */
    lua_pushvalue(L, -1);  /* duplicate key (for lua_next) */
    lua_pushvalue(L, -1);  /* duplicate key (to index positions table)) */
    lua_pushinteger(L, totalsize);  /* position for this rule */
    lua_settable(L, base + 1);  /* store key=>position in positions table */
    totalsize += l;
    n++;
  }
  luaL_argcheck(L, n > 0, t, "empty grammar");
  p = newpatt(L, totalsize);  /* create new pattern */
  p++;  /* save space for call */
  setinst(p++, IJmp, totalsize - 1);  /* after call, jumps to the end */
  for (i = 1; i <= n; i++) {  /* copy all rules into new pattern */
    p += addpatt(L, p, base + 1 + i*2);
    setinst(p++, IRet, 0);
  }
  p -= totalsize;  /* back to first position */
  totalsize = 2;  /* go through each rule's position */
  for (i = 1; i <= n; i++) {  /* check all rules */
    int l = pattsize(L, base + 1 + i*2) + 1;
    checkrule(L, p, totalsize, totalsize + l, base + 1, base + 2 + i*2);
    totalsize += l;
  }
  lua_pushvalue(L, base + 2);  /* get initial rule */
  lua_gettable(L, base + 1);  /* get its position in postions table */
  i = lua_tonumber(L, -1);  /* convert to number */
  lua_pop(L, 1);
  if (i == 0)  /* is it defined? */
    luaL_error(L, "initial rule not defined in given grammar");
  setinst(p, ICall, i);  /* first instruction calls initial rule */
  /* correct calls */
  for (i = 0; i < totalsize; i += sizei(p + i)) {
    if (p[i].i.code == IOpenCall) {
      int pos = getposition(L, base + 1, p[i].i.offset);
      p[i].i.code = (p[target(p, i + 1)].i.code == IRet) ? IJmp : ICall;
      p[i].i.offset = pos - i;
    }
  }
  optimizejumps(p);
  lua_replace(L, t);  /* put new pattern in old's position */
  lua_settop(L, base);  /* remove rules and positions table */
  return p;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x50(%rsp)
movl %esi, 0x4c(%rsp)
movl $0x2, 0x38(%rsp)
movl $0x0, 0x34(%rsp)
movq 0x50(%rsp), %rdi
callq 0x333eb0
movl %eax, 0x30(%rsp)
movq 0x50(%rsp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x336790
movq 0x50(%rsp), %rdi
movl $0x1, %esi
callq 0x3354f0
movq 0x50(%rsp), %rdi
callq 0x335470
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x338000
cmpl $0x0, %eax
je 0x35ee94
movq 0x50(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x334df0
movsd 0x1b84e0(%rip), %xmm1   # 0x517240
ucomisd %xmm1, %xmm0
jne 0x35ed8f
jp 0x35ed8f
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3347b0
cmpl $0x0, %eax
je 0x35ed8f
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x2, %esi
callq 0x334260
jmp 0x35ed32
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x35f210
cmpl $0x0, %eax
jne 0x35edd2
movq 0x50(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x50(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x35f2b0
movq 0x18(%rsp), %rdi
movq %rax, %rdx
leaq 0x23de80(%rip), %rsi    # 0x59cc4b
movb $0x0, %al
callq 0x33a320
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x3350d0
shrq $0x3, %rax
subq $0x1, %rax
addq $0x1, %rax
movl %eax, 0x2c(%rsp)
movl 0x38(%rsp), %eax
movl $0x7ff5, %ecx           # imm = 0x7FF5
subl 0x2c(%rsp), %ecx
cmpl %ecx, %eax
jl 0x35ee15
movq 0x50(%rsp), %rdi
leaq 0x23de51(%rip), %rsi    # 0x59cc5f
movb $0x0, %al
callq 0x33a320
movq 0x50(%rsp), %rdi
movl $0x14, %esi
leaq 0x23de4b(%rip), %rdx    # 0x59cc71
callq 0x33a840
movq 0x50(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x3341a0
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x334560
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x334560
movq 0x50(%rsp), %rdi
movslq 0x38(%rsp), %rsi
callq 0x3354f0
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x1, %esi
callq 0x336ae0
movl 0x2c(%rsp), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x35ed32
movb $0x1, %al
cmpl $0x0, 0x34(%rsp)
movb %al, 0x17(%rsp)
jg 0x35eec0
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
leaq 0x23dddb(%rip), %rdx    # 0x59cc8c
callq 0x33a1f0
cmpl $0x0, %eax
setne %al
movb %al, 0x17(%rsp)
movb 0x17(%rsp), %al
movq 0x50(%rsp), %rdi
movslq 0x38(%rsp), %rsi
callq 0x35db20
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
movl 0x38(%rsp), %edx
subl $0x1, %edx
movl $0x8, %esi
xorl %ecx, %ecx
callq 0x35dbc0
movl $0x1, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jg 0x35ef7c
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
movl 0x30(%rsp), %edx
addl $0x1, %edx
movl 0x3c(%rsp), %eax
shll %eax
addl %eax, %edx
callq 0x35f350
movl %eax, %ecx
movq 0x40(%rsp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, 0x40(%rsp)
movl $0x5, %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0x35dbc0
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x35ef12
movl 0x38(%rsp), %ecx
movq 0x40(%rsp), %rax
movslq %ecx, %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x40(%rsp)
movl $0x2, 0x38(%rsp)
movl $0x1, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x34(%rsp), %eax
jg 0x35f02e
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x1, %esi
movl 0x3c(%rsp), %eax
shll %eax
addl %eax, %esi
callq 0x3350d0
shrq $0x3, %rax
subq $0x1, %rax
addq $0x1, %rax
movl %eax, 0x28(%rsp)
movq 0x50(%rsp), %rdi
movq 0x40(%rsp), %rsi
movl 0x38(%rsp), %edx
movl 0x38(%rsp), %ecx
addl 0x28(%rsp), %ecx
movl 0x30(%rsp), %r8d
addl $0x1, %r8d
movl 0x30(%rsp), %r9d
addl $0x2, %r9d
movl 0x3c(%rsp), %eax
shll %eax
addl %eax, %r9d
callq 0x35f460
movl 0x28(%rsp), %eax
addl 0x38(%rsp), %eax
movl %eax, 0x38(%rsp)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
jmp 0x35efa9
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x2, %esi
callq 0x334560
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x1, %esi
callq 0x336210
movq 0x50(%rsp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x334df0
cvttsd2si %xmm0, %eax
movl %eax, 0x3c(%rsp)
movq 0x50(%rsp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x333ed0
cmpl $0x0, 0x3c(%rsp)
jne 0x35f090
movq 0x50(%rsp), %rdi
leaq 0x23dc11(%rip), %rsi    # 0x59cc9a
movb $0x0, %al
callq 0x33a320
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %edx
movl $0x9, %esi
xorl %ecx, %ecx
callq 0x35dbc0
movl $0x0, 0x3c(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x35f17d
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movzbl (%rax,%rcx,8), %eax
cmpl $0xa, %eax
jne 0x35f158
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
addl $0x1, %esi
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movswl 0x2(%rax,%rcx,8), %edx
callq 0x35f6a0
movl %eax, 0x24(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x40(%rsp), %rdi
movl 0x3c(%rsp), %esi
addl $0x1, %esi
callq 0x35f770
movl %eax, %ecx
movq 0x8(%rsp), %rax
movslq %ecx, %rcx
movzbl (%rax,%rcx,8), %edx
movl $0x9, %eax
movl $0x8, %ecx
cmpl $0x5, %edx
cmovel %ecx, %eax
movb %al, %dl
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movb %dl, (%rax,%rcx,8)
movl 0x24(%rsp), %eax
subl 0x3c(%rsp), %eax
movw %ax, %dx
movq 0x40(%rsp), %rax
movslq 0x3c(%rsp), %rcx
movw %dx, 0x2(%rax,%rcx,8)
jmp 0x35f15a
movq 0x40(%rsp), %rdi
movslq 0x3c(%rsp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x35f7b0
addl 0x3c(%rsp), %eax
movl %eax, 0x3c(%rsp)
jmp 0x35f0ad
movq 0x40(%rsp), %rdi
callq 0x35f800
movq 0x50(%rsp), %rdi
movl 0x4c(%rsp), %esi
callq 0x334260
movq 0x50(%rsp), %rdi
movl 0x30(%rsp), %esi
callq 0x333ed0
movq 0x40(%rsp), %rax
addq $0x58, %rsp
retq
nopl (%rax)