// File: /workspace/github_c_makefile_star2_O3/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 0x1e2ed
cmpl $0x21, %eax
jl 0x1e2f6
jmp 0x1e2fb
cmpl $0x9, %eax
jne 0x1e3c7
incq %r14
jmp 0x1e2dd
cmpl $0x2c, %eax
jg 0x1e313
cmpl $0x21, %eax
je 0x1e3a2
cmpl $0x2b, %eax
je 0x1e371
jmp 0x1e3c7
cmpl $0x2d, %eax
je 0x1e371
cmpl $0x7e, %eax
jne 0x1e3c7
incq %r14
movq %r14, %rcx
movq %rbx, %r9
callq 0x1e2d3
testq %rbx, %rbx
je 0x1e462
movzbl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x1e452
testl %ecx, %ecx
jne 0x1e47f
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1e462
orl %ecx, %eax
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jnp 0x1e484
jmp 0x1e462
leaq 0x1(%r14), %rcx
movq %rbx, %r9
callq 0x1e503
testq %rbx, %rbx
je 0x1e462
movzbl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x1e3d7
testl %ecx, %ecx
jne 0x1e3e2
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jnp 0x1e3e2
jmp 0x1e462
incq %r14
movq %r14, %rcx
movq %rbx, %r9
callq 0x1e2d3
cmpb $0x0, 0x1(%rbx)
je 0x1e417
movb $0x0, 0x1(%rbx)
movq $0x0, 0x20(%rbx)
jmp 0x1e4f0
movq %r14, %rcx
movq %rbx, %r9
callq 0x1e503
jmp 0x1e4f3
cmpq $0x0, 0x18(%rbx)
je 0x1e462
movsbl %cl, %ecx
cmpb $0x2d, (%r14)
movsd 0x20(%rbx), %xmm0
jne 0x1e3fd
xorpd 0x76468(%rip), %xmm0    # 0x94860
movlpd %xmm0, 0x20(%rbx)
orl %ecx, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setp %cl
setne %dl
orb %cl, %dl
movb %dl, 0x1(%rbx)
jmp 0x1e4f3
movzbl (%rbx), %ecx
cmpl $0x1, %ecx
je 0x1e4a4
testl %ecx, %ecx
jne 0x1e4ab
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1e4de
cvttsd2si 0x20(%rbx), %rcx
testq %rcx, %rcx
je 0x1e4cb
xorpd %xmm0, %xmm0
jmp 0x1e4d3
cmpq $0x0, 0x18(%rbx)
je 0x1e462
orl %ecx, %eax
cmpq $0x0, 0x18(%rbx)
jne 0x1e484
movq $0x0, 0x8(%rbx)
movw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rcx # imm = 0x7FF8000000000000
movq %rcx, 0x20(%rbx)
jmp 0x1e4f3
movsbl %cl, %ecx
orl %ecx, %eax
cvttsd2si 0x20(%rbx), %rcx
cmpq $-0x1, %rcx
notq %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
movsd %xmm0, 0x20(%rbx)
setne 0x1(%rbx)
jmp 0x1e4f3
cmpq $0x0, 0x18(%rbx)
je 0x1e4de
cmpq $0x0, 0x18(%rbx)
sete 0x1(%rbx)
je 0x1e4bc
xorpd %xmm0, %xmm0
jmp 0x1e4c4
movsd 0x74b4c(%rip), %xmm0    # 0x93010
movsd %xmm0, 0x20(%rbx)
jmp 0x1e4f0
movsd 0x74b3d(%rip), %xmm0    # 0x93010
movsd %xmm0, 0x20(%rbx)
sete 0x1(%rbx)
jmp 0x1e4f0
movb $0x1, 0x1(%rbx)
movabsq $0x3ff0000000000000, %rcx # imm = 0x3FF0000000000000
movq %rcx, 0x20(%rbx)
movb $0x0, (%rbx)
xorl %ecx, %ecx
negl %eax
sbbl %ecx, %ecx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq