#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 */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int /*<<< orphan*/ longjmp(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int setjmp(int /*<<< orphan*/);
int main(int argc, char **argv) {
  jmp_buf ex_buf__;
  switch (setjmp(ex_buf__)) {
  case 0:
    while (1) {
      {
        printf("In Try Statement\n");
        longjmp(ex_buf__, 2);
        printf("I do not appear\n");
      }
      break;
    case 1: {
      printf("Got Foo!\n");
    } break;
    case 2: {
      printf("Got Bar!\n");
    } break;
    case 3: {
      printf("Got Baz!\n");
    } break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,%ecx
mov    %rcx,-0x20(%rbp)
sub    $0x3,%eax
ja     11c2 <main+0x92>
mov    -0x20(%rbp),%rax
lea    0xe98(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1176 <main+0x46>
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <main+0x8d>
lea    0xe85(%rip),%rdi
call   1030 <printf@plt>
jmp    11bd <main+0x8d>
lea    0xe7e(%rip),%rdi
call   1030 <printf@plt>
jmp    11c2 <main+0x92>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <setjmp@plt>
cmp    $0x3,%eax
ja     1169 <main+0x39>
lea    0xee0(%rip),%rdi
mov    %eax,%eax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xebe(%rip),%rdi
jmp    1164 <main+0x34>
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xeb7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%esi
call   1050 <longjmp@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"In Try Statement\0A\00"
@.str.1 = [10 x i8] c"Got Foo!\0A\00"
@.str.2 = [10 x i8] c"Got Bar!\0A\00"
@.str.3 = [10 x i8] c"Got Baz!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %6
%8 = call i32 @setjmp(i32 %7)
switch i32 %8, label %21 [
i32 0, label %9
i32 1, label %14
i32 2, label %16
i32 3, label %18
]
9: ; preds = %2
br label %10
10: ; preds = %9
%11 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %6
%13 = call i32 @longjmp(i32 %12, i32 2)
unreachable
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %20
16: ; preds = %2
%17 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
br label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
br label %20
20: ; preds = %18, %16, %14
br label %21
21: ; preds = %20, %2
ret i32 0
}

LLVM IR (-O2):
@str = [9 x i8] c"Got Baz!\00"
@str.4 = [9 x i8] c"Got Bar!\00"
@str.5 = [9 x i8] c"Got Foo!\00"
@str.6 = [17 x i8] c"In Try Statement\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = call i32 @setjmp(i32 undef)
switch i32 %3, label %12 [
i32 0, label %4
i32 1, label %9
i32 2, label %7
i32 3, label %8
]
4: ; preds = %2
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.6, i64 0, i64 0))
%6 = call i32 @longjmp(i32 undef, i32 2)
unreachable
7: ; preds = %2
br label %9
8: ; preds = %2
br label %9
9: ; preds = %2, %8, %7
%10 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0), %8 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.5, i64 0, i64 0), %2 ]
%11 = call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %2
ret i32 0
}