// File: /workspace/github_c_makefile_star2_O2/mbitsnbites[P]SoftFP/softfloat.c
// Function: float32_rem
float32 float32_rem(float32 a, float32 b, float_status *status)
{
    flag aSign, zSign;
    int_fast16_t aExp, bExp, expDiff;
    uint32_t aSig, bSig;
    uint32_t q;
    uint64_t aSig64, bSig64, q64;
    uint32_t alternateASig;
    int32_t sigMean;
    a = float32_squash_input_denormal(a, status);
    b = float32_squash_input_denormal(b, status);

    aSig = extractFloat32Frac( a );
    aExp = extractFloat32Exp( a );
    aSign = extractFloat32Sign( a );
    bSig = extractFloat32Frac( b );
    bExp = extractFloat32Exp( b );
    if ( aExp == 0xFF ) {
        if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
            return propagateFloat32NaN(a, b, status);
        }
        float_raise(float_flag_invalid, status);
        return float32_default_nan;
    }
    if ( bExp == 0xFF ) {
        if (bSig) {
            return propagateFloat32NaN(a, b, status);
        }
        return a;
    }
    if ( bExp == 0 ) {
        if ( bSig == 0 ) {
            float_raise(float_flag_invalid, status);
            return float32_default_nan;
        }
        normalizeFloat32Subnormal( bSig, &bExp, &bSig );
    }
    if ( aExp == 0 ) {
        if ( aSig == 0 ) return a;
        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
    }
    expDiff = aExp - bExp;
    aSig |= 0x00800000;
    bSig |= 0x00800000;
    if ( expDiff < 32 ) {
        aSig <<= 8;
        bSig <<= 8;
        if ( expDiff < 0 ) {
            if ( expDiff < -1 ) return a;
            aSig >>= 1;
        }
        q = ( bSig <= aSig );
        if ( q ) aSig -= bSig;
        if ( 0 < expDiff ) {
            q = ( ( (uint64_t) aSig )<<32 ) / bSig;
            q >>= 32 - expDiff;
            bSig >>= 2;
            aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
        }
        else {
            aSig >>= 2;
            bSig >>= 2;
        }
    }
    else {
        if ( bSig <= aSig ) aSig -= bSig;
        aSig64 = ( (uint64_t) aSig )<<40;
        bSig64 = ( (uint64_t) bSig )<<40;
        expDiff -= 64;
        while ( 0 < expDiff ) {
            q64 = estimateDiv128To64( aSig64, 0, bSig64 );
            q64 = ( 2 < q64 ) ? q64 - 2 : 0;
            aSig64 = - ( ( bSig * q64 )<<38 );
            expDiff -= 62;
        }
        expDiff += 64;
        q64 = estimateDiv128To64( aSig64, 0, bSig64 );
        q64 = ( 2 < q64 ) ? q64 - 2 : 0;
        q = q64>>( 64 - expDiff );
        bSig <<= 6;
        aSig = ( ( aSig64>>33 )<<( expDiff - 1 ) ) - bSig * q;
    }
    do {
        alternateASig = aSig;
        ++q;
        aSig -= bSig;
    } while ( 0 <= (int32_t) aSig );
    sigMean = aSig + alternateASig;
    if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
        aSig = alternateASig;
    }
    zSign = ( (int32_t) aSig < 0 );
    if ( zSign ) aSig = - aSig;
    return normalizeRoundAndPackFloat32(aSign ^ zSign, bExp, aSig, status);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movl %esi, %r14d
