// File: /workspace/github_c_makefile_star2_O0/mbitsnbites[P]SoftFP/softfloat.c
// Function: float128_round_to_int
float128 float128_round_to_int(float128 a, float_status *status)
{
    flag aSign;
    int32 aExp;
    uint64_t lastBitMask, roundBitsMask;
    float128 z;

    aExp = extractFloat128Exp( a );
    if ( 0x402F <= aExp ) {
        if ( 0x406F <= aExp ) {
            if (    ( aExp == 0x7FFF )
                 && ( extractFloat128Frac0( a ) | extractFloat128Frac1( a ) )
               ) {
                return propagateFloat128NaN(a, a, status);
            }
            return a;
        }
        lastBitMask = 1;
        lastBitMask = ( lastBitMask<<( 0x406E - aExp ) )<<1;
        roundBitsMask = lastBitMask - 1;
        z = a;
        switch (status->float_rounding_mode) {
        case float_round_nearest_even:
            if ( lastBitMask ) {
                add128( z.high, z.low, 0, lastBitMask>>1, &z.high, &z.low );
                if ( ( z.low & roundBitsMask ) == 0 ) z.low &= ~ lastBitMask;
            }
            else {
                if ( (int64_t) z.low < 0 ) {
                    ++z.high;
                    if ( (uint64_t) ( z.low<<1 ) == 0 ) z.high &= ~1;
                }
            }
            break;
        case float_round_ties_away:
            if (lastBitMask) {
                add128(z.high, z.low, 0, lastBitMask >> 1, &z.high, &z.low);
            } else {
                if ((int64_t) z.low < 0) {
                    ++z.high;
                }
            }
            break;
        case float_round_to_zero:
            break;
        case float_round_up:
            if (!extractFloat128Sign(z)) {
                add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low);
            }
            break;
        case float_round_down:
            if (extractFloat128Sign(z)) {
                add128(z.high, z.low, 0, roundBitsMask, &z.high, &z.low);
            }
            break;
        default:
            abort();
        }
        z.low &= ~ roundBitsMask;
    }
    else {
        if ( aExp < 0x3FFF ) {
            if ( ( ( (uint64_t) ( a.high<<1 ) ) | a.low ) == 0 ) return a;
            status->float_exception_flags |= float_flag_inexact;
            aSign = extractFloat128Sign( a );
            switch (status->float_rounding_mode) {
             case float_round_nearest_even:
                if (    ( aExp == 0x3FFE )
                     && (   extractFloat128Frac0( a )
                          | extractFloat128Frac1( a ) )
                   ) {
                    return packFloat128( aSign, 0x3FFF, 0, 0 );
                }
                break;
            case float_round_ties_away:
                if (aExp == 0x3FFE) {
                    return packFloat128(aSign, 0x3FFF, 0, 0);
                }
                break;
             case float_round_down:
                return
                      aSign ? packFloat128( 1, 0x3FFF, 0, 0 )
                    : packFloat128( 0, 0, 0, 0 );
             case float_round_up:
                return
                      aSign ? packFloat128( 1, 0, 0, 0 )
                    : packFloat128( 0, 0x3FFF, 0, 0 );
            }
            return packFloat128( aSign, 0, 0, 0 );
        }
        lastBitMask = 1;
        lastBitMask <<= 0x402F - aExp;
        roundBitsMask = lastBitMask - 1;
        z.low = 0;
        z.high = a.high;
        switch (status->float_rounding_mode) {
        case float_round_nearest_even:
            z.high += lastBitMask>>1;
            if ( ( ( z.high & roundBitsMask ) | a.low ) == 0 ) {
                z.high &= ~ lastBitMask;
            }
            break;
        case float_round_ties_away:
            z.high += lastBitMask>>1;
            break;
        case float_round_to_zero:
            break;
        case float_round_up:
            if (!extractFloat128Sign(z)) {
                z.high |= ( a.low != 0 );
                z.high += roundBitsMask;
            }
            break;
        case float_round_down:
            if (extractFloat128Sign(z)) {
                z.high |= (a.low != 0);
                z.high += roundBitsMask;
            }
            break;
        default:
            abort();
        }
        z.high &= ~ roundBitsMask;
    }
    if ( ( z.low != a.low ) || ( z.high != a.high ) ) {
        status->float_exception_flags |= float_flag_inexact;
    }
    return z;

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x20(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x28(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e450
movl %eax, -0x30(%rbp)
movl $0x402f, %eax           # imm = 0x402F
cmpl -0x30(%rbp), %eax
jg 0x1f154
movl $0x406f, %eax           # imm = 0x406F
cmpl -0x30(%rbp), %eax
jg 0x1efb1
cmpl $0x7fff, -0x30(%rbp)    # imm = 0x7FFF
jne 0x1ef9c
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e430
movq %rax, -0x58(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e410
movq %rax, %rcx
movq -0x58(%rbp), %rax
orq %rcx, %rax
cmpq $0x0, %rax
je 0x1ef9c
movq -0x28(%rbp), %r8
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x1f480
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1f464
movq $0x1, -0x38(%rbp)
movq -0x38(%rbp), %rax
movb -0x30(%rbp), %dl
movb $0x6e, %cl
subb %dl, %cl
shlq %cl, %rax
addq %rax, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
decq %rax
movq %rax, -0x40(%rbp)
movups -0x20(%rbp), %xmm0
movaps %xmm0, -0x50(%rbp)
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, %ecx
movq %rcx, -0x60(%rbp)
subl $0x4, %eax
ja 0x1f13a
movq -0x60(%rbp), %rax
leaq 0x69a1(%rip), %rcx      # 0x259a4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, -0x38(%rbp)
je 0x1f057
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x38(%rbp), %rcx
shrq %rcx
leaq -0x50(%rbp), %r8
addq $0x8, %r8
leaq -0x50(%rbp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x18bd0
movq -0x50(%rbp), %rax
andq -0x40(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f055
movq -0x38(%rbp), %rax
xorq $-0x1, %rax
andq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x1f087
cmpq $0x0, -0x50(%rbp)
jge 0x1f085
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
shlq %rax
cmpq $0x0, %rax
jne 0x1f083
movq -0x48(%rbp), %rax
andq $-0x2, %rax
movq %rax, -0x48(%rbp)
jmp 0x1f085
jmp 0x1f087
jmp 0x1f13f
cmpq $0x0, -0x38(%rbp)
je 0x1f0b9
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x38(%rbp), %rcx
shrq %rcx
leaq -0x50(%rbp), %r8
addq $0x8, %r8
leaq -0x50(%rbp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x18bd0
jmp 0x1f0ce
cmpq $0x0, -0x50(%rbp)
jge 0x1f0cc
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x1f0ce
jmp 0x1f13f
jmp 0x1f13f
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1e470
cmpb $0x0, %al
jne 0x1f104
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rcx
leaq -0x50(%rbp), %r8
addq $0x8, %r8
leaq -0x50(%rbp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x18bd0
jmp 0x1f13f
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1e470
cmpb $0x0, %al
je 0x1f138
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x40(%rbp), %rcx
leaq -0x50(%rbp), %r8
addq $0x8, %r8
leaq -0x50(%rbp), %r9
xorl %eax, %eax
movl %eax, %edx
callq 0x18bd0
jmp 0x1f13f
callq 0x1030
movq -0x40(%rbp), %rax
xorq $-0x1, %rax
andq -0x50(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x1f432
cmpl $0x3fff, -0x30(%rbp)    # imm = 0x3FFF
jge 0x1f308
movq -0x18(%rbp), %rax
shlq %rax
orq -0x20(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f187
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x1f464
movq -0x28(%rbp), %rax
movb 0x2(%rax), %cl
orb $0x20, %cl
movb %cl, 0x2(%rax)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e470
movb %al, -0x29(%rbp)
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x4, %eax
ja 0x1f2e9
movq -0x68(%rbp), %rax
leaq 0x67ca(%rip), %rcx      # 0x25990
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x3ffe, -0x30(%rbp)    # imm = 0x3FFE
jne 0x1f228
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e430
movq %rax, -0x70(%rbp)
movq -0x20(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x1e410
movq %rax, %rcx
movq -0x70(%rbp), %rax
orq %rcx, %rax
cmpq $0x0, %rax
je 0x1f228
movl $0x3fff, %esi           # imm = 0x3FFF
xorl %eax, %eax
movl %eax, %ecx
movzbl -0x29(%rbp), %edi
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
jmp 0x1f2e9
cmpl $0x3ffe, -0x30(%rbp)    # imm = 0x3FFE
jne 0x1f258
movl $0x3fff, %esi           # imm = 0x3FFF
xorl %eax, %eax
movl %eax, %ecx
movzbl -0x29(%rbp), %edi
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
jmp 0x1f2e9
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
je 0x1f286
movl $0x1, %edi
movl $0x3fff, %esi           # imm = 0x3FFF
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f29e
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %ecx
movl %esi, %edi
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
movzbl -0x29(%rbp), %eax
cmpl $0x0, %eax
je 0x1f2c9
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f2e4
xorl %edi, %edi
movl $0x3fff, %esi           # imm = 0x3FFF
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
xorl %esi, %esi
xorl %eax, %eax
movl %eax, %ecx
movzbl -0x29(%rbp), %edi
movq %rcx, %rdx
callq 0x11a80
movq %rax, -0x10(%rbp)
movq %rdx, -0x8(%rbp)
jmp 0x1f464
movq $0x1, -0x38(%rbp)
movb -0x30(%rbp), %dl
movq -0x38(%rbp), %rax
movb $0x2f, %cl
subb %dl, %cl
shlq %cl, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
decq %rax
movq %rax, -0x40(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
movsbl 0x1(%rax), %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x4, %eax
ja 0x1f41d
movq -0x78(%rbp), %rax
leaq 0x661d(%rip), %rcx      # 0x2597c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x38(%rbp), %rax
shrq %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
andq -0x40(%rbp), %rax
orq -0x20(%rbp), %rax
cmpq $0x0, %rax
jne 0x1f399
movq -0x38(%rbp), %rax
xorq $-0x1, %rax
andq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1f422
movq -0x38(%rbp), %rax
shrq %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1f422
jmp 0x1f422
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1e470
cmpb $0x0, %al
jne 0x1f3e5
cmpq $0x0, -0x20(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1f422
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1e470
cmpb $0x0, %al
je 0x1f41b
cmpq $0x0, -0x20(%rbp)
setne %al
andb $0x1, %al
movzbl %al, %eax
cltq
orq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x1f422
callq 0x1030
movq -0x40(%rbp), %rax
xorq $-0x1, %rax
andq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x50(%rbp), %rax
cmpq -0x20(%rbp), %rax
jne 0x1f446
movq -0x48(%rbp), %rax
cmpq -0x18(%rbp), %rax
je 0x1f454
movq -0x28(%rbp), %rax
movsbl 0x2(%rax), %ecx
orl $0x20, %ecx
movb %cl, 0x2(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)