// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
pushq %rax
movq %r9, %rbx
movq %rcx, %r14
movzbl (%r14), %eax
cmpl $0x1f, %eax
jle 0x1ea19
cmpl $0x21, %eax
jl 0x1ea22
jmp 0x1ea27
cmpl $0x9, %eax
jne 0x1eb9f
incq %r14
jmp 0x1ea09
cmpl $0x2c, %eax
jg 0x1ea43
cmpl $0x21, %eax
je 0x1eb7a
cmpl $0x2b, %eax
je 0x1eaf1
jmp 0x1eb9f
cmpl $0x2d, %eax
je 0x1eaf1
cmpl $0x7e, %eax
jne 0x1eb9f
incq %r14
movq %r14, %rcx
movq %rbx, %r9
callq 0x1e9ff
testq %rbx, %rbx
je 0x1eb5a
movzbl (%rbx), %ecx
testl %ecx, %ecx
je 0x1ea87
cmpl $0x1, %ecx
jne 0x1ea96
cmpq $0x0, 0x18(%rbx)
je 0x1eb5a
testb %cl, %cl
jne 0x1ea96
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1eb5a
movsbl (%rbx), %ecx
orl %ecx, %eax
testq %rbx, %rbx
je 0x1eb5a
movzbl %cl, %ecx
testl %ecx, %ecx
je 0x1eabf
cmpl $0x1, %ecx
jne 0x1eace
cmpq $0x0, 0x18(%rbx)
je 0x1eb5a
testl %ecx, %ecx
jne 0x1eace
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1eb5a
cvttsd2si 0x20(%rbx), %rcx
cmpq $-0x1, %rcx
notq %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movsd %xmm0, 0x20(%rbx)
setne 0x1(%rbx)
jmp 0x1ec34
leaq 0x1(%r14), %rcx
movq %rbx, %r9
callq 0x1ec44
testq %rbx, %rbx
je 0x1eb5a
movzbl (%rbx), %ecx
testl %ecx, %ecx
je 0x1eb19
cmpl $0x1, %ecx
jne 0x1eb24
cmpq $0x0, 0x18(%rbx)
je 0x1eb5a
testb %cl, %cl
jne 0x1eb24
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1eb5a
movsbl (%rbx), %ecx
cmpb $0x2d, (%r14)
jne 0x1eb3f
movsd 0x20(%rbx), %xmm0
xorpd 0x78d26(%rip), %xmm0    # 0x97860
movlpd %xmm0, 0x20(%rbx)
orl %ecx, %eax
xorpd %xmm0, %xmm0
ucomisd 0x20(%rbx), %xmm0
setp %cl
setne %dl
orb %cl, %dl
movb %dl, 0x1(%rbx)
jmp 0x1ec34
movq $0x0, 0x8(%rbx)
movw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
movq %rcx, 0x20(%rbx)
jmp 0x1ec34
incq %r14
movq %r14, %rcx
movq %rbx, %r9
callq 0x1e9ff
cmpb $0x0, 0x1(%rbx)
je 0x1ebaf
movb $0x0, 0x1(%rbx)
movq $0x0, 0x20(%rbx)
jmp 0x1ec31
movq %r14, %rcx
movq %rbx, %r9
callq 0x1ec44
jmp 0x1ec34
testq %rbx, %rbx
je 0x1ebec
movzbl (%rbx), %ecx
testl %ecx, %ecx
je 0x1ebcb
cmpl $0x1, %ecx
jne 0x1ebd6
cmpq $0x0, 0x18(%rbx)
je 0x1ebec
testb %cl, %cl
jne 0x1ebd6
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1ebec
cmpb $0x0, (%rbx)
je 0x1ec00
cmpq $0x0, 0x18(%rbx)
sete 0x1(%rbx)
je 0x1ec11
xorpd %xmm0, %xmm0
jmp 0x1ec19
movb $0x1, 0x1(%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x20(%rbx)
jmp 0x1ec31
cvttsd2si 0x20(%rbx), %rcx
testq %rcx, %rcx
je 0x1ec20
xorpd %xmm0, %xmm0
jmp 0x1ec28
movsd 0x773f7(%rip), %xmm0    # 0x96010
movsd %xmm0, 0x20(%rbx)
jmp 0x1ec31
movsd 0x773e8(%rip), %xmm0    # 0x96010
movsd %xmm0, 0x20(%rbx)
sete 0x1(%rbx)
movb $0x0, (%rbx)
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq