// File: /workspace/github_c_makefile_star2_O3/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, %rbp
cmpb $0x0, 0x5(%rdx)
je 0xb790
testl $0x7f800000, %edi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %edi         # imm = 0x7FFFFF
sete %cl
orb %al, %cl
jne 0xb770
orb $0x40, 0x2(%rbp)
andl $0x80000000, %edi       # imm = 0x80000000
testl $0x7f800000, %esi       # imm = 0x7F800000
setne %al
testl $0x7fffff, %esi         # imm = 0x7FFFFF
sete %cl
orb %al, %cl
jne 0xb790
orb $0x40, 0x2(%rbp)
andl $0x80000000, %esi       # imm = 0x80000000
movl $0x7fffff, %r14d        # imm = 0x7FFFFF
movl %edi, %r15d
andl %r14d, %r15d
movl %edi, %eax
shrl $0x17, %eax
movl $0xff, %r8d
andl %r8d, %eax
andl %esi, %r14d
movl %esi, %edx
shrl $0x17, %edx
movl %edx, %ecx
andl %r8d, %ecx
cmpl %r8d, %eax
jne 0xb7d9
testl %r15d, %r15d
jne 0xb7f1
cmpl $0xff, %ecx
setne %al
testl %r14d, %r14d
sete %cl
orb %al, %cl
je 0xb7f1
jmp 0xb8c4
testb %dl, %dl
je 0xb807
movzbl %dl, %edx
cmpl $0xff, %edx
jne 0xb829
testl %r14d, %r14d
je 0xb8cd
movq %rbp, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xaf64
testl %r14d, %r14d
je 0xb8c4
bsrl %r14d, %edx
xorl $0x1f, %edx
leal -0x8(%rdx), %ecx
shll %cl, %r14d
movl $0x9, %ecx
subl %edx, %ecx
movslq %ecx, %rsi
jmp 0xb82b
movl %ecx, %esi
testq %rax, %rax
jne 0xb850
testl %r15d, %r15d
je 0xb8cd
bsrl %r15d, %eax
xorl $0x1f, %eax
leal -0x8(%rax), %ecx
shll %cl, %r15d
movl $0x9, %ecx
subl %eax, %ecx
movslq %ecx, %rax
movq %rax, %r13
subq %rsi, %r13
movl $0x800000, %ecx         # imm = 0x800000
orl %ecx, %r15d
orl %ecx, %r14d
cmpq $0x1f, %r13
jg 0xb8de
shll $0x8, %r15d
shll $0x8, %r14d
testq %r13, %r13
js 0xb994
xorl %edx, %edx
cmpl %r15d, %r14d
cmovbel %r14d, %edx
setbe %cl
subl %edx, %r15d
cmpq %rsi, %rax
je 0xb9a3
movq %r15, %rax
shlq $0x20, %rax
movl %r14d, %ecx
xorl %edx, %edx
divq %rcx
movl %r13d, %ecx
negb %cl
shrl %cl, %eax
shrl %r15d
decb %r13b
movl %r13d, %ecx
shll %cl, %r15d
shrl $0x2, %r14d
movl %eax, %ecx
imull %r14d, %ecx
subl %ecx, %r15d
jmp 0xb9ae
orb $0x1, 0x2(%rbp)
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, 0x10(%rsp)
movl %edi, 0x4(%rsp)
xorl %eax, %eax
cmpl %r15d, %r14d
cmovbel %r14d, %eax
subl %eax, %r15d
shlq $0x28, %r15
movl %r14d, %r12d
movq %r12, %rbx
shlq $0x28, %rbx
cmpq $0x41, %r13
jb 0xb94a
movq %rbp, 0x8(%rsp)
shlq $0x26, %r12
negq %r12
addq $-0x2, %r13
xorl %ebp, %ebp
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0xba2b
movq %rax, %r15
subq $0x2, %r15
cmovbq %rbp, %r15
imulq %r12, %r15
addq $-0x3e, %r13
cmpq $0x3e, %r13
ja 0xb919
addq $-0x3e, %r13
movq 0x8(%rsp), %rbp
jmp 0xb94e
addq $-0x40, %r13
xorl %r12d, %r12d
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0xba2b
subq $0x2, %rax
cmovbq %r12, %rax
movl %r13d, %ecx
negb %cl
shrq %cl, %rax
shrq $0x21, %r15
addb $0x3f, %r13b
movl %r13d, %ecx
shlq %cl, %r15
shll $0x6, %r14d
movl %r14d, %ecx
imull %eax, %ecx
subl %ecx, %r15d
movl 0x4(%rsp), %edi
movq 0x10(%rsp), %rsi
jmp 0xb9ae
cmpq $-0x1, %r13
jne 0xb8cd
shrl %r15d
xorl %ecx, %ecx
movzbl %cl, %eax
shrl $0x2, %r15d
shrl $0x2, %r14d
shrl $0x1f, %edi
leal (%r15,%r15), %ecx
negl %ecx
leal (%r14,%r14), %edx
decl %eax
addl %edx, %ecx
incl %eax
subl %r14d, %r15d
jns 0xb9bd
cmpl %ecx, %r14d
js 0xb9d7
movl $0x1, %edx
jne 0xb9e8
andl $0x1, %eax
jne 0xb9e8
addl %r15d, %r14d
movl %r14d, %edx
shrl $0x1f, %edx
movl %r14d, %r15d
testl %r14d, %r14d
jns 0xb9ee
negl %r15d
movl %r15d, %r14d
xorl %edi, %edx
testl %r14d, %r14d
je 0xb9fe
bsrl %r14d, %eax
xorl $0x1f, %eax
jmp 0xba03
movl $0x20, %eax
decb %al
movsbq %al, %rcx
subq %rcx, %rsi
shll %cl, %r14d
movzbl %dl, %edi
movl %r14d, %edx
movq %rbp, %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9f46