// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/./softfp_template.h
// Function: add_sf32
F_UINT add_sf(F_UINT a, F_UINT b, RoundingModeEnum rm,
              uint32_t *pfflags)
{
    uint32_t a_sign, b_sign, a_exp, b_exp;
    F_UINT tmp, a_mant, b_mant;

    /* swap so that  abs(a) >= abs(b) */
    if ((a & ~SIGN_MASK) < (b & ~SIGN_MASK)) {
        tmp = a;
        a = b;
        b = tmp;
    }
    a_sign = a >> (F_SIZE - 1);
    b_sign = b >> (F_SIZE - 1);
    a_exp = (a >> MANT_SIZE) & EXP_MASK;
    b_exp = (b >> MANT_SIZE) & EXP_MASK;
    a_mant = (a & MANT_MASK) << 3;
    b_mant = (b & MANT_MASK) << 3;
    if (unlikely(a_exp == EXP_MASK)) {
        if (a_mant != 0) {
            /* NaN result */
            if (!(a_mant & (QNAN_MASK << 3)) || issignan_sf(b))
                *pfflags |= FFLAG_INVALID_OP;
            return F_QNAN;
        } else if (b_exp == EXP_MASK && a_sign != b_sign) {
            *pfflags |= FFLAG_INVALID_OP;
            return F_QNAN;
        } else {
            /* infinity */
            return a;
        }
    }
    if (a_exp == 0) {
        a_exp = 1;
    } else {
        a_mant |= (F_UINT)1 << (MANT_SIZE + 3);
    }
    if (b_exp == 0) {
        b_exp = 1;
    } else {
        b_mant |= (F_UINT)1 << (MANT_SIZE + 3);
    }
    b_mant = rshift_rnd(b_mant, a_exp - b_exp);
    if (a_sign == b_sign) {
        /* same signs : add the absolute values  */
        a_mant += b_mant;
    } else {
        /* different signs : subtract the absolute values  */
        a_mant -= b_mant;
        if (a_mant == 0) {
            /* zero result : the sign needs a specific handling */
            a_sign = (rm == RM_RDN);
        }
    }
    a_exp += (RND_SIZE - 3);
    return normalize_sf(a_sign, a_exp, a_mant, rm, pfflags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq %rcx, -0x18(%rbp)
movl -0x8(%rbp), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl -0xc(%rbp), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jae 0x6cdc
movl -0x8(%rbp), %eax
movl %eax, -0x2c(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x8(%rbp), %eax
shrl $0x1f, %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
shrl $0x1f, %eax
movl %eax, -0x20(%rbp)
movl -0x8(%rbp), %eax
shrl $0x17, %eax
andl $0xff, %eax
movl %eax, -0x24(%rbp)
movl -0xc(%rbp), %eax
shrl $0x17, %eax
andl $0xff, %eax
movl %eax, -0x28(%rbp)
movl -0x8(%rbp), %eax
andl $0x7fffff, %eax         # imm = 0x7FFFFF
shll $0x3, %eax
movl %eax, -0x30(%rbp)
movl -0xc(%rbp), %eax
andl $0x7fffff, %eax         # imm = 0x7FFFFF
shll $0x3, %eax
movl %eax, -0x34(%rbp)
cmpl $0xff, -0x24(%rbp)
sete %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x6dab
cmpl $0x0, -0x30(%rbp)
je 0x6d78
movl -0x30(%rbp), %eax
andl $0x2000000, %eax        # imm = 0x2000000
cmpl $0x0, %eax
je 0x6d61
movl -0xc(%rbp), %edi
callq 0x6c00
cmpl $0x0, %eax
je 0x6d6c
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x6e46
cmpl $0xff, -0x28(%rbp)
jne 0x6da0
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x6da0
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x6e46
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x6e46
cmpl $0x0, -0x24(%rbp)
jne 0x6dba
movl $0x1, -0x24(%rbp)
jmp 0x6dc5
movl -0x30(%rbp), %eax
orl $0x4000000, %eax        # imm = 0x4000000
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x28(%rbp)
jne 0x6dd4
movl $0x1, -0x28(%rbp)
jmp 0x6ddf
movl -0x34(%rbp), %eax
orl $0x4000000, %eax        # imm = 0x4000000
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %edi
movl -0x24(%rbp), %esi
subl -0x28(%rbp), %esi
callq 0x6e50
movl %eax, -0x34(%rbp)
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
jne 0x6e03
movl -0x34(%rbp), %eax
addl -0x30(%rbp), %eax
movl %eax, -0x30(%rbp)
jmp 0x6e25
movl -0x34(%rbp), %ecx
movl -0x30(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x30(%rbp)
cmpl $0x0, -0x30(%rbp)
jne 0x6e23
cmpl $0x2, -0x10(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
jmp 0x6e25
movl -0x24(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x30(%rbp), %edx
movl -0x10(%rbp), %ecx
movq -0x18(%rbp), %r8
callq 0x6eb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop