// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_muladd
float64 float64_muladd(float64 a, float64 b, float64 c, int flags,
                       float_status *status)
{
    flag aSign, bSign, cSign, zSign;
    int_fast16_t aExp, bExp, cExp, pExp, zExp, expDiff;
    uint64_t aSig, bSig, cSig;
    flag pInf, pZero, pSign;
    uint64_t pSig0, pSig1, cSig0, cSig1, zSig0, zSig1;
    int shiftcount;
    flag signflip, infzero;

    a = float64_squash_input_denormal(a, status);
    b = float64_squash_input_denormal(b, status);
    c = float64_squash_input_denormal(c, status);
    aSig = extractFloat64Frac(a);
    aExp = extractFloat64Exp(a);
    aSign = extractFloat64Sign(a);
    bSig = extractFloat64Frac(b);
    bExp = extractFloat64Exp(b);
    bSign = extractFloat64Sign(b);
    cSig = extractFloat64Frac(c);
    cExp = extractFloat64Exp(c);
    cSign = extractFloat64Sign(c);

    infzero = ((aExp == 0 && aSig == 0 && bExp == 0x7ff && bSig == 0) ||
               (aExp == 0x7ff && 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 == 0x7ff) && aSig) ||
        ((bExp == 0x7ff) && bSig) ||
        ((cExp == 0x7ff) && cSig)) {
        return propagateFloat64MulAddNaN(a, b, c, infzero, status);
    }

    if (infzero) {
        float_raise(float_flag_invalid, status);
        return float64_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 == 0x7ff) || (bExp == 0x7ff);
    pZero = ((aExp | aSig) == 0) || ((bExp | bSig) == 0);

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

    if (pInf) {
        return packFloat64(pSign ^ signflip, 0x7ff, 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 packFloat64(zSign ^ signflip, 0, 0);
            }
            /* Exact zero plus a denorm */
            if (status->flush_to_zero) {
                float_raise(float_flag_output_denormal, status);
                return packFloat64(cSign ^ signflip, 0, 0);
            }
        }
        /* Zero plus something non-zero : just return the something */
        if (flags & float_muladd_halve_result) {
            if (cExp == 0) {
                normalizeFloat64Subnormal(cSig, &cExp, &cSig);
            }
            /* Subtract one to halve, and one again because roundAndPackFloat64
             * wants one less than the true exponent.
             */
            cExp -= 2;
            cSig = (cSig | 0x0010000000000000ULL) << 10;
            return roundAndPackFloat64(cSign ^ signflip, cExp, cSig, status);
        }
        return packFloat64(cSign ^ signflip, cExp, cSig);
    }

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

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

    /* Multiply first; this is easy. */
    /* NB: we subtract 0x3fe where float64_mul() subtracts 0x3ff
     * because we want the true exponent, not the "one-less-than"
     * flavour that roundAndPackFloat64() takes.
     */
    pExp = aExp + bExp - 0x3fe;
    aSig = (aSig | LIT64(0x0010000000000000))<<10;
    bSig = (bSig | LIT64(0x0010000000000000))<<11;
    mul64To128(aSig, bSig, &pSig0, &pSig1);
    if ((int64_t)(pSig0 << 1) >= 0) {
        shortShift128Left(pSig0, pSig1, 1, &pSig0, &pSig1);
        pExp--;
    }

    zSign = pSign ^ signflip;

    /* Now [pSig0:pSig1] is the significand of the multiply, with the explicit
     * bit in position 126.
     */
    if (cExp == 0) {
        if (!cSig) {
            /* Throw out the special case of c being an exact zero now */
            shift128RightJamming(pSig0, pSig1, 64, &pSig0, &pSig1);
            if (flags & float_muladd_halve_result) {
                pExp--;
            }
            return roundAndPackFloat64(zSign, pExp - 1,
                                       pSig1, status);
        }
        normalizeFloat64Subnormal(cSig, &cExp, &cSig);
    }

    /* Shift cSig and add the explicit bit so [cSig0:cSig1] is the
     * significand of the addend, with the explicit bit in position 126.
     */
    cSig0 = cSig << (126 - 64 - 52);
    cSig1 = 0;
    cSig0 |= LIT64(0x4000000000000000);
    expDiff = pExp - cExp;

    if (pSign == cSign) {
        /* Addition */
        if (expDiff > 0) {
            /* scale c to match p */
            shift128RightJamming(cSig0, cSig1, expDiff, &cSig0, &cSig1);
            zExp = pExp;
        } else if (expDiff < 0) {
            /* scale p to match c */
            shift128RightJamming(pSig0, pSig1, -expDiff, &pSig0, &pSig1);
            zExp = cExp;
        } else {
            /* no scaling needed */
            zExp = cExp;
        }
        /* Add significands and make sure explicit bit ends up in posn 126 */
        add128(pSig0, pSig1, cSig0, cSig1, &zSig0, &zSig1);
        if ((int64_t)zSig0 < 0) {
            shift128RightJamming(zSig0, zSig1, 1, &zSig0, &zSig1);
        } else {
            zExp--;
        }
        shift128RightJamming(zSig0, zSig1, 64, &zSig0, &zSig1);
        if (flags & float_muladd_halve_result) {
            zExp--;
        }
        return roundAndPackFloat64(zSign, zExp, zSig1, status);
    } else {
        /* Subtraction */
        if (expDiff > 0) {
            shift128RightJamming(cSig0, cSig1, expDiff, &cSig0, &cSig1);
            sub128(pSig0, pSig1, cSig0, cSig1, &zSig0, &zSig1);
            zExp = pExp;
        } else if (expDiff < 0) {
            shift128RightJamming(pSig0, pSig1, -expDiff, &pSig0, &pSig1);
            sub128(cSig0, cSig1, pSig0, pSig1, &zSig0, &zSig1);
            zExp = cExp;
            zSign ^= 1;
        } else {
            zExp = pExp;
            if (lt128(cSig0, cSig1, pSig0, pSig1)) {
                sub128(pSig0, pSig1, cSig0, cSig1, &zSig0, &zSig1);
            } else if (lt128(pSig0, pSig1, cSig0, cSig1)) {
                sub128(cSig0, cSig1, pSig0, pSig1, &zSig0, &zSig1);
                zSign ^= 1;
            } else {
                /* Exact zero */
                zSign = signflip;
                if (status->float_rounding_mode == float_round_down) {
                    zSign ^= 1;
                }
                return packFloat64(zSign, 0, 0);
            }
        }
        --zExp;
        /* Do the equivalent of normalizeRoundAndPackFloat64() but
         * starting with the significand in a pair of uint64_t.
         */
        if (zSig0) {
            shiftcount = countLeadingZeros64(zSig0) - 1;
            shortShift128Left(zSig0, zSig1, shiftcount, &zSig0, &zSig1);
            if (zSig1) {
                zSig0 |= 1;
            }
            zExp -= shiftcount;
        } else {
            shiftcount = countLeadingZeros64(zSig1);
            if (shiftcount == 0) {
                zSig0 = (zSig1 >> 1) | (zSig1 & 1);
                zExp -= 63;
            } else {
                shiftcount--;
                zSig0 = zSig1 << shiftcount;
                zExp -= (shiftcount + 64);
            }
        }
        if (flags & float_muladd_halve_result) {
            zExp--;
        }
        return roundAndPackFloat64(zSign, zExp, zSig0, status);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movabsq $0x7ff0000000000000, %r11 # imm = 0x7FF0000000000000
movabsq $0xfffffffffffff, %r14  # imm = 0xFFFFFFFFFFFFF
cmpb $0x0, 0x5(%r8)
je 0xe6b4
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
testq %r11, %rdi
setne %r10b
testq %r14, %rdi
sete %r9b
orb %r10b, %r9b
jne 0xe67e
orb $0x40, 0x2(%r8)
andq %rax, %rdi
testq %r11, %rsi
setne %r10b
testq %r14, %rsi
sete %r9b
orb %r10b, %r9b
jne 0xe699
orb $0x40, 0x2(%r8)
andq %rax, %rsi
testq %r11, %rdx
setne %r10b
testq %r14, %rdx
sete %r9b
orb %r10b, %r9b
jne 0xe6b4
orb $0x40, 0x2(%r8)
andq %rax, %rdx
movq %rdi, %r10
andq %r14, %r10
movq %rdi, %r9
shrq $0x34, %r9
movl $0x7ff, %eax            # imm = 0x7FF
andq %rax, %r9
movq %rsi, %r11
andq %r14, %r11
movq %rsi, %r12
shrq $0x34, %r12
andq %rax, %r12
andq %rdx, %r14
movq %rdx, %r15
shrq $0x34, %r15
andq %rax, %r15
cmpq %rax, %r12
jne 0xe71e
movq %r10, %rbx
orq %r11, %rbx
orq %r9, %rbx
jne 0xe71e
cmpl $0x7ff, %r15d           # imm = 0x7FF
setne %al
testq %r14, %r14
sete %cl
orb %al, %cl
je 0xe785
movabsq $0x7ff8000000000000, %r15 # imm = 0x7FF8000000000000
orb $0x1, 0x2(%r8)
jmp 0xe800
movq %r14, 0x20(%rsp)
movl %ecx, 0x34(%rsp)
cmpq %rax, %r12
movq %r8, (%rsp)
sete %bl
movq %r9, %r8
xorq %rax, %r8
movq %r12, %r13
orq %r11, %r13
movq %r13, %rbp
orq %r10, %rbp
orq %r8, %rbp
setne %r14b
cmpq %rax, %r9
sete %al
testq %r10, %r10
setne %bpl
testq %r11, %r11
setne %cl
testb %bl, %cl
movq (%rsp), %r8
jne 0xe785
andb %al, %bpl
jne 0xe785
cmpl $0x7ff, %r15d           # imm = 0x7FF
sete %al
cmpq $0x0, 0x20(%rsp)
setne %cl
testb %al, %cl
je 0xe878
movabsq $0x7ff8000000000000, %r15 # imm = 0x7FF8000000000000
movq %rdi, %rax
andq %r15, %rax
movabsq $0x7ff0000000000000, %r13 # imm = 0x7FF0000000000000
cmpq %r13, %rax
sete %cl
movq %rdi, %r9
shlq $0xd, %r9
setne %r10b
andb %cl, %r10b
movq %rsi, %r12
andq %r15, %r12
cmpq %r13, %r12
sete %cl
movq %rsi, %r9
shlq $0xd, %r9
setne %bpl
andb %cl, %bpl
movq %rdx, %r9
andq %r15, %r9
cmpq %r13, %r9
sete %r11b
movq %rdx, %rcx
shlq $0xd, %rcx
setne %r14b
testb %r10b, %r10b
jne 0xe7f4
testb %bpl, %bpl
jne 0xe7f4
andb %r14b, %r11b
je 0xe7f9
orb $0x1, 0x2(%r8)
cmpb $0x0, 0x6(%r8)
je 0xe812
movq %r15, %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $-0x10000000000001, %rcx # imm = 0xFFEFFFFFFFFFFFFF
movabsq $0x7ffffffffffff, %r11  # imm = 0x7FFFFFFFFFFFF
leaq (%rdi,%rdi), %r14
leaq (%rsi,%rsi), %rbx
cmpq %rcx, %rbx
seta %bl
orb %bpl, %bl
movzbl %bl, %ebp
movl $0x2, %ebx
subl %ebp, %ebx
xorl %ebp, %ebp
testb %r10b, %r10b
cmovnel %ebp, %ebx
cmpq %rcx, %r14
cmoval %ebp, %ebx
leaq 0x1(%r11), %r15
cmpl $0x2, %ebx
je 0xe901
cmpl $0x1, %ebx
jne 0xe917
orq %rsi, %r15
testq %r11, %rsi
cmoveq %rsi, %r15
cmpq %r13, %r12
cmovneq %rsi, %r15
jmp 0xe800
testb %r14b, %r14b
je 0xe70a
shrq $0x3f, %rdx
cmpq $0x7ff, %r9             # imm = 0x7FF
sete %cl
movl $0x7ff, %ebx            # imm = 0x7FF
cmpl %ebx, %r12d
sete %al
movl 0x34(%rsp), %ebp
movl %ebp, %r8d
andb $0x1, %r8b
xorb %dl, %r8b
movl %ebp, %r14d
shrb $0x2, %r14b
andb $0x1, %r14b
xorq %rsi, %rdi
shrq $0x3f, %rdi
movl %ebp, %esi
shrb %sil
andb $0x1, %sil
xorb %dil, %sil
orb %cl, %al
movq %r9, %rcx
orq %r10, %rcx
sete %dil
testq %r13, %r13
sete %r13b
cmpl %ebx, %r15d
jne 0xe92d
cmpb %r8b, %sil
setne %cl
andb %cl, %al
cmpb $0x1, %al
jne 0xe93a
movabsq $0x7ff8000000000000, %r15 # imm = 0x7FF8000000000000
movq (%rsp), %rax
orb $0x1, 0x2(%rax)
jmp 0xe800
orq %rdx, %r15
testq %r11, %rdx
cmoveq %rdx, %r15
cmpq %r13, %r9
cmovneq %rdx, %r15
jmp 0xe800
orq %rdi, %r15
testq %r11, %rdi
cmoveq %rdi, %r15
cmpq %r13, %rax
cmovneq %rdi, %r15
jmp 0xe800
testb %al, %al
je 0xe957
xorb %r14b, %sil
movzbl %sil, %r15d
jmp 0xe941
xorb %r14b, %r8b
movzbl %r8b, %r15d
shlq $0x3f, %r15
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
orq %rax, %r15
jmp 0xe800
orb %dil, %r13b
je 0xe98e
testq %r15, %r15
movq (%rsp), %r9
movq 0x20(%rsp), %rdx
je 0xe9a2
testb $0x8, %bpl
jne 0xec9a
xorb %r14b, %r8b
movzbl %r8b, %eax
shlq $0x3f, %rax
shlq $0x34, %r15
orq %rax, %r15
orq %rdx, %r15
jmp 0xe800
testq %r9, %r9
jne 0xe9d3
testq %r10, %r10
je 0xe9b9
bsrq %r10, %rax
xorq $0x3f, %rax
jmp 0xe9be
testq %rdx, %rdx
je 0xe9e7
cmpb $0x0, 0x4(%r9)
je 0xec74
orb $-0x80, 0x2(%r9)
jmp 0xe9f5
movl $0x40, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r10
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %r9
testq %r12, %r12
jne 0xea1f
testq %r11, %r11
je 0xea05
bsrq %r11, %rax
xorq $0x3f, %rax
jmp 0xea0a
cmpb %r8b, %sil
je 0xe9f5
cmpb $0x1, 0x1(%r9)
sete %r8b
xorb %r14b, %r8b
movzbl %r8b, %r15d
shlq $0x3f, %r15
jmp 0xe800
movl $0x40, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r11
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %r12
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
shlq $0xa, %r10
movq %r10, %rax
btsq $0x3e, %rax
shlq $0xb, %r11
movq %r11, %rdx
btsq $0x3f, %rdx
movq %rax, %rcx
shrq $0x20, %rcx
movq %rdx, %rdi
shrq $0x20, %rdi
movl %r10d, %r10d
movl %r11d, %r11d
imulq %rdi, %r10
imulq %rcx, %r11
imulq %rcx, %rdi
leaq 0x1(%rbx), %rcx
xorl %ebx, %ebx
addq %r10, %r11
cmovbq %rcx, %rbx
movq %r11, %r13
shrq $0x20, %r13
addq %rdi, %r13
shlq $0x20, %r11
imulq %rax, %rdx
cmpq %r11, %rdx
adcq %rbx, %r13
movq %rdx, 0x8(%rsp)
movq %r13, 0x28(%rsp)
btq $0x3e, %r13
jb 0xeab4
addq %r9, %r12
shldq $0x1, %rdx, %r13
leaq (%rdx,%rdx), %rax
movq %rax, 0x8(%rsp)
movq %r13, 0x28(%rsp)
addq $-0x3ff, %r12           # imm = 0xFC01
movq %rax, %rdx
jmp 0xeabe
addq %r9, %r12
addq $-0x3fe, %r12           # imm = 0xFC02
movq (%rsp), %rbx
movl %esi, %edi
xorb %r14b, %dil
testq %r15, %r15
movq 0x20(%rsp), %r9
jne 0xeaf6
testq %r9, %r9
je 0xec4d
bsrq %r9, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r9
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %r15
movabsq $0x4000000000000000, %rax # imm = 0x4000000000000000
shlq $0xa, %r9
orq %rax, %r9
movq $0x0, 0x10(%rsp)
movq %r9, 0x18(%rsp)
movq %r12, %rax
subq %r15, %rax
cmpb %r8b, %sil
jne 0xeb67
testq %rax, %rax
jle 0xebec
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %edi, %r14d
movq %r9, %rdi
xorl %esi, %esi
movq %rbx, %r15
movq %rdx, %rbx
movq %rax, %rdx
callq 0xedca
movq %rbx, %rdx
movq %r15, %rbx
movl %r14d, %edi
leaq 0x18(%rsp), %rax
movq (%rax), %r9
leaq 0x10(%rsp), %rax
movq (%rax), %rax
jmp 0xecf4
testq %rax, %rax
jle 0xebf9
leaq 0x18(%rsp), %rcx
leaq 0x10(%rsp), %r8
movl %edi, %r14d
movq %r9, %rdi
xorl %esi, %esi
movq %rbx, %r15
movq %rdx, %rbx
movq %rax, %rdx
callq 0xedca
movq %rbx, %rdx
movq %r15, %rbx
movl %r14d, %edi
leaq 0x10(%rsp), %rax
subq (%rax), %rdx
leaq 0x18(%rsp), %rax
sbbq (%rax), %r13
testq %r13, %r13
je 0xec37
bsrq %r13, %rax
xorq $0x3f, %rax
leaq -0x1(%rax), %rcx
movq %rdx, %rsi
shlq %cl, %rdx
testq %rcx, %rcx
je 0xebd6
shlq %cl, %r13
movb $0x1, %cl
subb %al, %cl
shrq %cl, %rsi
orq %rsi, %r13
testq %rdx, %rdx
movl $0x0, %edx
setne %dl
orq %r13, %rdx
subq %rax, %r12
jmp 0xed89
js 0xecb9
xorl %eax, %eax
jmp 0xecf1
js 0xed1f
cmpq %r13, %r9
sete %al
testq %rdx, %rdx
setne %cl
cmpq %r13, %r9
jb 0xedaf
andb %cl, %al
jne 0xedaf
cmpq %r9, %r13
jae 0xedb7
negq %rdx
sbbq %r13, %r9
xorb $0x1, %dil
movq %r9, %r13
jmp 0xeba9
testq %rdx, %rdx
je 0xed60
bsrq %rdx, %rax
xorq $0x3f, %rax
jmp 0xed65
xorl %eax, %eax
testq %rdx, %rdx
setne %al
orq %rax, %r13
shll $0x1c, %ebp
sarl $0x1f, %ebp
movslq %ebp, %rax
leaq (%rax,%r12), %rsi
decq %rsi
movzbl %dil, %edi
movq %r13, %rdx
jmp 0xed99
testb $0x8, %bpl
je 0xe974
bsrq %rdx, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %rdx
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %r15
addq $-0x2, %r15
shlq $0xa, %rdx
btsq $0x3e, %rdx
xorb %r14b, %r8b
movzbl %r8b, %edi
movq %r15, %rsi
movq %r9, %rcx
jmp 0xed9c
negq %rax
leaq 0x28(%rsp), %rcx
leaq 0x8(%rsp), %r8
movl %edi, %r14d
movq %r13, %rdi
movq %rdx, %rsi
movq %rax, %rdx
movq %rcx, %r13
movq %r9, %r12
callq 0xedca
movq %r12, %r9
movl %r14d, %edi
movq (%r13), %r13
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
movq (%rcx), %rdx
movq %r15, %r12
addq %rdx, %rax
adcq %r13, %r9
js 0xed01
decq %r12
jmp 0xed12
movq %r9, %rcx
shldq $0x3f, %rax, %rcx
andl $0x1, %eax
orq %rcx, %rax
shrq %r9
xorl %edx, %edx
testq %rax, %rax
setne %dl
orq %r9, %rdx
jmp 0xed89
negq %rax
leaq 0x28(%rsp), %r12
leaq 0x8(%rsp), %r8
movl %edi, %r14d
movq %r13, %rdi
movq %rdx, %rsi
movq %rax, %rdx
movq %r12, %rcx
movq %r9, %r13
callq 0xedca
movl %r14d, %edi
xorl %edx, %edx
leaq 0x8(%rsp), %rax
subq (%rax), %rdx
sbbq (%r12), %r13
xorb $0x1, %dil
movq %r15, %r12
jmp 0xeba9
movl $0x40, %eax
testq %rax, %rax
je 0xed79
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
addl %eax, %ecx
shlq %cl, %rdx
subq %rax, %r12
jmp 0xed85
movq %rdx, %rax
shrq %rax
andl $0x1, %edx
orq %rax, %rdx
addq $-0x40, %r12
shll $0x1c, %ebp
sarl $0x1f, %ebp
movslq %ebp, %rsi
addq %r12, %rsi
movzbl %dil, %edi
movq %rbx, %rcx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa25f
subq %r9, %r13
jmp 0xeba9
cmpb $0x1, 0x1(%rbx)
sete %al
xorb %al, %r14b
movzbl %r14b, %r15d
jmp 0xe9fc