// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/softfloat.c
// Function: floatx80_rem
floatx80 floatx80_rem(floatx80 a, floatx80 b, float_status *status)
{
    flag aSign, zSign;
    int32 aExp, bExp, expDiff;
    uint64_t aSig0, aSig1, bSig;
    uint64_t q, term0, term1, alternateASig0, alternateASig1;
    floatx80 z;

    aSig0 = extractFloatx80Frac( a );
    aExp = extractFloatx80Exp( a );
    aSign = extractFloatx80Sign( a );
    bSig = extractFloatx80Frac( b );
    bExp = extractFloatx80Exp( b );
    if ( aExp == 0x7FFF ) {
        if (    (uint64_t) ( aSig0<<1 )
             || ( ( bExp == 0x7FFF ) && (uint64_t) ( bSig<<1 ) ) ) {
            return propagateFloatx80NaN(a, b, status);
        }
        goto invalid;
    }
    if ( bExp == 0x7FFF ) {
        if ((uint64_t)(bSig << 1)) {
            return propagateFloatx80NaN(a, b, status);
        }
        return a;
    }
    if ( bExp == 0 ) {
        if ( bSig == 0 ) {
 invalid:
            float_raise(float_flag_invalid, status);
            z.low = floatx80_default_nan_low;
            z.high = floatx80_default_nan_high;
            return z;
        }
        normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
    }
    if ( aExp == 0 ) {
        if ( (uint64_t) ( aSig0<<1 ) == 0 ) return a;
        normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
    }
    bSig |= LIT64( 0x8000000000000000 );
    zSign = aSign;
    expDiff = aExp - bExp;
    aSig1 = 0;
    if ( expDiff < 0 ) {
        if ( expDiff < -1 ) return a;
        shift128Right( aSig0, 0, 1, &aSig0, &aSig1 );
        expDiff = 0;
    }
    q = ( bSig <= aSig0 );
    if ( q ) aSig0 -= bSig;
    expDiff -= 64;
    while ( 0 < expDiff ) {
        q = estimateDiv128To64( aSig0, aSig1, bSig );
        q = ( 2 < q ) ? q - 2 : 0;
        mul64To128( bSig, q, &term0, &term1 );
        sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
        shortShift128Left( aSig0, aSig1, 62, &aSig0, &aSig1 );
        expDiff -= 62;
    }
    expDiff += 64;
    if ( 0 < expDiff ) {
        q = estimateDiv128To64( aSig0, aSig1, bSig );
        q = ( 2 < q ) ? q - 2 : 0;
        q >>= 64 - expDiff;
        mul64To128( bSig, q<<( 64 - expDiff ), &term0, &term1 );
        sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
        shortShift128Left( 0, bSig, 64 - expDiff, &term0, &term1 );
        while ( le128( term0, term1, aSig0, aSig1 ) ) {
            ++q;
            sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
        }
    }
    else {
        term1 = 0;
        term0 = bSig;
    }
    sub128( term0, term1, aSig0, aSig1, &alternateASig0, &alternateASig1 );
    if (    lt128( alternateASig0, alternateASig1, aSig0, aSig1 )
         || (    eq128( alternateASig0, alternateASig1, aSig0, aSig1 )
              && ( q & 1 ) )
       ) {
        aSig0 = alternateASig0;
        aSig1 = alternateASig1;
        zSign = ! zSign;
    }
    return
        normalizeRoundAndPackFloatx80(
            80, zSign, bExp + expDiff, aSig0, aSig1, status);

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movw %cx, %ax
movw %si, %cx
movq %rdi, -0x20(%rbp)
movw %cx, -0x18(%rbp)
movq %rdx, -0x30(%rbp)
movw %ax, -0x28(%rbp)
movq %r8, -0x38(%rbp)
movq -0x20(%rbp), %rdi
movzwl -0x18(%rbp), %esi
callq 0x1ab30
movq %rax, -0x50(%rbp)
movq -0x20(%rbp), %rdi
movzwl -0x18(%rbp), %esi
callq 0x1ab50
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movzwl -0x18(%rbp), %esi
callq 0x1ab70
movb %al, -0x39(%rbp)
movq -0x30(%rbp), %rdi
movzwl -0x28(%rbp), %esi
callq 0x1ab30
movq %rax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
movzwl -0x28(%rbp), %esi
callq 0x1ab50
movl %eax, -0x44(%rbp)
cmpl $0x7fff, -0x40(%rbp)    # imm = 0x7FFF
jne 0x1ce9e
movq -0x50(%rbp), %rax
shlq %rax
cmpq $0x0, %rax
jne 0x1ce73
cmpl $0x7fff, -0x44(%rbp)    # imm = 0x7FFF
jne 0x1ce9c
movq -0x60(%rbp), %rax
shlq %rax
cmpq $0x0, %rax
je 0x1ce9c
movq -0x38(%rbp), %r8
movq -0x20(%rbp), %rdi
movw -0x18(%rbp), %ax
movq -0x30(%rbp), %rdx
movzwl %ax, %esi
movzwl -0x28(%rbp), %ecx
callq 0x1b670
movq %rax, -0x10(%rbp)
movw %dx, -0x8(%rbp)
jmp 0x1d2bd
jmp 0x1cf01
cmpl $0x7fff, -0x44(%rbp)    # imm = 0x7FFF
jne 0x1cef2
movq -0x60(%rbp), %rax
shlq %rax
cmpq $0x0, %rax
je 0x1cedd
movq -0x38(%rbp), %r8
movq -0x20(%rbp), %rdi
movw -0x18(%rbp), %ax
movq -0x30(%rbp), %rdx
movzwl %ax, %esi
movzwl -0x28(%rbp), %ecx
callq 0x1b670
movq %rax, -0x10(%rbp)
movw %dx, -0x8(%rbp)
jmp 0x1d2bd
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1d2bd
cmpl $0x0, -0x44(%rbp)
jne 0x1cf55
cmpq $0x0, -0x60(%rbp)
jne 0x1cf44
jmp 0x1cf01
movq -0x38(%rbp), %rsi
movl $0x1, %edi
callq 0x11080
movabsq $-0x4000000000000000, %rax # imm = 0xC000000000000000
movq %rax, -0x98(%rbp)
movw $0xffff, -0x90(%rbp)    # imm = 0xFFFF
movq -0x98(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1d2bd
movq -0x60(%rbp), %rdi
leaq -0x44(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x1c210
cmpl $0x0, -0x40(%rbp)
jne 0x1cf8e
movq -0x50(%rbp), %rax
shlq %rax
cmpq $0x0, %rax
jne 0x1cf7d
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1d2bd
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x1c210
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
orq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movb -0x39(%rbp), %al
movb %al, -0x3a(%rbp)
movl -0x40(%rbp), %eax
subl -0x44(%rbp), %eax
movl %eax, -0x48(%rbp)
movq $0x0, -0x58(%rbp)
cmpl $0x0, -0x48(%rbp)
jge 0x1cff9
cmpl $-0x1, -0x48(%rbp)
jge 0x1cfd8
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1d2bd
movq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0x1, %edx
leaq -0x50(%rbp), %rcx
leaq -0x58(%rbp), %r8
callq 0x17be0
movl $0x0, -0x48(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
setbe %al
andb $0x1, %al
movzbl %al, %eax
cltq
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x1d025
movq -0x60(%rbp), %rcx
movq -0x50(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x50(%rbp)
movl -0x48(%rbp), %eax
subl $0x40, %eax
movl %eax, -0x48(%rbp)
xorl %eax, %eax
cmpl -0x48(%rbp), %eax
jge 0x1d0da
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x14bf0
movq %rax, -0x68(%rbp)
movl $0x2, %eax
cmpq -0x68(%rbp), %rax
jae 0x1d06a
movq -0x68(%rbp), %rax
subq $0x2, %rax
movq %rax, -0xa0(%rbp)
jmp 0x1d075
xorl %eax, %eax
movq %rax, -0xa0(%rbp)
jmp 0x1d075
movq -0xa0(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
leaq -0x70(%rbp), %rdx
leaq -0x78(%rbp), %rcx
callq 0x18730
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r9
callq 0x18b70
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movl $0x3e, %edx
leaq -0x50(%rbp), %rcx
leaq -0x58(%rbp), %r8
callq 0x121c0
movl -0x48(%rbp), %eax
subl $0x3e, %eax
movl %eax, -0x48(%rbp)
jmp 0x1d02e
movl -0x48(%rbp), %eax
addl $0x40, %eax
movl %eax, -0x48(%rbp)
xorl %eax, %eax
cmpl -0x48(%rbp), %eax
jge 0x1d1f1
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0x14bf0
movq %rax, -0x68(%rbp)
movl $0x2, %eax
cmpq -0x68(%rbp), %rax
jae 0x1d11f
movq -0x68(%rbp), %rax
subq $0x2, %rax
movq %rax, -0xa8(%rbp)
jmp 0x1d12a
xorl %eax, %eax
movq %rax, -0xa8(%rbp)
jmp 0x1d12a
movq -0xa8(%rbp), %rax
movq %rax, -0x68(%rbp)
movl $0x40, %ecx
subl -0x48(%rbp), %ecx
movq -0x68(%rbp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
movq -0x68(%rbp), %rsi
movl $0x40, %eax
subl -0x48(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
shlq %cl, %rsi
leaq -0x70(%rbp), %rdx
leaq -0x78(%rbp), %rcx
callq 0x18730
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r9
callq 0x18b70
movq -0x60(%rbp), %rsi
movl $0x40, %eax
subl -0x48(%rbp), %eax
movslq %eax, %rdx
xorl %eax, %eax
movl %eax, %edi
leaq -0x70(%rbp), %rcx
leaq -0x78(%rbp), %r8
callq 0x121c0
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x1d2d0
cmpb $0x0, %al
je 0x1d1ef
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
movq -0x50(%rbp), %rdi
movq -0x58(%rbp), %rsi
movq -0x70(%rbp), %rdx
movq -0x78(%rbp), %rcx
leaq -0x50(%rbp), %r8
leaq -0x58(%rbp), %r9
callq 0x18b70
jmp 0x1d1ab
jmp 0x1d201
movq $0x0, -0x78(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
leaq -0x80(%rbp), %r8
leaq -0x88(%rbp), %r9
callq 0x18b70
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x19d70
movzbl %al, %eax
cmpl $0x0, %eax
jne 0x1d26f
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
callq 0x1d320
movzbl %al, %eax
cmpl $0x0, %eax
je 0x1d293
movq -0x68(%rbp), %rax
andq $0x1, %rax
cmpq $0x0, %rax
je 0x1d293
movq -0x80(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x58(%rbp)
cmpb $0x0, -0x3a(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movb %al, -0x3a(%rbp)
movb -0x3a(%rbp), %al
movl -0x44(%rbp), %edx
addl -0x48(%rbp), %edx
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %r8
movq -0x38(%rbp), %r9
movl $0x50, %edi
movzbl %al, %esi
callq 0x1d360
movq %rax, -0x10(%rbp)
movw %dx, -0x8(%rbp)
movq -0x10(%rbp), %rax
movw -0x8(%rbp), %dx
addq $0xb0, %rsp
popq %rbp
retq
nop