// File: /workspace/github_c_makefile_star2_O1/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, %r8
movb 0x5(%rdx), %al
testb %al, %al
je 0xb6e9
testl $0x7f800000, %edi       # imm = 0x7F800000
setne %cl
testl $0x7fffff, %edi         # imm = 0x7FFFFF
sete %dl
orb %cl, %dl
jne 0xb6e9
orb $0x40, 0x2(%r8)
andl $0x80000000, %edi       # imm = 0x80000000
testb %al, %al
je 0xb70e
testl $0x7f800000, %esi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %esi         # imm = 0x7FFFFF
sete %cl
orb %al, %cl
jne 0xb70e
orb $0x40, 0x2(%r8)
andl $0x80000000, %esi       # imm = 0x80000000
movl $0x7fffff, %r15d        # imm = 0x7FFFFF
movl %edi, %r12d
andl %r15d, %r12d
movl %edi, %r13d
shrl $0x17, %r13d
movl $0xff, %edx
andl %edx, %r13d
andl %esi, %r15d
movl %esi, %ecx
shrl $0x17, %ecx
movl %ecx, %eax
andl %edx, %eax
cmpl %edx, %r13d
jne 0xb756
testl %r12d, %r12d
jne 0xb76e
cmpl $0xff, %eax
setne %al
testl %r15d, %r15d
sete %cl
orb %al, %cl
je 0xb76e
jmp 0xb83e
testb %cl, %cl
je 0xb784
movzbl %cl, %ecx
cmpl $0xff, %ecx
jne 0xb7a6
testl %r15d, %r15d
je 0xb848
movq %r8, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaeae
testl %r15d, %r15d
je 0xb83e
bsrl %r15d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r15d
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %rsi
jmp 0xb7a8
movl %eax, %esi
testq %r13, %r13
jne 0xb7cd
testl %r12d, %r12d
je 0xb848
bsrl %r12d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r12d
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %r13
subq %rsi, %r13
movl $0x800000, %eax         # imm = 0x800000
orl %eax, %r12d
orl %eax, %r15d
cmpq $0x1f, %r13
jg 0xb859
shll $0x8, %r12d
testq %r13, %r13
js 0xb90e
shll $0x8, %r15d
xorl %eax, %eax
cmpl %r12d, %r15d
cmovbel %r15d, %eax
movl %r12d, %r9d
subl %eax, %r9d
testq %r13, %r13
jle 0xb920
movq %r9, %rax
shlq $0x20, %rax
movl %r15d, %ecx
xorl %edx, %edx
divq %rcx
movl %r13d, %ecx
negb %cl
shrl %cl, %eax
shrl $0x2, %r15d
shrl %r9d
decb %r13b
movl %r13d, %ecx
shll %cl, %r9d
movl %eax, %ecx
imull %r15d, %ecx
subl %ecx, %r9d
jmp 0xb930
orb $0x1, 0x2(%r8)
movl $0x7fc00000, %edi       # imm = 0x7FC00000
movl %edi, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, 0x8(%rsp)
movl %edi, 0x4(%rsp)
xorl %eax, %eax
cmpl %r12d, %r15d
cmovbel %r15d, %eax
subl %eax, %r12d
shlq $0x28, %r12
movl %r15d, %ebp
movq %rbp, %r14
shlq $0x28, %r14
cmpq $0x41, %r13
movq %r8, 0x10(%rsp)
jl 0xb8c0
shlq $0x26, %rbp
negq %rbp
addq $-0x2, %r13
xorl %ebx, %ebx
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xb99f
movq %rax, %r12
subq $0x2, %r12
cmovbq %rbx, %r12
imulq %rbp, %r12
addq $-0x3e, %r13
cmpq $0x3e, %r13
jg 0xb894
addq $-0x3e, %r13
jmp 0xb8c4
addq $-0x40, %r13
xorl %ebx, %ebx
movq %r12, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0xb99f
subq $0x2, %rax
cmovbq %rbx, %rax
movl %r13d, %ecx
negb %cl
shrq %cl, %rax
shrq $0x21, %r12
addb $0x3f, %r13b
movl %r13d, %ecx
shlq %cl, %r12
shll $0x6, %r15d
movl %r15d, %ecx
imull %eax, %ecx
subl %ecx, %r12d
movl 0x4(%rsp), %edi
movq 0x10(%rsp), %r8
movq 0x8(%rsp), %rsi
jmp 0xb933
cmpq $-0x1, %r13
jne 0xb848
shrl %r12d
jmp 0xb7ee
xorl %eax, %eax
cmpl %r12d, %r15d
setbe %al
shrl $0x2, %r9d
shrl $0x2, %r15d
movl %r9d, %r12d
leal (%r12,%r12), %ecx
negl %ecx
leal (%r15,%r15), %edx
decl %eax
addl %edx, %ecx
incl %eax
subl %r15d, %r12d
jns 0xb93f
cmpl %ecx, %r15d
js 0xb954
jne 0xb95a
andl $0x1, %eax
jne 0xb95a
addl %r12d, %r15d
movl %r15d, %r12d
movl %r12d, %edx
negl %edx
cmovsl %r12d, %edx
xorl %r12d, %edi
shrl $0x1f, %edi
testl %edx, %edx
je 0xb975
bsrl %edx, %eax
xorl $0x1f, %eax
jmp 0xb97a
movl $0x20, %eax
decb %al
movsbq %al, %rcx
subq %rcx, %rsi
shll %cl, %edx
movzbl %dil, %edi
movq %r8, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9e9b