#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 main(void) {
  int y = 5;
  switch (y) {
  case 1:
  case 2:
  case 3:
  case 5:
  case 6:
    printf(" hit case %d\n", y);
  default:
    printf(" default case\n");
  }
  int x = 10;
  int i = 3;
  printf("before using i++: x = %d, i = %d\n", x, i);
  x += 5 - i++;
  printf("after using i++: x = %d, i = %d\n", x, i);
  x = 10;
  i = 3;
  printf("before using ++i: x = %d, i = %d\n", x, i);
  x += 5 - ++i;
  printf("after using ++i: x = %d, i = %d\n", x, i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
add    $0xffffffff,%eax
sub    $0x3,%eax
jb     1151 <main+0x41>
jmp    113d <main+0x2d>
mov    -0x14(%rbp),%eax
add    $0xfffffffb,%eax
sub    $0x1,%eax
ja     1162 <main+0x52>
jmp    1151 <main+0x41>
mov    -0x8(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe92(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%ecx
mov    %ecx,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    $0x5,%eax
sub    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xa,-0xc(%rbp)
movl   $0x3,-0x10(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x10(%rbp)
mov    $0x5,%eax
sub    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf59(%rip),%rdi
call   1030 <puts@plt>
lea    0xec7(%rip),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed1(%rip),%rdi
mov    $0xc,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeda(%rip),%rdi
mov    $0xa,%esi
mov    $0x3,%edx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0xb,%esi
mov    $0x4,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c" hit case %d\0A\00"
@.str.1 = [15 x i8] c" default case\0A\00"
@.str.2 = [34 x i8] c"before using i++: x = %d, i = %d\0A\00"
@.str.3 = [33 x i8] c"after using i++: x = %d, i = %d\0A\00"
@.str.4 = [34 x i8] c"before using ++i: x = %d, i = %d\0A\00"
@.str.5 = [33 x i8] c"after using ++i: x = %d, i = %d\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
%5 = load i32, i32* %2
switch i32 %5, label %9 [
i32 1, label %6
i32 2, label %6
i32 3, label %6
i32 5, label %6
i32 6, label %6
]
6: ; preds = %0, %0, %0, %0, %0
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %9
9: ; preds = %0, %6
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9
store i32 10, i32* %3
store i32 3, i32* %4
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %12, i32 %13)
%15 = load i32, i32* %4
%16 = add nsw i32 %15, 1
store i32 %16, i32* %4
%17 = sub nsw i32 5, %15
%18 = load i32, i32* %3
%19 = add nsw i32 %18, %17
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = load i32, i32* %4
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %20, i32 %21)
store i32 10, i32* %3
store i32 3, i32* %4
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %24)
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
%28 = sub nsw i32 5, %27
%29 = load i32, i32* %3
%30 = add nsw i32 %29, %28
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 %31, i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c" hit case %d\0A\00"
@.str.2 = [34 x i8] c"before using i++: x = %d, i = %d\0A\00"
@.str.3 = [33 x i8] c"after using i++: x = %d, i = %d\0A\00"
@.str.4 = [34 x i8] c"before using ++i: x = %d, i = %d\0A\00"
@.str.5 = [33 x i8] c"after using ++i: x = %d, i = %d\0A\00"
@str = [14 x i8] c" default case\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 5)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 10, i32 3)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 12, i32 4)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0), i32 10, i32 3)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i32 11, i32 4)
ret i32 0
}