// File: /workspace/github_c_makefile_star2_O1/samtools[P]htslib/hts_expr.c
// Function: add_expr
static int add_expr(hts_filter_t *filt, void *data, hts_expr_sym_func *fn,
                    char *str, char **end, hts_expr_val_t *res) {
    if (mul_expr(filt, data, fn, str, end, res))
        return -1;

    str = *end;
    hts_expr_val_t val = HTS_EXPR_VAL_INIT;
    while (*str) {
        str = ws(str);
        int undef = 0;
        if (*str == '+' || *str == '-') {
            if (mul_expr(filt, data, fn, str+1, end, &val)) return -1;
            if (!hts_expr_val_exists(&val) || !hts_expr_val_exists(res)) {
                undef = 1;
            } else if (val.is_str || res->is_str) {
                hts_expr_val_free(&val);
                return -1; // arith on strings
            }
        }

        if (*str == '+')
            res->d += val.d;
        else if (*str == '-')
            res->d -= val.d;
        else
            break;

        if (undef)
            hts_expr_val_undef(res);
        else
            res->is_true = res->d != 0;

        str = *end;
    }

    hts_expr_val_free(&val);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r9, %rbx
movq %r8, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
callq 0x1e7c3
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x1e7b4
movq %r15, 0x30(%rsp)
movq (%r14), %rbp
xorpd %xmm0, %xmm0
leaq 0x8(%rsp), %rax
movapd %xmm0, 0x8(%rax)
movapd %xmm0, -0x8(%rax)
movq $0x0, 0x18(%rax)
cmpb $0x0, (%rbp)
je 0x1e78e
movzbl (%rbp), %eax
cmpl $0x1f, %eax
jle 0x1e648
cmpl $0x20, %eax
je 0x1e651
jmp 0x1e656
cmpl $0x9, %eax
jne 0x1e70b
incq %rbp
jmp 0x1e638
cmpl $0x2b, %eax
je 0x1e664
cmpl $0x2d, %eax
jne 0x1e70b
leaq 0x1(%rbp), %rcx
movq %r13, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rdx
movq %r14, %r8
movq %rsp, %r9
callq 0x1e7c3
movl $0x1, %r15d
testl %eax, %eax
jne 0x1e77f
movzbl (%rsp), %ecx
testl %ecx, %ecx
je 0x1e6ac
cmpl $0x1, %ecx
jne 0x1e6a5
cmpq $0x0, 0x18(%rsp)
je 0x1e70f
testb %cl, %cl
je 0x1e6ac
testq %rbx, %rbx
jne 0x1e6bf
jmp 0x1e70f
xorl %eax, %eax
testq %rbx, %rbx
je 0x1e711
movsd 0x20(%rsp), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1e711
movzbl (%rbx), %eax
testl %eax, %eax
je 0x1e6d6
cmpl $0x1, %eax
jne 0x1e6e1
cmpq $0x0, 0x18(%rbx)
je 0x1e70f
testb %al, %al
jne 0x1e6e1
movsd 0x20(%rbx), %xmm0
ucomisd %xmm0, %xmm0
jp 0x1e70f
testb %cl, %cl
jne 0x1e6ea
cmpb $0x0, (%rbx)
je 0x1e70b
movq 0x18(%rsp), %rdi
callq 0x45c0
xorpd %xmm0, %xmm0
leaq 0x8(%rsp), %rax
movupd %xmm0, (%rax)
movq $0x0, 0x10(%rax)
jmp 0x1e77f
movb $0x1, %al
jmp 0x1e711
xorl %eax, %eax
movzbl (%rbp), %ecx
cmpl $0x2b, %ecx
je 0x1e72c
cmpl $0x2d, %ecx
jne 0x1e779
movsd 0x20(%rbx), %xmm0
subsd 0x20(%rsp), %xmm0
jmp 0x1e737
movsd 0x20(%rsp), %xmm0
addsd 0x20(%rbx), %xmm0
movsd %xmm0, 0x20(%rbx)
testb %al, %al
je 0x1e756
xorpd %xmm0, %xmm0
ucomisd 0x20(%rbx), %xmm0
setp %al
setne %cl
orb %al, %cl
movb %cl, 0x1(%rbx)
jmp 0x1e771
movq $0x0, 0x8(%rbx)
movw $0x0, (%rbx)
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, 0x20(%rbx)
movq (%r14), %rbp
xorl %r15d, %r15d
jmp 0x1e77f
movl $0x3, %r15d
testl %r15d, %r15d
je 0x1e62e
cmpl $0x3, %r15d
jne 0x1e7af
movq 0x18(%rsp), %rdi
callq 0x45c0
xorpd %xmm0, %xmm0
movupd %xmm0, 0x8(%rsp)
movq $0x0, 0x18(%rsp)
xorl %eax, %eax
jmp 0x1e7b4
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq