#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 *calloc(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int *x;
  int i, j;
  x = calloc(5, sizeof(int));
  for (i = 0; i < 5; i++) {
    x[i] = 3 * i - 1;
  }
  j = 5;
  printf("j=%d ", j);
  printf("printing ++j %d  ", ++j);
  printf("printing j++ %d  ", j++);
  printf("j=%d\n", j);
  printf("printing *x %d ", *x);
  printf("printing ++*x %d ", ++*x);
  printf("printing *++x %d \n", *++x);
  printf("printing *x++ %d ", *x++);
  printf("printing *x %d\n", *x);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    117a <main+0x5a>
imul   $0x3,-0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <main+0x30>
movl   $0x5,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe75(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
lea    0xe61(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
add    $0x1,%esi
mov    %esi,(%rax)
lea    0xe51(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    0x4(%rax),%esi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
mov    (%rax),%esi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x5,%edi
mov    $0x4,%esi
call   1040 <calloc@plt>
lea    0xec9(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xebf(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <printf@plt>
lea    0xeb4(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [6 x i8] c"j=%d \00"
@.str.1 = [18 x i8] c"printing ++j %d \00"
@.str.2 = [18 x i8] c"printing j++ %d \00"
@.str.3 = [6 x i8] c"j=%d\0A\00"
@.str.4 = [16 x i8] c"printing *x %d \00"
@.str.5 = [18 x i8] c"printing ++*x %d \00"
@.str.6 = [19 x i8] c"printing *++x %d \0A\00"
@.str.7 = [18 x i8] c"printing *x++ %d \00"
@.str.8 = [16 x i8] c"printing *x %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = call i32* @calloc(i32 5, i32 4)
store i32* %9, i32** %6
store i32 0, i32* %7
br label %10
10: ; preds = %21, %2
%11 = load i32, i32* %7
%12 = icmp slt i32 %11, 5
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load i32, i32* %7
%15 = mul nsw i32 3, %14
%16 = sub nsw i32 %15, 1
%17 = load i32*, i32** %6
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
store i32 %16, i32* %20
br label %21
21: ; preds = %13
%22 = load i32, i32* %7
%23 = add nsw i32 %22, 1
store i32 %23, i32* %7
br label %10
24: ; preds = %10
store i32 5, i32* %8
%25 = load i32, i32* %8
%26 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
%29 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
%32 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%33 = load i32, i32* %8
%34 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %33)
%35 = load i32*, i32** %6
%36 = load i32, i32* %35
%37 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 %36)
%38 = load i32*, i32** %6
%39 = load i32, i32* %38
%40 = add nsw i32 %39, 1
store i32 %40, i32* %38
%41 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 %40)
%42 = load i32*, i32** %6
%43 = getelementptr inbounds i32, i32* %42, i32 1
store i32* %43, i32** %6
%44 = load i32, i32* %43
%45 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 %44)
%46 = load i32*, i32** %6
%47 = getelementptr inbounds i32, i32* %46, i32 1
store i32* %47, i32** %6
%48 = load i32, i32* %46
%49 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 %48)
%50 = load i32*, i32** %6
%51 = load i32, i32* %50
%52 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 %51)
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@.str = [6 x i8] c"j=%d \00"
@.str.1 = [18 x i8] c"printing ++j %d \00"
@.str.2 = [18 x i8] c"printing j++ %d \00"
@.str.3 = [6 x i8] c"j=%d\0A\00"
@.str.4 = [16 x i8] c"printing *x %d \00"
@.str.5 = [18 x i8] c"printing ++*x %d \00"
@.str.6 = [19 x i8] c"printing *++x %d \0A\00"
@.str.7 = [18 x i8] c"printing *x++ %d \00"
@.str.8 = [16 x i8] c"printing *x %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @calloc(i32 5, i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 6)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 6)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 7)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i32 -1)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i32 0)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i32 2)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0), i32 2)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0), i32 5)
ret i32 0
}