// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/softfloat.c
// Function: float64_to_int64_round_to_zero
int64 float64_to_int64_round_to_zero(float64 a, float_status *status)
{
    flag aSign;
    int_fast16_t aExp, shiftCount;
    uint64_t aSig;
    int64 z;
    a = float64_squash_input_denormal(a, status);

    aSig = extractFloat64Frac( a );
    aExp = extractFloat64Exp( a );
    aSign = extractFloat64Sign( a );
    if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
    shiftCount = aExp - 0x433;
    if ( 0 <= shiftCount ) {
        if ( 0x43E <= aExp ) {
            if ( float64_val(a) != LIT64( 0xC3E0000000000000 ) ) {
                float_raise(float_flag_invalid, status);
                if (    ! aSign
                     || (    ( aExp == 0x7FF )
                          && ( aSig != LIT64( 0x0010000000000000 ) ) )
                   ) {
                    return LIT64( 0x7FFFFFFFFFFFFFFF );
                }
            }
            return (int64_t) LIT64( 0x8000000000000000 );
        }
        z = aSig<<shiftCount;
    }
    else {
        if ( aExp < 0x3FE ) {
            if (aExp | aSig) {
                status->float_exception_flags |= float_flag_inexact;
            }
            return 0;
        }
        z = aSig>>( - shiftCount );
        if ( (uint64_t) ( aSig<<( shiftCount & 63 ) ) ) {
            status->float_exception_flags |= float_flag_inexact;
        }
    }
    if ( aSign ) z = - z;
    return z;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x11610
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x116a0
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11680
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x168f0
movb %al, -0x19(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x16d60
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
orq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
subq $0x433, %rax            # imm = 0x433
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq -0x30(%rbp), %rax
jg 0x16dfc
movl $0x43e, %eax            # imm = 0x43E
cmpq -0x28(%rbp), %rax
jg 0x16deb
movabsq $-0x3c20000000000000, %rax # imm = 0xC3E0000000000000
cmpq %rax, -0x10(%rbp)
je 0x16dd8
movq -0x18(%rbp), %rsi
movl $0x1, %edi
callq 0x11080
cmpb $0x0, -0x19(%rbp)
je 0x16dc3
cmpq $0x7ff, -0x28(%rbp)     # imm = 0x7FF
jne 0x16dd6
movabsq $0x10000000000000, %rax # imm = 0x10000000000000
cmpq %rax, -0x38(%rbp)
je 0x16dd6
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
movq %rax, -0x8(%rbp)
jmp 0x16e7a
jmp 0x16dd8
movabsq $-0x8000000000000000, %rax # imm = 0x8000000000000000
movq %rax, -0x8(%rbp)
jmp 0x16e7a
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
shlq %cl, %rax
movq %rax, -0x40(%rbp)
jmp 0x16e62
cmpq $0x3fe, -0x28(%rbp)     # imm = 0x3FE
jge 0x16e2c
movq -0x28(%rbp), %rax
orq -0x38(%rbp), %rax
cmpq $0x0, %rax
je 0x16e22
movq -0x18(%rbp), %rax
movsbl 0x2(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x2(%rax)
movq $0x0, -0x8(%rbp)
jmp 0x16e7a
movq -0x38(%rbp), %rax
xorl %ecx, %ecx
subq -0x30(%rbp), %rcx
shrq %cl, %rax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rax
movq -0x30(%rbp), %rcx
andq $0x3f, %rcx
shlq %cl, %rax
cmpq $0x0, %rax
je 0x16e60
movq -0x18(%rbp), %rax
movsbl 0x2(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x2(%rax)
jmp 0x16e62
cmpb $0x0, -0x19(%rbp)
je 0x16e72
xorl %eax, %eax
subq -0x40(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)