// File: /workspace/github_cpp_makefile_star2_O1/ctSkennerton[P]fxtract/util/bndm_t.c
// Function: main
int main(int argc, char **argv)
{
    plan_tests(1);
    char dflt[] = "one", *patt = argc > 1 ? argv[1] : dflt;
    char const *util = getenv("util") ? getenv("util") : ".";
    char const *file = argc > 1 ? argv[1] : "words";
    FILE *fp = fopenf("r", "%s/%s", util, file);
    if (!fp) return fprintf(stderr, "bndm_t: cannot open %s\n", file);
    int patlen = strlen(patt), lines = 0, goods = 0, hits = 0;
    char buf[999];

    while (fgets(buf, sizeof buf, fp)) {
        lines++;
        char *cp = strstr(buf, patt);
        hits += !!cp;
        if (cp == bndmem(buf, strlen(buf) - 1, patt, patlen)) ++goods;
        else fprintf(stderr, "# failed: %s", buf);
    }
    ok(goods == lines, "strstr == bndmem %d/%d times (%d hits)", goods, lines, hits);

    return exit_status();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x408, %rsp            # imm = 0x408
movq %rsi, %r14
movl %edi, %ebp
movl $0x1, %edi
callq 0x52d6
movl $0x656e6f, 0x14(%rsp)   # imm = 0x656E6F
cmpl $0x2, %ebp
jl 0x352f
movq 0x8(%r14), %rax
jmp 0x3534
leaq 0x14(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x2ac4(%rip), %rdi      # 0x6004
callq 0x3230
testq %rax, %rax
leaq 0x346b(%rip), %rdx      # 0x69ba
cmovneq %rax, %rdx
cmpl $0x2, %ebp
jl 0x355e
movq 0x8(%r14), %r15
jmp 0x3565
leaq 0x2aa4(%rip), %r15      # 0x6009
leaq 0x3519(%rip), %rdi      # 0x6a85
leaq 0x2a9c(%rip), %rsi      # 0x600f
xorl %r13d, %r13d
movq %r15, %rcx
xorl %eax, %eax
callq 0x42ba
testq %rax, %rax
je 0x36aa
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x30a0
movq %rax, 0x18(%rsp)
leaq 0x20(%rsp), %rdi
movl $0x3e7, %esi            # imm = 0x3E7
movq %rbx, %rdx
callq 0x32c0
movl $0x0, %r14d
movl $0x0, %ecx
movq %rcx, (%rsp)
testq %rax, %rax
je 0x3654
leaq 0x20(%rsp), %r12
movq $0x0, (%rsp)
xorl %r14d, %r14d
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x3050
movq %rax, %rbp
cmpq $0x1, %rax
movq (%rsp), %rax
sbbl $-0x1, %eax
movq %rax, (%rsp)
movq %r12, %rdi
callq 0x30a0
leal -0x1(%rax), %esi
movq %r12, %rdi
movq %r15, %rdx
movq 0x18(%rsp), %rcx
callq 0x36d8
cmpq %rax, %rbp
jne 0x3637
incl %r14d
movq %r12, %rdi
movl $0x3e7, %esi            # imm = 0x3E7
movq %rbx, %rdx
callq 0x32c0
incl %r13d
testq %rax, %rax
jne 0x35dd
jmp 0x3654
movq 0x59a2(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
leaq 0x29e5(%rip), %rsi      # 0x602d
movq %r12, %rdx
xorl %eax, %eax
callq 0x3290
jmp 0x361d
xorl %esi, %esi
cmpl %r13d, %r14d
sete %sil
leaq 0x29e4(%rip), %r10      # 0x6048
leaq 0x29d4(%rip), %r11      # 0x603f
leaq 0x29c8(%rip), %r9       # 0x603a
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %eax, %eax
pushq (%rsp)
pushq %r13
pushq %r14
pushq %r10
pushq $0x2a
pushq %r11
callq 0x4a00
addq $0x30, %rsp
callq 0x557a
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x592f(%rip), %rax      # 0x8fe0
movq (%rax), %rdi
leaq 0x295a(%rip), %rsi      # 0x6015
movq %r15, %rdx
xorl %eax, %eax
addq $0x408, %rsp            # imm = 0x408
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3290
nop