// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x290, %rsp            # imm = 0x290
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
leaq -0x20(%rbp), %rdx
callq 0x1abe0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
leaq -0x28(%rbp), %rdx
callq 0x1abe0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
movl $0x1, %edx
callq 0x1af90
movq %rax, %rdi
movq -0x20(%rbp), %rsi
callq 0x27380
subq $0x1, %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jge 0x27486
movq $0x0, -0x40(%rbp)
jmp 0x2749a
movq -0x40(%rbp), %rax
cmpq -0x20(%rbp), %rax
jbe 0x27498
movq -0x20(%rbp), %rax
movq %rax, -0x40(%rbp)
jmp 0x2749a
cmpl $0x0, -0x14(%rbp)
je 0x27536
movq -0x10(%rbp), %rdi
movl $0x4, %esi
callq 0x7440
cmpl $0x0, %eax
jne 0x274cd
movq -0x38(%rbp), %rdi
leaq 0x5a41(%rip), %rsi      # 0x2cf03
callq 0x53c0
cmpq $0x0, %rax
jne 0x27536
movq -0x30(%rbp), %rdi
addq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
subq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x28(%rbp), %rcx
callq 0x276b0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x27531
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
addq $0x1, %rsi
callq 0x7880
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
addq -0x28(%rbp), %rsi
callq 0x7880
movl $0x2, -0x4(%rbp)
jmp 0x2769f
jmp 0x2768f
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5e, %eax
jne 0x2755b
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
movl $0x1, %eax
movl %eax, -0x284(%rbp)
jmp 0x27565
xorl %eax, %eax
movl %eax, -0x284(%rbp)
jmp 0x27565
movl -0x284(%rbp), %eax
movl %eax, -0x26c(%rbp)
movq -0x30(%rbp), %rax
addq -0x40(%rbp), %rax
movq %rax, -0x278(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x258(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x30(%rbp), %rax
addq -0x20(%rbp), %rax
movq %rax, -0x260(%rbp)
movl $0x0, -0x250(%rbp)
movq -0x278(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x268(%rbp), %rdi
callq 0x277b0
movq %rax, -0x280(%rbp)
cmpq $0x0, %rax
je 0x27645
cmpl $0x0, -0x14(%rbp)
je 0x27626
movq -0x10(%rbp), %rdi
movq -0x278(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
addq $0x1, %rsi
callq 0x7880
movq -0x10(%rbp), %rdi
movq -0x280(%rbp), %rsi
movq -0x30(%rbp), %rax
subq %rax, %rsi
callq 0x7880
leaq -0x268(%rbp), %rdi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x27b90
addl $0x2, %eax
movl %eax, -0x4(%rbp)
jmp 0x2769f
movq -0x278(%rbp), %rsi
movq -0x280(%rbp), %rdx
leaq -0x268(%rbp), %rdi
callq 0x27b90
movl %eax, -0x4(%rbp)
jmp 0x2769f
jmp 0x27647
movq -0x278(%rbp), %rcx
movq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x278(%rbp)
xorl %eax, %eax
cmpq -0x260(%rbp), %rcx
movb %al, -0x285(%rbp)
jae 0x2767f
cmpl $0x0, -0x26c(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x285(%rbp)
movb -0x285(%rbp), %al
testb $0x1, %al
jne 0x275a5
jmp 0x2768f
movq -0x10(%rbp), %rdi
callq 0x7800
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x290, %rsp            # imm = 0x290
popq %rbp
retq
nopl (%rax,%rax)