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

    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );
    bSig = extractFloat64Frac( b );
    bExp = extractFloat64Exp( b );
    bSign = extractFloat64Sign( b );
    zSign = aSign ^ bSign;
    if ( aExp == 0x7FF ) {
        if (aSig) {
            return propagateFloat64NaN(a, b, status);
        }
        if ( bExp == 0x7FF ) {
            if (bSig) {
                return propagateFloat64NaN(a, b, status);
            }
            float_raise(float_flag_invalid, status);
            return float64_default_nan;
        }
        return packFloat64( zSign, 0x7FF, 0 );
    }
    if ( bExp == 0x7FF ) {
        if (bSig) {
            return propagateFloat64NaN(a, b, status);
        }
        return packFloat64( zSign, 0, 0 );
    }
    if ( bExp == 0 ) {
        if ( bSig == 0 ) {
            if ( ( aExp | aSig ) == 0 ) {
                float_raise(float_flag_invalid, status);
                return float64_default_nan;
            }
            float_raise(float_flag_divbyzero, status);
            return packFloat64( zSign, 0x7FF, 0 );
        }
        normalizeFloat64Subnormal( bSig, &bExp, &bSig );
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return packFloat64( zSign, 0, 0 );
        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
    }
    zExp = aExp - bExp + 0x3FD;
    aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<10;
    bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
    if ( bSig <= ( aSig + aSig ) ) {
        aSig >>= 1;
        ++zExp;
    }
    zSig = estimateDiv128To64( aSig, 0, bSig );
    if ( ( zSig & 0x1FF ) <= 2 ) {
        mul64To128( bSig, zSig, &term0, &term1 );
        sub128( aSig, 0, term0, term1, &rem0, &rem1 );
        while ( (int64_t) rem0 < 0 ) {
            --zSig;
            add128( rem0, rem1, 0, bSig, &rem0, &rem1 );
        }
        zSig |= ( rem1 != 0 );
    }
    return roundAndPackFloat64(zSign, zExp, zSig, status);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdx, %rsi
callq 0x920d
movq %rax, %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x920d
movabsq $0xfffffffffffff, %r14  # imm = 0xFFFFFFFFFFFFF
movq %r12, %r15
andq %r14, %r15
movq %r12, %rdx
shrq $0x34, %rdx
movl $0x7ff, %ecx            # imm = 0x7FF
andq %rcx, %rdx
andq %rax, %r14
movq %rax, %rsi
shrq $0x34, %rsi
andq %rcx, %rsi
movq %rax, %rbp
xorq %r12, %rbp
cmpq %rcx, %rdx
jne 0xd17b
testq %r15, %r15
jne 0xd194
cmpl $0x7ff, %esi            # imm = 0x7FF
jne 0xd2d7
testq %r14, %r14
jne 0xd194
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
orb $0x1, 0x2(%rbx)
jmp 0xd2f1
pushq $0x1
popq %rdi
testq %rsi, %rsi
je 0xd1b0
cmpl $0x7ff, %esi            # imm = 0x7FF
jne 0xd1d2
testq %r14, %r14
je 0xd2b7
movq %r12, %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 %r14, %r14
je 0xd2c9
bsrq %r14, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r14
movl %edi, %eax
subl %ecx, %eax
movslq %eax, %rsi
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
testq %rdx, %rdx
jne 0xd202
testq %r15, %r15
je 0xd2c1
bsrq %r15, %rcx
xorl $0x3f, %ecx
addl $0xf5, %ecx
movzbl %cl, %ecx
shlq %cl, %r15
subl %ecx, %edi
movslq %edi, %rdx
shrq $0x3f, %rbp
subq %rsi, %rdx
shlq $0xa, %r15
btsq $0x3e, %r15
shlq $0xb, %r14
orq %rax, %r14
leaq (%r15,%r15), %rax
xorl %ecx, %ecx
cmpq %rax, %r14
setbe %cl
shrq %cl, %r15
leaq (%rcx,%rdx), %r12
addq $0x3fd, %r12            # imm = 0x3FD
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xadbc
movq %rax, %r13
andl $0x1ff, %eax            # imm = 0x1FF
cmpl $0x2, %eax
ja 0xd297
movq %r12, (%rsp)
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %r12
movq %r14, %rdi
movq %r13, %rsi
movq %r12, %rcx
callq 0xd0a6
xorl %eax, %eax
subq (%r12), %rax
leaq 0x8(%rsp), %rcx
sbbq (%rcx), %r15
testq %r15, %r15
jns 0xd288
decq %r13
addq %r14, %rax
adcq $0x0, %r15
jmp 0xd277
xorl %ecx, %ecx
testq %rax, %rax
setne %cl
orq %rcx, %r13
movq (%rsp), %r12
movzbl %bpl, %edi
movq %r12, %rsi
movq %r13, %rdx
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x973e
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %rbp
movq %rbp, %rax
jmp 0xd2f1
orq %r15, %rdx
movb 0x2(%rbx), %cl
je 0xd300
orb $0x4, %cl
movb %cl, 0x2(%rbx)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %rbp
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
orq %rbp, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
orb $0x1, %cl
movb %cl, 0x2(%rbx)
jmp 0xd2f1