#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ dnear(double, double);
int /*<<< orphan*/ fnear(float, float);
double sll2d(long long);
float sll2f(long long);
double ull2d(unsigned long long);
float ull2f(unsigned long long);
test_longlong_integer_to_float() {
  if (ull2f(0ULL) != (float)0ULL)
    abort();
  if (ull2f(~0ULL) != (float)~0ULL)
    abort();
  if (ull2f((~0ULL) >> 1) != (float)((~0ULL) >> 1))
    abort();
  if (ull2f(~((~0ULL) >> 1)) != (float)~((~0ULL) >> 1))
    abort();
  if (ull2d(0ULL) != (double)0ULL)
    abort();
  if (ull2d(~0ULL) != (double)~0ULL)
    abort();
  if (ull2d((~0ULL) >> 1) != (double)((~0ULL) >> 1))
    abort();
  if (ull2d(~((~0ULL) >> 1)) != (double)~((~0ULL) >> 1))
    abort();
  if (sll2f(0LL) != (float)0LL)
    abort();
  if (sll2f(~0LL) != (float)~0LL)
    abort();
  if (!fnear(sll2f((long long int)((~0ULL) >> 1)),
             (float)(long long int)((~0ULL) >> 1)))
    abort();
  if (sll2f((long long int)(~((~0ULL) >> 1))) !=
      (float)(long long int)~((~0ULL) >> 1))
    abort();
  if (sll2d(0LL) != (double)0LL)
    abort();
  if (sll2d(~0LL) != (double)~0LL)
    abort();
  if (!dnear(sll2d((long long int)((~0ULL) >> 1)),
             (double)(long long int)((~0ULL) >> 1)))
    abort();
  if (!dnear(sll2d((long long int)~((~0ULL) >> 1)),
             (double)(long long int)~((~0ULL) >> 1)))
    abort();
}