movq %rdx, %rsi
callq 0x91e7
movl %eax, %ebp
movl %r14d, %edi
movq %rbx, %rsi
callq 0x91e7
movl $0x7fffff, %r14d        # imm = 0x7FFFFF
movl %ebp, %r13d
andl %r14d, %r13d
movl %ebp, %r12d
shrl $0x17, %r12d
movl $0xff, %edx
andl %edx, %r12d
andl %eax, %r14d
movl %eax, %esi
shrl $0x17, %esi
movl %esi, %ecx
andl %edx, %ecx
cmpl %edx, %r12d
jne 0xabac
testl %r13d, %r13d
jne 0xabc9
cmpl $0xff, %ecx
setne %cl
testl %r14d, %r14d
sete %dl
orb %cl, %dl
je 0xabc9
jmp 0xac95
pushq $0x9
popq %rdx
testb %sil, %sil
je 0xabe3
movzbl %sil, %esi
cmpl $0xff, %esi
jne 0xac02
testl %r14d, %r14d
je 0xac9e
movl %ebp, %edi
movl %eax, %esi
movq %rbx, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa3b6
testl %r14d, %r14d
je 0xac95
bsrl %r14d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r14d
movl %edx, %ecx
subl %eax, %ecx
movslq %ecx, %rsi
jmp 0xac04
movl %ecx, %esi
testq %r12, %r12
jne 0xac24
testl %r13d, %r13d
je 0xac9e
bsrl %r13d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r13d
subl %eax, %edx
movslq %edx, %r12
subq %rsi, %r12
movl $0x800000, %eax         # imm = 0x800000
orl %eax, %r13d
orl %eax, %r14d
cmpq $0x1f, %r12
jg 0xacaf
shll $0x8, %r13d
testq %r12, %r12
js 0xad41
shll $0x8, %r14d
xorl %eax, %eax
cmpl %r13d, %r14d
cmovbel %r14d, %eax
movl %r13d, %r8d
subl %eax, %r8d
testq %r12, %r12
jle 0xad53
movq %r8, %rax
shlq $0x20, %rax
movl %r14d, %ecx
xorl %edx, %edx
divq %rcx
movl %r12d, %ecx
negb %cl
shrl %cl, %eax
shrl %r8d
decb %r12b
movl %r12d, %ecx
shll %cl, %r8d
shrl $0x2, %r14d
movl %eax, %ecx
imull %r14d, %ecx
subl %ecx, %r8d
jmp 0xad63
orb $0x1, 0x2(%rbx)
movl $0x7fc00000, %ebp       # imm = 0x7FC00000
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, 0x8(%rsp)
movl %ebp, 0x4(%rsp)
movq %rbx, 0x10(%rsp)
xorl %ebx, %ebx
cmpl %r13d, %r14d
movl %r14d, %eax
cmoval %ebx, %eax
subl %eax, %r13d
shlq $0x28, %r13
movl %r14d, %r15d
movq %r15, %rbp
shlq $0x28, %rbp
addq $-0x40, %r12
shlq $0x26, %r15
negq %r15
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0xadbc
subq $0x2, %rax
cmovbq %rbx, %rax
testq %r12, %r12
jle 0xad0b
imulq %r15, %rax
addq $-0x3e, %r12
movq %rax, %r13
jmp 0xace4
movl %r12d, %ecx
negb %cl
shrq %cl, %rax
shll $0x6, %r14d
shrq $0x21, %r13
addb $0x3f, %r12b
movl %r12d, %ecx
shlq %cl, %r13
movl %r14d, %ecx
imull %eax, %ecx
subl %ecx, %r13d
movl %r13d, %r8d
movq 0x10(%rsp), %rbx
movl 0x4(%rsp), %ebp
movq 0x8(%rsp), %rsi
jmp 0xad63
cmpq $-0x1, %r12
jne 0xac9e
shrl %r13d
jmp 0xac45
xorl %eax, %eax
cmpl %r13d, %r14d
setbe %al
shrl $0x2, %r8d
shrl $0x2, %r14d
shrl $0x1f, %ebp
leal (%r8,%r8), %ecx
negl %ecx
leal (%r14,%r14), %edx
decl %eax
addl %edx, %ecx
incl %eax
subl %r14d, %r8d
jns 0xad72
cmpl %ecx, %r14d
js 0xad8a
pushq $0x1
popq %rdi
jne 0xad9b
andl $0x1, %eax
jne 0xad9b
addl %r8d, %r14d
movl %r14d, %edi
shrl $0x1f, %edi
movl %r14d, %r8d
testl %r14d, %r14d
jns 0xada1
negl %r8d
movl %r8d, %r14d
xorl %ebp, %edi
movl %r14d, %edx
movq %rbx, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9270