// File: /workspace/github_c_makefile_star2_O1/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, %r9   # imm = 0xFFFFFFFFFFFFF
cmpb $0x0, 0x5(%rsi)
je 0xefd0
movabsq $0x7ff0000000000000, %rcx # imm = 0x7FF0000000000000
testq %rcx, %rdi
setne %cl
testq %r9, %rdi
sete %dl
orb %cl, %dl
jne 0xefd0
orb $0x40, 0x2(%rax)
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
andq %rcx, %rdi
movq %rdi, %rdx
andq %r9, %rdx
movq %rdi, %rsi
shrq $0x34, %rsi
andq $0x7ff, %rsi            # imm = 0x7FF
jne 0xf00c
testq %rdx, %rdx
je 0xf103
bsrq %rdx, %rcx
xorl $0x3f, %ecx
addl $0xf5, %ecx
movzbl %cl, %ecx
shlq %cl, %rdx
movl $0x1, %esi
subl %ecx, %esi
movslq %esi, %rsi
testq %rdi, %rdi
js 0xf02d
cmpq $0x7ff, %rsi            # imm = 0x7FF
jne 0xf040
testq %rdx, %rdx
je 0xf10d
xorl %esi, %esi
movq %rax, %rdx
jmp 0xdb26
orb $0x1, 0x2(%rax)
movabsq $0x7ff8000000000000, %rdi # imm = 0x7FF8000000000000
jmp 0xf10d
pushq %r15
pushq %r14
pushq %rbx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
incq %r9
orq %r9, %rdx
movq %rsi, %rcx
shlq $0x34, %rcx
movabsq $-0x3ff0000000000000, %r9 # imm = 0xC010000000000000
addq %rcx, %r9
movabsq $0x8000000000000, %r10  # imm = 0x8000000000000
leaq 0x1(%r8), %rdi
movq %r10, %r11
movq %rdx, %rcx
shrq $0x20, %rcx
movl %edx, %r14d
imulq %rcx, %r14
imulq %rcx, %rcx
movq %r14, %r15
shrq $0x1f, %r15
movl %r15d, %ebx
andq %rdi, %r15
addq %rcx, %rbx
shlq $0x21, %r14
imulq %rdx, %rdx
cmpq %r14, %rdx
adcq %r15, %rbx
shldq $0xc, %rdx, %rbx
movq %rbx, %rdx
movq %rbx, %rcx
shrq $0x35, %rcx
andb $0x1, %cl
shrq %cl, %rbx
shlq $0xa, %rdx
sarq $0x3f, %rdx
andq %r10, %rdx
orq %rdx, %r9
shrq %r11
movq %rbx, %rdx
cmpq $0x1, %r10
movq %r11, %r10
ja 0xf076
movq %r9, %rdx
negq %rdx
xorl %edi, %edi
cmpq $0x3ff, %rsi            # imm = 0x3FF
setl %r10b
cmovgeq %r9, %rdx
testq %rdx, %rdx
popq %rbx
popq %r14
popq %r15
je 0xf111
bsrq %rdx, %rcx
xorq $0x3f, %rcx
jmp 0xf116
movabsq $-0x10000000000000, %rdi # imm = 0xFFF0000000000000
movq %rdi, %rax
retq
movl $0x40, %ecx
addl %ecx, %r8d
movl $0x409, %esi            # imm = 0x409
subq %rcx, %rsi
movl %r8d, %ecx
shlq %cl, %rdx
movb %r10b, %dil
movq %rax, %rcx
jmp 0xa1a9