#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, int);
int main() {
  int arr[] = {10, 20};
  int *p = arr;
  *p++;
  printf("\nafter *p++: arr[0]=%d arr[1]=%d *p=%d\n", arr[0], arr[1], *p);
  p = arr;
  *++p;
  printf("\nafter *++p: arr[0]=%d arr[1]=%d *p=%d\n", arr[0], arr[1], *p);
  p = arr;
  ++*p;
  printf("\nafter ++*p: arr[0]=%d arr[1]=%d *p=%d\n", arr[0], arr[1], *p);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0xc(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
lea    0xeb0(%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    $0xa,%esi
mov    $0x14,%edx
mov    $0x14,%ecx
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
mov    $0xa,%esi
mov    $0x14,%edx
mov    $0x14,%ecx
call   1030 <printf@plt>
lea    0xf02(%rip),%rdi
mov    $0xb,%esi
mov    $0x14,%edx
mov    $0xb,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.arr = [2 x i32] [i32 10, i32 20]
@.str = [40 x i8] c"\0Aafter *p++: arr[0]=%d arr[1]=%d *p=%d\0A\00"
@.str.1 = [40 x i8] c"\0Aafter *++p: arr[0]=%d arr[1]=%d *p=%d\0A\00"
@.str.2 = [40 x i8] c"\0Aafter ++*p: arr[0]=%d arr[1]=%d *p=%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [2 x i32]* %2 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = getelementptr inbounds i32, i32* %6, i32 1
store i32* %7, i32** %3
%8 = load i32, i32* %6
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %9
%11 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%12 = load i32, i32* %11
%13 = load i32*, i32** %3
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %12, i32 %14)
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32* %16, i32** %3
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i32 1
store i32* %18, i32** %3
%19 = load i32, i32* %18
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%21 = load i32, i32* %20
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%23 = load i32, i32* %22
%24 = load i32*, i32** %3
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %21, i32 %23, i32 %25)
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32* %27, i32** %3
%28 = load i32*, i32** %3
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1
store i32 %30, i32* %28
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %31
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%34 = load i32, i32* %33
%35 = load i32*, i32** %3
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 %32, i32 %34, i32 %36)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"\0Aafter *p++: arr[0]=%d arr[1]=%d *p=%d\0A\00"
@.str.1 = [40 x i8] c"\0Aafter *++p: arr[0]=%d arr[1]=%d *p=%d\0A\00"
@.str.2 = [40 x i8] c"\0Aafter ++*p: arr[0]=%d arr[1]=%d *p=%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 10, i32 20, i32 20)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 20, i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i32 11, i32 20, i32 11)
ret i32 0
}