#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);
int main() {
  char c;
  int i;
  long l;
  printf("Size of char is: %ld\n", ((char *)(&c) - (char *)(&c - 1)));
  printf("Size of int is: %ld\n", ((char *)(&i) - (char *)(&i - 1)));
  printf("Size of long is: %ld\n", ((char *)(&l) - (char *)(&l - 1)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x5(%rbp),%rcx
add    $0xffffffffffffffff,%rcx
lea    -0x5(%rbp),%rax
sub    %rcx,%rax
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
lea    -0xc(%rbp),%rcx
add    $0xfffffffffffffffc,%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    -0x18(%rbp),%rax
lea    -0x18(%rbp),%rcx
add    $0xfffffffffffffff8,%rcx
sub    %rcx,%rax
mov    %eax,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xeed(%rip),%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Size of char is: %ld\0A\00"
@.str.1 = [21 x i8] c"Size of int is: %ld\0A\00"
@.str.2 = [22 x i8] c"Size of long is: %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32
%4 = alloca i64
store i32 0, i32* %1
%5 = getelementptr inbounds i8, i8* %2, i64 -1
%6 = ptrtoint i8* %2 to i64
%7 = ptrtoint i8* %5 to i64
%8 = sub i64 %6, %7
%9 = trunc i64 %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = bitcast i32* %3 to i8*
%12 = getelementptr inbounds i32, i32* %3, i64 -1
%13 = bitcast i32* %12 to i8*
%14 = ptrtoint i8* %11 to i64
%15 = ptrtoint i8* %13 to i64
%16 = sub i64 %14, %15
%17 = trunc i64 %16 to i32
%18 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = bitcast i64* %4 to i8*
%20 = getelementptr inbounds i64, i64* %4, i64 -1
%21 = bitcast i64* %20 to i8*
%22 = ptrtoint i8* %19 to i64
%23 = ptrtoint i8* %21 to i64
%24 = sub i64 %22, %23
%25 = trunc i64 %24 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Size of char is: %ld\0A\00"
@.str.1 = [21 x i8] c"Size of int is: %ld\0A\00"
@.str.2 = [22 x i8] c"Size of long is: %ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 4)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 8)
ret i32 0
}