#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 */
typedef int /*<<< orphan*/ instance;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  union alpha {
    int entry;
    struct inner_s {
      int a : 1, b : 2, c : 3, d : 10, e : 12;
    } inner_field_s;
  };
  printf("sizeof alpha: %d\n\n", sizeof(union alpha));
  int input, value;
  union beta {
    int entry;
    struct inner_s inner_field_s;
  };
  printf("sizeof beta : %d\n\n", sizeof(union beta));
  union beta instance;
  scanf("%d", &input);
  instance.entry = input;
  printf("entry: %d\na:%d\tb:%d\tc:%d\td:%d\te:%d\t", instance.entry,
         instance.inner_field_s.a, instance.inner_field_s.b,
         instance.inner_field_s.c, instance.inner_field_s.d,
         instance.inner_field_s.e);
  printf("size of instance: %d\n", sizeof(instance));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x10(%rbp),%edx
shl    $0x1f,%edx
sar    $0x1f,%edx
mov    -0x10(%rbp),%ecx
shl    $0x1d,%ecx
sar    $0x1e,%ecx
mov    -0x10(%rbp),%r8d
shl    $0x1a,%r8d
sar    $0x1d,%r8d
mov    -0x10(%rbp),%r9d
shl    $0x10,%r9d
sar    $0x16,%r9d
mov    -0x10(%rbp),%eax
shl    $0x4,%eax
sar    $0x14,%eax
lea    0xe81(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe94(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    0x14(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%esi
mov    %esi,%edx
and    $0x1,%edx
neg    %edx
mov    %esi,%ecx
shl    $0x1d,%ecx
sar    $0x1e,%ecx
mov    %esi,%r8d
shl    $0x1a,%r8d
sar    $0x1d,%r8d
movswl %si,%r9d
sar    $0x6,%r9d
mov    %esi,%eax
shl    $0x4,%eax
sar    $0x14,%eax
mov    %eax,(%rsp)
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%union.beta = type { i32 }
%struct.inner_s = type { i32 }
@.str = [19 x i8] c"sizeof alpha: %d\0A\0A\00"
@.str.1 = [19 x i8] c"sizeof beta : %d\0A\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"entry: %d\0Aa:%d\09b:%d\09c:%d\09d:%d\09e:%d\09\00"
@.str.4 = [22 x i8] c"size of instance: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca %union.beta
store i32 0, i32* %1
%5 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 4)
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = bitcast %union.beta* %4 to i32*
store i32 %8, i32* %9
%10 = bitcast %union.beta* %4 to i32*
%11 = load i32, i32* %10
%12 = bitcast %union.beta* %4 to %struct.inner_s*
%13 = bitcast %struct.inner_s* %12 to i32*
%14 = load i32, i32* %13
%15 = shl i32 %14, 31
%16 = ashr i32 %15, 31
%17 = bitcast %union.beta* %4 to %struct.inner_s*
%18 = bitcast %struct.inner_s* %17 to i32*
%19 = load i32, i32* %18
%20 = shl i32 %19, 29
%21 = ashr i32 %20, 30
%22 = bitcast %union.beta* %4 to %struct.inner_s*
%23 = bitcast %struct.inner_s* %22 to i32*
%24 = load i32, i32* %23
%25 = shl i32 %24, 26
%26 = ashr i32 %25, 29
%27 = bitcast %union.beta* %4 to %struct.inner_s*
%28 = bitcast %struct.inner_s* %27 to i32*
%29 = load i32, i32* %28
%30 = shl i32 %29, 16
%31 = ashr i32 %30, 22
%32 = bitcast %union.beta* %4 to %struct.inner_s*
%33 = bitcast %struct.inner_s* %32 to i32*
%34 = load i32, i32* %33
%35 = shl i32 %34, 4
%36 = ashr i32 %35, 20
%37 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %11, i32 %16, i32 %21, i32 %26, i32 %31, i32 %36)
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"sizeof alpha: %d\0A\0A\00"
@.str.1 = [19 x i8] c"sizeof beta : %d\0A\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [36 x i8] c"entry: %d\0Aa:%d\09b:%d\09c:%d\09d:%d\09e:%d\09\00"
@.str.4 = [22 x i8] c"size of instance: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 4)
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = and i32 %6, 1
%8 = sub nsw i32 0, %7
%9 = shl i32 %6, 29
%10 = ashr i32 %9, 30
%11 = shl i32 %6, 26
%12 = ashr i32 %11, 29
%13 = shl i32 %6, 16
%14 = ashr i32 %13, 22
%15 = shl i32 %6, 4
%16 = ashr i32 %15, 20
%17 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16)
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 4)
ret i32 0
}