#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 /*<<< orphan*/ puts(char *);
int main(void) {
  int x = 5;
  printf("The value of  x[%d] before changing it is :%d\n", x, x);
  puts("==============================================");
  puts("In postdecrement the variables is changed first then used ");
  printf("The value of  x[%d] after decrement is :%d\n", x, --x);
  puts("==============================================");
  puts("In Post decrement x-- is the value of previous x ");
  puts("and when it is used after that it will be decremented by 1. ");
  printf("\nThe value of  x[%d] and after decrement is (x--) :%d\n", x, x--);
  printf("The value of  x[%d] and after decrement is (x--) :%d\n", x, x--);
  printf("The value of  x[%d] and after decrement is (x--) :%d\n", x, x--);
  printf("The value of  x[%d] and after decrement is (x--) :%d\n", x, x--);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xebd(%rip),%rdi
call   1040 <printf@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf03(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0xffffffff,%edx
mov    %edx,-0x8(%rbp)
lea    0xf26(%rip),%rdi
call   1040 <printf@plt>
lea    0xeb0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3a(%rip),%rdi
call   1030 <puts@plt>
lea    0xf60(%rip),%rdi
call   1030 <puts@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xf83(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xf6a(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xf50(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    %edx,%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
lea    0xf36(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
mov    $0x5,%edx
call   1040 <printf@plt>
lea    0xef1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf11(%rip),%rdi
call   1030 <puts@plt>
lea    0xf40(%rip),%rdi
mov    $0x5,%esi
mov    $0x4,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xf4e(%rip),%rdi
call   1030 <puts@plt>
lea    0xf74(%rip),%rdi
call   1030 <puts@plt>
lea    0xfa5(%rip),%rdi
mov    $0x4,%esi
mov    $0x4,%edx
call   1040 <printf@plt>
lea    0xf90(%rip),%rbx
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x2,%edx
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"The value of x[%d] before changing it is :%d\0A\00"
@.str.1 = [47 x i8] c"==============================================\00"
@.str.2 = [59 x i8] c"In postdecrement the variables is changed first then used \00"
@.str.3 = [44 x i8] c"The value of x[%d] after decrement is :%d\0A\00"
@.str.4 = [50 x i8] c"In Post decrement x-- is the value of previous x \00"
@.str.5 = [61 x i8] c"and when it is used after that it will be decremented by 1. \00"
@.str.6 = [55 x i8] c"\0AThe value of x[%d] and after decrement is (x--) :%d\0A\00"
@.str.7 = [54 x i8] c"The value of x[%d] and after decrement is (x--) :%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 5, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %3, i32 %4)
%6 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @puts(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %10)
%12 = call i32 @puts(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @puts(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%14 = call i32 @puts(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = load i32, i32* %2
%17 = add nsw i32 %16, -1
store i32 %17, i32* %2
%18 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 %15, i32 %16)
%19 = load i32, i32* %2
%20 = load i32, i32* %2
%21 = add nsw i32 %20, -1
store i32 %21, i32* %2
%22 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 %19, i32 %20)
%23 = load i32, i32* %2
%24 = load i32, i32* %2
%25 = add nsw i32 %24, -1
store i32 %25, i32* %2
%26 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 %23, i32 %24)
%27 = load i32, i32* %2
%28 = load i32, i32* %2
%29 = add nsw i32 %28, -1
store i32 %29, i32* %2
%30 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 %27, i32 %28)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"The value of x[%d] before changing it is :%d\0A\00"
@.str.1 = [47 x i8] c"==============================================\00"
@.str.2 = [59 x i8] c"In postdecrement the variables is changed first then used \00"
@.str.3 = [44 x i8] c"The value of x[%d] after decrement is :%d\0A\00"
@.str.4 = [50 x i8] c"In Post decrement x-- is the value of previous x \00"
@.str.5 = [61 x i8] c"and when it is used after that it will be decremented by 1. \00"
@.str.6 = [55 x i8] c"\0AThe value of x[%d] and after decrement is (x--) :%d\0A\00"
@.str.7 = [54 x i8] c"The value of x[%d] and after decrement is (x--) :%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 5, i32 5)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 4)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.4, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%8 = tail call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i32 4, i32 4)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 3, i32 3)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 2, i32 2)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0), i32 1, i32 1)
ret i32 0
}