x86 assembly (clang, -O0):
<test_longlong_integer_to_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1080 <ull2f@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1198 <test_longlong_integer_to_float+0x28>
jp     1198 <test_longlong_integer_to_float+0x28>
jmp    119f <test_longlong_integer_to_float+0x2f>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0xffffffffffffffff,%rdi
call   1080 <ull2f@plt>
movss  0xe4d(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11c7 <test_longlong_integer_to_float+0x57>
jp     11c7 <test_longlong_integer_to_float+0x57>
jmp    11ce <test_longlong_integer_to_float+0x5e>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x7fffffffffffffff,%rdi
ff ff 7f
call   1080 <ull2f@plt>
movss  0xe1f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    11f9 <test_longlong_integer_to_float+0x89>
jp     11f9 <test_longlong_integer_to_float+0x89>
jmp    1200 <test_longlong_integer_to_float+0x90>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x8000000000000000,%rdi
call   1080 <ull2f@plt>
movss  0xded(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    122b <test_longlong_integer_to_float+0xbb>
jp     122b <test_longlong_integer_to_float+0xbb>
jmp    1232 <test_longlong_integer_to_float+0xc2>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1090 <ull2d@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1253 <test_longlong_integer_to_float+0xe3>
jp     1253 <test_longlong_integer_to_float+0xe3>
jmp    125a <test_longlong_integer_to_float+0xea>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0xffffffffffffffff,%rdi
call   1090 <ull2d@plt>
movsd  0xda2(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1283 <test_longlong_integer_to_float+0x113>
jp     1283 <test_longlong_integer_to_float+0x113>
jmp    128a <test_longlong_integer_to_float+0x11a>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x7fffffffffffffff,%rdi
ff ff 7f
call   1090 <ull2d@plt>
movsd  0xd77(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12b6 <test_longlong_integer_to_float+0x146>
jp     12b6 <test_longlong_integer_to_float+0x146>
jmp    12bd <test_longlong_integer_to_float+0x14d>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x8000000000000000,%rdi
call   1090 <ull2d@plt>
movsd  0xd44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    12e9 <test_longlong_integer_to_float+0x179>
jp     12e9 <test_longlong_integer_to_float+0x179>
jmp    12f0 <test_longlong_integer_to_float+0x180>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <sll2f@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1310 <test_longlong_integer_to_float+0x1a0>
jp     1310 <test_longlong_integer_to_float+0x1a0>
jmp    1317 <test_longlong_integer_to_float+0x1a7>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0xffffffffffffffff,%rdi
call   1050 <sll2f@plt>
movss  0xcdd(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    133f <test_longlong_integer_to_float+0x1cf>
jp     133f <test_longlong_integer_to_float+0x1cf>
jmp    1346 <test_longlong_integer_to_float+0x1d6>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x7fffffffffffffff,%rdi
ff ff 7f
call   1050 <sll2f@plt>
movss  0xca7(%rip),%xmm1
call   1030 <fnear@plt>
cmp    $0x0,%eax
jne    1372 <test_longlong_integer_to_float+0x202>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x8000000000000000,%rdi
call   1050 <sll2f@plt>
movss  0xc83(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    139d <test_longlong_integer_to_float+0x22d>
jp     139d <test_longlong_integer_to_float+0x22d>
jmp    13a4 <test_longlong_integer_to_float+0x234>
mov    $0x0,%al
call   1040 <abort@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1060 <sll2d@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    13c5 <test_longlong_integer_to_float+0x255>
jp     13c5 <test_longlong_integer_to_float+0x255>
jmp    13cc <test_longlong_integer_to_float+0x25c>
mov    $0x0,%al
call   1040 <abort@plt>
mov    $0xffffffffffffffff,%rdi
call   1060 <sll2d@plt>
movsd  0xc40(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    13f5 <test_longlong_integer_to_float+0x285>
jp     13f5 <test_longlong_integer_to_float+0x285>
jmp    13fc <test_longlong_integer_to_float+0x28c>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x7fffffffffffffff,%rdi
ff ff 7f
call   1060 <sll2d@plt>
movsd  0xc05(%rip),%xmm1
call   1070 <dnear@plt>
cmp    $0x0,%eax
jne    1428 <test_longlong_integer_to_float+0x2b8>
mov    $0x0,%al
call   1040 <abort@plt>
movabs $0x8000000000000000,%rdi
call   1060 <sll2d@plt>
movsd  0xbe9(%rip),%xmm1
call   1070 <dnear@plt>
cmp    $0x0,%eax
jne    1454 <test_longlong_integer_to_float+0x2e4>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_longlong_integer_to_float>:
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1080 <ull2f@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    $0xffffffffffffffff,%rdi
call   1080 <ull2f@plt>
ucomiss 0xe60(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
movabs $0x7fffffffffffffff,%r14
ff ff 7f
mov    %r14,%rdi
call   1080 <ull2f@plt>
ucomiss 0xe3f(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
lea    0x1(%r14),%rbx
mov    %rbx,%rdi
call   1080 <ull2f@plt>
ucomiss 0xe20(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
xor    %edi,%edi
call   1090 <ull2d@plt>
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    $0xffffffffffffffff,%rdi
call   1090 <ull2d@plt>
ucomisd 0xdf2(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    %r14,%rdi
call   1090 <ull2d@plt>
ucomisd 0xdde(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    %rbx,%rdi
call   1090 <ull2d@plt>
ucomisd 0xdc2(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
xor    %edi,%edi
call   1050 <sll2f@plt>
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    $0xffffffffffffffff,%rdi
call   1050 <sll2f@plt>
ucomiss 0xd7a(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    %r14,%rdi
call   1050 <sll2f@plt>
movss  0xd5a(%rip),%xmm1
call   1030 <fnear@plt>
test   %eax,%eax
je     132b <test_longlong_integer_to_float+0x1bb>
mov    %rbx,%rdi
call   1050 <sll2f@plt>
ucomiss 0xd4a(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
xor    %edi,%edi
call   1060 <sll2d@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    $0xffffffffffffffff,%rdi
call   1060 <sll2d@plt>
ucomisd 0xd33(%rip),%xmm0
jne    132b <test_longlong_integer_to_float+0x1bb>
jp     132b <test_longlong_integer_to_float+0x1bb>
mov    %r14,%rdi
call   1060 <sll2d@plt>
movsd  0xd17(%rip),%xmm1
call   1070 <dnear@plt>
test   %eax,%eax
je     132b <test_longlong_integer_to_float+0x1bb>
mov    %rbx,%rdi
call   1060 <sll2d@plt>
movsd  0xd0e(%rip),%xmm1
call   1070 <dnear@plt>
test   %eax,%eax
je     132b <test_longlong_integer_to_float+0x1bb>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define i32 @test_longlong_integer_to_float() {
%1 = alloca i32
%2 = call float @ull2f(i64 0)
%3 = fcmp une float %2, 0.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call float @ull2f(i64 -1)
%8 = fcmp une float %7, 0x43F0000000000000
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 (...) @abort()
unreachable
11: ; preds = %6
%12 = call float @ull2f(i64 9223372036854775807)
%13 = fcmp une float %12, 0x43E0000000000000
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %11
%17 = call float @ull2f(i64 -9223372036854775808)
%18 = fcmp une float %17, 0x43E0000000000000
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %16
%22 = call double @ull2d(i64 0)
%23 = fcmp une double %22, 0.000000e+00
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = call i32 (...) @abort()
unreachable
26: ; preds = %21
%27 = call double @ull2d(i64 -1)
%28 = fcmp une double %27, 0x43F0000000000000
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 (...) @abort()
unreachable
31: ; preds = %26
%32 = call double @ull2d(i64 9223372036854775807)
%33 = fcmp une double %32, 0x43E0000000000000
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 (...) @abort()
unreachable
36: ; preds = %31
%37 = call double @ull2d(i64 -9223372036854775808)
%38 = fcmp une double %37, 0x43E0000000000000
br i1 %38, label %39, label %41
39: ; preds = %36
%40 = call i32 (...) @abort()
unreachable
41: ; preds = %36
%42 = call float @sll2f(i64 0)
%43 = fcmp une float %42, 0.000000e+00
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (...) @abort()
unreachable
46: ; preds = %41
%47 = call float @sll2f(i64 -1)
%48 = fcmp une float %47, -1.000000e+00
br i1 %48, label %49, label %51
49: ; preds = %46
%50 = call i32 (...) @abort()
unreachable
51: ; preds = %46
%52 = call float @sll2f(i64 9223372036854775807)
%53 = call i32 @fnear(float %52, float 0x43E0000000000000)
%54 = icmp ne i32 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %51
%56 = call i32 (...) @abort()
unreachable
57: ; preds = %51
%58 = call float @sll2f(i64 -9223372036854775808)
%59 = fcmp une float %58, 0xC3E0000000000000
br i1 %59, label %60, label %62
60: ; preds = %57
%61 = call i32 (...) @abort()
unreachable
62: ; preds = %57
%63 = call double @sll2d(i64 0)
%64 = fcmp une double %63, 0.000000e+00
br i1 %64, label %65, label %67
65: ; preds = %62
%66 = call i32 (...) @abort()
unreachable
67: ; preds = %62
%68 = call double @sll2d(i64 -1)
%69 = fcmp une double %68, -1.000000e+00
br i1 %69, label %70, label %72
70: ; preds = %67
%71 = call i32 (...) @abort()
unreachable
72: ; preds = %67
%73 = call double @sll2d(i64 9223372036854775807)
%74 = call i32 @dnear(double %73, double 0x43E0000000000000)
%75 = icmp ne i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = call i32 (...) @abort()
unreachable
78: ; preds = %72
%79 = call double @sll2d(i64 -9223372036854775808)
%80 = call i32 @dnear(double %79, double 0xC3E0000000000000)
%81 = icmp ne i32 %80, 0
br i1 %81, label %84, label %82
82: ; preds = %78
%83 = call i32 (...) @abort()
unreachable
84: ; preds = %78
%85 = load i32, i32* %1
ret i32 %85
}

LLVM IR (-O2):
define i32 @test_longlong_integer_to_float() {
%1 = tail call float @ull2f(i64 0)
%2 = fcmp une float %1, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call float @ull2f(i64 -1)
%7 = fcmp une float %6, 0x43F0000000000000
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = tail call float @ull2f(i64 9223372036854775807)
%12 = fcmp une float %11, 0x43E0000000000000
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
%16 = tail call float @ull2f(i64 -9223372036854775808)
%17 = fcmp une float %16, 0x43E0000000000000
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = tail call i32 (...) @abort()
unreachable
20: ; preds = %15
%21 = tail call double @ull2d(i64 0)
%22 = fcmp une double %21, 0.000000e+00
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = tail call i32 (...) @abort()
unreachable
25: ; preds = %20
%26 = tail call double @ull2d(i64 -1)
%27 = fcmp une double %26, 0x43F0000000000000
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 (...) @abort()
unreachable
30: ; preds = %25
%31 = tail call double @ull2d(i64 9223372036854775807)
%32 = fcmp une double %31, 0x43E0000000000000
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = tail call i32 (...) @abort()
unreachable
35: ; preds = %30
%36 = tail call double @ull2d(i64 -9223372036854775808)
%37 = fcmp une double %36, 0x43E0000000000000
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = tail call i32 (...) @abort()
unreachable
40: ; preds = %35
%41 = tail call float @sll2f(i64 0)
%42 = fcmp une float %41, 0.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = tail call i32 (...) @abort()
unreachable
45: ; preds = %40
%46 = tail call float @sll2f(i64 -1)
%47 = fcmp une float %46, -1.000000e+00
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = tail call i32 (...) @abort()
unreachable
50: ; preds = %45
%51 = tail call float @sll2f(i64 9223372036854775807)
%52 = tail call i32 @fnear(float %51, float 0x43E0000000000000)
%53 = icmp eq i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = tail call i32 (...) @abort()
unreachable
56: ; preds = %50
%57 = tail call float @sll2f(i64 -9223372036854775808)
%58 = fcmp une float %57, 0xC3E0000000000000
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = tail call i32 (...) @abort()
unreachable
61: ; preds = %56
%62 = tail call double @sll2d(i64 0)
%63 = fcmp une double %62, 0.000000e+00
br i1 %63, label %64, label %66
64: ; preds = %61
%65 = tail call i32 (...) @abort()
unreachable
66: ; preds = %61
%67 = tail call double @sll2d(i64 -1)
%68 = fcmp une double %67, -1.000000e+00
br i1 %68, label %69, label %71
69: ; preds = %66
%70 = tail call i32 (...) @abort()
unreachable
71: ; preds = %66
%72 = tail call double @sll2d(i64 9223372036854775807)
%73 = tail call i32 @dnear(double %72, double 0x43E0000000000000)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %77
75: ; preds = %71
%76 = tail call i32 (...) @abort()
unreachable
77: ; preds = %71
%78 = tail call double @sll2d(i64 -9223372036854775808)
%79 = tail call i32 @dnear(double %78, double 0xC3E0000000000000)
%80 = icmp eq i32 %79, 0
br i1 %80, label %81, label %83
81: ; preds = %77
%82 = tail call i32 (...) @abort()
unreachable
83: ; preds = %77
ret i32 undef
}