int main(void) {
  char c;
  short int i;
  short i2;
  long x;
  long int x2;
  float f;
  double d;
  char temp[8];
  double eight[8];
  puts("\tVariable sizes:\n");
  printf("Size of char variable c = %d\n", sizeof(c));
  printf("\tAnd its adress in memory is %p\n", &c);
  printf("Size of short int variable i = %d\n", sizeof(i));
  printf("Size of short variable i2 = %d\n", sizeof(i2));
  printf("Size of long variable x = %d\n", sizeof(x));
  printf("Size of long int variable x2 = %d\n", sizeof(x2));
  printf("Size of float variable f = %d\n", sizeof(f));
  printf("Size of double variable d = %d\n", sizeof(d));
  printf("Size of char temp[8] = %d\n", sizeof(temp));
  printf("  An it's location in memory is (hex to int):\n");
  for (i = 0; i < 8; i++)
    printf("\t%p -> %d\n", &temp[i], &temp[i]);
  printf("Size of double eight[8] = %d\n", sizeof(eight));
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <puts@plt>
lea    0xebb(%rip),%rdi
mov    $0x1,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x5(%rbp),%rsi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xee5(%rip),%rdi
mov    $0x2,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xef2(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xefd(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf0d(%rip),%rdi
mov    $0x4,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf19(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf26(%rip),%rdi
mov    $0x8,%esi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xf2e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movw   $0x0,-0x8(%rbp)
movswl -0x8(%rbp),%eax
cmp    $0x8,%eax
jge    1252 <main+0x122>
movswq -0x8(%rbp),%rax
lea    -0x38(%rbp),%rsi
add    %rax,%rsi
movswq -0x8(%rbp),%rax
lea    -0x38(%rbp),%rdx
add    %rax,%rdx
lea    0xf24(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x8(%rbp)
jmp    120e <main+0xde>
lea    0xf10(%rip),%rdi
mov    $0x40,%esi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %eax,%eax
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee1(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xefe(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf09(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf19(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf25(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf32(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf63(%rip),%rdi
call   1030 <puts@plt>
lea    0xf2e(%rip),%rbx
lea    0x7(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x9(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xa(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xb(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xd(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe(%rsp),%rdx
mov    %rbx,%rdi
mov    %rdx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xea2(%rip),%rdi
mov    $0x40,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\09Variable sizes:\0A\00"
@.str.1 = [30 x i8] c"Size of char variable c = %d\0A\00"
@.str.2 = [33 x i8] c"\09And its adress in memory is %p\0A\00"
@.str.3 = [35 x i8] c"Size of short int variable i = %d\0A\00"
@.str.4 = [32 x i8] c"Size of short variable i2 = %d\0A\00"
@.str.5 = [30 x i8] c"Size of long variable x = %d\0A\00"
@.str.6 = [35 x i8] c"Size of long int variable x2 = %d\0A\00"
@.str.7 = [31 x i8] c"Size of float variable f = %d\0A\00"
@.str.8 = [32 x i8] c"Size of double variable d = %d\0A\00"
@.str.9 = [27 x i8] c"Size of char temp[8] = %d\0A\00"
@.str.10 = [47 x i8] c" An it's location in memory is (hex to int):\0A\00"
@.str.11 = [11 x i8] c"\09%p -> %d\0A\00"
@.str.12 = [30 x i8] c"Size of double eight[8] = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i16
%4 = alloca i16
%5 = alloca i64
%6 = alloca i64
%7 = alloca float
%8 = alloca double
%9 = alloca [8 x i8]
%10 = alloca [8 x double]
store i32 0, i32* %1
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64 1)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i64 2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i64 2)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 8)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i64 8)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i64 4)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i64 8)
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i64 8)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.10, i64 0, i64 0))
store i16 0, i16* %3
br label %22
22: ; preds = %34, %0
%23 = load i16, i16* %3
%24 = sext i16 %23 to i32
%25 = icmp slt i32 %24, 8
br i1 %25, label %26, label %37
26: ; preds = %22
%27 = load i16, i16* %3
%28 = sext i16 %27 to i64
%29 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 %28
%30 = load i16, i16* %3
%31 = sext i16 %30 to i64
%32 = getelementptr inbounds [8 x i8], [8 x i8]* %9, i64 0, i64 %31
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %29, i8* %32)
br label %34
34: ; preds = %26
%35 = load i16, i16* %3
%36 = add i16 %35, 1
store i16 %36, i16* %3
br label %22
37: ; preds = %22
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i64 64)
%39 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"\09Variable sizes:\0A\00"
@.str.1 = [30 x i8] c"Size of char variable c = %d\0A\00"
@.str.2 = [33 x i8] c"\09And its adress in memory is %p\0A\00"
@.str.3 = [35 x i8] c"Size of short int variable i = %d\0A\00"
@.str.4 = [32 x i8] c"Size of short variable i2 = %d\0A\00"
@.str.5 = [30 x i8] c"Size of long variable x = %d\0A\00"
@.str.6 = [35 x i8] c"Size of long int variable x2 = %d\0A\00"
@.str.7 = [31 x i8] c"Size of float variable f = %d\0A\00"
@.str.8 = [32 x i8] c"Size of double variable d = %d\0A\00"
@.str.9 = [27 x i8] c"Size of char temp[8] = %d\0A\00"
@.str.11 = [11 x i8] c"\09%p -> %d\0A\00"
@.str.12 = [30 x i8] c"Size of double eight[8] = %d\0A\00"
@str = [46 x i8] c" An it's location in memory is (hex to int):\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca [8 x i8]
%3 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 0
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @puts to i32 (i8*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i64 1)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i8* %1)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i64 2)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0), i64 2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i64 8)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.6, i64 0, i64 0), i64 8)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i64 4)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i64 8)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i64 8)
%14 = call i32 bitcast (i32 (...)* @puts to i32 (i8*)*)(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @str, i64 0, i64 0))
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %3, i8* %3)
%16 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 1
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %16, i8* %16)
%18 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 2
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %18, i8* %18)
%20 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 3
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %20, i8* %20)
%22 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 4
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %22, i8* %22)
%24 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 5
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %24, i8* %24)
%26 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 6
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %26, i8* %26)
%28 = getelementptr inbounds [8 x i8], [8 x i8]* %2, i64 0, i64 7
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0), i8* %28, i8* %28)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.12, i64 0, i64 0), i64 64)
%31 = call i32 (...) @getchar()
ret i32 0
}