// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/./softfp_template.h
// Function: mul_sf64
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 %r14
pushq %rbx
movq %rcx, %r8
movl %edx, %r9d
movabsq $0xfffffffffffff, %r14  # imm = 0xFFFFFFFFFFFFF
movq %rsi, %r10
xorq %rdi, %r10
movq %rdi, %r11
shrq $0x34, %r11
movl $0x7ff, %ecx            # imm = 0x7FF
andl %ecx, %r11d
movq %rsi, %rbx
shrq $0x34, %rbx
andl %ecx, %ebx
movq %rdi, %rdx
andq %r14, %rdx
movq %rsi, %rax
andq %r14, %rax
cmpl %ecx, %r11d
sete %bpl
cmpl %ecx, %ebx
sete %cl
orb %bpl, %cl
cmpb $0x1, %cl
jne 0x6467
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
movq %rdi, %r9
notq %r9
testq %rcx, %r9
sete %r9b
testq %rdx, %rdx
setne %bpl
testb %bpl, %r9b
jne 0x6474
movq %rsi, %r9
notq %r9
testq %r9, %rcx
setne %r9b
testq %rax, %rax
sete %bpl
orb %r9b, %bpl
je 0x6474
testq %rax, %rax
jne 0x643a
cmpl $0x7ff, %r11d           # imm = 0x7FF
jne 0x643a
testl %ebx, %ebx
je 0x645b
cmpl $0x7ff, %ebx            # imm = 0x7FF
setne %al
testl %r11d, %r11d
setne %sil
testq %rdx, %rdx
setne %dl
orb %sil, %dl
orb %al, %dl
jne 0x6543
movabsq $0x7ff8000000000000, %r10 # imm = 0x7FF8000000000000
jmp 0x64aa
testl %r11d, %r11d
je 0x64b3
addq %r14, %rdx
incq %rdx
jmp 0x64d2
testq %rdx, %rdx
setne %dl
movabsq $0x7ff8000000000000, %r10 # imm = 0x7FF8000000000000
andq %r10, %rdi
cmpq %rcx, %rdi
sete %dil
testb %dl, %dil
jne 0x64aa
andq %r10, %rsi
cmpq %rcx, %rsi
setne %cl
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x653b
orb $0x10, (%r8)
jmp 0x653b
testq %rdx, %rdx
je 0x652e
bsrq %rdx, %rsi
xorl $0x3f, %esi
movl $0xfffffff5, %ecx       # imm = 0xFFFFFFF5
addl %esi, %ecx
movl $0xc, %r11d
subl %esi, %r11d
shlq %cl, %rdx
testl %ebx, %ebx
je 0x64de
addq %r14, %rax
incq %rax
jmp 0x64fb
testq %rax, %rax
je 0x652e
bsrq %rax, %rsi
xorl $0x3f, %esi
movl $0xfffffff5, %ecx       # imm = 0xFFFFFFF5
addl %esi, %ecx
movl $0xc, %ebx
subl %esi, %ebx
shlq %cl, %rax
shrq $0x3f, %r10
shlq $0xa, %rdx
shlq $0xb, %rax
mulq %rdx
leal (%r11,%rbx), %esi
addl $0xfffffc02, %esi       # imm = 0xFFFFFC02
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
orq %rcx, %rdx
movl %r10d, %edi
movl %r9d, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x6347
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %r10
movq %r10, %rax
popq %rbx
popq %r14
popq %rbp
retq
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %r10
orq %rcx, %r10
jmp 0x653b