// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/softfloat.c
// Function: float32_muladd
float32 float32_muladd(float32 a, float32 b, float32 c, int flags,
                       float_status *status)
{
    flag aSign, bSign, cSign, zSign;
    int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
    uint32_t aSig, bSig, cSig;
    flag pInf, pZero, pSign;
    uint64_t pSig64, cSig64, zSig64;
    uint32_t pSig;
    int shiftcount;
    flag signflip, infzero;

    a = float32_squash_input_denormal(a, status);
    b = float32_squash_input_denormal(b, status);
    c = float32_squash_input_denormal(c, status);
    aSig = extractFloat32Frac(a);
    aExp = extractFloat32Exp(a);
    aSign = extractFloat32Sign(a);
    bSig = extractFloat32Frac(b);
    bExp = extractFloat32Exp(b);
    bSign = extractFloat32Sign(b);
    cSig = extractFloat32Frac(c);
    cExp = extractFloat32Exp(c);
    cSign = extractFloat32Sign(c);

    infzero = ((aExp == 0 && aSig == 0 && bExp == 0xff && bSig == 0) ||
               (aExp == 0xff && aSig == 0 && bExp == 0 && bSig == 0));

    /* It is implementation-defined whether the cases of (0,inf,qnan)
     * and (inf,0,qnan) raise InvalidOperation or not (and what QNaN
     * they return if they do), so we have to hand this information
     * off to the target-specific pick-a-NaN routine.
     */
    if (((aExp == 0xff) && aSig) ||
        ((bExp == 0xff) && bSig) ||
        ((cExp == 0xff) && cSig)) {
        return propagateFloat32MulAddNaN(a, b, c, infzero, status);
    }

    if (infzero) {
        float_raise(float_flag_invalid, status);
        return float32_default_nan;
    }

    if (flags & float_muladd_negate_c) {
        cSign ^= 1;
    }

    signflip = (flags & float_muladd_negate_result) ? 1 : 0;

    /* Work out the sign and type of the product */
    pSign = aSign ^ bSign;
    if (flags & float_muladd_negate_product) {
        pSign ^= 1;
    }
    pInf = (aExp == 0xff) || (bExp == 0xff);
    pZero = ((aExp | aSig) == 0) || ((bExp | bSig) == 0);

    if (cExp == 0xff) {
        if (pInf && (pSign ^ cSign)) {
            /* addition of opposite-signed infinities => InvalidOperation */
            float_raise(float_flag_invalid, status);
            return float32_default_nan;
        }
        /* Otherwise generate an infinity of the same sign */
        return packFloat32(cSign ^ signflip, 0xff, 0);
    }

    if (pInf) {
        return packFloat32(pSign ^ signflip, 0xff, 0);
    }

    if (pZero) {
        if (cExp == 0) {
            if (cSig == 0) {
                /* Adding two exact zeroes */
                if (pSign == cSign) {
                    zSign = pSign;
                } else if (status->float_rounding_mode == float_round_down) {
                    zSign = 1;
                } else {
                    zSign = 0;
                }
                return packFloat32(zSign ^ signflip, 0, 0);
            }
            /* Exact zero plus a denorm */
            if (status->flush_to_zero) {
                float_raise(float_flag_output_denormal, status);
                return packFloat32(cSign ^ signflip, 0, 0);
            }
        }
        /* Zero plus something non-zero : just return the something */
        if (flags & float_muladd_halve_result) {
            if (cExp == 0) {
                normalizeFloat32Subnormal(cSig, &cExp, &cSig);
            }
            /* Subtract one to halve, and one again because roundAndPackFloat32
             * wants one less than the true exponent.
             */
            cExp -= 2;
            cSig = (cSig | 0x00800000) << 7;
            return roundAndPackFloat32(cSign ^ signflip, cExp, cSig, status);
        }
        return packFloat32(cSign ^ signflip, cExp, cSig);
    }

    if (aExp == 0) {
        normalizeFloat32Subnormal(aSig, &aExp, &aSig);
    }
    if (bExp == 0) {
        normalizeFloat32Subnormal(bSig, &bExp, &bSig);
    }

    /* Calculate the actual result a * b + c */

    /* Multiply first; this is easy. */
    /* NB: we subtract 0x7e where float32_mul() subtracts 0x7f
     * because we want the true exponent, not the "one-less-than"
     * flavour that roundAndPackFloat32() takes.
     */
    pExp = aExp + bExp - 0x7e;
    aSig = (aSig | 0x00800000) << 7;
    bSig = (bSig | 0x00800000) << 8;
    pSig64 = (uint64_t)aSig * bSig;
    if ((int64_t)(pSig64 << 1) >= 0) {
        pSig64 <<= 1;
        pExp--;
    }

    zSign = pSign ^ signflip;

    /* Now pSig64 is the significand of the multiply, with the explicit bit in
     * position 62.
     */
    if (cExp == 0) {
        if (!cSig) {
            /* Throw out the special case of c being an exact zero now */
            shift64RightJamming(pSig64, 32, &pSig64);
            pSig = pSig64;
            if (flags & float_muladd_halve_result) {
                pExp--;
            }
            return roundAndPackFloat32(zSign, pExp - 1,
                                       pSig, status);
        }
        normalizeFloat32Subnormal(cSig, &cExp, &cSig);
    }

    cSig64 = (uint64_t)cSig << (62 - 23);
    cSig64 |= LIT64(0x4000000000000000);
    expDiff = pExp - cExp;

    if (pSign == cSign) {
        /* Addition */
        if (expDiff > 0) {
            /* scale c to match p */
            shift64RightJamming(cSig64, expDiff, &cSig64);
            zExp = pExp;
        } else if (expDiff < 0) {
            /* scale p to match c */
            shift64RightJamming(pSig64, -expDiff, &pSig64);
            zExp = cExp;
        } else {
            /* no scaling needed */
            zExp = cExp;
        }
        /* Add significands and make sure explicit bit ends up in posn 62 */
        zSig64 = pSig64 + cSig64;
        if ((int64_t)zSig64 < 0) {
            shift64RightJamming(zSig64, 1, &zSig64);
        } else {
            zExp--;
        }
    } else {
        /* Subtraction */
        if (expDiff > 0) {
            shift64RightJamming(cSig64, expDiff, &cSig64);
            zSig64 = pSig64 - cSig64;
            zExp = pExp;
        } else if (expDiff < 0) {
            shift64RightJamming(pSig64, -expDiff, &pSig64);
            zSig64 = cSig64 - pSig64;
            zExp = cExp;
            zSign ^= 1;
        } else {
            zExp = pExp;
            if (cSig64 < pSig64) {
                zSig64 = pSig64 - cSig64;
            } else if (pSig64 < cSig64) {
                zSig64 = cSig64 - pSig64;
                zSign ^= 1;
            } else {
                /* Exact zero */
                zSign = signflip;
                if (status->float_rounding_mode == float_round_down) {
                    zSign ^= 1;
                }
                return packFloat32(zSign, 0, 0);
            }
        }
        --zExp;
        /* Normalize to put the explicit bit back into bit 62. */
        shiftcount = countLeadingZeros64(zSig64) - 1;
        zSig64 <<= shiftcount;
        zExp -= shiftcount;
    }
    if (flags & float_muladd_halve_result) {
        zExp--;
    }

    shift64RightJamming(zSig64, 32, &zSig64);
    return roundAndPackFloat32(zSign, zExp, zSig64, status);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl %edx, %r15d
cmpb $0x0, 0x5(%r8)
movq %r8, -0x8(%rsp)
je 0xbb81
testl $0x7f800000, %edi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %edi         # imm = 0x7FFFFF
sete %dl
orb %al, %dl
jne 0xbb3c
orb $0x40, 0x2(%r8)
andl $0x80000000, %edi       # imm = 0x80000000
testl $0x7f800000, %esi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %esi         # imm = 0x7FFFFF
sete %dl
orb %al, %dl
jne 0xbb5d
orb $0x40, 0x2(%r8)
andl $0x80000000, %esi       # imm = 0x80000000
testl $0x7f800000, %r15d      # imm = 0x7F800000
setne %al
testl $0x7fffff, %r15d        # imm = 0x7FFFFF
sete %dl
orb %al, %dl
jne 0xbb81
orb $0x40, 0x2(%r8)
andl $0x80000000, %r15d      # imm = 0x80000000
movl $0x7fffff, %edx         # imm = 0x7FFFFF
movl %edi, %r14d
andl %edx, %r14d
movl %edi, %r12d
shrl $0x17, %r12d
movl $0xff, %r11d
andl %r11d, %r12d
movl %esi, %r8d
andl %edx, %r8d
movl %esi, %r10d
shrl $0x17, %r10d
andl %r11d, %r10d
andl %r15d, %edx
movl %r15d, %eax
shrl $0x17, %eax
andl %r11d, %eax
cmpl %r11d, %r10d
jne 0xbbec
movl %r14d, %r11d
orl %r8d, %r11d
orl %r12d, %r11d
jne 0xbbec
cmpl $0xff, %eax
setne %al
testl %edx, %edx
sete %dl
orb %al, %dl
je 0xbc4e
movq -0x8(%rsp), %rax
orb $0x1, 0x2(%rax)
movl $0x7fc00000, %eax       # imm = 0x7FC00000
jmp 0xbcc2
movl %ecx, -0xc(%rsp)
movl $0xff, %ebx
cmpq %rbx, %r10
sete %r9b
movl %r12d, %r11d
xorl $0xff, %r11d
movl %r10d, %r13d
orl %r8d, %r13d
movl %r13d, %ebp
orl %r14d, %ebp
orl %r11d, %ebp
setne %cl
cmpq %rbx, %r12
sete %bl
testl %r14d, %r14d
setne %bpl
testl %r8d, %r8d
setne %r11b
testb %r9b, %r11b
jne 0xbc4e
andb %bl, %bpl
jne 0xbc4e
cmpl $0xff, %eax
sete %r9b
testl %edx, %edx
setne %r11b
testb %r9b, %r11b
je 0xbd26
movl $0x7fc00000, %r9d       # imm = 0x7FC00000
movl %edi, %edx
andl %r9d, %edx
movl $0x7f800000, %eax       # imm = 0x7F800000
cmpl %eax, %edx
sete %r8b
testl $0x3fffff, %edi         # imm = 0x3FFFFF
setne %r11b
andb %r8b, %r11b
movl %esi, %r10d
andl %r9d, %r10d
cmpl %eax, %r10d
sete %r8b
testl $0x3fffff, %esi         # imm = 0x3FFFFF
setne %bl
andb %r8b, %bl
andl %r15d, %r9d
cmpl %eax, %r9d
sete %al
testl $0x3fffff, %r15d        # imm = 0x3FFFFF
setne %bpl
testb %r11b, %r11b
movq -0x8(%rsp), %r8
jne 0xbcb1
testb %bl, %bl
jne 0xbcb1
andb %bpl, %al
je 0xbcb6
orb $0x1, 0x2(%r8)
movl $0x7fc00000, %eax       # imm = 0x7FC00000
cmpb $0x0, 0x6(%r8)
je 0xbccd
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leal (%rdi,%rdi), %r8d
leal (%rsi,%rsi), %eax
movl $0xff800000, %ebp       # imm = 0xFF800000
cmpl %ebp, %eax
setae %al
orb %bl, %al
movzbl %al, %ebx
movl $0x2, %eax
subl %ebx, %eax
xorl %ebx, %ebx
testb %r11b, %r11b
cmovnel %ebx, %eax
cmpl %ebp, %r8d
cmovael %ebx, %eax
cmpl $0x2, %eax
je 0xbda2
cmpl $0x1, %eax
jne 0xbdc5
movl %esi, %eax
orl $0x400000, %eax         # imm = 0x400000
testl $0x3fffff, %esi         # imm = 0x3FFFFF
cmovel %esi, %eax
cmpl $0x7f800000, %r10d      # imm = 0x7F800000
cmovnel %esi, %eax
jmp 0xbcc2
testb %cl, %cl
je 0xbbd9
shrl $0x1f, %r15d
cmpq $0xff, %r12
sete %cl
movl $0xff, %r9d
cmpl %r9d, %r10d
sete %r11b
movl -0xc(%rsp), %ebp
movl %ebp, %ebx
andb $0x1, %bl
xorb %r15b, %bl
movl %ebp, %r15d
shrb $0x2, %r15b
andb $0x1, %r15b
xorl %esi, %edi
shrl $0x1f, %edi
shrb %bpl
andb $0x1, %bpl
xorb %dil, %bpl
orb %cl, %r11b
movl %r12d, %ecx
orl %r14d, %ecx
sete %cl
testl %r13d, %r13d
sete %sil
cmpl %r9d, %eax
jne 0xbde3
cmpb %bl, %bpl
setne %al
andb %al, %r11b
cmpb $0x1, %r11b
je 0xbbd9
xorb %r15b, %bl
movzbl %bl, %eax
jmp 0xbdef
movl %r15d, %eax
orl $0x400000, %eax         # imm = 0x400000
testl $0x3fffff, %r15d        # imm = 0x3FFFFF
cmovel %r15d, %eax
cmpl $0x7f800000, %r9d       # imm = 0x7F800000
cmovnel %r15d, %eax
jmp 0xbcc2
movl %edi, %eax
orl $0x400000, %eax         # imm = 0x400000
testl $0x3fffff, %edi         # imm = 0x3FFFFF
cmovel %edi, %eax
cmpl $0x7f800000, %edx       # imm = 0x7F800000
cmovnel %edi, %eax
jmp 0xbcc2
testb %r11b, %r11b
je 0xbdfc
xorb %r15b, %bpl
movzbl %bpl, %eax
shll $0x1f, %eax
orl $0x7f800000, %eax       # imm = 0x7F800000
jmp 0xbcc2
orb %cl, %sil
je 0xbe2b
testq %rax, %rax
je 0xbe3e
testb $0x8, -0xc(%rsp)
movq -0x8(%rsp), %r8
jne 0xc05b
xorb %r15b, %bl
movzbl %bl, %ecx
shll $0x1f, %ecx
shll $0x17, %eax
orl %ecx, %eax
orl %edx, %eax
jmp 0xbcc2
testq %r12, %r12
jne 0xbe6e
testl %r14d, %r14d
je 0xbe59
bsrl %r14d, %esi
xorl $0x1f, %esi
jmp 0xbe5e
testl %edx, %edx
movq -0x8(%rsp), %r8
je 0xbe81
cmpb $0x0, 0x4(%r8)
je 0xc03b
orb $-0x80, 0x2(%r8)
jmp 0xbe8e
movl $0x20, %esi
leal -0x8(%rsi), %ecx
shll %cl, %r14d
movl $0x9, %ecx
subl %esi, %ecx
movslq %ecx, %r12
testq %r10, %r10
jne 0xbeb1
testl %r8d, %r8d
je 0xbe9c
bsrl %r8d, %esi
xorl $0x1f, %esi
jmp 0xbea1
cmpb %bl, %bpl
je 0xbe8e
cmpb $0x1, 0x1(%r8)
sete %bl
xorb %r15b, %bl
movzbl %bl, %eax
shll $0x1f, %eax
jmp 0xbcc2
movl $0x20, %esi
leal -0x8(%rsi), %ecx
shll %cl, %r8d
movl $0x9, %ecx
subl %esi, %ecx
movslq %ecx, %r10
addq %r12, %r10
shll $0x7, %r14d
orl $0x40000000, %r14d      # imm = 0x40000000
shll $0x8, %r8d
orl $0x80000000, %r8d       # imm = 0x80000000
imulq %r14, %r8
xorl %ecx, %ecx
movq %r8, %r14
addq %r8, %r14
setns %cl
cmovsq %r8, %r14
subq %rcx, %r10
addq $-0x7e, %r10
movl %ebp, %edi
xorb %r15b, %dil
testq %rax, %rax
je 0xbef5
movq -0x8(%rsp), %r9
jmp 0xbf17
testl %edx, %edx
movq -0x8(%rsp), %r9
je 0xc007
bsrl %edx, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %edx
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %rax
orq $0x800000, %rdx         # imm = 0x800000
shlq $0x27, %rdx
movq %r10, %rsi
subq %rax, %rsi
cmpb %bl, %bpl
jne 0xbf64
testq %rsi, %rsi
movl -0xc(%rsp), %r11d
jle 0xbfa9
cmpq $0x3f, %rsi
ja 0xc034
movq %rdx, %rax
movl %esi, %ecx
shrq %cl, %rax
negb %sil
movl %esi, %ecx
shlq %cl, %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
setne %cl
orq %rax, %rcx
movq %rcx, %rdx
jmp 0xc0b3
testq %rsi, %rsi
movl -0xc(%rsp), %r11d
jle 0xbfda
movl $0x1, %eax
cmpq $0x3f, %rsi
ja 0xbf94
movq %rdx, %r8
movl %esi, %ecx
shrq %cl, %r8
negb %sil
movl %esi, %ecx
shlq %cl, %rdx
xorl %eax, %eax
testq %rdx, %rdx
setne %al
orq %r8, %rax
subq %rax, %r14
movq %r14, %rsi
testq %rsi, %rsi
je 0xbff1
bsrq %rsi, %rax
xorq $0x3f, %rax
jmp 0xbff6
jns 0xc0b0
movq %rsi, %rcx
negq %rcx
cmpq $0x3f, %rcx
ja 0xc0a5
movq %r14, %r8
shrq %cl, %r8
movl %esi, %ecx
shlq %cl, %r14
xorl %ecx, %ecx
testq %r14, %r14
setne %cl
orq %r8, %rcx
jmp 0xc0ad
js 0xc076
movq %rdx, %rsi
subq %r14, %rsi
jae 0xc09a
subq %rdx, %r14
jmp 0xbf97
movl $0x40, %eax
leal -0x1(%rax), %ecx
shlq %cl, %rsi
subq %rax, %r10
movq %rsi, %r14
jmp 0xc0ca
movq %r14, %rax
shrq $0x20, %rax
xorl %edx, %edx
testl $0xfffffffe, %r14d      # imm = 0xFFFFFFFE
setne %dl
orl %eax, %edx
movl -0xc(%rsp), %eax
shll $0x1c, %eax
sarl $0x1f, %eax
cltq
leaq (%rax,%r10), %rsi
decq %rsi
jmp 0xc0e9
movl $0x1, %edx
jmp 0xc0b3
testb $0x8, -0xc(%rsp)
je 0xbe16
bsrl %edx, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %edx
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %rax
addq $-0x2, %rax
shll $0x7, %edx
orl $0x40000000, %edx       # imm = 0x40000000
xorb %r15b, %bl
movzbl %bl, %edi
movq %rax, %rsi
movq %r8, %rcx
jmp 0xc0f0
movq %rsi, %rcx
negq %rcx
cmpq $0x3f, %rcx
ja 0xc0ff
movq %r14, %r8
shrq %cl, %r8
movl %esi, %ecx
shlq %cl, %r14
xorl %ecx, %ecx
testq %r14, %r14
setne %cl
orq %r8, %rcx
jmp 0xc107
jbe 0xc119
xorb $0x1, %dil
jmp 0xbf9a
xorl %ecx, %ecx
testq %r14, %r14
setne %cl
movq %rcx, %r14
movq %rax, %r10
addq %rdx, %r14
js 0xc0bd
decq %r10
jmp 0xc0ca
movq %r14, %rax
shrq %rax
andl $0x1, %r14d
orq %rax, %r14
shll $0x1c, %r11d
sarl $0x1f, %r11d
movslq %r11d, %rsi
addq %r10, %rsi
movq %r14, %rax
shrq $0x20, %rax
xorl %edx, %edx
testl %r14d, %r14d
setne %dl
orl %eax, %edx
movzbl %dil, %edi
movq %r9, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9f46
xorl %ecx, %ecx
testq %r14, %r14
setne %cl
subq %rcx, %rdx
xorb $0x1, %dil
movq %rdx, %rsi
movq %rax, %r10
jmp 0xbf9a
cmpb $0x1, 0x1(%r9)
sete %al
xorb %al, %r15b
movzbl %r15b, %eax
jmp 0xbe94