// File: /workspace/github_c_makefile_star2_O0/tylerneylon[P]APIsWithLua/lua/lstrlib.c
// Function: add_s
static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
                                                   const char *e) {
  size_t l, i;
  lua_State *L = ms->L;
  const char *news = lua_tolstring(L, 3, &l);
  for (i = 0; i < l; i++) {
    if (news[i] != L_ESC)
      luaL_addchar(b, news[i]);
    else {
      i++;  /* skip ESC */
      if (!isdigit(uchar(news[i]))) {
        if (news[i] != L_ESC)
          luaL_error(L, "invalid use of '%c' in replacement string", L_ESC);
        luaL_addchar(b, news[i]);
      }
      else if (news[i] == '0')
          luaL_addlstring(b, s, e - s);
      else {
        push_onecapture(ms, news[i] - '1', s, e);
        luaL_tolstring(L, -1, NULL);  /* if number, convert it to string */
        lua_remove(L, -2);  /* remove original value */
        luaL_addvalue(b);  /* add capture to accumulated result */
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movl $0x3, %esi
leaq -0x28(%rbp), %rdx
callq 0x67d0
movq %rax, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x2fdea
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x25, %eax
je 0x2fc90
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rdx
movb $0x1, %al
cmpq 0x8(%rdx), %rcx
movb %al, -0x41(%rbp)
jb 0x2fc60
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x20630
cmpq $0x0, %rax
setne %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rsi
movq 0x10(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x10(%rsi)
movb %dl, (%rax,%rcx)
jmp 0x2fdd7
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
callq 0x5500
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movq -0x30(%rbp), %rdx
movzbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
jne 0x2fd4c
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x25, %eax
je 0x2fced
movq -0x38(%rbp), %rdi
leaq 0x73af(%rip), %rsi      # 0x37090
movl $0x25, %edx
movb $0x0, %al
callq 0x1fbf0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
movq -0x10(%rbp), %rdx
movb $0x1, %al
cmpq 0x8(%rdx), %rcx
movb %al, -0x42(%rbp)
jb 0x2fd1c
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x20630
cmpq $0x0, %rax
setne %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x10(%rbp), %rsi
movq 0x10(%rsi), %rcx
movq %rcx, %rdi
addq $0x1, %rdi
movq %rdi, 0x10(%rsi)
movb %dl, (%rax,%rcx)
jmp 0x2fdd5
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x30, %eax
jne 0x2fd77
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
subq %rax, %rdx
callq 0x208a0
jmp 0x2fdd3
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rax
movq -0x30(%rbp), %rcx
movsbl (%rax,%rcx), %esi
subl $0x31, %esi
movq -0x18(%rbp), %rdx
movq -0x20(%rbp), %rcx
callq 0x2f1a0
movq -0x38(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %eax, %eax
movl %eax, %edx
callq 0x21320
movq -0x38(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x5e60
movq -0x38(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x5dc0
movq -0x10(%rbp), %rdi
callq 0x209f0
jmp 0x2fdd5
jmp 0x2fdd7
jmp 0x2fdd9
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x2fc12
addq $0x50, %rsp
popq %rbp
retq