// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/softfloat.c
// Function: float128_div
float128 float128_div(float128 a, float128 b, float_status *status)
{
    flag aSign, bSign, zSign;
    int32 aExp, bExp, zExp;
    uint64_t aSig0, aSig1, bSig0, bSig1, zSig0, zSig1, zSig2;
    uint64_t rem0, rem1, rem2, rem3, term0, term1, term2, term3;
    float128 z;

    aSig1 = extractFloat128Frac1( a );
    aSig0 = extractFloat128Frac0( a );
    aExp = extractFloat128Exp( a );
    aSign = extractFloat128Sign( a );
    bSig1 = extractFloat128Frac1( b );
    bSig0 = extractFloat128Frac0( b );
    bExp = extractFloat128Exp( b );
    bSign = extractFloat128Sign( b );
    zSign = aSign ^ bSign;
    if ( aExp == 0x7FFF ) {
        if (aSig0 | aSig1) {
            return propagateFloat128NaN(a, b, status);
        }
        if ( bExp == 0x7FFF ) {
            if (bSig0 | bSig1) {
                return propagateFloat128NaN(a, b, status);
            }
            goto invalid;
        }
        return packFloat128( zSign, 0x7FFF, 0, 0 );
    }
    if ( bExp == 0x7FFF ) {
        if (bSig0 | bSig1) {
            return propagateFloat128NaN(a, b, status);
        }
        return packFloat128( zSign, 0, 0, 0 );
    }
    if ( bExp == 0 ) {
        if ( ( bSig0 | bSig1 ) == 0 ) {
            if ( ( aExp | aSig0 | aSig1 ) == 0 ) {
 invalid:
                float_raise(float_flag_invalid, status);
                z.low = float128_default_nan_low;
                z.high = float128_default_nan_high;
                return z;
            }
            float_raise(float_flag_divbyzero, status);
            return packFloat128( zSign, 0x7FFF, 0, 0 );
        }
        normalizeFloat128Subnormal( bSig0, bSig1, &bExp, &bSig0, &bSig1 );
    }
    if ( aExp == 0 ) {
        if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( zSign, 0, 0, 0 );
        normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 );
    }
    zExp = aExp - bExp + 0x3FFD;
    shortShift128Left(
        aSig0 | LIT64( 0x0001000000000000 ), aSig1, 15, &aSig0, &aSig1 );
    shortShift128Left(
        bSig0 | LIT64( 0x0001000000000000 ), bSig1, 15, &bSig0, &bSig1 );
    if ( le128( bSig0, bSig1, aSig0, aSig1 ) ) {
        shift128Right( aSig0, aSig1, 1, &aSig0, &aSig1 );
        ++zExp;
    }
    zSig0 = estimateDiv128To64( aSig0, aSig1, bSig0 );
    mul128By64To192( bSig0, bSig1, zSig0, &term0, &term1, &term2 );
    sub192( aSig0, aSig1, 0, term0, term1, term2, &rem0, &rem1, &rem2 );
    while ( (int64_t) rem0 < 0 ) {
        --zSig0;
        add192( rem0, rem1, rem2, 0, bSig0, bSig1, &rem0, &rem1, &rem2 );
    }
    zSig1 = estimateDiv128To64( rem1, rem2, bSig0 );
    if ( ( zSig1 & 0x3FFF ) <= 4 ) {
        mul128By64To192( bSig0, bSig1, zSig1, &term1, &term2, &term3 );
        sub192( rem1, rem2, 0, term1, term2, term3, &rem1, &rem2, &rem3 );
        while ( (int64_t) rem1 < 0 ) {
            --zSig1;
            add192( rem1, rem2, rem3, 0, bSig0, bSig1, &rem1, &rem2, &rem3 );
        }
        zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 );
    }
    shift128ExtraRightJamming( zSig0, zSig1, 0, 15, &zSig0, &zSig1, &zSig2 );
    return roundAndPackFloat128(zSign, zExp, zSig0, zSig1, zSig2, status);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r14
