// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/./softfp_template.h
// Function: fma_sf128
F_UINT fma_sf(F_UINT a, F_UINT b, F_UINT c, RoundingModeEnum rm,
              uint32_t *pfflags)
{
    uint32_t a_sign, b_sign, c_sign, r_sign;
    int32_t a_exp, b_exp, c_exp, r_exp, shift;
    F_UINT a_mant, b_mant, c_mant, r_mant1, r_mant0, c_mant1, c_mant0, mask;

    a_sign = a >> (F_SIZE - 1);
    b_sign = b >> (F_SIZE - 1);
    c_sign = c >> (F_SIZE - 1);
    r_sign = a_sign ^ b_sign;
    a_exp = (a >> MANT_SIZE) & EXP_MASK;
    b_exp = (b >> MANT_SIZE) & EXP_MASK;
    c_exp = (c >> MANT_SIZE) & EXP_MASK;
    a_mant = a & MANT_MASK;
    b_mant = b & MANT_MASK;
    c_mant = c & MANT_MASK;
    if (a_exp == EXP_MASK || b_exp == EXP_MASK || c_exp == EXP_MASK) {
        if (isnan_sf(a) || isnan_sf(b) || isnan_sf(c)) {
            if (issignan_sf(a) || issignan_sf(b) || issignan_sf(c)) {
                *pfflags |= FFLAG_INVALID_OP;
            }
            return F_QNAN;
        } else {
            /* infinities */
            if ((a_exp == EXP_MASK && (b_exp == 0 && b_mant == 0)) ||
                (b_exp == EXP_MASK && (a_exp == 0 && a_mant == 0)) ||
                ((a_exp == EXP_MASK || b_exp == EXP_MASK) &&
                 (c_exp == EXP_MASK && r_sign != c_sign))) {
                *pfflags |= FFLAG_INVALID_OP;
                return F_QNAN;
            } else if (c_exp == EXP_MASK) {
                return pack_sf(c_sign, EXP_MASK, 0);
            } else {
                return pack_sf(r_sign, EXP_MASK, 0);
            }
        }
    }
    if (a_exp == 0) {
        if (a_mant == 0)
            goto mul_zero;
        a_mant = normalize_subnormal_sf(&a_exp, a_mant);
    } else {
        a_mant |= (F_UINT)1 << MANT_SIZE;
    }
    if (b_exp == 0) {
        if (b_mant == 0) {
        mul_zero:
            if (c_exp == 0 && c_mant == 0) {
                if (c_sign != r_sign)
                    r_sign = (rm == RM_RDN);
                return pack_sf(r_sign, 0, 0);
            } else {
                return c;
            }
        }
        b_mant = normalize_subnormal_sf(&b_exp, b_mant);
    } else {
        b_mant |= (F_UINT)1 << MANT_SIZE;
    }
    /* multiply */
    r_exp = a_exp + b_exp - (1 << (EXP_SIZE - 1)) + 3;
    
    r_mant1 = mul_u(&r_mant0, a_mant << RND_SIZE, b_mant << RND_SIZE);
    /* normalize to F_SIZE - 3 */
    if (r_mant1 < ((F_UINT)1 << (F_SIZE - 3))) {
        r_mant1 = (r_mant1 << 1) | (r_mant0 >> (F_SIZE - 1));
        r_mant0 <<= 1;
        r_exp--;
    }

    /* add */
    if (c_exp == 0) {
        if (c_mant == 0) {
            /* add zero */
            r_mant1 |= (r_mant0 != 0);
            return normalize_sf(r_sign, r_exp, r_mant1, rm, pfflags);
        }
        c_mant = normalize_subnormal_sf(&c_exp, c_mant);
    } else {
        c_mant |= (F_UINT)1 << MANT_SIZE;
    }
    c_exp++;
    c_mant1 = c_mant << (RND_SIZE - 1);
    c_mant0 = 0;

    //    printf("r_s=%d r_exp=%d r_mant=%08x %08x\n", r_sign, r_exp, (uint32_t)r_mant1, (uint32_t)r_mant0);
    //    printf("c_s=%d c_exp=%d c_mant=%08x %08x\n", c_sign, c_exp, (uint32_t)c_mant1, (uint32_t)c_mant0);

    /* ensure that abs(r) >= abs(c) */
    if (!(r_exp > c_exp || (r_exp == c_exp && r_mant1 >= c_mant1))) {
        F_UINT tmp;
        int32_t c_tmp;
        /* swap */
        tmp = r_mant1; r_mant1 = c_mant1; c_mant1 = tmp;
        tmp = r_mant0; r_mant0 = c_mant0; c_mant0 = tmp;
        c_tmp = r_exp; r_exp = c_exp; c_exp = c_tmp;
        c_tmp = r_sign; r_sign = c_sign; c_sign = c_tmp;
    }
    /* right shift c_mant */
    shift = r_exp - c_exp;
    if (shift >= 2 * F_SIZE) {
        c_mant0 = (c_mant0 | c_mant1) != 0;
        c_mant1 = 0;
    } else if (shift >= F_SIZE + 1) {
        c_mant0 = rshift_rnd(c_mant1, shift - F_SIZE);
        c_mant1 = 0;
    } else if (shift == F_SIZE) {
        c_mant0 = c_mant1 | (c_mant0 != 0);
        c_mant1 = 0;
    } else if (shift != 0) {
        mask = ((F_UINT)1 << shift) - 1;
        c_mant0 = (c_mant1 << (F_SIZE - shift)) | (c_mant0 >> shift) | ((c_mant0 & mask) != 0);
        c_mant1 = c_mant1 >> shift;
    }
    //    printf("  r_mant=%08x %08x\n", (uint32_t)r_mant1, (uint32_t)r_mant0);
    //    printf("  c_mant=%08x %08x\n", (uint32_t)c_mant1, (uint32_t)c_mant0);
    /* add or subtract */
    if (r_sign == c_sign) {
        r_mant0 += c_mant0;
        r_mant1 += c_mant1 + (r_mant0 < c_mant0);
    } else {
        F_UINT tmp;
        tmp = r_mant0;
        r_mant0 -= c_mant0;
        r_mant1 = r_mant1 - c_mant1 - (r_mant0 > tmp);
        if ((r_mant0 | r_mant1) == 0) {
            /* zero result : the sign needs a specific handling */
            r_sign = (rm == RM_RDN);
        }
    }
#if 0
    //    printf("  r1_mant=%08x %08x\n", (uint32_t)r_mant1, (uint32_t)r_mant0);
    /* normalize */
    if (r_mant1 == 0) {
        r_mant1 = r_mant0;
        r_exp -= F_SIZE;
    } else {
        shift = clz(r_mant1) - (F_SIZE - 1 - IMANT_SIZE);
        if (shift != 0) {
            r_mant1 = (r_mant1 << shift) | (r_mant0 >> (F_SIZE - shift));
            r_mant0 <<= shift;
            r_exp -= shift;
        }
        r_mant1 |= (r_mant0 != 0);
    }
    return normalize_sf(r_sign, r_exp, r_mant1, rm, pfflags);
#else
    return normalize2_sf(r_sign, r_exp, r_mant1, r_mant0, rm, pfflags);
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %r8, 0x8(%rsp)
movq %rdx, %rax
movq %r9, %rdx
shrq $0x3f, %rdx
movq %rdx, 0x28(%rsp)
movq %rcx, %rdx
xorq %rsi, %rdx
movq %rdx, %r8
shrq $0x3f, %r8
movq %r8, (%rsp)
movq %rsi, %rbp
shrq $0x30, %rbp
movl $0x7fff, %r11d          # imm = 0x7FFF
andl %r11d, %ebp
movq %rcx, %r13
shrq $0x30, %r13
andl %r11d, %r13d
movq %r9, %r12
shrq $0x30, %r12
andl %r11d, %r12d
movabsq $0xffffffffffff, %rbx   # imm = 0xFFFFFFFFFFFF
movq %rsi, %r10
andq %rbx, %r10
movq %rcx, %r8
andq %rbx, %r8
andq %r9, %rbx
cmpl %r11d, %ebp
sete %r14b
cmpl %r11d, %r13d
sete %r15b
orb %r14b, %r15b
cmpl %r11d, %r12d
sete %r11b
orb %r15b, %r11b
movq 0x78(%rsp), %r14
cmpb $0x1, %r11b
jne 0x7f83
movabsq $0x7fff000000000000, %r11 # imm = 0x7FFF000000000000
movq %rsi, %r14
notq %r14
testq %r11, %r14
sete %r14b
movq %rdi, %r15
orq %r10, %r15
setne %r15b
testb %r15b, %r14b
jne 0x7f99
movq %rcx, %r14
notq %r14
testq %r14, %r11
setne %r14b
movq %rax, %r15
orq %r8, %r15
sete %r15b
orb %r14b, %r15b
cmpb $0x1, %r15b
jne 0x7f99
movq %r9, %r14
notq %r14
testq %r14, %r11
setne %r14b
movq 0x8(%rsp), %r15
orq %rbx, %r15
sete %r15b
orb %r14b, %r15b
je 0x7f99
orq %r8, %rax
sete %al
movl %ebp, %ecx
xorl $0x7fff, %ecx           # imm = 0x7FFF
orl %r13d, %ecx
sete %cl
testb %al, %cl
movq 0x78(%rsp), %rsi
jne 0x7f77
movl %r13d, %eax
xorl $0x7fff, %eax           # imm = 0x7FFF
orl %ebp, %eax
sete %al
orq %r10, %rdi
sete %cl
testb %cl, %al
jne 0x7f77
movl $0x7fff, %ecx           # imm = 0x7FFF
cmpl %ecx, %r13d
sete %al
cmpl %ecx, %ebp
sete %cl
movq 0x28(%rsp), %rdi
cmpl %edi, (%rsp)
je 0x84fa
orb %al, %cl
je 0x84fa
cmpl $0x7fff, %r12d          # imm = 0x7FFF
jne 0x84fa
movabsq $0x7fff800000000000, %rdx # imm = 0x7FFF800000000000
jmp 0x7fe8
movl 0x70(%rsp), %r15d
testl %ebp, %ebp
je 0x7ff2
btsq $0x30, %r10
movq %rdi, %rsi
jmp 0x8033
orq %r10, %rdi
setne %dil
movabsq $0x7fff800000000000, %rdx # imm = 0x7FFF800000000000
andq %rdx, %rsi
cmpq %r11, %rsi
sete %sil
testb %dil, %sil
movq 0x78(%rsp), %rsi
jne 0x7fe8
andq %rdx, %rcx
cmpq %r11, %rcx
setne %cl
orq %r8, %rax
sete %al
orb %cl, %al
cmpb $0x1, %al
jne 0x7fe8
andq %rdx, %r9
cmpq %r11, %r9
setne %al
orq %rbx, 0x8(%rsp)
sete %cl
orb %al, %cl
jne 0x7feb
orb $0x10, (%rsi)
xorl %eax, %eax
jmp 0x84eb
movq %rdi, %rcx
orq %r10, %rcx
je 0x818c
bsrq %rdi, %rdx
xorl $0x3f, %edx
orl $0x40, %edx
bsrq %r10, %rcx
xorl $0x3f, %ecx
testq %r10, %r10
cmovel %edx, %ecx
movl $0x10, %ebp
subl %ecx, %ebp
addb $-0xf, %cl
shldq %cl, %rdi, %r10
shlq %cl, %rdi
xorl %esi, %esi
testb $0x40, %cl
cmovneq %rdi, %r10
cmoveq %rdi, %rsi
testl %r13d, %r13d
je 0x8042
btsq $0x30, %r8
movq %rax, %rcx
jmp 0x8087
movq %rax, %rcx
orq %r8, %rcx
je 0x818c
bsrq %rax, %rcx
xorl $0x3f, %ecx
orl $0x40, %ecx
bsrq %r8, %rdx
xorl $0x3f, %edx
testq %r8, %r8
cmovel %ecx, %edx
movl $0x10, %r13d
subl %edx, %r13d
addb $-0xf, %dl
movl %edx, %ecx
shldq %cl, %rax, %r8
shlq %cl, %rax
xorl %ecx, %ecx
testb $0x40, %dl
cmovneq %rax, %r8
cmoveq %rax, %rcx
shldq $0xe, %rsi, %r10
shlq $0xe, %rsi
shldq $0xe, %rcx, %r8
shlq $0xe, %rcx
leaq 0x10(%rsp), %rdi
movq %r10, %rdx
callq 0x7da1
movq %rax, %r10
movq %rdx, %r9
movq %rdx, %rax
shrq $0x3d, %rax
jne 0x80e7
addl %ebp, %r13d
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
shldq $0x1, %r10, %r9
shldq $0x1, %rcx, %r10
shldq $0x1, %rax, %rcx
addq %rax, %rax
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
addl $0xffffc002, %r13d      # imm = 0xFFFFC002
jmp 0x80f1
addl %ebp, %r13d
addl $0xffffc003, %r13d      # imm = 0xFFFFC003
movq 0x8(%rsp), %rdx
testl %r12d, %r12d
je 0x8105
btsq $0x30, %rbx
movq %rdx, %rbp
jmp 0x8148
movq %rdx, %rax
orq %rbx, %rax
je 0x8338
bsrq %rdx, %rax
xorl $0x3f, %eax
orl $0x40, %eax
bsrq %rbx, %rcx
xorl $0x3f, %ecx
testq %rbx, %rbx
cmovel %eax, %ecx
movl $0x10, %r12d
subl %ecx, %r12d
addb $-0xf, %cl
shldq %cl, %rdx, %rbx
shlq %cl, %rdx
xorl %ebp, %ebp
testb $0x40, %cl
cmovneq %rdx, %rbx
cmoveq %rdx, %rbp
shldq $0xd, %rbp, %rbx
incl %r12d
shlq $0xd, %rbp
xorl %eax, %eax
cmpl %r12d, %r13d
jle 0x8160
movl %r12d, %edi
jmp 0x8172
jne 0x81c9
xorl %eax, %eax
cmpq %rbp, %r10
movq %r9, %rcx
sbbq %rbx, %rcx
jb 0x81c9
movl %r13d, %edi
xorl %esi, %esi
movq %rbp, %rdx
movq %rbx, %r8
movq %r10, %rbp
movq %r9, %rbx
movl %r13d, %r15d
movq (%rsp), %r10
movl %r10d, %r11d
jmp 0x81f3
testl %r12d, %r12d
sete %dl
movq 0x8(%rsp), %rax
orq %rax, %rbx
sete %cl
andb %dl, %cl
movq %r9, %rdx
cmpb $0x1, %cl
jne 0x84eb
xorl %edx, %edx
cmpl $0x2, %r15d
sete %dl
movq (%rsp), %rax
cmpl %eax, 0x28(%rsp)
cmoveq %rax, %rdx
shlq $0x3f, %rdx
jmp 0x7feb
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rsi
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movl %r13d, %edi
movq %r10, %rdx
movq %r9, %r8
movl %r12d, %r15d
movq 0x28(%rsp), %rcx
movl %ecx, %r11d
movq (%rsp), %r10
movl %r15d, %ecx
subl %edi, %ecx
cmpl $0x100, %ecx            # imm = 0x100
jl 0x8212
orq %rax, %rdx
orq %rsi, %r8
xorl %eax, %eax
orq %rdx, %r8
setne %al
xorl %esi, %esi
jmp 0x8256
cmpl $0x81, %ecx
jl 0x8239
addl $-0x80, %ecx
movq %rdx, %rdi
movq %r8, %rsi
movl %ecx, %edx
movl %r11d, %r12d
callq 0x7a5f
movl %r12d, %r11d
movq (%rsp), %r10
movq %rdx, %rsi
jmp 0x8256
cmpl $0x80, %ecx
jne 0x8390
xorl %ecx, %ecx
orq %rsi, %rax
setne %cl
orq %rcx, %rdx
movq %rdx, %rax
movq %r8, %rsi
xorl %edx, %edx
xorl %r8d, %r8d
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %r9
cmpl 0x28(%rsp), %r10d
jne 0x8282
addq %rbp, %rdx
adcq %rbx, %r8
addq %rax, %rdi
adcq %rsi, %r9
adcq $0x0, %rdx
adcq $0x0, %r8
jmp 0x82b9
subq %rdx, %rbp
sbbq %r8, %rbx
subq %rax, %rdi
sbbq %rsi, %r9
sbbq $0x0, %rbp
sbbq $0x0, %rbx
movq %rbp, %rax
orq %rdi, %rax
movq %rbx, %rcx
orq %r9, %rcx
xorl %edx, %edx
cmpl $0x2, 0x70(%rsp)
sete %dl
orq %rax, %rcx
cmovel %edx, %r11d
movq %rbp, %rdx
movq %rbx, %r8
movq %rdx, %rax
orq %r8, %rax
je 0x82f0
testq %r8, %r8
je 0x8324
bsrq %r8, %rsi
xorq $0x3f, %rsi
je 0x8525
movl %esi, %eax
decl %eax
jne 0x8465
xorl %eax, %eax
orq %r9, %rdi
setne %al
orq %rax, %rdx
xorl %eax, %eax
jmp 0x84d2
movq %rdi, %rax
orq %r9, %rax
je 0x8367
bsrq %r9, %rcx
xorl $0x3f, %ecx
bsrq %rdi, %rax
xorl $0x3f, %eax
orl $0x40, %eax
testq %r9, %r9
cmovnel %ecx, %eax
testl %eax, %eax
je 0x845b
movl %eax, %ecx
orl $0x80, %ecx
addl $0x7f, %eax
jmp 0x8371
bsrq %rdx, %rax
xorl $0x3f, %eax
movl %eax, %esi
orl $0x40, %esi
addl $0x3f, %eax
jmp 0x8465
movq 0x10(%rsp), %rax
xorl %ecx, %ecx
orq 0x18(%rsp), %rax
setne %cl
orq %rcx, %r10
movq (%rsp), %rdi
movl %r13d, %esi
movq %r10, %rdx
movq %r9, %rcx
movl %r15d, %r8d
movq %r14, %r9
callq 0x7ad0
jmp 0x84eb
movl $0x100, %ecx            # imm = 0x100
movl $0xff, %eax
addb $0x7f, %cl
shldq %cl, %rdi, %r9
shlq %cl, %rdi
xorl %edx, %edx
testb $0x40, %cl
cmovneq %rdi, %r9
cmoveq %rdi, %rdx
movq %r9, %r8
jmp 0x84d2
cmpl %r12d, %r13d
je 0x825b
movq %r8, %rdi
shrq %cl, %rdi
xorl %r10d, %r10d
testb $0x40, %cl
movq %rdi, %r9
cmovneq %r10, %r9
movq %r9, 0x30(%rsp)
movl %r11d, 0x8(%rsp)
movq %rdx, %r11
shrdq %cl, %r8, %r11
testb $0x40, %cl
cmovneq %rdi, %r11
movq %rsi, %rdi
shrq %cl, %rdi
testb $0x40, %cl
movq %rdi, %r12
movl $0x0, %r9d
cmovneq %r9, %r12
movq %rax, %r10
shrdq %cl, %rsi, %r10
testb $0x40, %cl
cmovneq %rdi, %r10
movq $-0x1, %r13
movq $-0x1, %rdi
shlq %cl, %rdi
testb $0x40, %cl
cmovneq %rdi, %r13
cmovneq %r9, %rdi
movb $-0x80, %r9b
subb %cl, %r9b
movl %r9d, %ecx
shldq %cl, %rdx, %r8
notq %rdi
shlq %cl, %rdx
testb $0x40, %r9b
cmovneq %rdx, %r8
movl $0x0, %ecx
cmovneq %rcx, %rdx
notq %r13
orq %r12, %r8
orq %r10, %rdx
movq (%rsp), %r10
andq %rsi, %r13
andq %rax, %rdi
xorl %eax, %eax
orq %r13, %rdi
setne %al
orq %rdx, %rax
movq %r8, %rsi
movq %r11, %rdx
movl 0x8(%rsp), %r11d
movq 0x30(%rsp), %r8
jmp 0x825b
movl $0x80, %esi
movl $0x7f, %eax
movq %r14, %r13
movq %rdi, %r14
movl %eax, %ecx
shlq %cl, %r14
xorl %ebx, %ebx
testb $0x40, %al
movq %r14, %r10
cmovneq %rbx, %r10
movl %r11d, %ebp
movq %r9, %r11
shldq %cl, %rdi, %r11
testb $0x40, %al
cmovneq %r14, %r11
movq %rdx, %r14
shlq %cl, %r14
testb $0x40, %al
movq %r14, %r12
cmovneq %rbx, %r12
shldq %cl, %rdx, %r8
testb $0x40, %al
cmovneq %r14, %r8
movq %r13, %r14
movb $-0x7f, %cl
subb %sil, %cl
shrdq %cl, %r9, %rdi
shrq %cl, %r9
testb $0x40, %cl
cmovneq %r9, %rdi
cmovneq %rbx, %r9
orq %r9, %r8
orq %r12, %rdi
xorl %edx, %edx
orq %r10, %r11
movl %ebp, %r11d
setne %dl
orq %rdi, %rdx
subl %eax, %r15d
movl %r11d, %edi
movl %r15d, %esi
movq %r8, %rcx
movl 0x70(%rsp), %r8d
movq %r14, %r9
callq 0x99b4
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
cmpl $0x7fff, %r12d          # imm = 0x7FFF
jne 0x851a
andq %rax, %r9
orq %r11, %r9
xorl %eax, %eax
movq %r9, %rdx
jmp 0x84eb
andq %rax, %rdx
orq %r11, %rdx
jmp 0x7feb
leaq 0xdfda(%rip), %rdi      # 0x16506
leaq 0xdfde(%rip), %rsi      # 0x16511
leaq 0xe18f(%rip), %rcx      # 0x166c9
movl $0xc9, %edx
callq 0x1080