// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hts_expr.c
// Function: simple_expr
static int simple_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn,
                       char *str, char **end, hts_expr_val_t *res) {
    // Main recursion step
    str = ws(str);
    if (*str == '(') {
        if (expression(filt, data, fn, str+1, end, res)) return -1;
        str = ws(*end);
        if (*str != ')') {
            fprintf(stderr, "Missing ')'\n");
            return -1;
        }
        *end = str+1;

        return 0;
    }

    // Otherwise a basic element.
    int fail = 0;
    double d = hts_str2dbl(str, end, &fail);
    if (str != *end) {
        res->is_str = 0;
        res->d = d;
    } else {
        // Not valid floating point syntax.
        // TODO: add function call names in here; len(), sqrt(), pow(), etc
        if (*str == '"') {
            res->is_str = 1;
            char *e = str+1;
            int backslash = 0;
            while (*e && *e != '"') {
                if (*e == '\\')
                    backslash=1, e+=1+(e[1]!='\0');
                else
                    e++;
            }

            kputsn(str+1, e-(str+1), ks_clear(&res->s));
            if (backslash) {
                size_t i, j;
                for (i = j = 0; i < res->s.l; i++) {
                    res->s.s[j++] = res->s.s[i];
                    if (res->s.s[i] == '\\') {
                        switch (res->s.s[++i]) {
                        case '"': res->s.s[j-1] = '"'; break;
                        case '\\':res->s.s[j-1] = '\\'; break;
                        case 't': res->s.s[j-1] = '\t'; break;
                        case 'n': res->s.s[j-1] = '\n'; break;
                        case 'r': res->s.s[j-1] = '\r'; break;
                        default:  res->s.s[j++] = res->s.s[i];
                        }
                    }
                }
                res->s.s[j] = 0;
                res->s.l = j;
            }
            if (*e != '"')
                return -1;
            *end = e+1;
        } else if (fn) {
            // Try lookup as variable, if not as function
            if (fn(data, str, end, res) == 0)
                return 0;
            else
                return func_expr(filt, data, fn, str, end, res);
        } else {
            return -1;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x28(%rbp), %rdi
callq 0x29c80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x28, %eax
jne 0x2b99d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2b942
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2bcd2
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x29c80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
je 0x2b982
movq 0xe167b(%rip), %rax     # 0x10cfe0
movq (%rax), %rdi
leaq 0xc5629(%rip), %rsi     # 0xf0f98
movb $0x0, %al
callq 0x46d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2bcd2
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2bcd2
movl $0x0, -0x3c(%rbp)
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
leaq -0x3c(%rbp), %rdx
callq 0x2bce0
movsd %xmm0, -0x48(%rbp)
movq -0x28(%rbp), %rax
movq -0x30(%rbp), %rcx
cmpq (%rcx), %rax
je 0x2b9e1
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movsd -0x48(%rbp), %xmm0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x20(%rax)
jmp 0x2bccb
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
jne 0x2bc73
movq -0x38(%rbp), %rax
movb $0x1, (%rax)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x54(%rbp)
movq -0x50(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x69(%rbp)
je 0x2ba2c
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
setne %al
movb %al, -0x69(%rbp)
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x2ba35
jmp 0x2ba7c
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x2ba6e
movl $0x1, -0x54(%rbp)
movq -0x50(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %ecx
addl $0x1, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
jmp 0x2ba7a
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x2ba0b
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
movq -0x50(%rbp), %rax
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
subq %rcx, %rax
movq %rax, -0x78(%rbp)
movq -0x38(%rbp), %rdi
addq $0x8, %rdi
callq 0x2c0d0
movq -0x80(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq %rax, %rdx
callq 0x2c020
cmpl $0x0, -0x54(%rbp)
je 0x2bc4d
movq $0x0, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x2bc31
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movb %dl, (%rax,%rcx)
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
jne 0x2bc1e
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rcx
movq %rcx, %rdx
incq %rdx
movq %rdx, -0x60(%rbp)
movsbl 0x1(%rax,%rcx), %eax
movl %eax, -0x84(%rbp)
subl $0x22, %eax
je 0x2bb82
jmp 0x2bb4e
movl -0x84(%rbp), %eax
subl $0x5c, %eax
je 0x2bb9b
jmp 0x2bb5b
movl -0x84(%rbp), %eax
subl $0x6e, %eax
je 0x2bbc7
jmp 0x2bb68
movl -0x84(%rbp), %eax
subl $0x72, %eax
je 0x2bbdd
jmp 0x2bb75
movl -0x84(%rbp), %eax
subl $0x74, %eax
je 0x2bbb1
jmp 0x2bbf3
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
subq $0x1, %rcx
movb $0x22, (%rax,%rcx)
jmp 0x2bc1c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
subq $0x1, %rcx
movb $0x5c, (%rax,%rcx)
jmp 0x2bc1c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
subq $0x1, %rcx
movb $0x9, (%rax,%rcx)
jmp 0x2bc1c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
subq $0x1, %rcx
movb $0xa, (%rax,%rcx)
jmp 0x2bc1c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
subq $0x1, %rcx
movb $0xd, (%rax,%rcx)
jmp 0x2bc1c
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x60(%rbp), %rcx
movb (%rax,%rcx), %dl
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
movq %rcx, %rsi
addq $0x1, %rsi
movq %rsi, -0x68(%rbp)
movb %dl, (%rax,%rcx)
jmp 0x2bc1e
jmp 0x2bc20
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0x2bad2
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x68(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x68(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x2bc62
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2bcd2
movq -0x50(%rbp), %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x2bcc9
cmpq $0x0, -0x20(%rbp)
je 0x2bcc0
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x38(%rbp), %rcx
callq *%rax
cmpl $0x0, %eax
jne 0x2bc9e
movl $0x0, -0x4(%rbp)
jmp 0x2bcd2
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x2c0f0
movl %eax, -0x4(%rbp)
jmp 0x2bcd2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2bcd2
jmp 0x2bccb
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nop