movq %rdi, %rbx
movq %rdi, 0x58(%rsp)
movabsq $0xffffffffffff, %rdi   # imm = 0xFFFFFFFFFFFF
movq %rsi, %r13
andq %rdi, %r13
movq %r13, 0x60(%rsp)
movq %rsi, %rax
shrq $0x30, %rax
movl $0x7fff, %r9d           # imm = 0x7FFF
movl %eax, %r11d
andl %r9d, %r11d
movl %r11d, 0x2c(%rsp)
movq %rdx, 0x38(%rsp)
andq %rcx, %rdi
movq %rdi, 0x40(%rsp)
movq %rcx, %r8
shrq $0x30, %r8
andl %r9d, %r8d
movl %r8d, 0x4(%rsp)
movq %rcx, %r10
xorq %rsi, %r10
cmpl %r9d, %r11d
jne 0x130d1
orq %rbx, %r13
jne 0x130e8
cmpl $0x7fff, %r8d           # imm = 0x7FFF
jne 0x1345c
orq %rdx, %rdi
jne 0x130e8
jmp 0x13478
testl %r8d, %r8d
je 0x130f8
cmpl $0x7fff, %r8d           # imm = 0x7FFF
jne 0x1312a
orq %rdx, %rdi
je 0x13438
movq %rbx, %rdi
movq %r14, %r8
callq 0x122b1
jmp 0x13508
movq %rdi, %rcx
orq %rdx, %rcx
je 0x1344a
leaq 0x4(%rsp), %rax
leaq 0x40(%rsp), %rcx
leaq 0x38(%rsp), %r8
movq %rdx, %rsi
movq %rax, %rdx
movq %r10, %r15
movl %r11d, %ebp
callq 0x11f34
movl %ebp, %r11d
movq %r15, %r10
movabsq $-0x8000000000000000, %r12 # imm = 0x8000000000000000
testl %r11d, %r11d
je 0x13140
movq %r14, 0x30(%rsp)
jmp 0x13184
movq %r13, %rax
orq %rbx, %rax
je 0x13500
movq %r14, 0x30(%rsp)
leaq 0x2c(%rsp), %r14
leaq 0x60(%rsp), %r15
leaq 0x58(%rsp), %rbp
movq %r13, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %r15, %rcx
movq %rbp, %r8
movq %r10, %rbx
callq 0x11f34
movq %rbx, %r10
movl (%r14), %r11d
movq (%r15), %r13
movq (%rbp), %rbx
subl 0x4(%rsp), %r11d
movq %rbx, %r14
shlq $0xf, %r14
shldq $0xf, %rbx, %r13
orq %r12, %r13
movq 0x40(%rsp), %rax
movq 0x38(%rsp), %r15
movq %r15, %rbp
shlq $0xf, %rbp
shlq $0xf, %rax
orq %r12, %rax
movq %r15, %rdx
shrq $0x31, %rdx
movq %rax, 0x20(%rsp)
orq %rax, %rdx
cmpq %r13, %rdx
setne %al
cmpq %r14, %rbp
seta %cl
cmpq %r13, %rdx
jb 0x131dd
orb %al, %cl
je 0x131dd
addl $0x3ffd, %r11d          # imm = 0x3FFD
jmp 0x131f0
shrq $0x31, %rbx
shrq %r13
shrdq $0x1, %rbx, %r14
addl $0x3ffe, %r11d          # imm = 0x3FFE
movl %r11d, (%rsp)
shrq $0x3f, %r10
movq %r10, 0x18(%rsp)
movq %r13, %rdi
movq %r14, %rsi
movq %rdx, 0x8(%rsp)
callq 0xba2b
movq %rax, %r12
movq %rbp, %rdi
shrq $0x20, %rdi
movq %rax, %r8
shrq $0x20, %r8
movl %ebp, %edx
andl $0xffff8000, %edx       # imm = 0xFFFF8000
movl %r12d, %r9d
movq %r8, %rax
movq %rdx, 0x50(%rsp)
imulq %rdx, %rax
movq %r9, %rsi
imulq %rdi, %rsi
movq %r8, %rdx
movq %rdi, 0x10(%rsp)
imulq %rdi, %rdx
xorl %edi, %edi
addq %rax, %rsi
setb %dil
shlq $0x20, %rdi
movq %rsi, %rbx
shrq $0x20, %rbx
shlq $0x20, %rsi
movq %r12, %rax
imulq %rbp, %rax
movq 0x20(%rsp), %r11
shrq $0x20, %r11
movl 0x8(%rsp), %ecx
movq %r8, %r10
movq %rcx, 0x48(%rsp)
imulq %rcx, %r10
imulq %r11, %r9
movq %r11, 0x20(%rsp)
imulq %r11, %r8
xorl %r11d, %r11d
addq %r10, %r9
setae %r11b
movq %r9, %r10
shrq $0x20, %r10
addq %r8, %r10
subq %r10, %r13
shlq $0x20, %r11
addq %r11, %r13
movq %r12, %r8
movq 0x8(%rsp), %rcx
movq %rcx, %r10
imulq %rcx, %r8
addq %r8, %rdx
addq %rbx, %rdx
shlq $0x20, %r9
cmpq %rsi, %rax
adcq %rdi, %rdx
xorl %esi, %esi
cmpq %r8, %rdx
setb %sil
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
addq %rcx, %r13
cmpq %r9, %r8
sbbq $0x0, %r13
subq %rdx, %r14
sbbq %rsi, %r13
negq %rax
sbbq $0x0, %r14
sbbq $0x0, %r13
js 0x13302
movq %rax, %rbx
movq %r10, %rdx
jmp 0x1333d
movq %r12, %rdx
shlq $0xf, %rdx
movl $0x8000, %ecx           # imm = 0x8000
subq %rdx, %rcx
imulq %r15, %rcx
movq %r10, %rdx
decq %r12
xorl %esi, %esi
addq %rdx, %r14
setb %sil
cmpq %rax, %rcx
adcq $0x0, %r14
adcq %rsi, %r13
leaq (%rax,%rbp), %rbx
addq %rbp, %rcx
movq %rbx, %rax
testq %r13, %r13
js 0x13318
movq %r14, %rdi
movq %rbx, %rsi
callq 0xba2b
movl %eax, %ecx
andl $0x3fff, %ecx           # imm = 0x3FFF
cmpl $0x4, %ecx
ja 0x1342b
movabsq $0x100000000, %rsi      # imm = 0x100000000
movq %rax, %rdi
shrq $0x20, %rdi
movl %eax, %edx
movq 0x50(%rsp), %rcx
imulq %rdi, %rcx
movq %rdx, %r8
movq 0x10(%rsp), %r13
imulq %r13, %r8
imulq %rdi, %r13
xorl %r9d, %r9d
addq %rcx, %r8
cmovaeq %r9, %rsi
movq %rsi, 0x10(%rsp)
movq %r8, %r10
shrq $0x20, %r10
shlq $0x20, %r8
movq 0x48(%rsp), %r11
imulq %rdi, %r11
movq 0x20(%rsp), %rcx
imulq %rcx, %rdx
imulq %rcx, %rdi
movq %rax, %rcx
imulq %rbp, %rcx
addq %r11, %rdx
movabsq $-0x100000000, %r11     # imm = 0xFFFFFFFF00000000
cmovaeq %r9, %r11
movq %rax, %r9
imulq 0x8(%rsp), %r9
addq %r9, %r13
addq %r10, %r13
movq %rdx, %r10
shrq $0x20, %r10
shlq $0x20, %rdx
cmpq %r8, %rcx
adcq 0x10(%rsp), %r13
xorl %esi, %esi
cmpq %r9, %r13
setb %sil
addq %rdi, %r10
subq %r10, %r14
addq %r11, %r14
cmpq %rdx, %r9
sbbq $0x0, %r14
subq %r13, %rbx
sbbq %rsi, %r14
negq %rcx
sbbq $0x0, %rbx
sbbq $0x0, %r14
movl (%rsp), %esi
js 0x1348b
movq %rcx, %rdx
movq 0x18(%rsp), %rdi
jmp 0x134cc
movq 0x18(%rsp), %rdi
movl (%rsp), %esi
jmp 0x134da
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %r10
jmp 0x13503
andl $0x7fff, %eax           # imm = 0x7FFF
orq %rbx, %rax
orq %r13, %rax
je 0x13478
orb $0x4, 0x2(%r14)
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
andq %rax, %r10
movabsq $0x7fff000000000000, %rdx # imm = 0x7FFF000000000000
orq %r10, %rdx
jmp 0x13487
orb $0x1, 0x2(%r14)
movabsq $0x7fff800000000000, %rdx # imm = 0x7FFF800000000000
xorl %eax, %eax
jmp 0x13508
movq %rax, %rdx
shlq $0xf, %rdx
movl $0x8000, %edi           # imm = 0x8000
subq %rdx, %rdi
imulq %rdi, %r15
movq 0x18(%rsp), %rdi
movq 0x8(%rsp), %r13
decq %rax
xorl %edx, %edx
addq %r13, %rbx
setb %dl
cmpq %rcx, %r15
adcq $0x0, %rbx
adcq %rdx, %r14
leaq (%rcx,%rbp), %rdx
addq %rbp, %r15
movq %rdx, %rcx
testq %r14, %r14
js 0x134a8
orq %rbx, %r14
xorl %ecx, %ecx
orq %rdx, %r14
setne %cl
orq %rcx, %rax
movq %r12, %rcx
shldq $0x31, %rax, %rcx
shlq $0x31, %rax
shrq $0xf, %r12
movzbl %dil, %edi
movq %r12, %rdx
movq %rax, %r8
movq 0x30(%rsp), %r9
callq 0x12ddf
jmp 0x13508
andq %r12, %r10
xorl %eax, %eax
movq %r10, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq