#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*/ bar(int);
__attribute__((no, noclone)) void foo(int x) {
  switch (x) {
  case 3:
    goto l1;
  case 4:
    goto l2;
  case 6:
    goto l3;
  default:
    return;
  }
l1:
  goto l4;
l2:
  goto l4;
l3:
  bar(-1);
l4:
  bar(0);
  if (x != 4)
    bar(1);
  if (x != 3)
    bar(-1);
  bar(2);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x3,%eax
je     1151 <foo+0x41>
jmp    112f <foo+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
je     1156 <foo+0x46>
jmp    1140 <foo+0x30>
mov    -0x8(%rbp),%eax
sub    $0x6,%eax
je     115b <foo+0x4b>
jmp    1160 <foo+0x50>
jmp    1165 <foo+0x55>
jmp    116a <foo+0x5a>
jmp    116f <foo+0x5f>
jmp    11b2 <foo+0xa2>
jmp    1179 <foo+0x69>
jmp    1179 <foo+0x69>
mov    $0xffffffff,%edi
call   1030 <bar@plt>
xor    %edi,%edi
call   1030 <bar@plt>
cmpl   $0x4,-0x4(%rbp)
je     1194 <foo+0x84>
mov    $0x1,%edi
call   1030 <bar@plt>
cmpl   $0x3,-0x4(%rbp)
je     11a8 <foo+0x98>
mov    $0xffffffff,%edi
call   1030 <bar@plt>
mov    $0x2,%edi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
mov    %edi,%ebx
lea    -0x3(%rbx),%eax
cmp    $0x2,%eax
jae    112e <foo+0x1e>
xor    %edi,%edi
call   1030 <bar@plt>
mov    $0x1,%edi
cmp    $0x4,%ebx
je     114e <foo+0x3e>
jmp    1153 <foo+0x43>
cmp    $0x6,%ebx
jne    1163 <foo+0x53>
mov    $0xffffffff,%edi
call   1030 <bar@plt>
xor    %edi,%edi
call   1030 <bar@plt>
mov    $0x1,%edi
call   1030 <bar@plt>
mov    $0xffffffff,%edi
call   1030 <bar@plt>
mov    $0x2,%edi
pop    %rbx
jmp    1030 <bar@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %7 [
i32 3, label %4
i32 4, label %5
i32 6, label %6
]
4: ; preds = %1
br label %8
5: ; preds = %1
br label %9
6: ; preds = %1
br label %10
7: ; preds = %1
br label %25
8: ; preds = %4
br label %12
9: ; preds = %5
br label %12
10: ; preds = %6
%11 = call i32 @bar(i32 -1)
br label %12
12: ; preds = %10, %9, %8
%13 = call i32 @bar(i32 0)
%14 = load i32, i32* %2
%15 = icmp ne i32 %14, 4
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @bar(i32 1)
br label %18
18: ; preds = %16, %12
%19 = load i32, i32* %2
%20 = icmp ne i32 %19, 3
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @bar(i32 -1)
br label %23
23: ; preds = %21, %18
%24 = call i32 @bar(i32 2)
br label %25
25: ; preds = %23, %7
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
switch i32 %0, label %14 [
i32 3, label %2
i32 4, label %2
i32 6, label %5
]
2: ; preds = %1, %1
%3 = tail call i32 @bar(i32 0)
%4 = icmp eq i32 %0, 4
br i1 %4, label %9, label %10
5: ; preds = %1
%6 = tail call i32 @bar(i32 -1)
%7 = tail call i32 @bar(i32 0)
%8 = tail call i32 @bar(i32 1)
br label %9
9: ; preds = %5, %2
br label %10
10: ; preds = %2, %9
%11 = phi i32 [ -1, %9 ], [ 1, %2 ]
%12 = tail call i32 @bar(i32 %11)
%13 = tail call i32 @bar(i32 2)
br label %14
14: ; preds = %1, %10
ret void
}