// File: /workspace/github_c_makefile_star2_O2/mbitsnbites[P]SoftFP/softfloat.c
// Function: floatx80_sqrt
floatx80 floatx80_sqrt(floatx80 a, float_status *status)
{
    flag aSign;
    int32 aExp, zExp;
    uint64_t aSig0, aSig1, zSig0, zSig1, doubleZSig0;
    uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
    floatx80 z;

    aSig0 = extractFloatx80Frac( a );
    aExp = extractFloatx80Exp( a );
    aSign = extractFloatx80Sign( a );
    if ( aExp == 0x7FFF ) {
        if ((uint64_t)(aSig0 << 1)) {
            return propagateFloatx80NaN(a, a, status);
        }
        if ( ! aSign ) return a;
        goto invalid;
    }
    if ( aSign ) {
        if ( ( aExp | aSig0 ) == 0 ) return a;
 invalid:
        float_raise(float_flag_invalid, status);
        z.low = floatx80_default_nan_low;
        z.high = floatx80_default_nan_high;
        return z;
    }
    if ( aExp == 0 ) {
        if ( aSig0 == 0 ) return packFloatx80( 0, 0, 0 );
        normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
    }
    zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFF;
    zSig0 = estimateSqrt32( aExp, aSig0>>32 );
    shift128Right( aSig0, 0, 2 + ( aExp & 1 ), &aSig0, &aSig1 );
    zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0<<32 ) + ( zSig0<<30 );
    doubleZSig0 = zSig0<<1;
    mul64To128( zSig0, zSig0, &term0, &term1 );
    sub128( aSig0, aSig1, term0, term1, &rem0, &rem1 );
    while ( (int64_t) rem0 < 0 ) {
        --zSig0;
        doubleZSig0 -= 2;
        add128( rem0, rem1, zSig0>>63, doubleZSig0 | 1, &rem0, &rem1 );
    }
    zSig1 = estimateDiv128To64( rem1, 0, doubleZSig0 );
    if ( ( zSig1 & LIT64( 0x3FFFFFFFFFFFFFFF ) ) <= 5 ) {
        if ( zSig1 == 0 ) zSig1 = 1;
        mul64To128( doubleZSig0, zSig1, &term1, &term2 );
        sub128( rem1, 0, term1, term2, &rem1, &rem2 );
        mul64To128( zSig1, zSig1, &term2, &term3 );
        sub192( rem1, rem2, 0, 0, term2, term3, &rem1, &rem2, &rem3 );
        while ( (int64_t) rem1 < 0 ) {
            --zSig1;
            shortShift128Left( 0, zSig1, 1, &term2, &term3 );
            term3 |= 1;
            term2 |= doubleZSig0;
            add192( rem1, rem2, rem3, 0, term2, term3, &rem1, &rem2, &rem3 );
        }
        zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 );
    }
    shortShift128Left( 0, zSig1, 1, &zSig0, &zSig1 );
    zSig0 |= doubleZSig0;
    return roundAndPackFloatx80(status->floatx80_rounding_precision,
                                0, zExp, zSig0, zSig1, status);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r8
