// File: /workspace/github_c_makefile_star2_O2/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, %r14d
movq %rdi, %r13
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %rbx
movq %rbx, %rdx
callq 0xf6c0
movq %rax, %rbp
pushq $0x2
popq %rsi
leaq 0x18(%rsp), %rdx
movq %r13, %rdi
callq 0xf6c0
movq %rax, %r15
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
movq %r13, %rdi
callq 0xf939
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 %r14d, %r14d
movq %r13, 0x8(%rsp)
movq %rbp, 0x10(%rsp)
je 0x17868
pushq $0x4
popq %rsi
movq %r13, %rdi
callq 0x5641
testl %eax, %eax
je 0x1784b
leaq (%r12,%rbp), %r14
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x17904
movq 0x20(%rsp), %rbp
subq %r12, %rbp
cmpq %rbp, %rax
ja 0x17909
movq %rax, %rcx
decq %rcx
movq %rcx, (%rsp)
subq %rcx, %rbp
movq %r15, %r12
incq %r12
testq %rbp, %rbp
je 0x17909
movsbl (%r15), %esi
movq %r14, %rdi
movq %rbp, %rdx
callq 0x4210
testq %rax, %rax
je 0x17909
movq %rax, %r13
leaq 0x1(%rax), %rbx
movq %rbx, %rdi
movq %r12, %rsi
movq (%rsp), %rdx
callq 0x4370
testl %eax, %eax
je 0x17929
addq %r14, %rbp
subq %rbx, %rbp
movq %rbx, %r14
jmp 0x17801
leaq 0x3515(%rip), %rsi      # 0x1ad67
movq %r15, %rdi
callq 0x43b0
testq %rax, %rax
je 0x177cb
movq 0x20(%rsp), %rcx
movl %r14d, (%rsp)
movb (%r15), %bl
xorl %eax, %eax
cmpb $0x5e, %bl
sete %al
addq %rax, %r15
leaq (%r12,%rbp), %r14
movq %rbp, %rax
leaq 0x28(%rsp), %rbp
movq %r13, 0x10(%rbp)
movq %rax, (%rbp)
addq %rax, %rcx
movq %rcx, 0x8(%rbp)
incq %r12
andl $0x0, 0x40(%rsp)
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x17967
testq %rax, %rax
jne 0x178c8
cmpb $0x5e, %bl
je 0x17909
leaq 0x1(%r14), %rax
incq %r12
cmpq 0x30(%rsp), %r14
movq %rax, %r14
jb 0x17898
jmp 0x17909
movq %rax, %r13
cmpl $0x0, (%rsp)
je 0x17917
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x57ff
subq 0x10(%rsp), %r13
movq %rbx, %rdi
movq %r13, %rsi
callq 0x57ff
leaq 0x28(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x17d10
addl $0x2, %eax
jmp 0x17955
testq %rbp, %rbp
jne 0x1792c
movq 0x8(%rsp), %rdi
callq 0x57d9
pushq $0x1
jmp 0x17954
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x17d10
jmp 0x17955
movq %r13, %r14
subq 0x10(%rsp), %r14
leaq 0x1(%r14), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x57ff
addq 0x18(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57ff
pushq $0x2
popq %rax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq