#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ longjmp(int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ setjmp(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  do {
    jmp_buf env;
    if (!setjmp(env)) {
      {
        printf("In TRY statement\n");
        longjmp(env, 1);
        printf("not reachable\n");
      }
    } else {
      { printf("exception caught\n"); }
    }
  } while (0);
  exit(EXIT_SUCCESS);
}


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>
cmp    $0x0,%eax
jne    1180 <main+0x40>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1050 <longjmp@plt>
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    1191 <main+0x51>
mov    0x2e48(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
call   1040 <setjmp@plt>
test   %eax,%eax
jne    1160 <main+0x20>
lea    0xeaf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%esi
call   1050 <longjmp@plt>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e6d(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"In TRY statement\0A\00"
@.str.1 = [18 x i8] c"exception caught\0A\00"
@EXIT_SUCCESS = global i32 0
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
br label %7
7: ; preds = %2
%8 = load i32, i32* %6
%9 = call i32 @setjmp(i32 %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %15, label %11
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = call i32 @longjmp(i32 %13, i32 1)
unreachable
15: ; preds = %7
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15
br label %18
18: ; preds = %17
%19 = load i32, i32* @EXIT_SUCCESS
%20 = call i32 @exit(i32 %19)
unreachable
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [17 x i8] c"In TRY statement\00"
@str.2 = [17 x i8] c"exception caught\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = call i32 @setjmp(i32 undef)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%7 = call i32 @longjmp(i32 undef, i32 1)
unreachable
8: ; preds = %2
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0))
%10 = load i32, i32* @EXIT_SUCCESS
%11 = call i32 @exit(i32 %10)
unreachable
}