#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 machineEndianness();
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (machineEndianness() == 0)
    printf("This machine is LITTLE ENDIAN\n");
  if (machineEndianness() == 1)
    printf("This machine is BIGENDIAN\n");
  printf("Sizes: char %lu int %lu double %lu\n", sizeof(char), sizeof(int),
         sizeof(double));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <machineEndianness@plt>
cmp    $0x0,%eax
jne    1154 <main+0x34>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <machineEndianness@plt>
cmp    $0x1,%eax
jne    1172 <main+0x52>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <machineEndianness@plt>
test   %eax,%eax
jne    1148 <main+0x18>
lea    0xefb(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <machineEndianness@plt>
cmp    $0x1,%eax
jne    1160 <main+0x30>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
mov    $0x8,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"This machine is LITTLE ENDIAN\0A\00"
@.str.1 = [27 x i8] c"This machine is BIGENDIAN\0A\00"
@.str.2 = [36 x i8] c"Sizes: char %lu int %lu double %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @machineEndianness()
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %2
%11 = call i32 (...) @machineEndianness()
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 1, i64 4, i64 8)
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
@.str.2 = [36 x i8] c"Sizes: char %lu int %lu double %lu\0A\00"
@str = [26 x i8] c"This machine is BIGENDIAN\00"
@str.3 = [30 x i8] c"This machine is LITTLE ENDIAN\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @machineEndianness()
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.3, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
%8 = tail call i32 (...) @machineEndianness()
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0), i64 1, i64 4, i64 8)
ret i32 0
}