// File: /workspace/github_c_makefile_star2_O1/mbitsnbites[P]SoftFP/softfloat.c
// Function: float128_rem
float128 float128_rem(float128 a, float128 b, float_status *status)
{
    flag aSign, zSign;
    int32 aExp, bExp, expDiff;
    uint64_t aSig0, aSig1, bSig0, bSig1, q, term0, term1, term2;
    uint64_t allZero, alternateASig0, alternateASig1, sigMean1;
    int64_t sigMean0;
    float128 z;

    aSig1 = extractFloat128Frac1( a );
    aSig0 = extractFloat128Frac0( a );
    aExp = extractFloat128Exp( a );
    aSign = extractFloat128Sign( a );
    bSig1 = extractFloat128Frac1( b );
    bSig0 = extractFloat128Frac0( b );
    bExp = extractFloat128Exp( b );
    if ( aExp == 0x7FFF ) {
        if (    ( aSig0 | aSig1 )
             || ( ( bExp == 0x7FFF ) && ( bSig0 | bSig1 ) ) ) {
            return propagateFloat128NaN(a, b, status);
        }
        goto invalid;
    }
    if ( bExp == 0x7FFF ) {
        if (bSig0 | bSig1) {
            return propagateFloat128NaN(a, b, status);
        }
        return a;
    }
    if ( bExp == 0 ) {
        if ( ( bSig0 | bSig1 ) == 0 ) {
 invalid:
            float_raise(float_flag_invalid, status);
            z.low = float128_default_nan_low;
            z.high = float128_default_nan_high;
            return z;
        }
        normalizeFloat128Subnormal( bSig0, bSig1, &bExp, &bSig0, &bSig1 );
    }
    if ( aExp == 0 ) {
        if ( ( aSig0 | aSig1 ) == 0 ) return a;
        normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 );
    }
    expDiff = aExp - bExp;
    if ( expDiff < -1 ) return a;
    shortShift128Left(
        aSig0 | LIT64( 0x0001000000000000 ),
        aSig1,
        15 - ( expDiff < 0 ),
        &aSig0,
        &aSig1
    );
    shortShift128Left(
        bSig0 | LIT64( 0x0001000000000000 ), bSig1, 15, &bSig0, &bSig1 );
    q = le128( bSig0, bSig1, aSig0, aSig1 );
    if ( q ) sub128( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 );
    expDiff -= 64;
    while ( 0 < expDiff ) {
        q = estimateDiv128To64( aSig0, aSig1, bSig0 );
        q = ( 4 < q ) ? q - 4 : 0;
        mul128By64To192( bSig0, bSig1, q, &term0, &term1, &term2 );
        shortShift192Left( term0, term1, term2, 61, &term1, &term2, &allZero );
        shortShift128Left( aSig0, aSig1, 61, &aSig0, &allZero );
        sub128( aSig0, 0, term1, term2, &aSig0, &aSig1 );
        expDiff -= 61;
    }
    if ( -64 < expDiff ) {
        q = estimateDiv128To64( aSig0, aSig1, bSig0 );
        q = ( 4 < q ) ? q - 4 : 0;
        q >>= - expDiff;
        shift128Right( bSig0, bSig1, 12, &bSig0, &bSig1 );
        expDiff += 52;
        if ( expDiff < 0 ) {
            shift128Right( aSig0, aSig1, - expDiff, &aSig0, &aSig1 );
        }
        else {
            shortShift128Left( aSig0, aSig1, expDiff, &aSig0, &aSig1 );
        }
        mul128By64To192( bSig0, bSig1, q, &term0, &term1, &term2 );
        sub128( aSig0, aSig1, term1, term2, &aSig0, &aSig1 );
    }
    else {
        shift128Right( aSig0, aSig1, 12, &aSig0, &aSig1 );
        shift128Right( bSig0, bSig1, 12, &bSig0, &bSig1 );
    }
    do {
        alternateASig0 = aSig0;
        alternateASig1 = aSig1;
        ++q;
        sub128( aSig0, aSig1, bSig0, bSig1, &aSig0, &aSig1 );
    } while ( 0 <= (int64_t) aSig0 );
    add128(
        aSig0, aSig1, alternateASig0, alternateASig1, (uint64_t *)&sigMean0, &sigMean1 );
    if (    ( sigMean0 < 0 )
         || ( ( ( sigMean0 | sigMean1 ) == 0 ) && ( q & 1 ) ) ) {
        aSig0 = alternateASig0;
        aSig1 = alternateASig1;
    }
    zSign = ( (int64_t) aSig0 < 0 );
    if ( zSign ) sub128( 0, 0, aSig0, aSig1, &aSig0, &aSig1 );
    return normalizeRoundAndPackFloat128(aSign ^ zSign, bExp - 4, aSig0, aSig1,
                                         status);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r8, %r13
