#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 volatile);
int main(void) {
  int i = 0;
  printf("++i + ++i + ++i = %d\n", ++i + ++i + ++i);
  volatile int j = 0;
  printf("++j + ++j + ++j = %d\n", ++j + ++j + ++j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
add    %eax,%esi
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
add    %eax,%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
add    %eax,%esi
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
add    %eax,%esi
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
movl   $0x0,0x4(%rsp)
mov    0x4(%rsp),%eax
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
mov    0x4(%rsp),%ecx
lea    0x1(%rcx),%edx
mov    %edx,0x4(%rsp)
lea    0x2(%rcx,%rax,1),%eax
mov    0x4(%rsp),%ecx
lea    0x1(%rcx),%edx
mov    %edx,0x4(%rsp)
lea    (%rcx,%rax,1),%esi
add    $0x1,%esi
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"++i + ++i + ++i = %d\0A\00"
@.str.1 = [22 x i8] c"++j + ++j + ++j = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 6)
%3 = bitcast i32* %1 to i8*
store volatile i32 0, i32* %1
%4 = load volatile i32, i32* %1
%5 = add nsw i32 %4, 1
store volatile i32 %5, i32* %1
%6 = load volatile i32, i32* %1
%7 = add nsw i32 %6, 1
store volatile i32 %7, i32* %1
%8 = add nsw i32 %7, %5
%9 = load volatile i32, i32* %1
%10 = add nsw i32 %9, 1
store volatile i32 %10, i32* %1
%11 = add nsw i32 %8, %10
%12 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i32 %11)
ret i32 0
}