// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_rem
float64 float64_rem(float64 a, float64 b, float_status *status)
{
    flag aSign, zSign;
    int_fast16_t aExp, bExp, expDiff;
    uint64_t aSig, bSig;
    uint64_t q, alternateASig;
    int64_t sigMean;

    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 );
    if ( aExp == 0x7FF ) {
        if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
            return propagateFloat64NaN(a, b, status);
        }
        float_raise(float_flag_invalid, status);
        return float64_default_nan;
    }
    if ( bExp == 0x7FF ) {
        if (bSig) {
            return propagateFloat64NaN(a, b, status);
        }
        return a;
    }
    if ( bExp == 0 ) {
        if ( bSig == 0 ) {
            float_raise(float_flag_invalid, status);
            return float64_default_nan;
        }
        normalizeFloat64Subnormal( bSig, &bExp, &bSig );
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return a;
        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
    }
    expDiff = aExp - bExp;
    aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<11;
    bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
    if ( expDiff < 0 ) {
        if ( expDiff < -1 ) return a;
        aSig >>= 1;
    }
    q = ( bSig <= aSig );
    if ( q ) aSig -= bSig;
    expDiff -= 64;
    while ( 0 < expDiff ) {
        q = estimateDiv128To64( aSig, 0, bSig );
        q = ( 2 < q ) ? q - 2 : 0;
        aSig = - ( ( bSig>>2 ) * q );
        expDiff -= 62;
    }
    expDiff += 64;
    if ( 0 < expDiff ) {
        q = estimateDiv128To64( aSig, 0, bSig );
        q = ( 2 < q ) ? q - 2 : 0;
        q >>= 64 - expDiff;
        bSig >>= 2;
        aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
    }
    else {
        aSig >>= 2;
        bSig >>= 2;
    }
    do {
        alternateASig = aSig;
        ++q;
        aSig -= bSig;
    } while ( 0 <= (int64_t) aSig );
    sigMean = aSig + alternateASig;
    if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
        aSig = alternateASig;
    }
    zSign = ( (int64_t) aSig < 0 );
    if ( zSign ) aSig = - aSig;
    return normalizeRoundAndPackFloat64(aSign ^ zSign, bExp, aSig, status);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11610
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x11610
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x116a0
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11680
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rdi
callq 0x168f0
movb %al, -0x21(%rbp)
movq -0x18(%rbp), %rdi
callq 0x116a0
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
callq 0x11680
movq %rax, -0x38(%rbp)
cmpq $0x7ff, -0x30(%rbp)     # imm = 0x7FF
jne 0x18d06
cmpq $0x0, -0x48(%rbp)
jne 0x18ccb
cmpq $0x7ff, -0x38(%rbp)     # imm = 0x7FF
jne 0x18ce5
cmpq $0x0, -0x50(%rbp)
je 0x18ce5
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x17f70
movq %rax, -0x8(%rbp)
jmp 0x18ffb
movq -0x20(%rbp), %rsi
movl $0x1, %edi
callq 0x11080
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, -0x8(%rbp)
jmp 0x18ffb
cmpq $0x7ff, -0x38(%rbp)     # imm = 0x7FF
jne 0x18d3e
cmpq $0x0, -0x50(%rbp)
je 0x18d31
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x17f70
movq %rax, -0x8(%rbp)
jmp 0x18ffb
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x18ffb
cmpq $0x0, -0x38(%rbp)
jne 0x18d7e
cmpq $0x0, -0x50(%rbp)
jne 0x18d6d
movq -0x20(%rbp), %rsi
movl $0x1, %edi
callq 0x11080
movabsq $0x7ff8000000000000, %rax # imm = 0x7FF8000000000000
movq %rax, -0x8(%rbp)
jmp 0x18ffb
movq -0x50(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x17a20
cmpq $0x0, -0x30(%rbp)
jne 0x18daa
cmpq $0x0, -0x48(%rbp)
jne 0x18d99
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x18ffb
movq -0x48(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x17a20
movq -0x30(%rbp), %rax
subq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
orq -0x48(%rbp), %rax
shlq $0xb, %rax
movq %rax, -0x48(%rbp)
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
orq -0x50(%rbp), %rax
shlq $0xb, %rax
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x40(%rbp)
jge 0x18e08
cmpq $-0x1, -0x40(%rbp)
jge 0x18dfd
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x18ffb
movq -0x48(%rbp), %rax
shrq %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x48(%rbp), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x18e34
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
subq $0x40, %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpq -0x40(%rbp), %rax
jge 0x18eaa
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x14bf0
movq %rax, -0x58(%rbp)
movl $0x2, %eax
cmpq -0x58(%rbp), %rax
jae 0x18e76
movq -0x58(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x70(%rbp)
jmp 0x18e7e
xorl %eax, %eax
movq %rax, -0x70(%rbp)
jmp 0x18e7e
movq -0x70(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rcx
shrq $0x2, %rcx
imulq -0x58(%rbp), %rcx
xorl %eax, %eax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
subq $0x3e, %rax
movq %rax, -0x40(%rbp)
jmp 0x18e40
movq -0x40(%rbp), %rax
addq $0x40, %rax
movq %rax, -0x40(%rbp)
xorl %eax, %eax
cmpq -0x40(%rbp), %rax
jge 0x18f44
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x14bf0
movq %rax, -0x58(%rbp)
movl $0x2, %eax
cmpq -0x58(%rbp), %rax
jae 0x18ef0
movq -0x58(%rbp), %rax
subq $0x2, %rax
movq %rax, -0x78(%rbp)
jmp 0x18ef8
xorl %eax, %eax
movq %rax, -0x78(%rbp)
jmp 0x18ef8
movq -0x78(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x40, %ecx
subq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rax
shrq %cl, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
shrq $0x2, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
shrq %rax
movq -0x40(%rbp), %rcx
subq $0x1, %rcx
shlq %cl, %rax
movq -0x50(%rbp), %rcx
imulq -0x58(%rbp), %rcx
subq %rcx, %rax
movq %rax, -0x48(%rbp)
jmp 0x18f5c
movq -0x48(%rbp), %rax
shrq $0x2, %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
shrq $0x2, %rax
movq %rax, -0x50(%rbp)
jmp 0x18f5e
movq -0x48(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x48(%rbp)
xorl %eax, %eax
cmpq -0x48(%rbp), %rax
jle 0x18f5e
movq -0x48(%rbp), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jl 0x18fb1
cmpq $0x0, -0x68(%rbp)
jne 0x18fb9
movq -0x58(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x18fb9
movq -0x60(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x22(%rbp)
cmpb $0x0, -0x22(%rbp)
je 0x18fd9
xorl %eax, %eax
subq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movzbl -0x21(%rbp), %eax
movzbl -0x22(%rbp), %ecx
xorl %ecx, %eax
movq -0x38(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq -0x20(%rbp), %rcx
movzbl %al, %edi
callq 0x11fa0
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)