void test() {
  struct Test {
    int num;
    char *pNum;
    short sDate;
    char c[2];
    short sBa[4];
  } * p;
  printf("\n\np = %x\n", p);
  printf("p + 0x1 = %x\n", p + 0x1);
  printf("(unsigned long)p + 0x1 = %x\n", (unsigned long)p + 0x1);
  printf("(unsigned int *)p + 0x1 = %x\n", (unsigned int *)p + 0x1);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rsi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x20,%rsi
lea    0xefe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x1,%rsi
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.Test = type { i32, i8*, i16, [2 x i8], [4 x i16] }
@.str = [10 x i8] c"\0A\0Ap = %x\0A\00"
@.str.1 = [14 x i8] c"p + 0x1 = %x\0A\00"
@.str.2 = [29 x i8] c"(unsigned long)p + 0x1 = %x\0A\00"
@.str.3 = [30 x i8] c"(unsigned int *)p + 0x1 = %x\0A\00"
define void @test() {
%1 = alloca %struct.Test*
%2 = load %struct.Test*, %struct.Test** %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.Test* %2)
%4 = load %struct.Test*, %struct.Test** %1
%5 = getelementptr inbounds %struct.Test, %struct.Test* %4, i64 1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %struct.Test* %5)
%7 = load %struct.Test*, %struct.Test** %1
%8 = ptrtoint %struct.Test* %7 to i64
%9 = add i64 %8, 1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 %9)
%11 = load %struct.Test*, %struct.Test** %1
%12 = bitcast %struct.Test* %11 to i32*
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32* %13)
ret void
}

LLVM IR (-O2):
%struct.Test = type { i32, i8*, i16, [2 x i8], [4 x i16] }
@.str = [10 x i8] c"\0A\0Ap = %x\0A\00"
@.str.1 = [14 x i8] c"p + 0x1 = %x\0A\00"
@.str.2 = [29 x i8] c"(unsigned long)p + 0x1 = %x\0A\00"
@.str.3 = [30 x i8] c"(unsigned int *)p + 0x1 = %x\0A\00"
define void @test() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), %struct.Test* undef)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), %struct.Test* poison)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i64 undef)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), i32* poison)
ret void
}