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

    aSig1 = extractFloat128Frac1( a );
    aSig0 = extractFloat128Frac0( a );
    aExp = extractFloat128Exp( a );
    aSign = extractFloat128Sign( a );
    if ( aExp == 0x7FFF ) {
        if (aSig0 | aSig1) {
            return propagateFloat128NaN(a, a, status);
        }
        if ( ! aSign ) return a;
        goto invalid;
    }
    if ( aSign ) {
        if ( ( aExp | aSig0 | aSig1 ) == 0 ) return a;
 invalid:
        float_raise(float_flag_invalid, status);
        z.low = float128_default_nan_low;
        z.high = float128_default_nan_high;
        return z;
    }
    if ( aExp == 0 ) {
        if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( 0, 0, 0, 0 );
        normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 );
    }
    zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFE;
    aSig0 |= LIT64( 0x0001000000000000 );
    zSig0 = estimateSqrt32( aExp, aSig0>>17 );
    shortShift128Left( aSig0, aSig1, 13 - ( 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 & 0x1FFF ) <= 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 );
    }
    shift128ExtraRightJamming( zSig0, zSig1, 0, 14, &zSig0, &zSig1, &zSig2 );
    return roundAndPackFloat128(0, zExp, zSig0, zSig1, zSig2, status);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r8
movq %rdi, %r15
movabsq $0xffffffffffff, %rbx   # imm = 0xFFFFFFFFFFFF
movq %rdi, 0x30(%rsp)
movq %rsi, %rdi
andq %rbx, %rdi
movq %rdi, 0x38(%rsp)
movq %rsi, %rcx
shrq $0x30, %rcx
movl $0x7fff, %edx           # imm = 0x7FFF
movl %ecx, %eax
andl %edx, %eax
movl %eax, 0xc(%rsp)
cmpl %edx, %eax
jne 0x11fc1
orq %r15, %rdi
je 0x11fd1
movq %r15, %rdi
movq %r15, %rdx
movq %rsi, %rcx
callq 0x10ca1
jmp 0x121f6
testq %rsi, %rsi
js 0x11fdc
testl %eax, %eax
je 0x12005
movq %r8, 0x10(%rsp)
jmp 0x12041
testq %rsi, %rsi
jns 0x121fc
jmp 0x11fee
andl $0x7fff, %ecx           # imm = 0x7FFF
orq %r15, %rcx
orq %rdi, %rcx
je 0x121fc
orb $0x1, 0x2(%r8)
movabsq $0x7fff800000000000, %rsi # imm = 0x7FFF800000000000
xorl %r15d, %r15d
jmp 0x121fc
movq %rdi, %rax
orq %r15, %rax
je 0x12211
movq %r8, 0x10(%rsp)
leaq 0xc(%rsp), %r14
leaq 0x38(%rsp), %r12
leaq 0x30(%rsp), %r13
movq %r15, %rsi
movq %r14, %rdx
movq %r12, %rcx
movq %r13, %r8
callq 0x1092e
movl (%r14), %eax
movq (%r12), %rdi
movq (%r13), %r15
leal -0x3fff(%rax), %ecx
sarl %ecx
movl %ecx, 0x8(%rsp)
incq %rbx
orq %rdi, %rbx
movslq %eax, %r14
movq %rbx, %rsi
shrq $0x11, %rsi
movq %r14, %rdi
callq 0xb507
andb $0x1, %r14b
xorb $0xd, %r14b
movq %r15, %r12
movl %r14d, %ecx
shlq %cl, %r12
shlq %cl, %rbx
negb %r14b
movl %r14d, %ecx
shrq %cl, %r15
movl %eax, %r14d
orq %rbx, %r15
movq %r14, %rdx
shlq $0x20, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0xadbc
shlq $0x1e, %r14
addq %rax, %r14
leaq (%r14,%r14), %r13
leaq 0x40(%rsp), %rbx
leaq 0x20(%rsp), %rbp
movq %r14, %rdi
movq %r14, %rsi
movq %rbx, %rdx
movq %rbp, %rcx
callq 0xd0a6
subq (%rbp), %r12
sbbq (%rbx), %r15
testq %r15, %r15
jns 0x120e8
decq %r14
leaq -0x2(%r13), %rax
movq %r14, %rcx
shrq $0x3f, %rcx
decq %r13
addq %r13, %r12
adcq %rcx, %r15
movq %rax, %r13
jmp 0x120c7
movl 0x8(%rsp), %ebx
addl $0x3ffe, %ebx           # imm = 0x3FFE
movq %r12, %rdi
xorl %esi, %esi
movq %r13, %rdx
callq 0xadbc
movq %rax, %r15
andl $0x1ffe, %eax           # imm = 0x1FFE
cmpl $0x5, %eax
ja 0x121d2
movl %ebx, 0x8(%rsp)
xorl %ebx, %ebx
cmpq $0x1, %r15
adcq %rbx, %r15
leaq 0x20(%rsp), %rdx
leaq 0x18(%rsp), %rcx
movq %r13, %rdi
movq %r15, %rsi
callq 0xd0a6
xorl %ebp, %ebp
leaq 0x18(%rsp), %rdx
subq (%rdx), %rbp
leaq 0x20(%rsp), %rax
sbbq (%rax), %r12
leaq 0x28(%rsp), %rcx
movq %r15, %rdi
movq %r15, %rsi
callq 0xd0a6
xorl %eax, %eax
leaq 0x18(%rsp), %rcx
subq (%rcx), %rbp
setb %al
leaq 0x28(%rsp), %rcx
subq (%rcx), %rbx
sbbq $0x0, %rbp
sbbq %rax, %r12
leaq -0x1(,%r15,2), %rax
leaq -0x1(%r15), %rcx
testq %r12, %r12
jns 0x121c0
movq %rcx, %rdx
shrq $0x3f, %rdx
leaq (%rdx,%rbp), %rsi
addq %r13, %rsi
xorl %edi, %edi
cmpq %rbp, %rsi
setb %dil
movq %rax, %rsi
addq %rbx, %rsi
adcq %rbp, %rdx
addq %r13, %rdx
addq %rax, %rbx
movq %rdx, %rsi
sbbq $0x0, %rsi
adcq %rdi, %r12
movq %rdx, %rbp
decq %r15
addq $-0x2, %rax
decq %rcx
jmp 0x1217c
orq %r12, %rbp
xorl %eax, %eax
orq %rbx, %rbp
setne %al
orq %rax, %r15
movl 0x8(%rsp), %ebx
movq %r14, %rcx
shldq $0x32, %r15, %rcx
shlq $0x32, %r15
shrq $0xe, %r14
xorl %edi, %edi
movl %ebx, %esi
movq %r14, %rdx
movq %r15, %r8
movq 0x10(%rsp), %r9
callq 0x115fc
movq %rax, %r15
movq %rdx, %rsi
movq %r15, %rax
movq %rsi, %rdx
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r15d, %r15d
xorl %esi, %esi
jmp 0x121fc