// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/./softfp_template.h
// Function: mul_sf32
F_UINT mul_sf(F_UINT a, F_UINT b, RoundingModeEnum rm,
              uint32_t *pfflags)
{
    uint32_t a_sign, b_sign, r_sign;
    int32_t a_exp, b_exp, r_exp;
    F_UINT a_mant, b_mant, r_mant, r_mant_low;

    a_sign = a >> (F_SIZE - 1);
    b_sign = b >> (F_SIZE - 1);
    r_sign = a_sign ^ b_sign;
    a_exp = (a >> MANT_SIZE) & EXP_MASK;
    b_exp = (b >> MANT_SIZE) & EXP_MASK;
    a_mant = a & MANT_MASK;
    b_mant = b & MANT_MASK;
    if (a_exp == EXP_MASK || b_exp == EXP_MASK) {
        if (isnan_sf(a) || isnan_sf(b)) {
            if (issignan_sf(a) || issignan_sf(b)) {
                *pfflags |= FFLAG_INVALID_OP;
            }
            return F_QNAN;
        } else {
            /* infinity */
            if ((a_exp == EXP_MASK && (b_exp == 0 && b_mant == 0)) ||
                (b_exp == EXP_MASK && (a_exp == 0 && a_mant == 0))) {
                *pfflags |= FFLAG_INVALID_OP;
                return F_QNAN;
            } else {
                return pack_sf(r_sign, EXP_MASK, 0);
            }
        }
    }
    if (a_exp == 0) {
        if (a_mant == 0)
            return pack_sf(r_sign, 0, 0); /* 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)
            return pack_sf(r_sign, 0, 0); /* zero */
        b_mant = normalize_subnormal_sf(&b_exp, b_mant);
    } else {
        b_mant |= (F_UINT)1 << MANT_SIZE;
    }
    r_exp = a_exp + b_exp - (1 << (EXP_SIZE - 1)) + 2;
    
    r_mant = mul_u(&r_mant_low,a_mant << RND_SIZE, b_mant << (RND_SIZE + 1));
    r_mant |= (r_mant_low != 0);
    return normalize_sf(r_sign, r_exp, r_mant, rm, pfflags);
}

// Assembly:
pushq %rbp
pushq %rbx
movq %rcx, %r8
movl %edx, %r9d
movl %esi, %eax
xorl %edi, %eax
movl %edi, %r11d
shrl $0x17, %r11d
movl $0xff, %ecx
andl %ecx, %r11d
movl %esi, %ebx
shrl $0x17, %ebx
andl %ecx, %ebx
movl $0x7fffff, %r10d        # imm = 0x7FFFFF
movl %edi, %edx
andl %r10d, %edx
andl %esi, %r10d
cmpl %ecx, %r11d
setne %bpl
cmpl %ecx, %ebx
setne %cl
testb %cl, %bpl
jne 0x50b3
movl %edi, %ecx
notl %ecx
testl $0x7f800000, %ecx       # imm = 0x7F800000
sete %cl
testl %edx, %edx
setne %r9b
testb %r9b, %cl
jne 0x50c0
movl %esi, %ecx
notl %ecx
testl $0x7f800000, %ecx       # imm = 0x7F800000
setne %cl
testl %r10d, %r10d
sete %r9b
orb %cl, %r9b
je 0x50c0
movl %r11d, %ecx
xorl $0xff, %ecx
orl %ebx, %r10d
orl %ecx, %r10d
je 0x50fa
xorl $0xff, %ebx
orl %edx, %r11d
orl %ebx, %r11d
je 0x50fa
andl $0x80000000, %eax       # imm = 0x80000000
orl $0x7f800000, %eax       # imm = 0x7F800000
jmp 0x517a
testl %r11d, %r11d
je 0x5105
orl $0x800000, %edx         # imm = 0x800000
jmp 0x511d
testl %edx, %edx
setne %al
andl $0x7fc00000, %edi       # imm = 0x7FC00000
cmpl $0x7f800000, %edi       # imm = 0x7F800000
sete %cl
testb %al, %cl
jne 0x50fa
andl $0x7fc00000, %esi       # imm = 0x7FC00000
cmpl $0x7f800000, %esi       # imm = 0x7F800000
setne %al
testl %r10d, %r10d
sete %cl
orb %al, %cl
movl $0x7fc00000, %eax       # imm = 0x7FC00000
jne 0x517a
orb $0x10, (%r8)
movl $0x7fc00000, %eax       # imm = 0x7FC00000
jmp 0x517a
testl %edx, %edx
je 0x5175
bsrl %edx, %ecx
xorl $0x1f, %ecx
movl $0x9, %r11d
subl %ecx, %r11d
addb $-0x8, %cl
shll %cl, %edx
testl %ebx, %ebx
je 0x512a
orl $0x800000, %r10d        # imm = 0x800000
jmp 0x5143
testl %r10d, %r10d
je 0x5175
bsrl %r10d, %ecx
xorl $0x1f, %ecx
movl $0x9, %ebx
subl %ecx, %ebx
addb $-0x8, %cl
shll %cl, %r10d
shrl $0x1f, %eax
leal (%r11,%rbx), %esi
addl $-0x7e, %esi
shll $0x7, %edx
shll $0x8, %r10d
imulq %rdx, %r10
movq %r10, %rcx
shrq $0x20, %rcx
xorl %edx, %edx
testl %r10d, %r10d
setne %dl
orl %ecx, %edx
movl %eax, %edi
movl %r9d, %ecx
popq %rbx
popq %rbp
jmp 0x4fc4
andl $0x80000000, %eax       # imm = 0x80000000
popq %rbx
popq %rbp
retq