#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*/ printf(char *);
void flipped_double(void) {
  typedef struct {
    unsigned lo, hi;
  } dfloat;
  union {
    dfloat eksplicit;
    double machine_double;
  } x;
  x.machine_double = 2;
  dfloat test = x.eksplicit;
  if (test.lo == 0 && test.hi != 0) {
    printf("#define double_wordorder_bigendian_p 0\n");
  } else if (test.lo != 0 && test.hi == 0) {
    printf("#define double_wordorder_bigendian_p 1\n");
  } else {
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<flipped_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1152 <flipped_double+0x42>
cmpl   $0x0,-0xc(%rbp)
je     1152 <flipped_double+0x42>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
jmp    1181 <flipped_double+0x71>
cmpl   $0x0,-0x10(%rbp)
je     1177 <flipped_double+0x67>
cmpl   $0x0,-0xc(%rbp)
jne    1177 <flipped_double+0x67>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
jmp    117c <flipped_double+0x6c>
jmp    117c <flipped_double+0x6c>
jmp    1181 <flipped_double+0x71>
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flipped_double>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
%union.anon = type { double }
%struct.dfloat = type { i32, i32 }
@.str = [40 x i8] c"#define double_wordorder_bigendian_p 0\0A\00"
@.str.1 = [40 x i8] c"#define double_wordorder_bigendian_p 1\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @flipped_double() {
%1 = alloca %union.anon
%2 = alloca %struct.dfloat
%3 = bitcast %union.anon* %1 to double*
store double 2.000000e+00, double* %3
%4 = bitcast %union.anon* %1 to %struct.dfloat*
%5 = bitcast %struct.dfloat* %2 to i8*
%6 = bitcast %struct.dfloat* %4 to i8*
%7 = getelementptr inbounds %struct.dfloat, %struct.dfloat* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = getelementptr inbounds %struct.dfloat, %struct.dfloat* %2, i32 0, i32 1
%12 = load i32, i32* %11
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
br label %28
16: ; preds = %10, %0
%17 = getelementptr inbounds %struct.dfloat, %struct.dfloat* %2, i32 0, i32 0
%18 = load i32, i32* %17
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %26
20: ; preds = %16
%21 = getelementptr inbounds %struct.dfloat, %struct.dfloat* %2, i32 0, i32 1
%22 = load i32, i32* %21
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %27
26: ; preds = %20, %16
br label %27
27: ; preds = %26, %24
br label %28
28: ; preds = %27, %14
%29 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [39 x i8] c"#define double_wordorder_bigendian_p 0\00"
define void @flipped_double() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}