// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/./softfp_template.h
// Function: sqrt_sf32
F_UINT sqrt_sf(F_UINT a, RoundingModeEnum rm,
               uint32_t *pfflags)
{
    uint32_t a_sign;
    int32_t a_exp;
    F_UINT a_mant;

    a_sign = a >> (F_SIZE - 1);
    a_exp = (a >> MANT_SIZE) & EXP_MASK;
    a_mant = a & MANT_MASK;
    if (a_exp == EXP_MASK) {
        if (a_mant != 0) {
            if (issignan_sf(a)) {
                *pfflags |= FFLAG_INVALID_OP;
            }
            return F_QNAN;
        } else if (a_sign) {
            goto neg_error;
        } else {
            return a; /* +infinity */
        }
    }
    if (a_sign) {
        if (a_exp == 0 && a_mant == 0)
            return a; /* -zero */
    neg_error:
        *pfflags |= FFLAG_INVALID_OP;
        return F_QNAN;
    }
    if (a_exp == 0) {
        if (a_mant == 0)
            return pack_sf(0, 0, 0); /* zero */
        a_mant = normalize_subnormal_sf(&a_exp, a_mant);
    } else {
        a_mant |= (F_UINT)1 << MANT_SIZE;
    }
    a_exp -= EXP_MASK / 2;
    /* simpler to handle an even exponent */
    if (a_exp & 1) {
        a_exp--;
        a_mant <<= 1;
    }
    a_exp = (a_exp >> 1) + EXP_MASK / 2;
    a_mant <<= (F_SIZE - 4 - MANT_SIZE);
    if (sqrtrem_u(&a_mant, a_mant, 0))
        a_mant |= 1;
    return normalize_sf(a_sign, a_exp, a_mant, rm, pfflags);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq %rdx, -0x18(%rbp)
movl -0x8(%rbp), %eax
shrl $0x1f, %eax
movl %eax, -0x1c(%rbp)
movl -0x8(%rbp), %eax
shrl $0x17, %eax
andl $0xff, %eax
movl %eax, -0x20(%rbp)
movl -0x8(%rbp), %eax
andl $0x7fffff, %eax         # imm = 0x7FFFFF
movl %eax, -0x24(%rbp)
cmpl $0xff, -0x20(%rbp)
jne 0x7afa
cmpl $0x0, -0x24(%rbp)
je 0x7ae7
movl -0x8(%rbp), %edi
callq 0x6c00
cmpl $0x0, %eax
je 0x7adb
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x7bd8
cmpl $0x0, -0x1c(%rbp)
je 0x7aef
jmp 0x7b19
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7bd8
cmpl $0x0, -0x1c(%rbp)
je 0x7b30
cmpl $0x0, -0x20(%rbp)
jne 0x7b17
cmpl $0x0, -0x24(%rbp)
jne 0x7b17
movl -0x8(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x7bd8
jmp 0x7b19
movq -0x18(%rbp), %rax
movl (%rax), %ecx
orl $0x10, %ecx
movl %ecx, (%rax)
movl $0x7fc00000, -0x4(%rbp) # imm = 0x7FC00000
jmp 0x7bd8
cmpl $0x0, -0x20(%rbp)
jne 0x7b60
cmpl $0x0, -0x24(%rbp)
jne 0x7b4f
xorl %edx, %edx
movl %edx, %edi
movl %edx, %esi
callq 0x7160
movl %eax, -0x4(%rbp)
jmp 0x7bd8
movl -0x24(%rbp), %esi
leaq -0x20(%rbp), %rdi
callq 0x7190
movl %eax, -0x24(%rbp)
jmp 0x7b6b
movl -0x24(%rbp), %eax
orl $0x800000, %eax         # imm = 0x800000
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
subl $0x7f, %eax
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x7b90
movl -0x20(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
shll %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
sarl %eax
addl $0x7f, %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
shll $0x5, %eax
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %esi
leaq -0x24(%rbp), %rdi
xorl %edx, %edx
callq 0x7bf0
cmpl $0x0, %eax
je 0x7bc0
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %edi
movl -0x20(%rbp), %esi
movl -0x24(%rbp), %edx
movl -0xc(%rbp), %ecx
movq -0x18(%rbp), %r8
callq 0x6eb0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)