#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*/ assert(int);
int func3(int /*<<< orphan*/ *, int);
int setjmp(int /*<<< orphan*/);
int main(int argc, char **argv) {
  jmp_buf env;
  int value;
  value = setjmp(env);
  if (value == 0) {
    func3(&env, 0);
    assert(0);
  } else {
    assert(3 == value);
  }
  value = setjmp(env);
  if (value == 0) {
    func3(&env, 1);
    assert(0);
  } else {
    assert(2 == value);
  }
  value = setjmp(env);
  if (value == 0) {
    func3(&env, 2);
    assert(0);
  } else {
    assert(1 == value);
  }
  value = setjmp(env);
  assert(value == 0);
  assert(func3(&env, 3) == 3);
  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   1050 <setjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    1172 <main+0x42>
lea    -0x14(%rbp),%rdi
xor    %esi,%esi
call   1030 <func3@plt>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    1187 <main+0x57>
mov    $0x3,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x14(%rbp),%edi
call   1050 <setjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11b6 <main+0x86>
lea    -0x14(%rbp),%rdi
mov    $0x1,%esi
call   1030 <func3@plt>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    11cb <main+0x9b>
mov    $0x2,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x14(%rbp),%edi
call   1050 <setjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    11fa <main+0xca>
lea    -0x14(%rbp),%rdi
mov    $0x2,%esi
call   1030 <func3@plt>
xor    %edi,%edi
call   1040 <assert@plt>
jmp    120f <main+0xdf>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x14(%rbp),%edi
call   1050 <setjmp@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
lea    -0x14(%rbp),%rdi
mov    $0x3,%esi
call   1030 <func3@plt>
cmp    $0x3,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
call   1050 <setjmp@plt>
test   %eax,%eax
jne    11f8 <main+0xc8>
lea    0xc(%rsp),%rdi
xor    %ebx,%ebx
mov    %ebx,%esi
call   1030 <func3@plt>
mov    %ebx,%edi
call   1040 <assert@plt>
mov    0xc(%rsp),%edi
call   1050 <setjmp@plt>
test   %eax,%eax
je     1172 <main+0x42>
xor    %ecx,%ecx
cmp    $0x2,%eax
sete   %al
mov    %al,%cl
mov    %ecx,%edi
jmp    1183 <main+0x53>
lea    0xc(%rsp),%rdi
mov    $0x1,%esi
call   1030 <func3@plt>
mov    %ebx,%edi
call   1040 <assert@plt>
mov    0xc(%rsp),%edi
call   1050 <setjmp@plt>
test   %eax,%eax
je     11a3 <main+0x73>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %al
mov    %al,%cl
mov    %ecx,%edi
jmp    11b4 <main+0x84>
lea    0xc(%rsp),%rdi
mov    $0x2,%esi
call   1030 <func3@plt>
xor    %edi,%edi
call   1040 <assert@plt>
mov    0xc(%rsp),%edi
call   1050 <setjmp@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %al
mov    %al,%dil
call   1040 <assert@plt>
lea    0xc(%rsp),%rdi
mov    $0x3,%esi
call   1030 <func3@plt>
xor    %edi,%edi
cmp    $0x3,%eax
sete   %al
mov    %al,%dil
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %edi,%edi
cmp    $0x3,%eax
sete   %al
mov    %al,%dil
call   1040 <assert@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %6
%9 = call i32 @setjmp(i32 %8)
store i32 %9, i32* %7
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 @func3(i32* %6, i32 0)
%14 = call i32 @assert(i32 0)
br label %20
15: ; preds = %2
%16 = load i32, i32* %7
%17 = icmp eq i32 3, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
br label %20
20: ; preds = %15, %12
%21 = load i32, i32* %6
%22 = call i32 @setjmp(i32 %21)
store i32 %22, i32* %7
%23 = load i32, i32* %7
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = call i32 @func3(i32* %6, i32 1)
%27 = call i32 @assert(i32 0)
br label %33
28: ; preds = %20
%29 = load i32, i32* %7
%30 = icmp eq i32 2, %29
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
br label %33
33: ; preds = %28, %25
%34 = load i32, i32* %6
%35 = call i32 @setjmp(i32 %34)
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = call i32 @func3(i32* %6, i32 2)
%40 = call i32 @assert(i32 0)
br label %46
41: ; preds = %33
%42 = load i32, i32* %7
%43 = icmp eq i32 1, %42
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
br label %46
46: ; preds = %41, %38
%47 = load i32, i32* %6
%48 = call i32 @setjmp(i32 %47)
store i32 %48, i32* %7
%49 = load i32, i32* %7
%50 = icmp eq i32 %49, 0
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 @func3(i32* %6, i32 3)
%54 = icmp eq i32 %53, 3
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @setjmp(i32 undef)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = call i32 @func3(i32* %3, i32 0)
%9 = call i32 @assert(i32 0)
%10 = load i32, i32* %3
%11 = call i32 @setjmp(i32 %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %19
13: ; preds = %2
%14 = icmp eq i32 %5, 3
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
unreachable
17: ; preds = %7
%18 = call i32 @func3(i32* %3, i32 1)
br label %22
19: ; preds = %7
%20 = icmp eq i32 %11, 2
%21 = zext i1 %20 to i32
br label %22
22: ; preds = %19, %17
%23 = phi i32 [ %21, %19 ], [ 0, %17 ]
%24 = call i32 @assert(i32 %23)
%25 = load i32, i32* %3
%26 = call i32 @setjmp(i32 %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @func3(i32* %3, i32 2)
br label %33
30: ; preds = %22
%31 = icmp eq i32 %26, 1
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %30, %28
%34 = phi i32 [ %32, %30 ], [ 0, %28 ]
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %3
%37 = call i32 @setjmp(i32 %36)
%38 = icmp eq i32 %37, 0
%39 = zext i1 %38 to i32
%40 = call i32 @assert(i32 %39)
%41 = call i32 @func3(i32* %3, i32 3)
%42 = icmp eq i32 %41, 3
%43 = zext i1 %42 to i32
%44 = call i32 @assert(i32 %43)
ret i32 0
}