// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/test/test_expr.c
// Function: lookup
int lookup(void *data, char *str, char **end, hts_expr_val_t *res) {
    int foo = 15551; // my favourite palindromic prime
    int a = 1;
    int b = 2;
    int c = 3;
    res->is_str = 0;
    if (strncmp(str, "foo", 3) == 0) {
        *end = str+3;
        res->d = foo;
    } else if (*str == 'a') {
        *end = str+1;
        res->d = a;
    } else if (*str == 'b') {
        *end = str+1;
        res->d = b;
    } else if (*str == 'c') {
        *end = str+1;
        res->d = c;
    } else if (strncmp(str, "magic", 5) == 0) {
        // non-empty string
        *end = str+5;
        res->is_str = 1;
        kputs("plugh", ks_clear(&res->s));
    } else if (strncmp(str, "empty-but-true", 14) == 0) {
        // empty string
        *end = str+14;
        res->is_true = 1;
        res->is_str = 1;
        kputs("", ks_clear(&res->s));
    } else if (strncmp(str, "empty", 5) == 0) {
        // empty string
        *end = str+5;
        res->is_str = 1;
        kputs("", ks_clear(&res->s));
    } else if (strncmp(str, "zero-but-true", 13) == 0) {
        *end = str+13;
        res->d = 0;
        res->is_true = 1;
    } else if (strncmp(str, "null-but-true", 13) == 0) {
        *end = str+13;
        hts_expr_val_undef(res);
        res->is_true = 1;
    } else if (strncmp(str, "null", 4) == 0) {
        // null string (eg aux:Z tag is absent)
        *end = str+4;
        hts_expr_val_undef(res);
    } else if (strncmp(str, "nan", 3) == 0) {
        // sqrt(-1), 0/0 and similar
        // Semantically the same operations as null.
        *end = str+3;
        hts_expr_val_undef(res);

    } else {
        return -1;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movb $0x0, (%rcx)
movzbl (%rsi), %r13d
leal -0x61(%r13), %eax
cmpl $0x5, %eax
ja 0x5eb7
leaq 0x8a1bf(%rip), %rcx     # 0x90004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
incq %r15
movq %r15, (%r14)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
jmp 0x5e82
incq %r15
movq %r15, (%r14)
movabsq $0x4008000000000000, %rax # imm = 0x4008000000000000
jmp 0x5e82
incq %r15
movq %r15, (%r14)
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
movq %rax, 0x20(%rbx)
xorl %r12d, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
cmpb $0x6f, 0x1(%r15)
jne 0x5eb7
cmpb $0x6f, 0x2(%r15)
jne 0x5eb7
addq $0x3, %r15
movq %r15, (%r14)
movabsq $0x40ce5f8000000000, %rax # imm = 0x40CE5F8000000000
jmp 0x5e82
leaq 0x8a62b(%rip), %rsi     # 0x904e9
movl $0x5, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x5f8e
leaq 0x8a617(%rip), %rsi     # 0x904f1
movl $0xe, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x5fd6
leaq 0x8a140(%rip), %rsi     # 0x90036
movl $0x5, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x600c
leaq 0x8a641(%rip), %rsi     # 0x90553
movl $0xd, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x605f
leaq 0x8a307(%rip), %rsi     # 0x90235
movl $0xd, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x6077
leaq 0x8a37a(%rip), %rsi     # 0x902c4
movl $0x4, %edx
movq %r15, %rdi
callq 0x4210
testl %eax, %eax
je 0x608d
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
cmpb $0x6e, %r13b
jne 0x5e89
cmpb $0x61, 0x1(%r15)
jne 0x5e89
cmpb $0x6e, 0x2(%r15)
jne 0x5e89
addq $0x3, %r15
jmp 0x6091
addq $0x5, %r15
movq %r15, (%r14)
movb $0x1, (%rbx)
movq $0x0, 0x8(%rbx)
movq 0x18(%rbx), %rax
xorl %r12d, %r12d
cmpq $0x6, 0x10(%rbx)
ja 0x5fe4
movl $0xa, %esi
movq %rax, %rdi
callq 0x4850
testq %rax, %rax
je 0x5e89
movq %rax, 0x18(%rbx)
movq $0xa, 0x10(%rbx)
movq 0x8(%rbx), %rcx
jmp 0x5fe6
addq $0xe, %r15
movq %r15, (%r14)
movw $0x101, (%rbx)          # imm = 0x101
jmp 0x6016
xorl %ecx, %ecx
movb $0x68, 0x4(%rax,%rcx)
movl $0x67756c70, (%rax,%rcx) # imm = 0x67756C70
movq 0x8(%rbx), %rax
movq 0x18(%rbx), %rcx
leaq 0x5(%rax), %rdx
movq %rdx, 0x8(%rbx)
movb $0x0, 0x5(%rcx,%rax)
jmp 0x5e89
addq $0x5, %r15
movq %r15, (%r14)
movb $0x1, (%rbx)
movq $0x0, 0x8(%rbx)
movq 0x18(%rbx), %rax
xorl %r12d, %r12d
cmpq $0x1, 0x10(%rbx)
ja 0x6054
movl $0x3, %esi
movq %rax, %rdi
callq 0x4850
testq %rax, %rax
je 0x5e89
movq %rax, 0x18(%rbx)
movq $0x3, 0x10(%rbx)
movq 0x8(%rbx), %rcx
jmp 0x6056
xorl %ecx, %ecx
movb $0x0, (%rax,%rcx)
jmp 0x5e89
addq $0xd, %r15
movq %r15, (%r14)
movq $0x0, 0x20(%rbx)
movb $0x1, 0x1(%rbx)
jmp 0x5e86
addq $0xd, %r15
movq %r15, (%r14)
movq $0x0, 0x8(%rbx)
movw $0x100, (%rbx)          # imm = 0x100
jmp 0x60a1
addq $0x4, %r15
movq %r15, (%r14)
movq $0x0, 0x8(%rbx)
movw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
jmp 0x5e82