#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(void) {
  char foo[sizeof(long)];
  char foo2[sizeof(long long)];
  int i;
  long mask, val;
  long long val2, mask2;
  printf("sizeof(int)        = %d\n", sizeof(int));
  printf("sizeof(long)       = %d\n", sizeof(long));
  printf("sizeof(long long)  = %d\n", sizeof(long long));
  printf("sizeof(void*)      = %d\n", sizeof(void *));
  printf("LP64!!\n");
  for (i = 0; i < sizeof(long); i++) {
    foo[i] = i;
  }
  for (i = 0; i < sizeof(long long); i++) {
    foo2[i] = i;
  }
  val = *(long *)foo;
  val2 = *(long long *)foo2;
  printf("long          = ");
  mask = 0xFF;
  for (i = 0; i < sizeof(long); i++) {
    printf("%d ", (int)((val & mask) >> (i * 8)));
    mask <<= 8;
  }
  printf("\n");
  printf("long long     = ");
  mask2 = 0xFF;
  for (i = 0; i < sizeof(long long); i++) {
    printf("%d ", (int)((val2 & mask2) >> (i * 8)));
    mask2 <<= 8;
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee6(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeec(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
jae    11a9 <main+0x99>
mov    -0x18(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0xc(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1180 <main+0x70>
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
jae    11d9 <main+0xc9>
mov    -0x18(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b0 <main+0xa0>
mov    -0xc(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%rax
mov    %rax,-0x30(%rbp)
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0xff,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
jae    1251 <main+0x141>
mov    -0x28(%rbp),%rax
and    -0x20(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
sar    %cl,%rax
mov    %eax,%esi
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1206 <main+0xf6>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movq   $0xff,-0x38(%rbp)
movl   $0x0,-0x18(%rbp)
movslq -0x18(%rbp),%rax
cmp    $0x8,%rax
jae    12c7 <main+0x1b7>
mov    -0x30(%rbp),%rax
and    -0x38(%rbp),%rax
mov    -0x18(%rbp),%ecx
shl    $0x3,%ecx
mov    %ecx,%ecx
sar    %cl,%rax
mov    %eax,%esi
lea    0xdd7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    127c <main+0x16c>
lea    0xd9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed4(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xf06(%rip),%rdi
call   1040 <puts@plt>
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xed7(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe55(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [25 x i8] c"sizeof(long) = %d\0A\00"
@.str.2 = [25 x i8] c"sizeof(long long) = %d\0A\00"
@.str.3 = [25 x i8] c"sizeof(void*) = %d\0A\00"
@.str.4 = [8 x i8] c"LP64!!\0A\00"
@.str.5 = [17 x i8] c"long = \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [17 x i8] c"long long = \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [8 x i8]
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 4)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 8)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 8)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 8)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %4
br label %14
14: ; preds = %24, %0
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = icmp ult i64 %16, 8
br i1 %17, label %18, label %27
18: ; preds = %14
%19 = load i32, i32* %4
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 %22
store i8 %20, i8* %23
br label %24
24: ; preds = %18
%25 = load i32, i32* %4
%26 = add nsw i32 %25, 1
store i32 %26, i32* %4
br label %14
27: ; preds = %14
store i32 0, i32* %4
br label %28
28: ; preds = %38, %27
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = icmp ult i64 %30, 8
br i1 %31, label %32, label %41
32: ; preds = %28
%33 = load i32, i32* %4
%34 = trunc i32 %33 to i8
%35 = load i32, i32* %4
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 %36
store i8 %34, i8* %37
br label %38
38: ; preds = %32
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %28
41: ; preds = %28
%42 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%43 = bitcast i8* %42 to i64*
%44 = load i64, i64* %43
store i64 %44, i64* %6
%45 = getelementptr inbounds [8 x i8], [8 x i8]* %3, i64 0, i64 0
%46 = bitcast i8* %45 to i64*
%47 = load i64, i64* %46
store i64 %47, i64* %7
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
store i64 255, i64* %5
store i32 0, i32* %4
br label %49
49: ; preds = %65, %41
%50 = load i32, i32* %4
%51 = sext i32 %50 to i64
%52 = icmp ult i64 %51, 8
br i1 %52, label %53, label %68
53: ; preds = %49
%54 = load i64, i64* %6
%55 = load i64, i64* %5
%56 = and i64 %54, %55
%57 = load i32, i32* %4
%58 = mul nsw i32 %57, 8
%59 = zext i32 %58 to i64
%60 = ashr i64 %56, %59
%61 = trunc i64 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %61)
%63 = load i64, i64* %5
%64 = shl i64 %63, 8
store i64 %64, i64* %5
br label %65
65: ; preds = %53
%66 = load i32, i32* %4
%67 = add nsw i32 %66, 1
store i32 %67, i32* %4
br label %49
68: ; preds = %49
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
store i64 255, i64* %8
store i32 0, i32* %4
br label %71
71: ; preds = %87, %68
%72 = load i32, i32* %4
%73 = sext i32 %72 to i64
%74 = icmp ult i64 %73, 8
br i1 %74, label %75, label %90
75: ; preds = %71
%76 = load i64, i64* %7
%77 = load i64, i64* %8
%78 = and i64 %76, %77
%79 = load i32, i32* %4
%80 = mul nsw i32 %79, 8
%81 = zext i32 %80 to i64
%82 = ashr i64 %78, %81
%83 = trunc i64 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %83)
%85 = load i64, i64* %8
%86 = shl i64 %85, 8
store i64 %86, i64* %8
br label %87
87: ; preds = %75
%88 = load i32, i32* %4
%89 = add nsw i32 %88, 1
store i32 %89, i32* %4
br label %71
90: ; preds = %71
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%92 = load i32, i32* %1
ret i32 %92
}

LLVM IR (-O2):
@.str = [25 x i8] c"sizeof(int) = %d\0A\00"
@.str.1 = [25 x i8] c"sizeof(long) = %d\0A\00"
@.str.2 = [25 x i8] c"sizeof(long long) = %d\0A\00"
@.str.3 = [25 x i8] c"sizeof(void*) = %d\0A\00"
@.str.5 = [17 x i8] c"long = \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.8 = [17 x i8] c"long long = \00"
@str = [7 x i8] c"LP64!!\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i64 4)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i64 8)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 8)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), i64 8)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 0)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 2)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 4)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 5)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 6)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 7)
%15 = tail call i32 @putchar(i32 10)
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 0)
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 1)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 2)
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 3)
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 4)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 5)
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 6)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 7)
%25 = tail call i32 @putchar(i32 10)
ret i32 0
}