// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/lua/src/lstrlib.c
// Function: str_find_aux
static int str_find_aux (lua_State *L, int find) {
  size_t l1, l2;
  const char *s = luaL_checklstring(L, 1, &l1);
  const char *p = luaL_checklstring(L, 2, &l2);
  ptrdiff_t init = posrelat(luaL_optinteger(L, 3, 1), l1) - 1;
  if (init < 0) init = 0;
  else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;
  if (find && (lua_toboolean(L, 4) ||  /* explicit request? */
      strpbrk(p, SPECIALS) == NULL)) {  /* or no special characters? */
    /* do a plain search */
    const char *s2 = lmemfind(s+init, l1-init, p, l2);
    if (s2) {
      lua_pushinteger(L, s2-s+1);
      lua_pushinteger(L, s2-s+l2);
      return 2;
    }
  }
  else {
    MatchState ms;
    int anchor = (*p == '^') ? (p++, 1) : 0;
    const char *s1=s+init;
    ms.L = L;
    ms.src_init = s;
    ms.src_end = s+l1;
    do {
      const char *res;
      ms.level = 0;
      if ((res=match(&ms, s1, p)) != NULL) {
        if (find) {
          lua_pushinteger(L, s1-s+1);  /* start */
          lua_pushinteger(L, res-s);   /* end */
          return push_captures(&ms, NULL, 0) + 2;
        }
        else
          return push_captures(&ms, s1, res);
      }
    } while (s1++ < ms.src_end && !anchor);
  }
  lua_pushnil(L);  /* not found */
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movl %esi, %r13d
movq %rdi, %rbp
leaq 0x20(%rsp), %rbx
movl $0x1, %esi
movq %rbx, %rdx
callq 0x10b24
movq %rax, %r14
leaq 0x18(%rsp), %rdx
movq %rbp, %rdi
movl $0x2, %esi
callq 0x10b24
movq %rax, %r15
movl $0x1, %edx
movq %rbp, %rdi
movl $0x3, %esi
callq 0x10dbc
movq (%rbx), %rcx
leaq 0x1(%rcx), %rdx
movq %rax, %rsi
sarq $0x3f, %rsi
andq %rdx, %rsi
addq %rax, %rsi
xorl %eax, %eax
testq %rsi, %rsi
movl $0x0, %r12d
cmovgq %rsi, %r12
decq %r12
cmpq %rcx, %r12
cmovaeq %rcx, %r12
testq %rsi, %rsi
cmovleq %rax, %r12
testl %r13d, %r13d
movq %rbp, 0x8(%rsp)
movq %r14, 0x10(%rsp)
je 0x19708
movq %rbp, %rdi
movl $0x4, %esi
callq 0x5a62
testl %eax, %eax
je 0x196eb
leaq (%r14,%r12), %rbp
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x197a6
movq 0x20(%rsp), %r14
subq %r12, %r14
cmpq %r14, %rax
ja 0x197ab
movq %rax, %rcx
decq %rcx
movq %rcx, (%rsp)
subq %rcx, %r14
je 0x197ab
movsbl (%r15), %r12d
incq %r15
movq %rbp, %rdi
movl %r12d, %esi
movq %r14, %rdx
callq 0x4220
testq %rax, %rax
je 0x197ab
movq %rax, %r13
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq (%rsp), %rdx
callq 0x4380
testl %eax, %eax
je 0x197de
addq %rbp, %r14
movq %rbx, %rbp
subq %rbx, %r14
jne 0x196a6
jmp 0x197ab
leaq 0x369d(%rip), %rsi      # 0x1cd8f
movq %r15, %rdi
callq 0x43c0
testq %rax, %rax
je 0x19669
movq 0x20(%rsp), %rcx
movl %r13d, (%rsp)
movb (%r15), %bl
xorl %eax, %eax
cmpb $0x5e, %bl
sete %al
addq %rax, %r15
movq %r14, %rax
addq %r12, %r14
leaq 0x28(%rsp), %r13
movq %rbp, 0x10(%r13)
movq %rax, (%r13)
addq %rax, %rcx
movq %rcx, 0x8(%r13)
incq %r12
movl $0x0, 0x40(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x1980e
testq %rax, %rax
jne 0x1976a
cmpb $0x5e, %bl
je 0x197ab
leaq 0x1(%r14), %rax
incq %r12
cmpq 0x30(%rsp), %r14
movq %rax, %r14
jb 0x19737
jmp 0x197ab
movq %rax, %rbp
cmpl $0x0, (%rsp)
je 0x197cc
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5c40
subq 0x10(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5c40
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x19bbc
addl $0x2, %eax
jmp 0x197ba
testq %r14, %r14
jne 0x197e1
movq 0x8(%rsp), %rdi
callq 0x5c17
movl $0x1, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rbp, %rdx
callq 0x19bbc
jmp 0x197ba
movq %r13, %rbp
subq 0x10(%rsp), %rbp
leaq 0x1(%rbp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x5c40
addq 0x18(%rsp), %rbp
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x5c40
movl $0x2, %eax
jmp 0x197ba