// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/lua/src/lstrlib.c
// Function: str_gsub
static int str_gsub (lua_State *L) {
  size_t srcl;
  const char *src = luaL_checklstring(L, 1, &srcl);
  const char *p = luaL_checkstring(L, 2);
  int  tr = lua_type(L, 3);
  int max_s = luaL_optint(L, 4, srcl+1);
  int anchor = (*p == '^') ? (p++, 1) : 0;
  int n = 0;
  MatchState ms;
  luaL_Buffer b;
  luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING ||
                   tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3,
                      "string/function/table expected");
  luaL_buffinit(L, &b);
  ms.L = L;
  ms.src_init = src;
  ms.src_end = src+srcl;
  while (n < max_s) {
    const char *e;
    ms.level = 0;
    e = match(&ms, src, p);
    if (e) {
      n++;
      add_value(&ms, &b, src, e);
    }
    if (e && e>src) /* non empty match? */
      src = e;  /* skip it */
    else if (src < ms.src_end)
      luaL_addchar(&b, *src++);
    else break;
    if (anchor) break;
  }
  luaL_addlstring(&b, src, ms.src_end-src);
  luaL_pushresult(&b);
  lua_pushinteger(L, n);  /* number of substitutions */
  return 2;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x2280, %rsp           # imm = 0x2280
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movl $0x1, %esi
leaq -0x10(%rbp), %rdx
callq 0x1abe0
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rdi
movl $0x2, %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x1abe0
movq %rax, -0x20(%rbp)
movq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x6fe0
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rdx
addq $0x1, %rdx
movl $0x4, %esi
callq 0x1af90
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5e, %eax
jne 0x26cca
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movl $0x1, %eax
movl %eax, -0x2274(%rbp)
jmp 0x26cd4
xorl %eax, %eax
movl %eax, -0x2274(%rbp)
jmp 0x26cd4
movl -0x2274(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, -0x30(%rbp)
movb $0x1, %al
cmpl $0x3, -0x24(%rbp)
movb %al, -0x2275(%rbp)
je 0x26d3d
movb $0x1, %al
cmpl $0x4, -0x24(%rbp)
movb %al, -0x2275(%rbp)
je 0x26d3d
movb $0x1, %al
cmpl $0x6, -0x24(%rbp)
movb %al, -0x2275(%rbp)
je 0x26d3d
movb $0x1, %al
cmpl $0x5, -0x24(%rbp)
movb %al, -0x2275(%rbp)
je 0x26d3d
movq -0x8(%rbp), %rdi
movl $0x3, %esi
leaq 0x6359(%rip), %rdx      # 0x2d085
callq 0x1a7b0
cmpl $0x0, %eax
setne %al
movb %al, -0x2275(%rbp)
movb -0x2275(%rbp), %al
movq -0x8(%rbp), %rdi
leaq -0x2268(%rbp), %rsi
callq 0x1b530
movq -0x8(%rbp), %rax
movq %rax, -0x240(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x250(%rbp)
movq -0x18(%rbp), %rax
addq -0x10(%rbp), %rax
movq %rax, -0x248(%rbp)
movl -0x30(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x26e8e
movl $0x0, -0x238(%rbp)
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x250(%rbp), %rdi
callq 0x277b0
movq %rax, -0x2270(%rbp)
cmpq $0x0, -0x2270(%rbp)
je 0x26dda
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x18(%rbp), %rdx
movq -0x2270(%rbp), %rcx
leaq -0x250(%rbp), %rdi
leaq -0x2268(%rbp), %rsi
callq 0x28d00
cmpq $0x0, -0x2270(%rbp)
je 0x26e01
movq -0x2270(%rbp), %rax
cmpq -0x18(%rbp), %rax
jbe 0x26e01
movq -0x2270(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x26e81
movq -0x18(%rbp), %rax
cmpq -0x248(%rbp), %rax
jae 0x26e7d
movq -0x2268(%rbp), %rcx
leaq -0x2268(%rbp), %rdx
addq $0x18, %rdx
addq $0x2000, %rdx           # imm = 0x2000
movb $0x1, %al
cmpq %rdx, %rcx
movb %al, -0x2276(%rbp)
jb 0x26e4d
leaq -0x2268(%rbp), %rdi
callq 0x1b680
cmpq $0x0, %rax
setne %al
movb %al, -0x2276(%rbp)
movb -0x2276(%rbp), %al
movq -0x18(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x18(%rbp)
movb (%rax), %cl
movq -0x2268(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x2268(%rbp)
movb %cl, (%rax)
jmp 0x26e7f
jmp 0x26e8e
jmp 0x26e81
cmpl $0x0, -0x2c(%rbp)
je 0x26e89
jmp 0x26e8e
jmp 0x26d78
movq -0x18(%rbp), %rsi
movq -0x248(%rbp), %rdx
movq -0x18(%rbp), %rax
subq %rax, %rdx
leaq -0x2268(%rbp), %rdi
callq 0x1b570
leaq -0x2268(%rbp), %rdi
callq 0x1b640
movq -0x8(%rbp), %rdi
movslq -0x30(%rbp), %rsi
callq 0x7880
movl $0x2, %eax
addq $0x2280, %rsp           # imm = 0x2280
popq %rbp
retq
nopw %cs:(%rax,%rax)