#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 EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  union {
    short s;
    char c[sizeof(short)];
  } un;
  un.s = 0x0102;
  if (sizeof(short) == 2) {
    if (un.c[0] == 1 && un.c[1] == 2) {
      printf("B\n");
    } else {
      if (un.c[0] == 2 && un.c[1] == 1) {
        printf("L\n");
      }
    }
  } else {
    printf("?\n");
  }
  return (EXIT_SUCCESS);
}


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)
movw   $0x102,-0x18(%rbp)
movsbl -0x18(%rbp),%eax
cmp    $0x1,%eax
jne    1157 <main+0x47>
movsbl -0x17(%rbp),%eax
cmp    $0x2,%eax
jne    1157 <main+0x47>
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x72>
movsbl -0x18(%rbp),%eax
cmp    $0x2,%eax
jne    117d <main+0x6d>
movsbl -0x17(%rbp),%eax
cmp    $0x1,%eax
jne    117d <main+0x6d>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    1182 <main+0x72>
mov    0x2e57(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i16 }
@.str = [3 x i8] c"B\0A\00"
@.str.1 = [3 x i8] c"L\0A\00"
@EXIT_SUCCESS = global i32 0
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 i16*
store i16 258, i16* %7
%8 = bitcast %union.anon* %6 to [2 x i8]*
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %21
13: ; preds = %2
%14 = bitcast %union.anon* %6 to [2 x i8]*
%15 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 1
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %36
21: ; preds = %13, %2
%22 = bitcast %union.anon* %6 to [2 x i8]*
%23 = getelementptr inbounds [2 x i8], [2 x i8]* %22, i64 0, i64 0
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %35
27: ; preds = %21
%28 = bitcast %union.anon* %6 to [2 x i8]*
%29 = getelementptr inbounds [2 x i8], [2 x i8]* %28, i64 0, i64 1
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %27
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %35
35: ; preds = %33, %27, %21
br label %36
36: ; preds = %35, %19
%37 = load i32, i32* @EXIT_SUCCESS
ret i32 %37
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [2 x i8] c"L\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}