// File: /workspace/github_c_makefile_star2_O1/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
pushq %rax
movq %rdx, %rbx
movabsq $-0x8000000000000000, %r14 # imm = 0x8000000000000000
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
movabsq $0xfffffffffffff, %rbp  # imm = 0xFFFFFFFFFFFFF
movb 0x5(%rdx), %cl
testb %cl, %cl
je 0xe088
testq %rax, %rdi
setne %dl
testq %rbp, %rdi
sete %r8b
orb %dl, %r8b
jne 0xe088
orb $0x40, 0x2(%rbx)
andq %r14, %rdi
testb %cl, %cl
je 0xe0a3
testq %rax, %rsi
setne %cl
testq %rbp, %rsi
sete %dl
orb %cl, %dl
jne 0xe0a3
orb $0x40, 0x2(%rbx)
andq %r14, %rsi
movq %rdi, %r12
andq %rbp, %r12
movq %rdi, %rdx
shrq $0x34, %rdx
movl $0x7ff, %ecx            # imm = 0x7FF
andq %rcx, %rdx
andq %rsi, %rbp
movq %rsi, %r8
shrq $0x34, %r8
andq %rcx, %r8
movq %rsi, %r15
xorq %rdi, %r15
cmpq %rcx, %rdx
jne 0xe0fa
testq %r12, %r12
jne 0xe111
cmpl $0x7ff, %r8d            # imm = 0x7FF
jne 0xe24c
testq %rbp, %rbp
jne 0xe111
movabsq $0x7ff8000000000000, %r15 # imm = 0x7FF8000000000000
orb $0x1, 0x2(%rbx)
jmp 0xe252
testq %r8, %r8
je 0xe127
cmpl $0x7ff, %r8d            # imm = 0x7FF
jne 0xe14c
testq %rbp, %rbp
je 0xe239
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdb26
testq %rbp, %rbp
je 0xe23e
bsrq %rbp, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %rbp
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %r8
testq %rdx, %rdx
jne 0xe176
testq %r12, %r12
je 0xe239
bsrq %r12, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r12
movl $0x1, %eax
subl %ecx, %eax
movslq %eax, %rdx
shrq $0x3f, %r15
subq %r8, %rdx
shlq $0xa, %r12
btsq $0x3e, %r12
shlq $0xb, %rbp
orq %rbp, %r14
leaq (%r12,%r12), %rax
xorl %ecx, %ecx
cmpq %rax, %r14
setbe %cl
shrq %cl, %r12
leaq (%rcx,%rdx), %r13
addq $0x3fd, %r13            # imm = 0x3FD
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xb99f
movl %eax, %ecx
andl $0x1ff, %ecx            # imm = 0x1FF
cmpl $0x2, %ecx
ja 0xe292
movq %r14, %rcx
shrq $0x20, %rcx
movq %rax, %rsi
shrq $0x20, %rsi
andl $0xfffff800, %ebp       # imm = 0xFFFFF800
movl %eax, %edx
imulq %rsi, %rbp
imulq %rcx, %rdx
imulq %rcx, %rsi
xorl %edi, %edi
addq %rbp, %rdx
setae %dil
shlq $0x20, %rdi
movq %rdx, %r8
shrq $0x20, %r8
movq %rax, %r9
imulq %r14, %r9
xorl %r10d, %r10d
movq %r9, %rcx
negq %rcx
sbbq %r10, %r10
addq %rsi, %r8
subq %r8, %r10
addq %r12, %r10
addq %rdi, %r10
shlq $0x20, %rdx
cmpq %rdx, %r9
sbbq $0x0, %r10
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %r10, %rdx
js 0xe264
movq %rcx, %rdi
jmp 0xe287
andq %r14, %r15
jmp 0xe252
orq %r12, %rdx
movb 0x2(%rbx), %cl
je 0xe2b2
orb $0x4, %cl
movb %cl, 0x2(%rbx)
andq %r14, %r15
orq %rax, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %esi
subq %rax, %rsi
imulq %r14, %rsi
decq %rax
leaq (%rcx,%r14), %rdi
cmpq %rcx, %rsi
leaq (%rsi,%r14), %rsi
adcq $0x0, %rdx
movq %rdi, %rcx
js 0xe270
xorl %ecx, %ecx
testq %rdi, %rdi
setne %cl
orq %rcx, %rax
movzbl %r15b, %edi
movq %r13, %rsi
movq %rax, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa1a9
movabsq $0x7ff8000000000000, %r15 # imm = 0x7FF8000000000000
orb $0x1, %cl
movb %cl, 0x2(%rbx)
jmp 0xe252