#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 dead();
int halt();
int live();
void test2() {
  int i;
  switch (live()) {
  case 1:
    halt(), dead();
  case 2:
    live(), halt(), dead();
  case 3:
    live() + halt();
    dead();
  case 4:
  a4:
    live(), halt();
    goto a4;
  case 5:
    goto a5;
  c5:
    dead();
    goto b5;
  a5:
    live(), halt();
  b5:
    goto c5;
  case 6:
    if (live())
      goto e6;
    live(), halt();
  d6:
    dead();
    goto b6;
  c6:
    dead();
    goto b6;
  e6:
    live(), halt();
  b6:
    goto c6;
  case 7:
    halt() + dead();
    -halt();
  case 8:
    i += halt();
  case 9:
    halt() ? dead() : dead();
  case 10:
    (float)halt();
  case 11: {
    int a[5];
    live(), a[halt()];
  }
  }
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
xor    %eax,%eax
call   1050 <live@plt>
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0xa,%eax
ja     1281 <test2+0x151>
mov    -0x28(%rbp),%rax
lea    0xea4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1030 <dead@plt>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1030 <dead@plt>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1030 <dead@plt>
jmp    11a2 <test2+0x72>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
jmp    11a2 <test2+0x72>
jmp    11c6 <test2+0x96>
mov    $0x0,%al
call   1030 <dead@plt>
jmp    11d4 <test2+0xa4>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
jmp    11ba <test2+0x8a>
mov    $0x0,%al
call   1050 <live@plt>
cmp    $0x0,%eax
je     11ee <test2+0xbe>
jmp    1214 <test2+0xe4>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1030 <dead@plt>
jmp    1222 <test2+0xf2>
mov    $0x0,%al
call   1030 <dead@plt>
jmp    1222 <test2+0xf2>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
jmp    1208 <test2+0xd8>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1030 <dead@plt>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1040 <halt@plt>
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1040 <halt@plt>
cmp    $0x0,%eax
je     1265 <test2+0x135>
mov    $0x0,%al
call   1030 <dead@plt>
jmp    126c <test2+0x13c>
mov    $0x0,%al
call   1030 <dead@plt>
mov    $0x0,%al
call   1040 <halt@plt>
mov    $0x0,%al
call   1050 <live@plt>
mov    $0x0,%al
call   1040 <halt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbx
xor    %eax,%eax
call   1050 <live@plt>
add    $0xffffffff,%eax
cmp    $0xa,%eax
ja     11a0 <test2+0x70>
lea    0xeb9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
call   1040 <halt@plt>
jmp    1190 <test2+0x60>
pop    %rbx
ret
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
jmp    11b0 <test2+0x80>
xor    %eax,%eax
call   1050 <live@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
call   1040 <halt@plt>
test   %ebx,%ebx
jne    11e0 <test2+0xb0>
xor    %eax,%eax
call   1030 <dead@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <dead@plt>
jmp    11e0 <test2+0xb0>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1030 <dead@plt>
xor    %eax,%eax
call   1040 <halt@plt>
xor    %eax,%eax
call   1050 <live@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <halt@plt>

LLVM IR (-O0):
define void @test2() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = call i32 (...) @live()
switch i32 %3, label %70 [
i32 1, label %4
i32 2, label %7
i32 3, label %11
i32 4, label %16
i32 5, label %20
i32 6, label %27
i32 7, label %42
i32 8, label %48
i32 9, label %52
i32 10, label %61
i32 11, label %64
]
4: ; preds = %0
%5 = call i32 (...) @halt()
%6 = call i32 (...) @dead()
br label %7
7: ; preds = %0, %4
%8 = call i32 (...) @live()
%9 = call i32 (...) @halt()
%10 = call i32 (...) @dead()
br label %11
11: ; preds = %0, %7
%12 = call i32 (...) @live()
%13 = call i32 (...) @halt()
%14 = add nsw i32 %12, %13
%15 = call i32 (...) @dead()
br label %16
16: ; preds = %0, %11
br label %17
17: ; preds = %17, %16
%18 = call i32 (...) @live()
%19 = call i32 (...) @halt()
br label %17
20: ; preds = %0
br label %23
21: ; preds = %26
%22 = call i32 (...) @dead()
br label %26
23: ; preds = %20
%24 = call i32 (...) @live()
%25 = call i32 (...) @halt()
br label %26
26: ; preds = %23, %21
br label %21
27: ; preds = %0
%28 = call i32 (...) @live()
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %27
br label %38
31: ; preds = %27
%32 = call i32 (...) @live()
%33 = call i32 (...) @halt()
br label %34
34: ; preds = %31
%35 = call i32 (...) @dead()
br label %41
36: ; preds = %41
%37 = call i32 (...) @dead()
br label %41
38: ; preds = %30
%39 = call i32 (...) @live()
%40 = call i32 (...) @halt()
br label %41
41: ; preds = %38, %36, %34
br label %36
42: ; preds = %0
%43 = call i32 (...) @halt()
%44 = call i32 (...) @dead()
%45 = add nsw i32 %43, %44
%46 = call i32 (...) @halt()
%47 = sub nsw i32 0, %46
br label %48
48: ; preds = %0, %42
%49 = call i32 (...) @halt()
%50 = load i32, i32* %1
%51 = add nsw i32 %50, %49
store i32 %51, i32* %1
br label %52
52: ; preds = %0, %48
%53 = call i32 (...) @halt()
%54 = icmp ne i32 %53, 0
br i1 %54, label %55, label %57
55: ; preds = %52
%56 = call i32 (...) @dead()
br label %59
57: ; preds = %52
%58 = call i32 (...) @dead()
br label %59
59: ; preds = %57, %55
%60 = phi i32 [ %56, %55 ], [ %58, %57 ]
br label %61
61: ; preds = %0, %59
%62 = call i32 (...) @halt()
%63 = sitofp i32 %62 to float
br label %64
64: ; preds = %0, %61
%65 = call i32 (...) @live()
%66 = call i32 (...) @halt()
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 %67
%69 = load i32, i32* %68
br label %70
70: ; preds = %64, %0
ret void
}

