#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 */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double, int /*<<< orphan*/);
int /*<<< orphan*/ stdlib_base_float64_get_high_word(double,
                                                     int /*<<< orphan*/ *);
int main() {
  double x[] = {3.14, -3.14, 0.0, 0.0 / 0.0};
  uint32_t high;
  int i;
  for (i = 0; i < 4; i++) {
    stdlib_base_float64_get_high_word(x[i], &high);
    printf("%lf => high: %u\n", x[i], high);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec1(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x38(%rbp)
cmpl   $0x4,-0x38(%rbp)
jge    11a6 <main+0x86>
movslq -0x38(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
lea    -0x34(%rbp),%rdi
call   1040 <stdlib_base_float64_get_high_word@plt>
movslq -0x38(%rbp),%rax
movsd  -0x30(%rbp,%rax,8),%xmm0
mov    -0x34(%rbp),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1162 <main+0x42>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movsd  0xed4(%rip),%xmm0
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <stdlib_base_float64_get_high_word@plt>
mov    0x4(%rsp),%esi
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
movsd  0xeb1(%rip),%xmm0
call   1030 <printf@plt>
movsd  0xeac(%rip),%xmm0
mov    %r14,%rdi
call   1040 <stdlib_base_float64_get_high_word@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
movsd  0xe95(%rip),%xmm0
call   1030 <printf@plt>
xorps  %xmm0,%xmm0
mov    %r14,%rdi
call   1040 <stdlib_base_float64_get_high_word@plt>
mov    0x4(%rsp),%esi
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe76(%rip),%xmm0
mov    %r14,%rdi
call   1040 <stdlib_base_float64_get_high_word@plt>
mov    0x4(%rsp),%esi
mov    %rbx,%rdi
movsd  0xe5f(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.x = [4 x double] [double 3.140000e+00, double -3.140000e+00, double 0.000000e+00, double 0x7FF8000000000000]
@.str = [17 x i8] c"%lf => high: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x double]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [4 x double]* %2 to i8*
store i32 0, i32* %4
br label %6
6: ; preds = %21, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %24
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 %11
%13 = load double, double* %12
%14 = call i32 @stdlib_base_float64_get_high_word(double %13, i32* %3)
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [4 x double], [4 x double]* %2, i64 0, i64 %16
%18 = load double, double* %17
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double %18, i32 %19)
br label %21
21: ; preds = %9
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
br label %6
24: ; preds = %6
%25 = load i32, i32* %1
ret i32 %25
}

LLVM IR (-O2):
@.str = [17 x i8] c"%lf => high: %u\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @stdlib_base_float64_get_high_word(double 3.140000e+00, i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double 3.140000e+00, i32 %4)
%6 = call i32 @stdlib_base_float64_get_high_word(double -3.140000e+00, i32* %1)
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double -3.140000e+00, i32 %7)
%9 = call i32 @stdlib_base_float64_get_high_word(double 0.000000e+00, i32* %1)
%10 = load i32, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double 0.000000e+00, i32 %10)
%12 = call i32 @stdlib_base_float64_get_high_word(double 0x7FF8000000000000, i32* %1)
%13 = load i32, i32* %1
%14 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), double 0x7FF8000000000000, i32 %13)
ret i32 0
}