int main01(void) {
  int array[100] = {1, 2, 3, 4, 5};
  int *p = array;
  *p = 100;
  printf("%u\n", p);
  p++;
  printf("%u\n", p);
  int i = 300;
  p = &i;
  *p = 200;
  printf("i = %d\n", i);
  return 0;
}


x86 assembly (clang, -O0):
<main01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1a0,%rsp
lea    -0x190(%rbp),%rdi
xor    %esi,%esi
mov    $0x190,%edx
call   1040 <memset@plt>
movl   $0x1,-0x190(%rbp)
movl   $0x2,-0x18c(%rbp)
movl   $0x3,-0x188(%rbp)
movl   $0x4,-0x184(%rbp)
movl   $0x5,-0x180(%rbp)
lea    -0x190(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x198(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x198(%rbp),%rsi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x198(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x198(%rbp)
mov    -0x198(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x12c,-0x19c(%rbp)
lea    -0x19c(%rbp),%rax
mov    %rax,-0x198(%rbp)
mov    -0x198(%rbp),%rax
movl   $0xc8,(%rax)
mov    -0x19c(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main01>:
push   %r14
push   %rbx
sub    $0x198,%rsp
lea    0x10(%rsp),%rdi
mov    $0x180,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0x4(%rsp),%r14
movl   $0x5,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xeb6(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe99(%rip),%rdi
mov    $0xc8,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%u\0A\00"
@.str.1 = [8 x i8] c"i = %d\0A\00"
define i32 @main01() {
%1 = alloca [100 x i32]
%2 = alloca i32*
%3 = alloca i32
%4 = bitcast [100 x i32]* %1 to i8*
%5 = bitcast i8* %4 to <{ i32, i32, i32, i32, i32, [95 x i32] }>*
%6 = getelementptr inbounds <{ i32, i32, i32, i32, i32, [95 x i32] }>, <{ i32, i32, i32, i32, i32, [95 x i32] }>* %5, i32 0, i32 0
store i32 1, i32* %6
%7 = getelementptr inbounds <{ i32, i32, i32, i32, i32, [95 x i32] }>, <{ i32, i32, i32, i32, i32, [95 x i32] }>* %5, i32 0, i32 1
store i32 2, i32* %7
%8 = getelementptr inbounds <{ i32, i32, i32, i32, i32, [95 x i32] }>, <{ i32, i32, i32, i32, i32, [95 x i32] }>* %5, i32 0, i32 2
store i32 3, i32* %8
%9 = getelementptr inbounds <{ i32, i32, i32, i32, i32, [95 x i32] }>, <{ i32, i32, i32, i32, i32, [95 x i32] }>* %5, i32 0, i32 3
store i32 4, i32* %9
%10 = getelementptr inbounds <{ i32, i32, i32, i32, i32, [95 x i32] }>, <{ i32, i32, i32, i32, i32, [95 x i32] }>* %5, i32 0, i32 4
store i32 5, i32* %10
%11 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
store i32* %11, i32** %2
%12 = load i32*, i32** %2
store i32 100, i32* %12
%13 = load i32*, i32** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %13)
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %2
%17 = load i32*, i32** %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %17)
store i32 300, i32* %3
store i32* %3, i32** %2
%19 = load i32*, i32** %2
store i32 200, i32* %19
%20 = load i32, i32* %3
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%u\0A\00"
@.str.1 = [8 x i8] c"i = %d\0A\00"
define i32 @main01() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 4
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 1
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 4
store i32 5, i32* %7
%8 = bitcast [100 x i32]* %1 to <4 x i32>*
store <4 x i32> <i32 100, i32 2, i32 3, i32 4>, <4 x i32>* %8
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %5)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %6)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 200)
ret i32 0
}