// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %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)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %r8
movq -0x38(%rbp), %r9
callq 0x2b370
cmpl $0x0, %eax
je 0x2b1de
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b35c
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
leaq -0x60(%rbp), %rdi
xorl %esi, %esi
movl $0x28, %edx
callq 0x4250
movq -0x28(%rbp), %rax
cmpb $0x0, (%rax)
je 0x2b34c
movq -0x28(%rbp), %rdi
callq 0x29c80
movq %rax, -0x28(%rbp)
movl $0x0, -0x64(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
je 0x2b236
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2b2bb
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x28(%rbp), %rcx
addq $0x1, %rcx
movq -0x30(%rbp), %r8
leaq -0x60(%rbp), %r9
callq 0x2b370
cmpl $0x0, %eax
je 0x2b268
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b35c
leaq -0x60(%rbp), %rdi
callq 0x29ce0
cmpl $0x0, %eax
je 0x2b284
movq -0x38(%rbp), %rdi
callq 0x29ce0
cmpl $0x0, %eax
jne 0x2b28d
movl $0x1, -0x64(%rbp)
jmp 0x2b2b9
movsbl -0x60(%rbp), %eax
cmpl $0x0, %eax
jne 0x2b2a2
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x2b2b7
leaq -0x60(%rbp), %rdi
callq 0x2a790
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x2b35c
jmp 0x2b2b9
jmp 0x2b2bb
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
jne 0x2b2dc
movsd -0x40(%rbp), %xmm0
movq -0x38(%rbp), %rax
addsd 0x20(%rax), %xmm0
movsd %xmm0, 0x20(%rax)
jmp 0x2b305
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x2b301
movsd -0x40(%rbp), %xmm1
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, 0x20(%rax)
jmp 0x2b303
jmp 0x2b34c
jmp 0x2b305
cmpl $0x0, -0x64(%rbp)
je 0x2b316
movq -0x38(%rbp), %rdi
callq 0x2a750
jmp 0x2b33c
movq -0x38(%rbp), %rax
movsd 0x20(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
setne %al
setp %cl
orb %cl, %al
andb $0x1, %al
movzbl %al, %eax
movb %al, %cl
movq -0x38(%rbp), %rax
movb %cl, 0x1(%rax)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x2b1f9
leaq -0x60(%rbp), %rdi
callq 0x2a790
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)