// File: /workspace/github_c_makefile_star2_O0/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
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
shrl $0x1f, %eax
movl %eax, -0x1c(%rbp)
movl -0xc(%rbp), %eax
shrl $0x1f, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
xorl -0x20(%rbp), %eax
movl %eax, -0x24(%rbp)
movl -0x8(%rbp), %eax
shrl $0x17, %eax
andl $0xff, %eax
movl %eax, -0x28(%rbp)
movl -0xc(%rbp), %eax
shrl $0x17, %eax
andl $0xff, %eax
movl %eax, -0x2c(%rbp)
movl -0x8(%rbp), %eax
andl $0x7fffff, %eax         # imm = 0x7FFFFF
movl %eax, -0x34(%rbp)
movl -0xc(%rbp), %eax
andl $0x7fffff, %eax         # imm = 0x7FFFFF
movl %eax, -0x38(%rbp)
cmpl $0xff, -0x28(%rbp)
je 0x6fe8
cmpl $0xff, -0x2c(%rbp)
jne 0x708b
movl -0x8(%rbp), %edi
callq 0x6c50
cmpl $0x0, %eax
jne 0x7002
movl -0xc(%rbp), %edi
callq 0x6c50
cmpl $0x0, %eax
je 0x7033
movl -0x8(%rbp), %edi
callq 0x6c00
cmpl $0x0, %eax
jne 0x701c
movl -0xc(%rbp), %edi
callq 0x6c00
cmpl $0x0, %eax
je 0x7027
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x7153
cmpl $0xff, -0x28(%rbp)
jne 0x7048
cmpl $0x0, -0x2c(%rbp)
jne 0x7048
cmpl $0x0, -0x38(%rbp)
je 0x705d
cmpl $0xff, -0x2c(%rbp)
jne 0x7074
cmpl $0x0, -0x28(%rbp)
jne 0x7074
cmpl $0x0, -0x34(%rbp)
jne 0x7074
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x7153
movl -0x24(%rbp), %edi
movl $0xff, %esi
xorl %edx, %edx
callq 0x7160
movl %eax, -0x4(%rbp)
jmp 0x7153
cmpl $0x0, -0x28(%rbp)
jne 0x70bc
cmpl $0x0, -0x34(%rbp)
jne 0x70ab
movl -0x24(%rbp), %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x7160
movl %eax, -0x4(%rbp)
jmp 0x7153
movl -0x34(%rbp), %esi
leaq -0x28(%rbp), %rdi
callq 0x7190
movl %eax, -0x34(%rbp)
jmp 0x70c7
movl -0x34(%rbp), %eax
orl $0x800000, %eax         # imm = 0x800000
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x70f5
cmpl $0x0, -0x38(%rbp)
jne 0x70e4
movl -0x24(%rbp), %edi
xorl %edx, %edx
movl %edx, %esi
callq 0x7160
movl %eax, -0x4(%rbp)
jmp 0x7153
movl -0x38(%rbp), %esi
leaq -0x2c(%rbp), %rdi
callq 0x7190
movl %eax, -0x38(%rbp)
jmp 0x7100
movl -0x38(%rbp), %eax
orl $0x800000, %eax         # imm = 0x800000
movl %eax, -0x38(%rbp)
movl -0x28(%rbp), %eax
addl -0x2c(%rbp), %eax
subl $0x80, %eax
addl $0x2, %eax
movl %eax, -0x30(%rbp)
movl -0x34(%rbp), %esi
shll $0x7, %esi
movl -0x38(%rbp), %edx
shll $0x8, %edx
leaq -0x40(%rbp), %rdi
callq 0x71e0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x40(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x24(%rbp), %edi
movl -0x30(%rbp), %esi
movl -0x3c(%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
nopl (%rax)