LLVM IR (-O2):
define void @test2() {
%1 = tail call i32 (...) @live()
switch i32 %1, label %46 [
i32 1, label %2
i32 2, label %5
i32 3, label %9
i32 4, label %13
i32 5, label %17
i32 6, label %22
i32 7, label %32
i32 8, label %36
i32 9, label %38
i32 10, label %41
i32 11, label %43
]
2: ; preds = %0
%3 = tail call i32 (...) @halt()
%4 = tail call i32 (...) @dead()
br label %5
5: ; preds = %0, %2
%6 = tail call i32 (...) @live()
%7 = tail call i32 (...) @halt()
%8 = tail call i32 (...) @dead()
br label %9
9: ; preds = %0, %5
%10 = tail call i32 (...) @live()
%11 = tail call i32 (...) @halt()
%12 = tail call i32 (...) @dead()
br label %13
13: ; preds = %0, %9
br label %14
14: ; preds = %13, %14
%15 = tail call i32 (...) @live()
%16 = tail call i32 (...) @halt()
br label %14
17: ; preds = %0
%18 = tail call i32 (...) @live()
%19 = tail call i32 (...) @halt()
br label %20
20: ; preds = %17, %20
%21 = tail call i32 (...) @dead()
br label %20
22: ; preds = %0
%23 = tail call i32 (...) @live()
%24 = icmp eq i32 %23, 0
%25 = tail call i32 (...) @live()
%26 = tail call i32 (...) @halt()
br i1 %24, label %27, label %29
27: ; preds = %22
%28 = tail call i32 (...) @dead()
br label %29
29: ; preds = %22, %27
br label %30
30: ; preds = %29, %30
%31 = tail call i32 (...) @dead()
br label %30
32: ; preds = %0
%33 = tail call i32 (...) @halt()
%34 = tail call i32 (...) @dead()
%35 = tail call i32 (...) @halt()
br label %36
36: ; preds = %0, %32
%37 = tail call i32 (...) @halt()
br label %38
38: ; preds = %0, %36
%39 = tail call i32 (...) @halt()
%40 = tail call i32 (...) @dead()
br label %41
41: ; preds = %38, %0
%42 = tail call i32 (...) @halt()
br label %43
43: ; preds = %0, %41
%44 = tail call i32 (...) @live()
%45 = tail call i32 (...) @halt()
br label %46
46: ; preds = %43, %0
ret void
}