#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) {
  union {
    long i;
    char c[4];
  } sextest;
  sextest.i = 0x03020100;
  printf("This machine is ");
  if (sextest.c[0] == 0x03)
    printf("big endian / bytesex odd / Most Significant Byte First\n");
  else
    printf("little endian / bytesex even / Least Significant Byte First\n");
  printf("\nunion{int i; char c[4]} u;\n\n"
         "u.i = 0x03020100;\n"
         "/* is equivalent to: */\n"
         "u.c[0] = %#x;\nu.c[1] = %#x;\nu.c[2] = %#x;\nu.c[3] = %#x;\n",
         sextest.c[0], sextest.c[1], sextest.c[2], sextest.c[3]);
  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)
movq   $0x3020100,-0x18(%rbp)
03
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x18(%rbp),%eax
cmp    $0x3,%eax
jne    115c <main+0x4c>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    116a <main+0x5a>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsbl -0x18(%rbp),%esi
movsbl -0x17(%rbp),%edx
movsbl -0x16(%rbp),%ecx
movsbl -0x15(%rbp),%r8d
lea    0xf04(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
lea    0xecf(%rip),%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    $0x2,%ecx
mov    $0x3,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
%union.anon = type { i64 }
@.str = [17 x i8] c"This machine is \00"
@.str.1 = [56 x i8] c"big endian / bytesex odd / Most Significant Byte First\0A\00"
@.str.2 = [61 x i8] c"little endian / bytesex even / Least Significant Byte First\0A\00"
@.str.3 = [128 x i8] c"\0Aunion{int i; char c[4]} u;\0A\0Au.i = 0x03020100;\0A/* is equivalent to: */\0Au.c[0] = %#x;\0Au.c[1] = %#x;\0Au.c[2] = %#x;\0Au.c[3] = %#x;\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %union.anon
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = bitcast %union.anon* %6 to i64*
store i64 50462976, i64* %7
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = bitcast %union.anon* %6 to [4 x i8]*
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %9, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 3
br i1 %13, label %14, label %16
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0))
br label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.2, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
%19 = bitcast %union.anon* %6 to [4 x i8]*
%20 = getelementptr inbounds [4 x i8], [4 x i8]* %19, i64 0, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = bitcast %union.anon* %6 to [4 x i8]*
%24 = getelementptr inbounds [4 x i8], [4 x i8]* %23, i64 0, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = bitcast %union.anon* %6 to [4 x i8]*
%28 = getelementptr inbounds [4 x i8], [4 x i8]* %27, i64 0, i64 2
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = bitcast %union.anon* %6 to [4 x i8]*
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %31, i64 0, i64 3
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %26, i32 %30, i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"This machine is \00"
@.str.3 = [128 x i8] c"\0Aunion{int i; char c[4]} u;\0A\0Au.i = 0x03020100;\0A/* is equivalent to: */\0Au.c[0] = %#x;\0Au.c[1] = %#x;\0Au.c[2] = %#x;\0Au.c[3] = %#x;\0A\00"
@str = [60 x i8] c"little endian / bytesex even / Least Significant Byte First\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @.str.3, i64 0, i64 0), i32 0, i32 1, i32 2, i32 3)
ret i32 0
}