// File: /workspace/github_c_makefile_star2_O2/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_sqrt
float64 float64_sqrt(float64 a, float_status *status)
{
    flag aSign;
    int_fast16_t aExp, zExp;
    uint64_t aSig, zSig, doubleZSig;
    uint64_t rem0, rem1, term0, term1;
    a = float64_squash_input_denormal(a, status);

    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );
    if ( aExp == 0x7FF ) {
        if (aSig) {
            return propagateFloat64NaN(a, a, status);
        }
        if ( ! aSign ) return a;
        float_raise(float_flag_invalid, status);
        return float64_default_nan;
    }
    if ( aSign ) {
        if ( ( aExp | aSig ) == 0 ) return a;
        float_raise(float_flag_invalid, status);
        return float64_default_nan;
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return float64_zero;
        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
    }
    zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE;
    aSig |= LIT64( 0x0010000000000000 );
    zSig = estimateSqrt32( aExp, aSig>>21 );
    aSig <<= 9 - ( aExp & 1 );
    zSig = estimateDiv128To64( aSig, 0, zSig<<32 ) + ( zSig<<30 );
    if ( ( zSig & 0x1FF ) <= 5 ) {
        doubleZSig = zSig<<1;
        mul64To128( zSig, zSig, &term0, &term1 );
        sub128( aSig, 0, term0, term1, &rem0, &rem1 );
        while ( (int64_t) rem0 < 0 ) {
            --zSig;
            doubleZSig -= 2;
            add128( rem0, rem1, zSig>>63, doubleZSig | 1, &rem0, &rem1 );
        }
        zSig |= ( ( rem0 | rem1 ) != 0 );
    }
    return roundAndPackFloat64(0, zExp, zSig, status);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movabsq $0xfffffffffffff, %r14  # imm = 0xFFFFFFFFFFFFF
callq 0x920d
movq %rax, %rdx
andq %r14, %rdx
movq %rax, %r12
shrq $0x34, %r12
movl $0x7ff, %ecx            # imm = 0x7FF
andq %rcx, %r12
cmpq %rcx, %r12
jne 0xdd43
testq %rdx, %rdx
je 0xde28
movq %rax, %rdi
movq %rax, %rsi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xcb8c
testq %rax, %rax
js 0xde2f
testq %r12, %r12
jne 0xdd74
testq %rdx, %rdx
je 0xde7a
bsrq %rdx, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %rdx
pushq $0x1
popq %rax
subl %ecx, %eax
movslq %eax, %r12
leaq -0x3ff(%r12), %r15
sarq %r15
addq $0x3fe, %r15            # imm = 0x3FE
incq %r14
orq %rdx, %r14
movq %r14, %rsi
shrq $0x15, %rsi
movq %r12, %rdi
callq 0xb507
andb $0x1, %r12b
xorb $0x9, %r12b
movl %r12d, %ecx
shlq %cl, %r14
movl %eax, %ebp
movq %rbp, %rdx
shlq $0x20, %rdx
movq %r14, %rdi
xorl %esi, %esi
callq 0xadbc
movq %rax, %r13
movq %rbp, %r12
shlq $0x1e, %r12
addq %rax, %r12
andl $0x1fe, %eax            # imm = 0x1FE
cmpl $0x5, %eax
ja 0xde5c
leaq 0x10(%rsp), %rdx
leaq 0x8(%rsp), %rcx
movq %r12, %rdi
movq %r12, %rsi
callq 0xd0a6
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
subq (%rcx), %rax
leaq 0x10(%rsp), %rcx
sbbq (%rcx), %r14
shlq $0x1f, %rbp
leaq -0x1(,%r13,2), %rcx
addq %rbp, %rcx
testq %r14, %r14
jns 0xde51
decq %r12
movq %r12, %rdx
shrq $0x3f, %rdx
addq %rcx, %rax
adcq %rdx, %r14
addq $-0x2, %rcx
jmp 0xde0d
testq %rax, %rax
jns 0xde42
jmp 0xde34
orq %rdx, %r12
je 0xde42
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
orb $0x1, 0x2(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
orq %r14, %rax
setne %cl
orq %rcx, %r12
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x973e
xorl %eax, %eax
jmp 0xde42