movq %rdi, %r14
movl %esi, %ecx
movl %esi, %eax
notl %eax
testw $0x7fff, %ax            # imm = 0x7FFF
jne 0xfbb5
leaq (,%r14,2), %rax
testq %rax, %rax
je 0xfbcb
movq %r14, %rdi
movl %ecx, %esi
movq %r14, %rdx
callq 0xec53
jmp 0xfdd2
andl $0x7fff, %esi           # imm = 0x7FFF
testw %cx, %cx
js 0xfbda
testl %esi, %esi
je 0xfbfd
movq %r8, 0x10(%rsp)
jmp 0xfc1b
testw %cx, %cx
movw $0x7fff, %cx            # imm = 0x7FFF
jns 0xfdd7
jmp 0xfbe5
movl %esi, %eax
orq %r14, %rax
je 0xfdd7
orb $0x1, 0x2(%r8)
movw $0xffff, %cx            # imm = 0xFFFF
movabsq $-0x4000000000000000, %r14 # imm = 0xC000000000000000
jmp 0xfdd7
testq %r14, %r14
je 0xfdeb
movq %r8, 0x10(%rsp)
bsrq %r14, %rcx
xorq $0x3f, %rcx
shlq %cl, %r14
pushq $0x1
popq %rsi
subl %ecx, %esi
leal -0x3fff(%rsi), %eax
sarl %eax
movl %eax, 0xc(%rsp)
movslq %esi, %r15
movq %r14, %rsi
shrq $0x20, %rsi
movq %r15, %rdi
callq 0xb507
andb $0x1, %r15b
orb $0x2, %r15b
movq %r14, %r12
movl %r15d, %ecx
shrq %cl, %r12
negb %r15b
movl %r15d, %ecx
shlq %cl, %r14
movl %eax, %ebx
movq %rbx, %rdx
shlq $0x20, %rdx
movq %r12, %rdi
movq %r14, %rsi
callq 0xadbc
movq %rax, %r13
shlq $0x1e, %rbx
leaq (%rbx,%rax), %rdi
leaq (%rdi,%rdi), %r15
leaq 0x28(%rsp), %rdx
leaq 0x18(%rsp), %rbp
movq %rdi, %rsi
movq %rbp, %rcx
callq 0xd0a6
subq (%rbp), %r14
leaq 0x28(%rsp), %rax
sbbq (%rax), %r12
leaq (%rbx,%r13), %rax
decq %rax
testq %r12, %r12
jns 0xfcbf
leaq -0x2(%r15), %rcx
movq %rax, %rdx
shrq $0x3f, %rdx
decq %r15
addq %r15, %r14
adcq %rdx, %r12
decq %rax
movq %rcx, %r15
jmp 0xfc9e
movl 0xc(%rsp), %ebx
addl $0x3fff, %ebx           # imm = 0x3FFF
movq %r14, %rdi
xorl %esi, %esi
movq %r15, %rdx
callq 0xadbc
movq %rax, %r12
movabsq $0x3ffffffffffffffe, %rax # imm = 0x3FFFFFFFFFFFFFFE
andq %r12, %rax
cmpq $0x5, %rax
ja 0xfdb1
movl %ebx, 0xc(%rsp)
xorl %ebp, %ebp
cmpq $0x1, %r12
adcq %rbp, %r12
leaq 0x18(%rsp), %rdx
leaq 0x30(%rsp), %r13
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rcx
callq 0xd0a6
xorl %ebx, %ebx
subq (%r13), %rbx
leaq 0x18(%rsp), %rax
sbbq (%rax), %r14
leaq 0x20(%rsp), %rcx
movq %r12, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0xd0a6
xorl %eax, %eax
subq (%r13), %rbx
setb %al
leaq 0x20(%rsp), %rcx
subq (%rcx), %rbp
sbbq $0x0, %rbx
sbbq %rax, %r14
leaq -0x1(,%r12,2), %rax
leaq -0x1(%r12), %rcx
testq %r14, %r14
jns 0xfd9f
movq %rcx, %rdx
shrq $0x3f, %rdx
leaq (%rbx,%rdx), %rsi
addq %r15, %rsi
xorl %edi, %edi
cmpq %rbx, %rsi
setb %dil
movq %rax, %rsi
addq %rbp, %rsi
adcq %rbx, %rdx
addq %r15, %rdx
addq %rax, %rbp
movq %rdx, %rsi
sbbq $0x0, %rsi
adcq %rdi, %r14
movq %rdx, %rbx
decq %r12
addq $-0x2, %rax
decq %rcx
jmp 0xfd5b
orq %r14, %rbx
xorl %eax, %eax
orq %rbp, %rbx
setne %al
orq %rax, %r12
movl 0xc(%rsp), %ebx
leaq (%r12,%r12), %r8
shrq $0x3f, %r12
addq %r15, %r12
movq 0x10(%rsp), %r9
movsbl 0x3(%r9), %edi
xorl %esi, %esi
movl %ebx, %edx
movq %r12, %rcx
callq 0xf265
movq %rax, %r14
movl %edx, %ecx
movq %r14, %rax
movl %ecx, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
xorl %ecx, %ecx
jmp 0xfdd7