#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 *);
int main(int argc, char *argv[]) {
  unsigned int data = 0x01234567;
  char *data_ptr = (char *)&data;
  if ((data_ptr[0] == 0x01) && (data_ptr[1] == 0x23) && (data_ptr[2] == 0x45) &&
      (data_ptr[3] == 0x67)) {
    printf("I'm big endian\n");
  } else if ((data_ptr[0] == 0x67) && (data_ptr[1] == 0x45) &&
             (data_ptr[2] == 0x23) && (data_ptr[3] == 0x01)) {
    printf("I'm little endian\n");
  } else {
    printf("I'm confused about my endianess :-(\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1234567,-0x14(%rbp)
lea    -0x14(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x1,%eax
jne    1189 <main+0x79>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x23,%eax
jne    1189 <main+0x79>
mov    -0x20(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x45,%eax
jne    1189 <main+0x79>
mov    -0x20(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x67,%eax
jne    1189 <main+0x79>
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
jmp    11ee <main+0xde>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x67,%eax
jne    11dd <main+0xcd>
mov    -0x20(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x45,%eax
jne    11dd <main+0xcd>
mov    -0x20(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x23,%eax
jne    11dd <main+0xcd>
mov    -0x20(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x1,%eax
jne    11dd <main+0xcd>
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
jmp    11e9 <main+0xd9>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    11ee <main+0xde>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"I'm big endian\0A\00"
@.str.1 = [19 x i8] c"I'm little endian\0A\00"
@.str.2 = [37 x i8] c"I'm confused about my endianess :-(\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 19088743, i32* %6
%8 = bitcast i32* %6 to i8*
store i8* %8, i8** %7
%9 = load i8*, i8** %7
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 1
br i1 %13, label %14, label %34
14: ; preds = %2
%15 = load i8*, i8** %7
%16 = getelementptr inbounds i8, i8* %15, i64 1
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 35
br i1 %19, label %20, label %34
20: ; preds = %14
%21 = load i8*, i8** %7
%22 = getelementptr inbounds i8, i8* %21, i64 2
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 69
br i1 %25, label %26, label %34
26: ; preds = %20
%27 = load i8*, i8** %7
%28 = getelementptr inbounds i8, i8* %27, i64 3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 103
br i1 %31, label %32, label %34
32: ; preds = %26
%33 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %63
34: ; preds = %26, %20, %14, %2
%35 = load i8*, i8** %7
%36 = getelementptr inbounds i8, i8* %35, i64 0
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 103
br i1 %39, label %40, label %60
40: ; preds = %34
%41 = load i8*, i8** %7
%42 = getelementptr inbounds i8, i8* %41, i64 1
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = icmp eq i32 %44, 69
br i1 %45, label %46, label %60
46: ; preds = %40
%47 = load i8*, i8** %7
%48 = getelementptr inbounds i8, i8* %47, i64 2
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 35
br i1 %51, label %52, label %60
52: ; preds = %46
%53 = load i8*, i8** %7
%54 = getelementptr inbounds i8, i8* %53, i64 3
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %52
%59 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %62
60: ; preds = %52, %46, %40, %34
%61 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %62
62: ; preds = %60, %58
br label %63
63: ; preds = %62, %32
ret i32 0
}

LLVM IR (-O2):
@str = [18 x i8] c"I'm little endian\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 0
}