// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/softfloat.c
// Function: float128_to_int32_round_to_zero
int32 float128_to_int32_round_to_zero(float128 a, float_status *status)
{
    flag aSign;
    int32 aExp, shiftCount;
    uint64_t aSig0, aSig1, savedASig;
    int32_t z;

    aSig1 = extractFloat128Frac1( a );
    aSig0 = extractFloat128Frac0( a );
    aExp = extractFloat128Exp( a );
    aSign = extractFloat128Sign( a );
    aSig0 |= ( aSig1 != 0 );
    if ( 0x401E < aExp ) {
        if ( ( aExp == 0x7FFF ) && aSig0 ) aSign = 0;
        goto invalid;
    }
    else if ( aExp < 0x3FFF ) {
        if (aExp || aSig0) {
            status->float_exception_flags |= float_flag_inexact;
        }
        return 0;
    }
    aSig0 |= LIT64( 0x0001000000000000 );
    shiftCount = 0x402F - aExp;
    savedASig = aSig0;
    aSig0 >>= shiftCount;
    z = aSig0;
    if ( aSign ) z = - z;
    if ( ( z < 0 ) ^ aSign ) {
 invalid:
        float_raise(float_flag_invalid, status);
        return aSign ? (int32_t) 0x80000000 : 0x7FFFFFFF;
    }
    if ( ( aSig0<<shiftCount ) != savedASig ) {
        status->float_exception_flags |= float_flag_inexact;
    }
    return z;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1e410
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1e430
movq %rax, -0x38(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1e450
movl %eax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x1e470
movb %al, -0x21(%rbp)
cmpq $0x0, -0x40(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
orq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x401e, %eax           # imm = 0x401E
cmpl -0x28(%rbp), %eax
jge 0x1e520
cmpl $0x7fff, -0x28(%rbp)    # imm = 0x7FFF
jne 0x1e51b
cmpq $0x0, -0x38(%rbp)
je 0x1e51b
movb $0x0, -0x21(%rbp)
jmp 0x1e5b5
cmpl $0x3fff, -0x28(%rbp)    # imm = 0x3FFF
jge 0x1e550
cmpl $0x0, -0x28(%rbp)
jne 0x1e536
cmpq $0x0, -0x38(%rbp)
je 0x1e544
movq -0x20(%rbp), %rax
movsbl 0x2(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x2(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x1e600
jmp 0x1e552
movabsq $0x1000000000000, %rax  # imm = 0x1000000000000
orq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x402f, %eax           # imm = 0x402F
subl -0x28(%rbp), %eax
movl %eax, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, %ecx
shrq %cl, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movl %eax, -0x4c(%rbp)
cmpb $0x0, -0x21(%rbp)
je 0x1e59c
xorl %eax, %eax
subl -0x4c(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
setl %al
andb $0x1, %al
movzbl %al, %eax
movzbl -0x21(%rbp), %ecx
xorl %ecx, %eax
cmpl $0x0, %eax
je 0x1e5dc
jmp 0x1e5b5
movq -0x20(%rbp), %rsi
movl $0x1, %edi
callq 0x11080
movzbl -0x21(%rbp), %edx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl $0x80000000, %ecx       # imm = 0x80000000
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x1e600
movq -0x38(%rbp), %rax
movl -0x2c(%rbp), %ecx
shlq %cl, %rax
cmpq -0x48(%rbp), %rax
je 0x1e5fa
movq -0x20(%rbp), %rax
movsbl 0x2(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x2(%rax)
movl -0x4c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)