#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  int i;
  int big;
  union {
    unsigned long l;
    char c[sizeof(long)];
  } u;
  u.l = 0x04030201;
  if (sizeof(long) > 4) {
    if (u.c[0] == 0x08)
      big = 1;
    else
      big = 0;
  } else {
    if (u.c[0] == 0x04)
      big = 1;
    else
      big = 0;
  }
  for (i = 0; i < sizeof(long); i++) {
    if (big == 1 && (u.c[i] == (sizeof(long) - i))) {
      continue;
    } else if (big == 0 && (u.c[i] == (i + 1))) {
      continue;
    } else {
      big = -1;
      break;
    }
  }
  if (big == 1) {
    printf("XNTP_BIG_ENDIAN\n");
  } else if (big == 0) {
    printf("XNTP_LITTLE_ENDIAN\n");
  }
  exit(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   $0x4030201,-0x20(%rbp)
04
movsbl -0x20(%rbp),%eax
cmp    $0x8,%eax
jne    1157 <main+0x37>
movl   $0x1,-0x18(%rbp)
jmp    115e <main+0x3e>
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
movslq -0x14(%rbp),%rax
cmp    $0x8,%rax
jae    11e1 <main+0xc1>
cmpl   $0x1,-0x18(%rbp)
jne    11a1 <main+0x81>
movslq -0x14(%rbp),%rax
movsbq -0x20(%rbp,%rax,1),%rax
movslq -0x14(%rbp),%rdx
mov    $0x8,%ecx
sub    %rdx,%rcx
cmp    %rcx,%rax
jne    11a1 <main+0x81>
jmp    11d3 <main+0xb3>
cmpl   $0x0,-0x18(%rbp)
jne    11c7 <main+0xa7>
movslq -0x14(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    11c7 <main+0xa7>
jmp    11d3 <main+0xb3>
movl   $0xffffffff,-0x18(%rbp)
jmp    11e1 <main+0xc1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1165 <main+0x45>
cmpl   $0x1,-0x18(%rbp)
jne    11fc <main+0xdc>
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
cmpl   $0x0,-0x18(%rbp)
jne    1212 <main+0xf2>
lea    0xe04(%rip),%rdi
call   1030 <printf@plt>
jmp    1217 <main+0xf7>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
%union.anon = type { i64 }
@.str = [17 x i8] c"XNTP_BIG_ENDIAN\0A\00"
@.str.1 = [20 x i8] c"XNTP_LITTLE_ENDIAN\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %union.anon
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast %union.anon* %8 to i64*
store i64 67305985, i64* %9
%10 = bitcast %union.anon* %8 to [8 x i8]*
%11 = getelementptr inbounds [8 x i8], [8 x i8]* %10, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 8
br i1 %14, label %15, label %16
15: ; preds = %2
store i32 1, i32* %7
br label %17
16: ; preds = %2
store i32 0, i32* %7
br label %17
17: ; preds = %16, %15
store i32 0, i32* %6
br label %18
18: ; preds = %52, %17
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = icmp ult i64 %20, 8
br i1 %21, label %22, label %55
22: ; preds = %18
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 1
br i1 %24, label %25, label %37
25: ; preds = %22
%26 = bitcast %union.anon* %8 to [8 x i8]*
%27 = load i32, i32* %6
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %26, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = sext i8 %30 to i64
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = sub i64 8, %33
%35 = icmp eq i64 %31, %34
br i1 %35, label %36, label %37
36: ; preds = %25
br label %52
37: ; preds = %25, %22
%38 = load i32, i32* %7
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %51
40: ; preds = %37
%41 = bitcast %union.anon* %8 to [8 x i8]*
%42 = load i32, i32* %6
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [8 x i8], [8 x i8]* %41, i64 0, i64 %43
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = load i32, i32* %6
%48 = add nsw i32 %47, 1
%49 = icmp eq i32 %46, %48
br i1 %49, label %50, label %51
50: ; preds = %40
br label %52
51: ; preds = %40, %37
store i32 -1, i32* %7
br label %55
52: ; preds = %50, %36
%53 = load i32, i32* %6
%54 = add nsw i32 %53, 1
store i32 %54, i32* %6
br label %18
55: ; preds = %51, %18
%56 = load i32, i32* %7
%57 = icmp eq i32 %56, 1
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %66
60: ; preds = %55
%61 = load i32, i32* %7
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %65
63: ; preds = %60
%64 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
br label %65
65: ; preds = %63, %60
br label %66
66: ; preds = %65, %58
%67 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}