main(void) {
  unsigned int x;
  char *cPtr;
  short *sPtr;
  int *iPtr;
  cPtr = (char *)&x;
  sPtr = (short *)&x;
  iPtr = &x;
  printf("Before increment \n");
  printf("cPtr = %x, sPtr =%x, iPtr = %x\n", cPtr, sPtr, iPtr);
  cPtr += 5;
  sPtr += 5;
  iPtr += 5;
  printf(" After incrementing each by 5 \n");
  printf("cPtr = %x, sPtr =%x, iPtr = %x\n", cPtr, sPtr, iPtr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x5,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x14,%rax
mov    %rax,-0x20(%rbp)
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xec5(%rip),%rbx
lea    0x4(%rsp),%rcx
mov    %rbx,%rdi
mov    %rcx,%rsi
mov    %rcx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x9(%rsp),%r14
lea    0xe(%rsp),%r15
lea    0x18(%rsp),%r12
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Before increment \0A\00"
@.str.1 = [32 x i8] c"cPtr = %x, sPtr =%x, iPtr = %x\0A\00"
@.str.2 = [32 x i8] c" After incrementing each by 5 \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i16*
%4 = alloca i32*
%5 = bitcast i32* %1 to i8*
store i8* %5, i8** %2
%6 = bitcast i32* %1 to i16*
store i16* %6, i16** %3
store i32* %1, i32** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = load i16*, i16** %3
%10 = load i32*, i32** %4
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %8, i16* %9, i32* %10)
%12 = load i8*, i8** %2
%13 = getelementptr inbounds i8, i8* %12, i64 5
store i8* %13, i8** %2
%14 = load i16*, i16** %3
%15 = getelementptr inbounds i16, i16* %14, i64 5
store i16* %15, i16** %3
%16 = load i32*, i32** %4
%17 = getelementptr inbounds i32, i32* %16, i64 5
store i32* %17, i32** %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%19 = load i8*, i8** %2
%20 = load i16*, i16** %3
%21 = load i32*, i32** %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %19, i16* %20, i32* %21)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"cPtr = %x, sPtr =%x, iPtr = %x\0A\00"
@str = [18 x i8] c"Before increment \00"
@str.3 = [31 x i8] c" After incrementing each by 5 \00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = bitcast i32* %1 to i16*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %1, i32* %1)
%6 = getelementptr inbounds i8, i8* %2, i64 5
%7 = getelementptr inbounds i16, i16* %3, i64 5
%8 = getelementptr inbounds i32, i32* %1, i64 5
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.3, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %6, i16* %7, i32* %8)
ret i32 0
}