#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*/ expecti(int, int);
void test() {
  int a = 0;
  switch (1 + 2) {
  case 0:
    expecti(0, 1);
  case 3:
    a = 3;
    break;
  case 1:
    expecti(0, 1);
  }
  expecti(a, 3);
  a = 0;
  switch (1) {
  case 0:
    a++;
  case 1:
    a++;
  case 2:
    a++;
  case 3:
    a++;
  }
  expecti(a, 3);
  a = 0;
  switch (100) {
  case 0:
    break;
  default:
    a++;
  }
  expecti(a, 1);
  a = 0;
  int accumulate = 38;
  switch (accumulate % 8) {
  case 0:
    do {
      a++;
    case 7:
      a++;
    case 6:
      a++;
    case 5:
      a++;
    case 4:
      a++;
    case 3:
      a++;
    case 2:
      a++;
    case 1:
      a++;
    } while ((accumulate -= 8) > 0);
  }
  expecti(a, 38);
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x3,%esi
mov    %esi,-0x14(%rbp)
call   1030 <expecti@plt>
mov    -0x14(%rbp),%esi
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <expecti@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <expecti@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x26,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%edx
add    $0x7,%edx
test   %eax,%eax
mov    %eax,%ecx
cmovs  %edx,%ecx
and    $0xfffffff8,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     1229 <test+0x119>
mov    -0x10(%rbp),%rax
lea    0xe44(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    11ca <test+0xba>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x8,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jg     11ca <test+0xba>
jmp    1229 <test+0x119>
mov    -0x4(%rbp),%edi
mov    $0x26,%esi
call   1030 <expecti@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    $0x3,%edi
mov    $0x3,%esi
call   1030 <expecti@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <expecti@plt>
mov    $0x26,%edi
mov    $0x26,%esi
pop    %rax
jmp    1030 <expecti@plt>

LLVM IR (-O0):
define void @test() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %1
%3 = load i32, i32* %1
%4 = call i32 @expecti(i32 %3, i32 3)
store i32 0, i32* %1
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 1
store i32 %6, i32* %1
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @expecti(i32 %11, i32 3)
store i32 0, i32* %1
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = call i32 @expecti(i32 %15, i32 1)
store i32 0, i32* %1
store i32 38, i32* %2
%17 = load i32, i32* %2
%18 = srem i32 %17, 8
switch i32 %18, label %49 [
i32 0, label %19
i32 7, label %23
i32 6, label %26
i32 5, label %29
i32 4, label %32
i32 3, label %35
i32 2, label %38
i32 1, label %41
]
19: ; preds = %0
br label %20
20: ; preds = %44, %19
%21 = load i32, i32* %1
%22 = add nsw i32 %21, 1
store i32 %22, i32* %1
br label %23
23: ; preds = %0, %20
%24 = load i32, i32* %1
%25 = add nsw i32 %24, 1
store i32 %25, i32* %1
br label %26
26: ; preds = %0, %23
%27 = load i32, i32* %1
%28 = add nsw i32 %27, 1
store i32 %28, i32* %1
br label %29
29: ; preds = %0, %26
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %32
32: ; preds = %0, %29
%33 = load i32, i32* %1
%34 = add nsw i32 %33, 1
store i32 %34, i32* %1
br label %35
35: ; preds = %0, %32
%36 = load i32, i32* %1
%37 = add nsw i32 %36, 1
store i32 %37, i32* %1
br label %38
38: ; preds = %0, %35
%39 = load i32, i32* %1
%40 = add nsw i32 %39, 1
store i32 %40, i32* %1
br label %41
41: ; preds = %0, %38
%42 = load i32, i32* %1
%43 = add nsw i32 %42, 1
store i32 %43, i32* %1
br label %44
44: ; preds = %41
%45 = load i32, i32* %2
%46 = sub nsw i32 %45, 8
store i32 %46, i32* %2
%47 = icmp sgt i32 %46, 0
br i1 %47, label %20, label %48
48: ; preds = %44
br label %49
49: ; preds = %48, %0
%50 = load i32, i32* %1
%51 = call i32 @expecti(i32 %50, i32 38)
ret void
}

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 @expecti(i32 3, i32 3)
%2 = tail call i32 @expecti(i32 3, i32 3)
%3 = tail call i32 @expecti(i32 1, i32 1)
%4 = tail call i32 @expecti(i32 38, i32 38)
ret void
}