#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 main(void) {
  int c, a, b;
  c = 5, a = 0, b = 1;
  printf("c=%d\n", c);
  a = b + c++;
  printf("a=%d\n", a);
  printf("c=%d\n\n", c);
  c = 5, a = 0, b = 1;
  printf("c=%d\n", c);
  a = b + ++c;
  printf("a=%d\n", a);
  printf("c=%d\n", c);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x8(%rbp)
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x5,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x8(%rbp)
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%esi
lea    0xe3e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%rbx
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0xed7(%rip),%r14
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"c=%d\0A\00"
@.str.1 = [6 x i8] c"a=%d\0A\00"
@.str.2 = [7 x i8] c"c=%d\0A\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 6)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 6)
%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 ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32 7)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 6)
ret i32 0
}