#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 *, ...);
void showPrefixAndPostfixOps() {
  int num1, num2;
  printf("\nPrefix and Postfix operators... (num1 = 10)");
  num1 = 10;
  num2 = num1++;
  printf("\nnum2 = num1++; so num2 = %d and num1 = %d", num2, num1);
  num1 = 10;
  num2 = ++num1;
  printf("\nnum2 = ++num1; so num2 = %d and num1 = %d\n", num2, num1);
}


x86 assembly (clang, -O0):
<showPrefixAndPostfixOps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
lea    0xee9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showPrefixAndPostfixOps>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf07(%rip),%rdi
mov    $0xa,%esi
mov    $0xb,%edx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf1a(%rip),%rdi
mov    $0xb,%esi
mov    $0xb,%edx
xor    %eax,%eax
pop    %rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [45 x i8] c"\0APrefix and Postfix operators... (num1 = 10)\00"
@.str.1 = [43 x i8] c"\0Anum2 = num1++; so num2 = %d and num1 = %d\00"
@.str.2 = [44 x i8] c"\0Anum2 = ++num1; so num2 = %d and num1 = %d\0A\00"
define void @showPrefixAndPostfixOps() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
store i32 10, i32* %1
%4 = load i32, i32* %1
%5 = add nsw i32 %4, 1
store i32 %5, i32* %1
store i32 %4, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 %6, i32 %7)
store i32 10, i32* %1
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = load i32, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 %11, i32 %12)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c"\0APrefix and Postfix operators... (num1 = 10)\00"
@.str.1 = [43 x i8] c"\0Anum2 = num1++; so num2 = %d and num1 = %d\00"
@.str.2 = [44 x i8] c"\0Anum2 = ++num1; so num2 = %d and num1 = %d\0A\00"
define void @showPrefixAndPostfixOps() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i32 10, i32 11)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0), i32 11, i32 11)
ret void
}