// File: /workspace/github_c_makefile_star2_O3/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 $0xfffffffffffff, %rbp  # imm = 0xFFFFFFFFFFFFF
cmpb $0x0, 0x5(%rdx)
je 0xe12a
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
testq %rax, %rdi
setne %cl
testq %rbp, %rdi
sete %dl
orb %cl, %dl
jne 0xe113
orb $0x40, 0x2(%rbx)
andq %r14, %rdi
testq %rax, %rsi
setne %al
testq %rbp, %rsi
sete %cl
orb %al, %cl
jne 0xe12a
orb $0x40, 0x2(%rbx)
andq %r14, %rsi
movq %rdi, %r15
andq %rbp, %r15
movq %rdi, %rax
shrq $0x34, %rax
movl $0x7ff, %ecx            # imm = 0x7FF
andq %rcx, %rax
andq %rsi, %rbp
movq %rsi, %rdx
shrq $0x34, %rdx
andq %rcx, %rdx
movq %rsi, %r13
xorq %rdi, %r13
cmpq %rcx, %rax
jne 0xe180
testq %r15, %r15
jne 0xe196
cmpl $0x7ff, %edx            # imm = 0x7FF
jne 0xe2d4
testq %rbp, %rbp
jne 0xe196
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
orb $0x1, 0x2(%rbx)
jmp 0xe2e4
testq %rdx, %rdx
je 0xe1ac
cmpl $0x7ff, %edx            # imm = 0x7FF
jne 0xe1d2
testq %rbp, %rbp
je 0xe2be
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdbdb
testq %rbp, %rbp
je 0xe2c6
bsrq %rbp, %rcx
xorl $0x3f, %ecx
addl $0xf5, %ecx
movzbl %cl, %ecx
shlq %cl, %rbp
movl $0x1, %edx
subl %ecx, %edx
movslq %edx, %rdx
testq %rax, %rax
jne 0xe1fb
testq %r15, %r15
je 0xe2be
bsrq %r15, %rax
xorl $0x3f, %eax
addl $0xf5, %eax
movzbl %al, %ecx
shlq %cl, %r15
movl $0x1, %eax
subl %ecx, %eax
cltq
shrq $0x3f, %r13
subq %rdx, %rax
shlq $0xa, %r15
btsq $0x3e, %r15
shlq $0xb, %rbp
orq %rbp, %r14
leaq (%r15,%r15), %rdx
xorl %ecx, %ecx
cmpq %rdx, %r14
setbe %cl
shrq %cl, %r15
leaq (%rcx,%rax), %r12
addq $0x3fd, %r12            # imm = 0x3FD
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xba2b
movl %eax, %ecx
andl $0x1ff, %ecx            # imm = 0x1FF
cmpl $0x2, %ecx
ja 0xe321
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 %r15, %r10
addq %rdi, %r10
shlq $0x20, %rdx
cmpq %rdx, %r9
sbbq $0x0, %r10
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
addq %r10, %rdx
js 0xe2f3
movq %rcx, %rdi
jmp 0xe316
andq %r14, %r13
movq %r13, %rax
jmp 0xe2e4
orq %r15, %rax
movb 0x2(%rbx), %cl
je 0xe341
orb $0x4, %cl
movb %cl, 0x2(%rbx)
andq %r14, %r13
movabsq $0x7ff0000000000000, %rax # imm = 0x7FF0000000000000
orq %r13, %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 0xe2ff
xorl %ecx, %ecx
testq %rdi, %rdi
setne %cl
orq %rcx, %rax
movzbl %r13b, %edi
movq %r12, %rsi
movq %rax, %rdx
movq %rbx, %rcx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa25f
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
orb $0x1, %cl
movb %cl, 0x2(%rbx)
jmp 0xe2e4