#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*/ puts(char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int main(int argc, const char *argv[]) {
  union {
    int n;
    char c[sizeof(int)];
  } u;
  ((void)(argc));
  u.n = 1;
  if (!strcmp(argv[0], "isbe")) {
    return (!(((u).c[0] != 1)));
  } else if (!strcmp(argv[0], "isle")) {
    return (!(!((u).c[0] != 1)));
  } else {
    puts(((u).c[0] != 1) ? "big endian" : "little endian");
  }
  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   $0x1,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1172 <main+0x52>
movsbl -0x18(%rbp),%eax
cmp    $0x1,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11d3 <main+0xb3>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe85(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11a9 <main+0x89>
movsbl -0x18(%rbp),%eax
cmp    $0x1,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    11d3 <main+0xb3>
movsbl -0x18(%rbp),%ecx
lea    0xe61(%rip),%rdi
lea    0xe4f(%rip),%rax
cmp    $0x1,%ecx
cmovne %rax,%rdi
call   1030 <puts@plt>
jmp    11cc <main+0xac>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    (%rsi),%rbx
lea    0xed5(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     115a <main+0x3a>
lea    0xec7(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
je     115f <main+0x3f>
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
jmp    115f <main+0x3f>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%union.anon = type { i32 }
@.str = [5 x i8] c"isbe\00"
@.str.1 = [5 x i8] c"isle\00"
@.str.2 = [11 x i8] c"big endian\00"
@.str.3 = [14 x i8] c"little endian\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 = load i32, i32* %4
%8 = bitcast %union.anon* %6 to i32*
store i32 1, i32* %8
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 @strcmp(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = icmp ne i32 %12, 0
br i1 %13, label %22, label %14
14: ; preds = %2
%15 = bitcast %union.anon* %6 to [4 x i8]*
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 1
%20 = xor i1 %19, true
%21 = zext i1 %20 to i32
store i32 %21, i32* %3
br label %48
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @strcmp(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %37, label %28
28: ; preds = %22
%29 = bitcast %union.anon* %6 to [4 x i8]*
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %29, i64 0, i64 0
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp ne i32 %32, 1
%34 = xor i1 %33, true
%35 = xor i1 %34, true
%36 = zext i1 %35 to i32
store i32 %36, i32* %3
br label %48
37: ; preds = %22
%38 = bitcast %union.anon* %6 to [4 x i8]*
%39 = getelementptr inbounds [4 x i8], [4 x i8]* %38, i64 0, i64 0
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp ne i32 %41, 1
%43 = zext i1 %42 to i64
%44 = select i1 %42, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0)
%45 = call i32 @puts(i8* %44)
br label %46
46: ; preds = %37
br label %47
47: ; preds = %46
store i32 0, i32* %3
br label %48
48: ; preds = %47, %28, %14
%49 = load i32, i32* %3
ret i32 %49
}

LLVM IR (-O2):
@.str = [5 x i8] c"isbe\00"
@.str.1 = [5 x i8] c"isle\00"
@.str.3 = [14 x i8] c"little endian\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %3, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %6, %2, %9
%12 = phi i32 [ 0, %9 ], [ 1, %2 ], [ 0, %6 ]
ret i32 %12
}