// File: /workspace/github_c_makefile_star2_O2/samtools[P]htslib/hts_expr.c
// Function: unary_expr
static int unary_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn,
                      char *str, char **end, hts_expr_val_t *res) {
    int err;
    str = ws(str);
    if (*str == '+' || *str == '-') {
        err = simple_expr(filt, data, fn, str+1, end, res);
        if (!hts_expr_val_exists(res)) {
            hts_expr_val_undef(res);
        } else {
            err |= res->is_str;
            if (*str == '-')
                res->d = -res->d;
            res->is_true = res->d != 0;
        }
    } else if (*str == '!') {
        err = unary_expr(filt, data, fn, str+1, end, res);
        if (res->is_true) {
            // Any explicitly true value becomes false
            res->d = res->is_true = 0;
        } else if (!hts_expr_val_exists(res)) {
            // We can also still negate undef values by toggling the
            // is_true override value.
            res->d = res->is_true = !res->is_true;
        } else if (res->is_str) {
            // !null = true, !"foo" = false, NOTE: !"" = false also
            res->d = res->is_true = (res->s.s == NULL);
        } else {
            res->d = !(int64_t)res->d;
            res->is_true = res->d != 0;
        }
        res->is_str = 0;
    } else if (*str == '~') {
        err = unary_expr(filt, data, fn, str+1, end, res);
        if (!hts_expr_val_exists(res)) {
            hts_expr_val_undef(res);
        } else {
            err |= res->is_str;
            if (!hts_expr_val_exists(res)) {
                hts_expr_val_undef(res);
            } else {
                res->d = ~(int64_t)res->d;
                res->is_true = res->d != 0;
            }
        }
    } else {
        err = simple_expr(filt, data, fn, str, end, res);
    }
    return err ? -1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %r8, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movq %rcx, %rdi
callq 0x191b7
movq %rax, %r14
movzbl (%rax), %eax
cmpl $0x21, %eax
je 0x1a08a
cmpl $0x2b, %eax
je 0x19fba
cmpl $0x7e, %eax
je 0x1a01b
cmpl $0x2d, %eax
jne 0x1a0ba
movq %r14, %rcx
incq %rcx
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r15, %r8
movq %rbx, %r9
callq 0x1a157
movl %eax, %ebp
movq %rbx, %rdi
callq 0x191cd
testl %eax, %eax
je 0x1a071
movsbl (%rbx), %eax
cmpb $0x2d, (%r14)
movsd 0x20(%rbx), %xmm0
jne 0x1a001
xorpd 0x5c864(%rip), %xmm0    # 0x76860
movlpd %xmm0, 0x20(%rbx)
orl %eax, %ebp
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setp %al
setne %cl
orb %al, %cl
movb %cl, 0x1(%rbx)
jmp 0x1a0d3
incq %r14
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x19f76
movl %eax, %ebp
movq %rbx, %rdi
callq 0x191cd
testl %eax, %eax
je 0x1a071
movsbl (%rbx), %eax
orl %eax, %ebp
movq %rbx, %rdi
callq 0x191cd
testl %eax, %eax
je 0x1a071
cvttsd2si 0x20(%rbx), %rax
cmpq $-0x1, %rax
notq %rax
cvtsi2sd %rax, %xmm0
movsd %xmm0, 0x20(%rbx)
setne 0x1(%rbx)
jmp 0x1a0d3
andq $0x0, 0x8(%rbx)
andw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, 0x20(%rbx)
jmp 0x1a0d3
incq %r14
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x19f76
movl %eax, %ebp
cmpb $0x0, 0x1(%rbx)
je 0x1a0e8
movb $0x0, 0x1(%rbx)
andq $0x0, 0x20(%rbx)
movb $0x0, (%rbx)
jmp 0x1a0d3
movq %rbp, %rdi
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
movq %rbx, %r9
callq 0x1a157
movl %eax, %ebp
xorl %eax, %eax
negl %ebp
sbbl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x191cd
testl %eax, %eax
je 0x1a10a
cmpb $0x0, (%rbx)
je 0x1a11e
cmpq $0x0, 0x18(%rbx)
sete 0x1(%rbx)
je 0x1a12f
xorpd %xmm0, %xmm0
jmp 0x1a137
movb $0x1, 0x1(%rbx)
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, 0x20(%rbx)
jmp 0x1a0b5
cvttsd2si 0x20(%rbx), %rax
testq %rax, %rax
je 0x1a141
xorpd %xmm0, %xmm0
jmp 0x1a149
movsd 0x5aed9(%rip), %xmm0    # 0x75010
movsd %xmm0, 0x20(%rbx)
jmp 0x1a0b5
movsd 0x5aec7(%rip), %xmm0    # 0x75010
movsd %xmm0, 0x20(%rbx)
sete 0x1(%rbx)
jmp 0x1a0b5