movq %rsi, %rbp
movq %rdi, %r15
movabsq $0xffffffffffff, %rbx   # imm = 0xFFFFFFFFFFFF
movq %rdi, 0x8(%rsp)
movq %rsi, %r12
andq %rbx, %r12
movq %r12, 0x10(%rsp)
movq %rsi, %r14
shrq $0x30, %r14
movl $0x7fff, %esi           # imm = 0x7FFF
andl %esi, %r14d
movl %r14d, 0x34(%rsp)
movq %rdx, 0x20(%rsp)
movq %rcx, %rdi
andq %rbx, %rdi
movq %rdi, 0x28(%rsp)
movq %rcx, %rax
shrq $0x30, %rax
andl %esi, %eax
movl %eax, 0x30(%rsp)
cmpl %esi, %r14d
jne 0x13528
orq %r15, %r12
jne 0x13538
cmpl $0x7fff, %eax           # imm = 0x7FFF
setne %al
orq %rdx, %rdi
sete %sil
orb %al, %sil
je 0x13538
jmp 0x13798
testl %eax, %eax
je 0x13561
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x13587
orq %rdx, %rdi
je 0x1354c
movq %r15, %rdi
movq %rbp, %rsi
movq %r13, %r8
callq 0x12261
movq %rax, %r15
movq %rdx, %rbp
movq %r15, %rax
movq %rbp, %rdx
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rax
orq %rdx, %rax
je 0x13798
leaq 0x30(%rsp), %rax
leaq 0x28(%rsp), %rcx
leaq 0x20(%rsp), %r8
movq %rdx, %rsi
movq %rax, %rdx
callq 0x11f08
testl %r14d, %r14d
jne 0x135ae
movq %r12, %rax
orq %r15, %rax
je 0x1354c
leaq 0x34(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0x8(%rsp), %r8
movq %r12, %rdi
movq %r15, %rsi
callq 0x11f08
movq %r13, 0x50(%rsp)
movl 0x34(%rsp), %r13d
movl 0x30(%rsp), %esi
subl %esi, %r13d
cmpl $-0x1, %r13d
jl 0x1354c
movq %rbp, 0x48(%rsp)
incq %rbx
orq 0x10(%rsp), %rbx
movq 0x8(%rsp), %rdx
cmpl $-0x1, %r13d
sete %al
movl %eax, %ecx
xorb $0xf, %cl
movq %rdx, %r9
shlq %cl, %r9
shlq %cl, %rbx
movq %r9, 0x8(%rsp)
addb $0x31, %al
movl %eax, %ecx
shrq %cl, %rdx
orq %rbx, %rdx
movq %rdx, 0x10(%rsp)
movq 0x28(%rsp), %r14
movq 0x20(%rsp), %rbx
movq %rbx, %r10
shlq $0xf, %r10
movq %r10, 0x20(%rsp)
shlq $0xf, %r14
btsq $0x3f, %r14
shrq $0x31, %rbx
leaq (%rbx,%r14), %r8
movq %r8, 0x28(%rsp)
cmpq %r8, %rdx
seta %cl
sete %dil
cmpq %r10, %r9
setae %al
andb %dil, %al
orb %cl, %al
cmpb $0x1, %al
jne 0x13655
subq %r10, %r9
movq %r9, 0x8(%rsp)
sbbq %r8, %rdx
movq %rdx, 0x10(%rsp)
movq %r8, 0x38(%rsp)
movq 0x10(%rsp), %r12
movq 0x8(%rsp), %rbp
cmpl $0x41, %r13d
movl %esi, 0x1c(%rsp)
movq %r10, 0x40(%rsp)
jl 0x137af
movq %rbx, 0x58(%rsp)
movq %r10, %rax
shrq $0x20, %rax
movq %rax, 0x70(%rsp)
movl %r10d, %eax
andl $0xffff8000, %eax       # imm = 0xFFFF8000
movq %rax, 0x68(%rsp)
shrq $0x20, %r14
movl 0x38(%rsp), %eax
movq %rax, 0x60(%rsp)
addl $-0x3, %r13d
movq %r12, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %rbx
movq %rbx, %rdx
callq 0xb99f
movq %rax, %r15
subq $0x4, %r15
movl $0x0, %eax
cmovbq %rax, %r15
movq %r15, %rsi
shrq $0x20, %rsi
movl %r15d, %r9d
movq %rsi, %r8
imulq 0x68(%rsp), %r8
movq %r9, %rdx
movq 0x70(%rsp), %rax
imulq %rax, %rdx
movq %rsi, %rcx
imulq %rax, %rcx
xorl %edi, %edi
addq %r8, %rdx
setb %dil
shlq $0x20, %rdi
movq %rdx, %r10
shrq $0x20, %r10
shlq $0x20, %rdx
movq %r15, %r8
imulq 0x40(%rsp), %r8
movq %rsi, %r11
imulq 0x60(%rsp), %r11
imulq %r14, %r9
addq %r11, %r9
imull %r14d, %esi
movq %r9, %r11
shrq $0x20, %r11
shlq $0x20, %r9
movq %r15, %rax
imulq %rbx, %rax
xorl %ebx, %ebx
cmpq %r9, %rax
setb %bl
addl %esi, %r11d
addl %r11d, %ebx
addq %rax, %rcx
addq %r10, %rcx
cmpq %rdx, %r8
adcq %rdi, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
setb %dl
addl %ebx, %edx
shldq $0x3d, %rcx, %rdx
shldq $0x3d, %r8, %rcx
shldq $0x3d, %rbp, %r12
movq %rcx, %rbp
negq %rbp
sbbq $0x0, %r12
subq %rdx, %r12
addl $-0x3d, %r13d
cmpl $0x3d, %r13d
jg 0x136a6
addl $-0x3d, %r13d
movl 0x1c(%rsp), %esi
movq 0x58(%rsp), %rbx
movq 0x40(%rsp), %r10
jmp 0x137b7
orb $0x1, 0x2(%r13)
movabsq $0x7fff800000000000, %rbp # imm = 0x7FFF800000000000
xorl %r15d, %r15d
jmp 0x1354c
movzbl %al, %r15d
addl $-0x40, %r13d
movq %r12, 0x10(%rsp)
movq %rbp, 0x8(%rsp)
cmpl $-0x3f, %r13d
jl 0x13835
movq %r12, %rdi
movq %rbp, %rsi
movq 0x38(%rsp), %r14
movq %r14, %rdx
callq 0xb99f
movq %rax, %rcx
xorl %r15d, %r15d
subq $0x4, %rcx
cmovaeq %rcx, %r15
movl %r13d, %ecx
negb %cl
shrq %cl, %r15
movq 0x40(%rsp), %rax
shldq $0x34, %rax, %rbx
shrq $0xc, %r14
movq %rbx, 0x20(%rsp)
movq %r14, %r8
movq %r14, 0x28(%rsp)
cmpl $-0x35, %r13d
jg 0x13868
movb $-0x34, %dl
subb %r13b, %dl
movq %r12, %rax
movl %edx, %ecx
shrq %cl, %rax
negb %cl
shlq %cl, %r12
movl %edx, %ecx
shrq %cl, %rbp
orq %r12, %rbp
movq %rbp, 0x8(%rsp)
movq %rax, %r12
jmp 0x13891
movq %r12, %rax
shrdq $0xc, %r12, %rbp
shrq $0xc, %rax
movq %rbp, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movq 0x38(%rsp), %rax
shrq $0xc, %rax
shldq $0x34, %r10, %rbx
movq %rbx, 0x20(%rsp)
movq %rax, 0x28(%rsp)
jmp 0x13902
addl $0x34, %r13d
movq %rbp, %rax
movl %r13d, %ecx
shlq %cl, %rax
movq %rax, 0x8(%rsp)
testl %r13d, %r13d
je 0x13891
movl %r13d, %ecx
shlq %cl, %r12
negb %r13b
movl %r13d, %ecx
shrq %cl, %rbp
orq %rbp, %r12
movl 0x1c(%rsp), %esi
movq %rbx, %rdx
shrq $0x20, %rdx
movq %r15, %rcx
shrq $0x20, %rcx
movl %ebx, %eax
andl $-0x8, %eax
movl %r15d, %edi
imulq %rcx, %rax
imulq %rdx, %rdi
xorl %r9d, %r9d
addq %rax, %rdi
setae %r9b
shlq $0x20, %r9
movq %rdi, %rax
shrq $0x20, %rax
shlq $0x20, %rdi
imulq %r15, %rbx
imulq %r15, %r8
imulq %rdx, %rcx
addq %r8, %rcx
addq %rax, %rcx
cmpq %rdi, %rbx
sbbq %rcx, %r9
addq %r12, %r9
subq %rbx, 0x8(%rsp)
sbbq $0x0, %r9
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
addq %r9, %rax
movq %rax, 0x10(%rsp)
movq 0x48(%rsp), %r11
movq 0x50(%rsp), %r8
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %rcx
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %rdx
leaq (%rcx,%rdx,2), %rax
leaq (%rcx,%rcx), %r10
decq %r15
movq %rbx, %rdi
subq %r10, %rax
subq %r9, %rbx
incq %r15
subq %rcx, %rdx
sbbq $0x0, %rbx
jns 0x1392b
movq %rbx, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
addq %rdi, %rbx
cmpq %rdx, %rax
adcq $0x0, %rbx
js 0x13962
orq %rax, %rbx
andl $0x1, %r15d
orq %rbx, %r15
jne 0x1396f
addq %rdx, %rcx
movq %rdi, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
jns 0x1398b
xorl %eax, %eax
negq 0x8(%rsp)
sbbq %rax, %rax
subq %rdi, %rax
movq %rax, 0x10(%rsp)
xorq %r11, %rdi
shrq $0x3f, %rdi
addl $-0x4, %esi
movq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
callq 0xa33b
jmp 0x13546