// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/softfloat.c
// Function: float32_sqrt
float32 float32_sqrt(float32 a, float_status *status)
{
    flag aSign;
    int_fast16_t aExp, zExp;
    uint32_t aSig, zSig;
    uint64_t rem, term;
    a = float32_squash_input_denormal(a, status);

    aSig = extractFloat32Frac( a );
    aExp = extractFloat32Exp( a );
    aSign = extractFloat32Sign( a );
    if ( aExp == 0xFF ) {
        if (aSig) {
            return propagateFloat32NaN(a, float32_zero, status);
        }
        if ( ! aSign ) return a;
        float_raise(float_flag_invalid, status);
        return float32_default_nan;
    }
    if ( aSign ) {
        if ( ( aExp | aSig ) == 0 ) return a;
        float_raise(float_flag_invalid, status);
        return float32_default_nan;
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return float32_zero;
        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
    }
    zExp = ( ( aExp - 0x7F )>>1 ) + 0x7E;
    aSig = ( aSig | 0x00800000 )<<8;
    zSig = estimateSqrt32( aExp, aSig ) + 2;
    if ( ( zSig & 0x7F ) <= 5 ) {
        if ( zSig < 2 ) {
            zSig = 0x7FFFFFFF;
            goto roundAndPack;
        }
        aSig >>= aExp & 1;
        term = ( (uint64_t) zSig ) * zSig;
        rem = ( ( (uint64_t) aSig )<<32 ) - term;
        while ( (int64_t) rem < 0 ) {
            --zSig;
            rem += ( ( (uint64_t) zSig )<<1 ) | 1;
        }
        zSig |= ( rem != 0 );
    }
    shift32RightJamming( zSig, 1, &zSig );
 roundAndPack:
    return roundAndPackFloat32(0, zExp, zSig, status);

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpb $0x0, 0x5(%rsi)
je 0xc15e
testl $0x7f800000, %edi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %edi         # imm = 0x7FFFFF
sete %cl
orb %al, %cl
jne 0xc15e
orb $0x40, 0x2(%rbx)
andl $0x80000000, %edi       # imm = 0x80000000
movl %edi, %r14d
andl $0x7fffff, %r14d        # imm = 0x7FFFFF
movl %edi, %r12d
shrl $0x17, %r12d
movl $0xff, %eax
andl %eax, %r12d
cmpl %eax, %r12d
jne 0xc19a
testl %r14d, %r14d
je 0xc253
xorl %esi, %esi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xaf64
testl %edi, %edi
js 0xc259
testq %r12, %r12
jne 0xc1c7
testl %r14d, %r14d
je 0xc275
bsrl %r14d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r14d
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %r12
leaq -0x7f(%r12), %r15
sarq %r15
addq $0x7e, %r15
shll $0x8, %r14d
orl $0x80000000, %r14d      # imm = 0x80000000
movq %r12, %rdi
movl %r14d, %esi
callq 0xc279
leal 0x2(%rax), %esi
movl %esi, %ecx
andl $0x7e, %ecx
cmpl $0x5, %ecx
ja 0xc230
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
cmpl $-0x3, %eax
ja 0xc23b
andb $0x1, %r12b
movl %r12d, %ecx
shrl %cl, %r14d
movl %esi, %eax
imulq %rax, %rax
shlq $0x20, %r14
subq %rax, %r14
jns 0xc224
decl %esi
leaq (%r14,%rsi,2), %r14
incq %r14
js 0xc219
xorl %eax, %eax
testq %r14, %r14
setne %al
orl %esi, %eax
movl %eax, %esi
movl %esi, %eax
shrl %eax
andl $0x1, %esi
orl %eax, %esi
movl %esi, %edx
xorl %edi, %edi
movq %r15, %rsi
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x9f46
testl %edi, %edi
jns 0xc267
jmp 0xc25e
orl %r14d, %r12d
je 0xc267
orb $0x1, 0x2(%rbx)
movl $0x7fc00000, %edi       # imm = 0x7FC00000
movl %edi, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %edi, %edi
jmp 0xc267