// File: /workspace/github_c_makefile_star2_O0/sasairc[P]clangsay/src/libbenly/src/typestring.c
// Function: mbindex
static
int mbindex(STRING* self, char* const str, size_t pos, size_t* idx)
{
    int     ch      = 0;

    size_t  len     = 0;

    char*   p       = NULL;

    if (self->empty(self))
        return (status = ESTRISEMPTY);
    if (str == NULL || idx == NULL)
        return (status = EARGISNULPTR);
    if (!mb_is_in_range(self, pos))
        return (status = EOUTOFRANGE);

    len = strlen(str);
    p = self->c_str(self);
    setlocale(LC_CTYPE, T_STRING_LOCALE_VALUE);
    while (*p != '\0') {
        if ((ch = mblen(p, MB_CUR_MAX)) < 0) {
#ifdef  LIBRARY_VERBOSE
            print_error();
/* LIBRARY_VERBOSE */
#endif
            return (status = EINVALIDCHAR);
        }
        if (pos)
            pos--;
        else if (memcmp(p, str, len) == 0)
            return 0;
        p += ch;
        (*idx)++;
    }
    /* not found */
    *idx = 0;

    return (status = ESTRNOTFOUND);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0xa0(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
cmpl $0x0, %eax
je 0xda3e
leaq 0x981c(%rip), %rax      # 0x17248
movl $0xfffffffc, (%rax)     # imm = 0xFFFFFFFC
movl $0xfffffffc, -0x4(%rbp) # imm = 0xFFFFFFFC
jmp 0xdb80
cmpq $0x0, -0x18(%rbp)
je 0xda4c
cmpq $0x0, -0x28(%rbp)
jne 0xda65
leaq 0x97f5(%rip), %rax      # 0x17248
movl $0xfffffffb, (%rax)     # imm = 0xFFFFFFFB
movl $0xfffffffb, -0x4(%rbp) # imm = 0xFFFFFFFB
jmp 0xdb80
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0xf4a0
cmpl $0x0, %eax
jne 0xda90
leaq 0x97ca(%rip), %rax      # 0x17248
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xdb80
movq -0x18(%rbp), %rdi
callq 0x2190
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0xc8(%rax), %rax
movq -0x10(%rbp), %rdi
callq *%rax
movq %rax, -0x40(%rbp)
xorl %edi, %edi
leaq 0x4a61(%rip), %rsi      # 0x1251c
callq 0x23d0
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0xdb61
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
callq 0x21b0
movq -0x48(%rbp), %rdi
movq %rax, %rsi
callq 0x22e0
movl %eax, -0x2c(%rbp)
cmpl $0x0, %eax
jge 0xdb07
leaq 0x9750(%rip), %rax      # 0x17248
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
movl $0xfffffffe, -0x4(%rbp) # imm = 0xFFFFFFFE
jmp 0xdb80
cmpq $0x0, -0x20(%rbp)
je 0xdb1c
movq -0x20(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0xdb3d
movq -0x40(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x38(%rbp), %rdx
callq 0x2380
cmpl $0x0, %eax
jne 0xdb3b
movl $0x0, -0x4(%rbp)
jmp 0xdb80
jmp 0xdb3d
movl -0x2c(%rbp), %ecx
movq -0x40(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0xdac0
movq -0x28(%rbp), %rax
movq $0x0, (%rax)
leaq 0x96d5(%rip), %rax      # 0x17248
movl $0xfffffffa, (%rax)     # imm = 0xFFFFFFFA
movl $0xfffffffa, -0x4(%rbp) # imm = 0xFFFFFFFA
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)