// File: /workspace/github_c_makefile_star2_O0/samtools[P]htslib/hts_expr.c
// Function: func_expr
static int func_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn,
                     char *str, char **end, hts_expr_val_t *res) {
    int func_ok = -1;
    switch (*str) {
    case 'a':
        if (strncmp(str, "avg(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = expr_func_avg(res);
        }
        break;

    case 'd':
        if (strncmp(str, "default(", 8) == 0) {
            if (expression(filt, data, fn, str+8, end, res)) return -1;
            if (**end != ',')
                return -1;
            (*end)++;
            hts_expr_val_t val = HTS_EXPR_VAL_INIT;
            if (expression(filt, data, fn, ws(*end), end, &val)) return -1;
            func_ok = 1;
            if (!hts_expr_val_existsT(res)) {
                kstring_t swap = res->s;
                *res = val;
                val.s = swap;
                hts_expr_val_free(&val);
            }
        }
        break;

    case 'e':
        if (strncmp(str, "exists(", 7) == 0) {
            if (expression(filt, data, fn, str+7, end, res)) return -1;
            func_ok = 1;
            res->is_true = res->d = hts_expr_val_existsT(res);
            res->is_str = 0;
        } else if (strncmp(str, "exp(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = 1;
            res->d = exp(res->d);
            res->is_str = 0;
            if (isnan(res->d))
                hts_expr_val_undef(res);
        }

        break;

    case 'l':
        if (strncmp(str, "length(", 7) == 0) {
            if (expression(filt, data, fn, str+7, end, res)) return -1;
            func_ok = expr_func_length(res);
        } else if (strncmp(str, "log(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = 1;
            res->d = log(res->d);
            res->is_str = 0;
            if (isnan(res->d))
                hts_expr_val_undef(res);
        }
        break;

    case 'm':
        if (strncmp(str, "min(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = expr_func_min(res);
        } else if (strncmp(str, "max(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = expr_func_max(res);
        }
        break;

    case 'p':
        if (strncmp(str, "pow(", 4) == 0) {
            if (expression(filt, data, fn, str+4, end, res)) return -1;
            func_ok = 1;

            if (**end != ',')
                return -1;
            (*end)++;
            hts_expr_val_t val = HTS_EXPR_VAL_INIT;
            if (expression(filt, data, fn, ws(*end), end, &val)) return -1;
            if (!hts_expr_val_exists(res) || !hts_expr_val_exists(&val)) {
                hts_expr_val_undef(res);
            } else if (res->is_str || val.is_str) {
                hts_expr_val_free(&val); // arith on strings
                return -1;
            } else {
                func_ok = 1;
                res->d = pow(res->d, val.d);
                hts_expr_val_free(&val);
                res->is_str = 0;
            }

            if (isnan(res->d))
                hts_expr_val_undef(res);
        }
        break;

    case 's':
        if (strncmp(str, "sqrt(", 5) == 0) {
            if (expression(filt, data, fn, str+5, end, res)) return -1;
            func_ok = 1;
            res->d = sqrt(res->d);
            res->is_str = 0;
            if (isnan(res->d))
                hts_expr_val_undef(res);
        }
        break;
    }

    if (func_ok < 0)
        return -1;

    str = ws(*end);
    if (*str != ')') {
        fprintf(stderr, "Missing ')'\n");
        return -1;
    }
    *end = str+1;

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %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)
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
addl $-0x61, %eax
movl %eax, %ecx
movq %rcx, -0xb0(%rbp)
subl $0x12, %eax
ja 0x2c80f
movq -0xb0(%rbp), %rax
leaq 0xc4d7c(%rip), %rcx     # 0xf0ec0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x28(%rbp), %rdi
leaq 0xc4e4d(%rip), %rsi     # 0xf0fa5
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c1a5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c199
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x38(%rbp), %rdi
callq 0x2c920
movl %eax, -0x3c(%rbp)
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4df5(%rip), %rsi     # 0xf0faa
movl $0x8, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c2fc
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x8, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c1fa
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x30(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x2c215
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x30(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
leaq -0x68(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x4250
movq -0x10(%rbp), %rax
movq %rax, -0xc8(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x29c80
movq -0xc8(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movq -0xb8(%rbp), %rdx
movq %rax, %rcx
movq -0x30(%rbp), %r8
leaq -0x68(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c296
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2a700
cmpl $0x0, %eax
jne 0x2c2fa
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x80(%rbp)
movq 0x10(%rax), %rcx
movq %rcx, -0x78(%rbp)
movq 0x18(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x38(%rbp), %rdi
leaq -0x68(%rbp), %rsi
movl $0x28, %edx
callq 0x43b0
movq -0x80(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x2a790
jmp 0x2c2fc
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4ca7(%rip), %rsi     # 0xf0fb3
movl $0x7, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c37f
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x7, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c34d
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2a700
cvtsi2sd %eax, %xmm0
movq -0x38(%rbp), %rcx
movsd %xmm0, 0x20(%rcx)
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
jmp 0x2c413
movq -0x28(%rbp), %rdi
leaq 0xc4c31(%rip), %rsi     # 0xf0fbb
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c411
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c3cb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x48f0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x2c406
jmp 0x2c40f
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2c411
jmp 0x2c413
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4b9d(%rip), %rsi     # 0xf0fc0
movl $0x7, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c475
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x7, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c464
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x38(%rbp), %rdi
callq 0x2ca00
movl %eax, -0x3c(%rbp)
jmp 0x2c509
movq -0x28(%rbp), %rdi
leaq 0xc4b48(%rip), %rsi     # 0xf0fc8
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c507
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c4c1
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x4380
movq -0x38(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x2c4fc
jmp 0x2c505
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2c507
jmp 0x2c509
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4ab4(%rip), %rsi     # 0xf0fcd
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c568
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c55a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x38(%rbp), %rdi
callq 0x2ca70
movl %eax, -0x3c(%rbp)
jmp 0x2c5c2
movq -0x28(%rbp), %rdi
leaq 0xc4a5f(%rip), %rsi     # 0xf0fd2
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c5c0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c5b4
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x38(%rbp), %rdi
callq 0x2cb40
movl %eax, -0x3c(%rbp)
jmp 0x2c5c2
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4a05(%rip), %rsi     # 0xf0fd7
movl $0x4, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c776
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x4, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c617
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
je 0x2c639
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x30(%rbp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x4250
movq -0x10(%rbp), %rax
movq %rax, -0xe0(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xd0(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x29c80
movq -0xe0(%rbp), %rdi
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rdx
movq %rax, %rcx
movq -0x30(%rbp), %r8
leaq -0xa8(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c6c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x38(%rbp), %rdi
callq 0x29ce0
cmpl $0x0, %eax
je 0x2c6df
leaq -0xa8(%rbp), %rdi
callq 0x29ce0
cmpl $0x0, %eax
jne 0x2c6ea
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2c755
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x2c702
movsbl -0xa8(%rbp), %eax
cmpl $0x0, %eax
je 0x2c71a
leaq -0xa8(%rbp), %rdi
callq 0x2a790
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd -0x88(%rbp), %xmm1
callq 0x48c0
movq -0x38(%rbp), %rax
movsd %xmm0, 0x20(%rax)
leaq -0xa8(%rbp), %rdi
callq 0x2a790
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
jmp 0x2c755
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x2c76b
jmp 0x2c774
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2c776
jmp 0x2c80f
movq -0x28(%rbp), %rdi
leaq 0xc4856(%rip), %rsi     # 0xf0fdc
movl $0x5, %edx
callq 0x4200
cmpl $0x0, %eax
jne 0x2c80d
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x5, %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x29c30
cmpl $0x0, %eax
je 0x2c7c7
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movl $0x1, -0x3c(%rbp)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
callq 0x4360
movq -0x38(%rbp), %rax
movsd %xmm0, 0x20(%rax)
movq -0x38(%rbp), %rax
movb $0x0, (%rax)
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x2c802
jmp 0x2c80b
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2c80d
jmp 0x2c80f
cmpl $0x0, -0x3c(%rbp)
jge 0x2c81e
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x29c80
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x29, %eax
je 0x2c85b
movq 0xe079f(%rip), %rax     # 0x10cfe0
movq (%rax), %rdi
leaq 0xc474d(%rip), %rsi     # 0xf0f98
movb $0x0, %al
callq 0x46d0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2c871
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xe0, %rsp
popq %rbp
retq
nopl (%rax)