#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*/ program_error(char *);
void set_htole_double(double *d) {
  const double one = 1.0;
  if (((const unsigned char *)&one)[0] == 0x3F) {
    unsigned char tmp, *b = (unsigned char *)d;
    tmp = b[0], b[0] = b[7], b[7] = tmp;
    tmp = b[1], b[1] = b[6], b[6] = tmp;
    tmp = b[2], b[2] = b[5], b[5] = tmp;
    tmp = b[3], b[3] = b[4], b[4] = tmp;
  } else if (((const unsigned char *)&one)[7] != 0x3F)
    program_error("unknown floating point host format");
}


x86 assembly (clang, -O0):
<set_htole_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  0xedc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movzbl -0x10(%rbp),%eax
cmp    $0x3f,%eax
jne    11c9 <set_htole_double+0xb9>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x20(%rbp),%rax
mov    0x7(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,(%rax)
mov    -0x11(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x7(%rax)
mov    -0x20(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x20(%rbp),%rax
mov    0x6(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x11(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x6(%rax)
mov    -0x20(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x20(%rbp),%rax
mov    0x5(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x11(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x20(%rbp),%rax
mov    0x3(%rax),%al
mov    %al,-0x11(%rbp)
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x3(%rax)
mov    -0x11(%rbp),%cl
mov    -0x20(%rbp),%rax
mov    %cl,0x4(%rax)
jmp    11e7 <set_htole_double+0xd7>
movzbl -0x9(%rbp),%eax
cmp    $0x3f,%eax
je     11e2 <set_htole_double+0xd2>
lea    0xe2b(%rip),%rdi
call   1030 <program_error@plt>
jmp    11e7 <set_htole_double+0xd7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_htole_double>:
ret

LLVM IR (-O0):
@.str = [35 x i8] c"unknown floating point host format\00"
define void @set_htole_double(double* %0) {
%2 = alloca double*
%3 = alloca double
%4 = alloca i8
%5 = alloca i8*
store double* %0, double** %2
store double 1.000000e+00, double* %3
%6 = bitcast double* %3 to i8*
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = zext i8 %8 to i32
%10 = icmp eq i32 %9, 63
br i1 %10, label %11, label %58
11: ; preds = %1
%12 = load double*, double** %2
%13 = bitcast double* %12 to i8*
store i8* %13, i8** %5
%14 = load i8*, i8** %5
%15 = getelementptr inbounds i8, i8* %14, i64 0
%16 = load i8, i8* %15
store i8 %16, i8* %4
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 7
%19 = load i8, i8* %18
%20 = load i8*, i8** %5
%21 = getelementptr inbounds i8, i8* %20, i64 0
store i8 %19, i8* %21
%22 = load i8, i8* %4
%23 = load i8*, i8** %5
%24 = getelementptr inbounds i8, i8* %23, i64 7
store i8 %22, i8* %24
%25 = load i8*, i8** %5
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %26
store i8 %27, i8* %4
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 6
%30 = load i8, i8* %29
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i64 1
store i8 %30, i8* %32
%33 = load i8, i8* %4
%34 = load i8*, i8** %5
%35 = getelementptr inbounds i8, i8* %34, i64 6
store i8 %33, i8* %35
%36 = load i8*, i8** %5
%37 = getelementptr inbounds i8, i8* %36, i64 2
%38 = load i8, i8* %37
store i8 %38, i8* %4
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i64 5
%41 = load i8, i8* %40
%42 = load i8*, i8** %5
%43 = getelementptr inbounds i8, i8* %42, i64 2
store i8 %41, i8* %43
%44 = load i8, i8* %4
%45 = load i8*, i8** %5
%46 = getelementptr inbounds i8, i8* %45, i64 5
store i8 %44, i8* %46
%47 = load i8*, i8** %5
%48 = getelementptr inbounds i8, i8* %47, i64 3
%49 = load i8, i8* %48
store i8 %49, i8* %4
%50 = load i8*, i8** %5
%51 = getelementptr inbounds i8, i8* %50, i64 4
%52 = load i8, i8* %51
%53 = load i8*, i8** %5
%54 = getelementptr inbounds i8, i8* %53, i64 3
store i8 %52, i8* %54
%55 = load i8, i8* %4
%56 = load i8*, i8** %5
%57 = getelementptr inbounds i8, i8* %56, i64 4
store i8 %55, i8* %57
br label %67
58: ; preds = %1
%59 = bitcast double* %3 to i8*
%60 = getelementptr inbounds i8, i8* %59, i64 7
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = icmp ne i32 %62, 63
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 @program_error(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
br label %66
66: ; preds = %64, %58
br label %67
67: ; preds = %66, %11
ret void
}

LLVM IR (-O2):
define void @set_htole_double(double* nocapture %0) {
ret void
}