// File: /workspace/github_c_makefile_star2_O3/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_log2
float64 float64_log2(float64 a, float_status *status)
{
    flag aSign, zSign;
    int_fast16_t aExp;
    uint64_t aSig, aSig0, aSig1, zSig, i;
    a = float64_squash_input_denormal(a, status);

    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );

    if ( aExp == 0 ) {
        if ( aSig == 0 ) return packFloat64( 1, 0x7FF, 0 );
        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
    }
    if ( aSign ) {
        float_raise(float_flag_invalid, status);
        return float64_default_nan;
    }
    if ( aExp == 0x7FF ) {
        if (aSig) {
            return propagateFloat64NaN(a, float64_zero, status);
        }
        return a;
    }

    aExp -= 0x3FF;
    aSig |= LIT64( 0x0010000000000000 );
    zSign = aExp < 0;
    zSig = (uint64_t)aExp << 52;
    for (i = 1LL << 51; i > 0; i >>= 1) {
        mul64To128( aSig, aSig, &aSig0, &aSig1 );
        aSig = ( aSig0 << 12 ) | ( aSig1 >> 52 );
        if ( aSig & LIT64( 0x0020000000000000 ) ) {
            aSig >>= 1;
            zSig |= i;
        }
    }

    if ( zSign )
        zSig = -zSig;
    return normalizeRoundAndPackFloat64(zSign, 0x408, zSig, status);
}

// Assembly:
movq %rsi, %rax
movabsq $0xfffffffffffff, %rdx  # imm = 0xFFFFFFFFFFFFF
cmpb $0x0, 0x5(%rsi)
je 0xf075
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
testq %rcx, %rdi
setne %cl
testq %rdx, %rdi
sete %sil
orb %cl, %sil
jne 0xf075
orb $0x40, 0x2(%rax)
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
andq %rcx, %rdi
movq %rdi, %r8
andq %rdx, %r8
movq %rdi, %rsi
shrq $0x34, %rsi
andq $0x7ff, %rsi            # imm = 0x7FF
jne 0xf0b1
testq %r8, %r8
je 0xf199
bsrq %r8, %rcx
xorl $0x3f, %ecx
addl $0xf5, %ecx
movzbl %cl, %ecx
shlq %cl, %r8
movl $0x1, %esi
subl %ecx, %esi
movslq %esi, %rsi
testq %rdi, %rdi
js 0xf0d2
cmpq $0x7ff, %rsi            # imm = 0x7FF
jne 0xf0e5
testq %r8, %r8
je 0xf1a3
xorl %esi, %esi
movq %rax, %rdx
jmp 0xdbdb
orb $0x1, 0x2(%rax)
movabsq $0x7ff8000000000000, %rdi # imm = 0x7FF8000000000000
jmp 0xf1a3
pushq %r15
pushq %r14
pushq %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
incq %rdx
orq %rdx, %r8
movq %rsi, %rcx
shlq $0x34, %rcx
movabsq $-0x3ff0000000000000, %rdx # imm = 0xC010000000000000
addq %rcx, %rdx
movabsq $0x8000000000000, %r10  # imm = 0x8000000000000
leaq 0x1(%rdi), %r9
movq %r10, %r11
movq %r8, %rcx
shrq $0x20, %rcx
movl %r8d, %r14d
imulq %rcx, %r14
imulq %rcx, %rcx
movq %r14, %r15
shrq $0x1f, %r15
movl %r15d, %ebx
andq %r9, %r15
addq %rcx, %rbx
shlq $0x21, %r14
imulq %r8, %r8
cmpq %r14, %r8
adcq %r15, %rbx
shldq $0xc, %r8, %rbx
movq %rbx, %r8
movq %rbx, %rcx
shrq $0x35, %rcx
andb $0x1, %cl
shrq %cl, %rbx
shlq $0xa, %r8
sarq $0x3f, %r8
andq %r10, %r8
orq %r8, %rdx
shrq %r11
movq %rbx, %r8
cmpq $0x1, %r10
movq %r11, %r10
ja 0xf11a
cmpq $0x3ff, %rsi            # imm = 0x3FF
popq %rbx
popq %r14
popq %r15
jge 0xf1a7
negq %rdx
je 0xf1b6
bsrq %rdx, %rcx
xorq $0x3f, %rcx
jmp 0xf1bb
movabsq $-0x10000000000000, %rdi # imm = 0xFFF0000000000000
movq %rdi, %rax
retq
testq %rdx, %rdx
je 0xf1d1
bsrq %rdx, %rcx
xorq $0x3f, %rcx
jmp 0xf1d6
movl $0x40, %ecx
addl %ecx, %edi
movl $0x409, %esi            # imm = 0x409
subq %rcx, %rsi
movl %edi, %ecx
shlq %cl, %rdx
movl $0x1, %edi
jmp 0xf1e7
movl $0x40, %ecx
addl %ecx, %edi
movl $0x409, %esi            # imm = 0x409
subq %rcx, %rsi
movl %edi, %ecx
shlq %cl, %rdx
xorl %edi, %edi
movq %rax, %rcx
jmp 0xa25f