// File: ctSkennerton[P]fxtract/util/str_x.c
// Function: do_mem
static double
do_mem(char const *name, MEMF fn, MEMREF const*rv, int nr, int count, char *pat, char **exp)
{
    int     i, r, patlen = strlen(pat);
    double  start = tick();
    char    *cp, *sp;

    //do_mem never called before do_str
    for (r = 0; r < nr; ++r) {
        cp = fn((char*)(intptr_t)rv[r].ptr, rv[r].len, pat, patlen);
        if (exp[r] != cp) {
            fprintf(stderr, "%s(pat='%s' [%d] exp=%"FSIZE"d act=%"FSIZE"d) failed\n\t[%"FSIZE"d] %s\n", name, pat, r,
                    exp[r] ? exp[r] - rv[r].ptr : -1, cp ? cp - rv[r].ptr : -1, 
                    rv[r].len, sp = acstr(rv[r].ptr, rv[r].len));
            free(sp);
            return 0;
        }
    }

    for (i = 0; i < count; ++i)
        for (r = 0; r < nr; ++r)
            if (exp[r] != fn((char*)(intptr_t)rv[r].ptr, rv[r].len, pat, patlen))
                return 0;

    return tick() - start;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movl %r8d, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x30b0
movl %eax, -0x3c(%rbp)
callq 0x7770
movsd %xmm0, -0x48(%rbp)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3c87
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdi
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl %ecx, %esi
movq -0x30(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq *%rax
movq %rax, -0x50(%rbp)
movq 0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq -0x50(%rbp), %rax
je 0x3c77
movq 0x84bc(%rip), %rax      # 0xbfe0
movq (%rax), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x68(%rbp)
movl -0x38(%rbp), %eax
movl %eax, -0x5c(%rbp)
movq 0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x3b77
movq 0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x80(%rbp)
jmp 0x3b84
movq $-0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x3b84
movq -0x80(%rbp), %rax
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x3bb8
movq -0x50(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rcx
subq %rcx, %rax
movq %rax, -0x90(%rbp)
jmp 0x3bc8
movq $-0x1, %rax
movq %rax, -0x90(%rbp)
jmp 0x3bc8
movq -0x90(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movslq -0x38(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rax
movl %eax, %esi
callq 0x5530
movq -0x78(%rbp), %rdi
movq -0x70(%rbp), %rdx
movq -0x68(%rbp), %rcx
movl -0x5c(%rbp), %r8d
movq -0x88(%rbp), %r9
movq -0xa0(%rbp), %r11
movq -0x98(%rbp), %r10
movq %rax, -0x58(%rbp)
leaq 0x5521(%rip), %rsi      # 0x916d
movq %r11, (%rsp)
movq %r10, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movb $0x0, %al
callq 0x3290
movq -0x58(%rbp), %rdi
callq 0x3220
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x3d35
jmp 0x3c79
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3ac3
movl $0x0, -0x34(%rbp)
movl -0x34(%rbp), %eax
cmpl -0x28(%rbp), %eax
jge 0x3d26
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x24(%rbp), %eax
jge 0x3d16
movq 0x10(%rbp), %rax
movslq -0x38(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xa8(%rbp)
movq -0x18(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq (%rcx), %rdi
movq -0x20(%rbp), %rcx
movslq -0x38(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rcx
movq 0x8(%rcx), %rcx
movl %ecx, %esi
movq -0x30(%rbp), %rdx
movl -0x3c(%rbp), %ecx
callq *%rax
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
je 0x3d09
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x3d35
jmp 0x3d0b
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x3ca1
jmp 0x3d18
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x3c8e
callq 0x7770
subsd -0x48(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)