void main() {
  short a;
  unsigned short b;
  int c;
  unsigned d;
  long e;
  unsigned long f;
  printf("short size is          %d \n", sizeof(a));
  printf("unsigned short size is %d \n", sizeof(b));
  printf("int size is            %d \n", sizeof(c));
  printf("unsigned size is       %d \n", sizeof(d));
  printf("long size is           %d \n", sizeof(e));
  printf("unsigned long size is  %d \n", sizeof(f));
  short int i, *p;
  char j = 'a';
  i = 10;
  p = &i;
  printf("%d %d\n", p, sizeof(p));
  printf("%d %d\n", *p, sizeof(*p));
  p += 1;
  printf("%d %d\n", p, sizeof(*p));
  p += 1;
  printf("%d %d\n", p, sizeof(*p));
  p += 1;
  printf("%d %d\n", p, sizeof(*p));
  p += 1000000;
  printf("%d %d\n", *p, sizeof(*p));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    0xee1(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeea(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef3(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xefc(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1030 <printf@plt>
movb   $0x61,-0x31(%rbp)
movw   $0xa,-0x22(%rbp)
lea    -0x22(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xf01(%rip),%rdi
mov    $0x8,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
movswl (%rax),%esi
lea    0xee7(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xec4(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rsi
lea    0xe7e(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rax
add    $0x1e8480,%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movswl (%rax),%esi
lea    0xe56(%rip),%rdi
mov    $0x2,%edx
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xee4(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf08(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
movw   $0xa,0xe(%rsp)
lea    0xf13(%rip),%rbx
lea    0xe(%rsp),%rsi
mov    $0x8,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movswl 0xe(%rsp),%esi
mov    $0x2,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    $0x2,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x12(%rsp),%rsi
mov    $0x2,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    $0x2,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
movswl 0x1e8494(%rsp),%esi
mov    $0x2,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"short size is %d \0A\00"
@.str.1 = [28 x i8] c"unsigned short size is %d \0A\00"
@.str.2 = [28 x i8] c"int size is %d \0A\00"
@.str.3 = [28 x i8] c"unsigned size is %d \0A\00"
@.str.4 = [28 x i8] c"long size is %d \0A\00"
@.str.5 = [28 x i8] c"unsigned long size is %d \0A\00"
@.str.6 = [7 x i8] c"%d %d\0A\00"
define void @main() {
%1 = alloca i16
%2 = alloca i16
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
%7 = alloca i16
%8 = alloca i16*
%9 = alloca i8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 2)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 4)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 4)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i64 8)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 8)
store i8 97, i8* %9
store i16 10, i16* %7
store i16* %7, i16** %8
%16 = load i16*, i16** %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %16, i64 8)
%18 = load i16*, i16** %8
%19 = load i16, i16* %18
%20 = sext i16 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %20, i64 2)
%22 = load i16*, i16** %8
%23 = getelementptr inbounds i16, i16* %22, i64 1
store i16* %23, i16** %8
%24 = load i16*, i16** %8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %24, i64 2)
%26 = load i16*, i16** %8
%27 = getelementptr inbounds i16, i16* %26, i64 1
store i16* %27, i16** %8
%28 = load i16*, i16** %8
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %28, i64 2)
%30 = load i16*, i16** %8
%31 = getelementptr inbounds i16, i16* %30, i64 1
store i16* %31, i16** %8
%32 = load i16*, i16** %8
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %32, i64 2)
%34 = load i16*, i16** %8
%35 = getelementptr inbounds i16, i16* %34, i64 1000000
store i16* %35, i16** %8
%36 = load i16*, i16** %8
%37 = load i16, i16* %36
%38 = sext i16 %37 to i32
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %38, i64 2)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"short size is %d \0A\00"
@.str.1 = [28 x i8] c"unsigned short size is %d \0A\00"
@.str.2 = [28 x i8] c"int size is %d \0A\00"
@.str.3 = [28 x i8] c"unsigned size is %d \0A\00"
@.str.4 = [28 x i8] c"long size is %d \0A\00"
@.str.5 = [28 x i8] c"unsigned long size is %d \0A\00"
@.str.6 = [7 x i8] c"%d %d\0A\00"
define void @main() {
%1 = alloca i16
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i64 2)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i64 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i64 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0), i64 4)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.4, i64 0, i64 0), i64 8)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.5, i64 0, i64 0), i64 8)
%8 = bitcast i16* %1 to i8*
store i16 10, i16* %1
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %1, i64 8)
%10 = load i16, i16* %1
%11 = sext i16 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %11, i64 2)
%13 = getelementptr inbounds i16, i16* %1, i64 1
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %13, i64 2)
%15 = getelementptr inbounds i16, i16* %1, i64 2
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %15, i64 2)
%17 = getelementptr inbounds i16, i16* %1, i64 3
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i16* %17, i64 2)
%19 = getelementptr inbounds i16, i16* %1, i64 1000003
%20 = load i16, i16* %19
%21 = sext i16 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i32 %21, i64 2)
ret void
}