// File: /workspace/github_c_makefile_star2_O3/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 $0x68, %rsp
movq %r8, %rbp
movq %rsi, %r14
movq %rdi, %r15
movabsq $0xffffffffffff, %rbx   # imm = 0xFFFFFFFFFFFF
movq %rdi, 0x30(%rsp)
movq %rsi, %r12
andq %rbx, %r12
movq %r12, 0x38(%rsp)
movq %rsi, %r13
shrq $0x30, %r13
movl $0x7fff, %esi           # imm = 0x7FFF
andl %esi, %r13d
movl %r13d, 0x14(%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, 0x4(%rsp)
cmpl %esi, %r13d
jne 0x1359c
orq %r15, %r12
jne 0x135ac
cmpl $0x7fff, %eax           # imm = 0x7FFF
setne %al
orq %rdx, %rdi
sete %sil
orb %al, %sil
je 0x135ac
jmp 0x136ab
testl %eax, %eax
je 0x135d5
cmpl $0x7fff, %eax           # imm = 0x7FFF
jne 0x135fb
orq %rdx, %rdi
je 0x135c0
movq %r15, %rdi
movq %r14, %rsi
movq %rbp, %r8
callq 0x122b1
movq %rax, %r15
movq %rdx, %r14
movq %r15, %rax
movq %r14, %rdx
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rax
orq %rdx, %rax
je 0x136ab
leaq 0x4(%rsp), %rax
leaq 0x28(%rsp), %rcx
leaq 0x20(%rsp), %r8
movq %rdx, %rsi
movq %rax, %rdx
callq 0x11f34
testl %r13d, %r13d
jne 0x13629
movq %r12, %rax
orq %r15, %rax
je 0x135c0
leaq 0x14(%rsp), %r13
leaq 0x38(%rsp), %rcx
leaq 0x30(%rsp), %r8
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x11f34
movl (%r13), %r13d
movl 0x4(%rsp), %esi
subl %esi, %r13d
cmpl $-0x1, %r13d
jl 0x135c0
movq %rbp, 0x18(%rsp)
incq %rbx
orq 0x38(%rsp), %rbx
movq 0x30(%rsp), %r12
cmpl $-0x1, %r13d
sete %al
movl %eax, %ecx
xorb $0xf, %cl
movq %r12, %rbp
shlq %cl, %rbp
shlq %cl, %rbx
addb $0x31, %al
movl %eax, %ecx
shrq %cl, %r12
orq %rbx, %r12
movq 0x28(%rsp), %r9
movq 0x20(%rsp), %r15
movq %r15, %r8
shlq $0xf, %r8
shlq $0xf, %r9
btsq $0x3f, %r9
shrq $0x31, %r15
leaq (%r15,%r9), %rdi
cmpq %rdi, %r12
seta %cl
sete %dl
cmpq %r8, %rbp
setae %al
andb %dl, %al
orb %cl, %al
cmpb $0x1, %al
jne 0x136c1
subq %r8, %rbp
movq %rdi, %rbx
sbbq %rdi, %r12
jmp 0x136c4
orb $0x1, 0x2(%rbp)
movabsq $0x7fff800000000000, %r14 # imm = 0x7FFF800000000000
xorl %r15d, %r15d
jmp 0x135c0
movq %rdi, %rbx
cmpl $0x41, %r13d
jl 0x137f1
movq %r15, 0x40(%rsp)
movl %esi, (%rsp)
movq %r14, 0x48(%rsp)
movq %r8, %rax
shrq $0x20, %rax
movq %rax, 0x60(%rsp)
movl %r8d, %eax
andl $0xffff8000, %eax       # imm = 0xFFFF8000
movq %rax, 0x58(%rsp)
shrq $0x20, %r9
movl %ebx, %eax
movq %rax, 0x50(%rsp)
addl $-0x3, %r13d
movq %r8, 0x8(%rsp)
movq %r9, %r15
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xba2b
subq $0x4, %rax
movl $0x0, %ecx
cmovbq %rcx, %rax
movq %rax, %rsi
shrq $0x20, %rsi
movl %eax, %r9d
movq %rsi, %r8
imulq 0x58(%rsp), %r8
movq %r9, %rdx
movq 0x60(%rsp), %rdi
imulq %rdi, %rdx
movq %rsi, %rcx
imulq %rdi, %rcx
xorl %edi, %edi
addq %r8, %rdx
setb %dil
shlq $0x20, %rdi
movq %rdx, %r10
shrq $0x20, %r10
shlq $0x20, %rdx
movq %rax, %r8
imulq 0x8(%rsp), %r8
movq %rsi, %r11
imulq 0x50(%rsp), %r11
imulq %r15, %r9
addq %r11, %r9
imull %r15d, %esi
movq %r9, %r11
shrq $0x20, %r11
shlq $0x20, %r9
imulq %rbx, %rax
xorl %r14d, %r14d
cmpq %r9, %rax
setb %r14b
addl %esi, %r11d
addl %r11d, %r14d
addq %rax, %rcx
addq %r10, %rcx
cmpq %rdx, %r8
adcq %rdi, %rcx
xorl %edx, %edx
cmpq %rax, %rcx
setb %dl
addl %r14d, %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
ja 0x1370b
addl $-0x3d, %r13d
movq 0x48(%rsp), %r14
movq 0x40(%rsp), %r15
jmp 0x13806
testl %r13d, %r13d
jle 0x13967
movq %r8, 0x8(%rsp)
movl %esi, (%rsp)
addl $-0x40, %r13d
movq %r12, %rdi
movq %rbp, %rsi
movq %rbx, %rdx
callq 0xba2b
xorl %edx, %edx
subq $0x4, %rax
cmovaeq %rax, %rdx
movl %r13d, %ecx
negb %cl
shrq %cl, %rdx
shrq $0xc, %rbx
movq 0x8(%rsp), %rax
shldq $0x34, %rax, %r15
cmpl $-0x35, %r13d
jg 0x1385c
movb $-0x34, %al
subb %r13b, %al
movq %r12, %rsi
movl %eax, %ecx
shrq %cl, %rsi
negb %cl
shlq %cl, %r12
movl %eax, %ecx
shrq %cl, %rbp
orq %r12, %rbp
movq %rbp, %rax
movq %rsi, %r12
jmp 0x13880
addl $0x34, %r13d
movq %rbp, %rax
movl %r13d, %ecx
shlq %cl, %rax
testl %r13d, %r13d
je 0x13880
movl %r13d, %ecx
shlq %cl, %r12
negb %r13b
movl %r13d, %ecx
shrq %cl, %rbp
orq %rbp, %r12
movq %r15, %rsi
shrq $0x20, %rsi
movq %rdx, %rcx
shrq $0x20, %rcx
movl %r15d, %r8d
andl $-0x8, %r8d
movl %edx, %r9d
imulq %rcx, %r8
imulq %rsi, %r9
xorl %edi, %edi
addq %r8, %r9
setae %dil
shlq $0x20, %rdi
movq %r9, %r8
shrq $0x20, %r8
shlq $0x20, %r9
movq %rdx, %r10
imulq %r15, %r10
movq %rdx, %r11
imulq %rbx, %r11
imulq %rsi, %rcx
addq %r11, %rcx
addq %r8, %rcx
cmpq %r9, %r10
sbbq %rcx, %rdi
addq %r12, %rdi
subq %r10, %rax
sbbq $0x0, %rdi
movabsq $-0x100000000, %r11     # imm = 0xFFFFFFFF00000000
addq %rdi, %r11
movq 0x18(%rsp), %r8
movl (%rsp), %esi
leaq (%r15,%rax), %rcx
leaq (%r15,%rax,2), %r10
leaq (%r15,%r15), %r9
decq %rdx
movq %r11, %rdi
subq %r9, %r10
subq %rbx, %r11
subq %r15, %rcx
incq %rdx
subq %r15, %rax
sbbq $0x0, %r11
jns 0x13904
leaq (%r11,%rdi), %r9
cmpq %rax, %r10
adcq $0x0, %r9
js 0x13934
orq %r10, %r9
andl $0x1, %edx
orq %r9, %rdx
jne 0x13942
movq %rdi, %r11
movq %rcx, %rax
movq %rdi, %rdx
testq %rdi, %rdi
jns 0x13953
xorl %edx, %edx
negq %rax
sbbq %rdx, %rdx
subq %r11, %rdx
movq %r11, %rdi
movq %rax, %rcx
xorq %r14, %rdi
shrq $0x3f, %rdi
addl $-0x4, %esi
callq 0xa40a
jmp 0x135ba
movzbl %al, %edx
movq %r12, %r11
shrq $0xc, %r11
shrdq $0xc, %r12, %rbp
shrq $0xc, %rbx
shldq $0x34, %r8, %r15
movq %rbp, %rax
movq 0x18(%rsp), %r8
jmp 0x138f5