#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 f(int, int);
int /*<<< orphan*/ printf(char *, int, int);
void main() {
  int i = 2, p, m = 2;
  p = f(i, ++i);
  printf("p=%d i=%d\n", p, i);
  p = f(m, m++);
  printf("p=%d m=%d\n", p, m);
  printf("i=%d ++i=%d\n", i, ++i);
  printf("m=%d m++=%d\n", m, m++);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x2,-0x4(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x4(%rbp)
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xea9(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
call   1030 <f@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%esi
mov    -0x4(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x4(%rbp)
lea    0xe7f(%rip),%rdi
call   1040 <printf@plt>
mov    -0xc(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    %edx,%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe72(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <f@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
mov    $0x3,%edx
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x2,%esi
call   1030 <f@plt>
lea    0xeb2(%rip),%rdi
mov    %eax,%esi
mov    $0x3,%edx
call   1040 <printf@plt>
lea    0xeaa(%rip),%rdi
mov    $0x3,%esi
mov    $0x4,%edx
call   1040 <printf@plt>
lea    0xea1(%rip),%rdi
mov    $0x3,%esi
mov    $0x3,%edx
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"p=%d i=%d\0A\00"
@.str.1 = [11 x i8] c"p=%d m=%d\0A\00"
@.str.2 = [13 x i8] c"i=%d ++i=%d\0A\00"
@.str.3 = [13 x i8] c"m=%d m++=%d\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 2, i32* %1
store i32 2, i32* %3
%4 = load i32, i32* %1
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = call i32 @f(i32 %4, i32 %6)
store i32 %7, i32* %2
%8 = load i32, i32* %2
%9 = load i32, i32* %1
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = add nsw i32 %12, 1
store i32 %13, i32* %3
%14 = call i32 @f(i32 %11, i32 %12)
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %16)
%18 = load i32, i32* %1
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
%21 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %18, i32 %20)
%22 = load i32, i32* %3
%23 = load i32, i32* %3
%24 = add nsw i32 %23, 1
store i32 %24, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %22, i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"p=%d i=%d\0A\00"
@.str.1 = [11 x i8] c"p=%d m=%d\0A\00"
@.str.2 = [13 x i8] c"i=%d ++i=%d\0A\00"
@.str.3 = [13 x i8] c"m=%d m++=%d\0A\00"
define void @main() {
%1 = tail call i32 @f(i32 2, i32 3)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32 3)
%3 = tail call i32 @f(i32 2, i32 2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %3, i32 3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 3, i32 4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 3)
ret void
}