#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*/ print(char *);
int /*<<< orphan*/ printid(int);
int main() {
  int i = 0, j = 1;
  switch (i) {
  case -1:
    j++;
    break;
  case 0: {
    int d = 1;
    j += d;
    i = 2;
  }
  case 2:
    j++;
  }
  print("j  3");
  printid(j);
  switch (i) {
  case 1:
    j--;
    break;
  case 2:
    j--;
    break;
  default:
    j++;
  }
  print("j  4");
  printid(j);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0xffffffff,%eax
je     1172 <main+0x52>
jmp    1151 <main+0x31>
mov    -0x14(%rbp),%eax
test   %eax,%eax
je     1180 <main+0x60>
jmp    1161 <main+0x41>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1197 <main+0x77>
jmp    11a0 <main+0x80>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a0 <main+0x80>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe59(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x1,%eax
je     11d9 <main+0xb9>
jmp    11c8 <main+0xa8>
mov    -0x18(%rbp),%eax
sub    $0x2,%eax
je     11e7 <main+0xc7>
jmp    11f5 <main+0xd5>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11fe <main+0xde>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    11fe <main+0xde>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
lea    0xe00(%rip),%rdi
call   1030 <print@plt>
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <print@plt>
mov    $0x3,%edi
call   1040 <printid@plt>
lea    0xec7(%rip),%rdi
call   1030 <print@plt>
mov    $0x2,%edi
call   1040 <printid@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"j 3\00"
@.str.1 = [5 x i8] c"j 4\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 1, i32* %3
%5 = load i32, i32* %2
switch i32 %5, label %16 [
i32 -1, label %6
i32 0, label %9
i32 2, label %13
]
6: ; preds = %0
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
store i32 %8, i32* %3
br label %16
9: ; preds = %0
store i32 1, i32* %4
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = add nsw i32 %11, %10
store i32 %12, i32* %3
store i32 2, i32* %2
br label %13
13: ; preds = %0, %9
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 1
store i32 %15, i32* %3
br label %16
16: ; preds = %13, %0, %6
%17 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* %3
%19 = call i32 @printid(i32 %18)
%20 = load i32, i32* %2
switch i32 %20, label %27 [
i32 1, label %21
i32 2, label %24
]
21: ; preds = %16
%22 = load i32, i32* %3
%23 = add nsw i32 %22, -1
store i32 %23, i32* %3
br label %30
24: ; preds = %16
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %30
27: ; preds = %16
%28 = load i32, i32* %3
%29 = add nsw i32 %28, 1
store i32 %29, i32* %3
br label %30
30: ; preds = %27, %24, %21
%31 = call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%32 = load i32, i32* %3
%33 = call i32 @printid(i32 %32)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"j 3\00"
@.str.1 = [5 x i8] c"j 4\00"
define i32 @main() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printid(i32 3)
%3 = tail call i32 @print(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 @printid(i32 2)
ret i32 0
}