#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 square(int);
int main(int argc, char *argv[]) {
  int a, b, p, q;
  a = 1;
  p = square(a++);
  printf("a=%d, p=%d\n", a, p);
  b = 1;
  q = ((b++) * (b++));
  printf("b=%d, q=%d\n", b, q);
  a = 1;
  p = square(++a);
  printf("a=%d, p=%d\n", a, p);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    %edi,%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
call   1030 <square@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
imul   %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe81(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
mov    %edi,-0x14(%rbp)
call   1030 <square@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <square@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1040 <printf@plt>
lea    0xec4(%rip),%rdi
mov    $0x3,%esi
mov    $0x2,%edx
call   1040 <printf@plt>
mov    $0x2,%edi
call   1030 <square@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"a=%d, p=%d\0A\00"
@.str.1 = [12 x i8] c"b=%d, q=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @square(i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 3, i32 2)
%6 = tail call i32 @square(i32 2)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 2, i32 %6)
ret i32 0
}