#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*/ assert(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ longjmp(int /*<<< orphan*/, int);
int setjmp(int /*<<< orphan*/);
int main(int argc __attribute__((unused)),
         char const *const argv[] __attribute__((unused))) {
  {
    jmp_buf L;
    int flag = 0, code = 0;
    code = setjmp(L);
    if (code) {
      flag = 2;
    } else {
      flag = 1;
    }
    assert(0 == code);
    assert(1 == flag);
  }
  {
    jmp_buf L;
    int code;
    int flag = 0;
    code = setjmp(L);
    if (2 == code) {
      flag = 2;
    } else {
      longjmp(L, 2);
      flag = 1;
    }
    assert(2 == code);
    assert(2 == flag);
  }
  {
    jmp_buf L;
    int code;
    int flag = 0;
    code = setjmp(L);
    switch (code) {
    case 2:
      flag = 2;
      break;
    default:
      longjmp(L, 2);
      flag = 1;
      break;
    }
    assert(2 == code);
    assert(2 == flag);
  }
  {
    jmp_buf L;
    int code;
    int flag = 0;
    code = setjmp(L);
    switch (code) {
    case 2:
      longjmp(L, 3);
      flag = 2;
      break;
    case 3:
      flag = 3;
      break;
    default:
      longjmp(L, 2);
      flag = 1;
      break;
    }
    assert(3 == code);
    assert(3 == flag);
  }
  {
    jmp_buf L;
    int code;
    int flag = 0;
    code = setjmp(L);
    switch (code) {
    case 2:
      longjmp(L, 3);
      flag = 2;
      break;
    default:
      if (3 == code) {
        flag = 3;
      } else {
        longjmp(L, 2);
        flag = 1;
      }
      break;
    }
    assert(3 == code);
    assert(3 == flag);
  }
  {
    jmp_buf L;
    volatile int times = 0;
    int code = 0;
    int flag = 0;
    code = setjmp(L);
    switch (code) {
    case 2:
      longjmp(L, 3);
      flag = 2;
      break;
    default:
      if ((3 == code) && (times < 5)) {
        ++times;
        longjmp(L, 2);
      } else if (3 == code) {
        flag = 3;
      } else {
        longjmp(L, 2);
        flag = 1;
      }
      break;
    }
    assert(3 == code);
    assert(3 == flag);
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1185 <main+0x45>
movl   $0x2,-0x18(%rbp)
jmp    118c <main+0x4c>
movl   $0x1,-0x18(%rbp)
xor    %eax,%eax
cmp    -0x1c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x1,%eax
cmp    -0x18(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x24(%rbp)
mov    $0x2,%eax
cmp    -0x24(%rbp),%eax
jne    11df <main+0x9f>
movl   $0x2,-0x28(%rbp)
jmp    11ec <main+0xac>
mov    -0x20(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
mov    -0x24(%rbp),%eax
sub    $0x2,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x28(%rbp),%eax
sub    $0x2,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x2c(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
sub    $0x2,%eax
jne    123d <main+0xfd>
jmp    1231 <main+0xf1>
movl   $0x2,-0x34(%rbp)
jmp    124a <main+0x10a>
mov    -0x2c(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
mov    -0x30(%rbp),%eax
sub    $0x2,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x34(%rbp),%eax
sub    $0x2,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x38(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x60(%rbp)
sub    $0x2,%eax
je     12a3 <main+0x163>
jmp    1292 <main+0x152>
mov    -0x60(%rbp),%eax
sub    $0x3,%eax
je     12b0 <main+0x170>
jmp    12bc <main+0x17c>
mov    -0x38(%rbp),%edi
mov    $0x3,%esi
call   1050 <longjmp@plt>
movl   $0x3,-0x40(%rbp)
jmp    12c9 <main+0x189>
mov    -0x38(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
mov    -0x3c(%rbp),%eax
sub    $0x3,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x40(%rbp),%eax
sub    $0x3,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x44(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%eax
sub    $0x2,%eax
jne    131b <main+0x1db>
jmp    130e <main+0x1ce>
mov    -0x44(%rbp),%edi
mov    $0x3,%esi
call   1050 <longjmp@plt>
mov    $0x3,%eax
cmp    -0x48(%rbp),%eax
jne    1335 <main+0x1f5>
movl   $0x3,-0x4c(%rbp)
jmp    1342 <main+0x202>
mov    -0x44(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
jmp    1347 <main+0x207>
mov    -0x48(%rbp),%eax
sub    $0x3,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4c(%rbp),%eax
sub    $0x3,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x50(%rbp),%edi
call   1040 <setjmp@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
sub    $0x2,%eax
jne    13a7 <main+0x267>
jmp    139a <main+0x25a>
mov    -0x50(%rbp),%edi
mov    $0x3,%esi
call   1050 <longjmp@plt>
mov    $0x3,%eax
cmp    -0x58(%rbp),%eax
jne    13d7 <main+0x297>
mov    -0x54(%rbp),%eax
cmp    $0x5,%eax
jge    13d7 <main+0x297>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x50(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
mov    $0x3,%eax
cmp    -0x58(%rbp),%eax
jne    13f1 <main+0x2b1>
movl   $0x3,-0x5c(%rbp)
jmp    13fe <main+0x2be>
mov    -0x50(%rbp),%edi
mov    $0x2,%esi
call   1050 <longjmp@plt>
jmp    1403 <main+0x2c3>
jmp    1408 <main+0x2c8>
mov    $0x3,%eax
cmp    -0x58(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x3,%eax
cmp    -0x5c(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    0x2ba7(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
call   1040 <setjmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %al
mov    %al,%bl
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
call   1040 <setjmp@plt>
cmp    $0x2,%eax
jne    1208 <main+0xc8>
mov    $0x1,%ebx
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
call   1040 <setjmp@plt>
cmp    $0x2,%eax
jne    1208 <main+0xc8>
mov    $0x1,%ebx
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
call   1040 <setjmp@plt>
cmp    $0x2,%eax
je     1212 <main+0xd2>
cmp    $0x3,%eax
jne    1208 <main+0xc8>
mov    $0x1,%ebx
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
call   1040 <setjmp@plt>
cmp    $0x2,%eax
je     1212 <main+0xd2>
cmp    $0x3,%eax
jne    1208 <main+0xc8>
mov    $0x1,%ebx
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
movl   $0x0,0xc(%rsp)
call   1040 <setjmp@plt>
cmp    $0x2,%eax
je     1212 <main+0xd2>
cmp    $0x3,%eax
jne    1208 <main+0xc8>
mov    0xc(%rsp),%eax
cmp    $0x4,%eax
jg     121c <main+0xdc>
addl   $0x1,0xc(%rsp)
mov    $0x2,%esi
call   1050 <longjmp@plt>
mov    $0x3,%esi
call   1050 <longjmp@plt>
mov    $0x1,%ebx
mov    %ebx,%edi
call   1030 <assert@plt>
mov    %ebx,%edi
call   1030 <assert@plt>
mov    0x2daa(%rip),%rax
mov    (%rax),%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
%25 = load i32, i32* %6
%26 = call i32 @setjmp(i32 %25)
store i32 %26, i32* %8
%27 = load i32, i32* %8
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %2
store i32 2, i32* %7
br label %31
30: ; preds = %2
store i32 1, i32* %7
br label %31
31: ; preds = %30, %29
%32 = load i32, i32* %8
%33 = icmp eq i32 0, %32
%34 = zext i1 %33 to i32
%35 = call i32 @assert(i32 %34)
%36 = load i32, i32* %7
%37 = icmp eq i32 1, %36
%38 = zext i1 %37 to i32
%39 = call i32 @assert(i32 %38)
store i32 0, i32* %11
%40 = load i32, i32* %9
%41 = call i32 @setjmp(i32 %40)
store i32 %41, i32* %10
%42 = load i32, i32* %10
%43 = icmp eq i32 2, %42
br i1 %43, label %44, label %45
44: ; preds = %31
store i32 2, i32* %11
br label %48
45: ; preds = %31
%46 = load i32, i32* %9
%47 = call i32 @longjmp(i32 %46, i32 2)
unreachable
48: ; preds = %44
%49 = load i32, i32* %10
%50 = icmp eq i32 2, %49
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = load i32, i32* %11
%54 = icmp eq i32 2, %53
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
store i32 0, i32* %14
%57 = load i32, i32* %12
%58 = call i32 @setjmp(i32 %57)
store i32 %58, i32* %13
%59 = load i32, i32* %13
switch i32 %59, label %61 [
i32 2, label %60
]
60: ; preds = %48
store i32 2, i32* %14
br label %64
61: ; preds = %48
%62 = load i32, i32* %12
%63 = call i32 @longjmp(i32 %62, i32 2)
unreachable
64: ; preds = %60
%65 = load i32, i32* %13
%66 = icmp eq i32 2, %65
%67 = zext i1 %66 to i32
%68 = call i32 @assert(i32 %67)
%69 = load i32, i32* %14
%70 = icmp eq i32 2, %69
%71 = zext i1 %70 to i32
%72 = call i32 @assert(i32 %71)
store i32 0, i32* %17
%73 = load i32, i32* %15
%74 = call i32 @setjmp(i32 %73)
store i32 %74, i32* %16
%75 = load i32, i32* %16
switch i32 %75, label %80 [
i32 2, label %76
i32 3, label %79
]
76: ; preds = %64
%77 = load i32, i32* %15
%78 = call i32 @longjmp(i32 %77, i32 3)
unreachable
79: ; preds = %64
store i32 3, i32* %17
br label %83
80: ; preds = %64
%81 = load i32, i32* %15
%82 = call i32 @longjmp(i32 %81, i32 2)
unreachable
83: ; preds = %79
%84 = load i32, i32* %16
%85 = icmp eq i32 3, %84
%86 = zext i1 %85 to i32
%87 = call i32 @assert(i32 %86)
%88 = load i32, i32* %17
%89 = icmp eq i32 3, %88
%90 = zext i1 %89 to i32
%91 = call i32 @assert(i32 %90)
store i32 0, i32* %20
%92 = load i32, i32* %18
%93 = call i32 @setjmp(i32 %92)
store i32 %93, i32* %19
%94 = load i32, i32* %19
switch i32 %94, label %98 [
i32 2, label %95
]
95: ; preds = %83
%96 = load i32, i32* %18
%97 = call i32 @longjmp(i32 %96, i32 3)
unreachable
98: ; preds = %83
%99 = load i32, i32* %19
%100 = icmp eq i32 3, %99
br i1 %100, label %101, label %102
101: ; preds = %98
store i32 3, i32* %20
br label %105
102: ; preds = %98
%103 = load i32, i32* %18
%104 = call i32 @longjmp(i32 %103, i32 2)
unreachable
105: ; preds = %101
br label %106
106: ; preds = %105
%107 = load i32, i32* %19
%108 = icmp eq i32 3, %107
%109 = zext i1 %108 to i32
%110 = call i32 @assert(i32 %109)
%111 = load i32, i32* %20
%112 = icmp eq i32 3, %111
%113 = zext i1 %112 to i32
%114 = call i32 @assert(i32 %113)
store volatile i32 0, i32* %22
store i32 0, i32* %23
store i32 0, i32* %24
%115 = load i32, i32* %21
%116 = call i32 @setjmp(i32 %115)
store i32 %116, i32* %23
%117 = load i32, i32* %23
switch i32 %117, label %121 [
i32 2, label %118
]
118: ; preds = %106
%119 = load i32, i32* %21
%120 = call i32 @longjmp(i32 %119, i32 3)
unreachable
121: ; preds = %106
%122 = load i32, i32* %23
%123 = icmp eq i32 3, %122
br i1 %123, label %124, label %132
124: ; preds = %121
%125 = load volatile i32, i32* %22
%126 = icmp slt i32 %125, 5
br i1 %126, label %127, label %132
127: ; preds = %124
%128 = load volatile i32, i32* %22
%129 = add nsw i32 %128, 1
store volatile i32 %129, i32* %22
%130 = load i32, i32* %21
%131 = call i32 @longjmp(i32 %130, i32 2)
unreachable
132: ; preds = %124, %121
%133 = load i32, i32* %23
%134 = icmp eq i32 3, %133
br i1 %134, label %135, label %136
135: ; preds = %132
store i32 3, i32* %24
br label %139
136: ; preds = %132
%137 = load i32, i32* %21
%138 = call i32 @longjmp(i32 %137, i32 2)
unreachable
139: ; preds = %135
br label %140
140: ; preds = %139
br label %141
141: ; preds = %140
%142 = load i32, i32* %23
%143 = icmp eq i32 3, %142
%144 = zext i1 %143 to i32
%145 = call i32 @assert(i32 %144)
%146 = load i32, i32* %24
%147 = icmp eq i32 3, %146
%148 = zext i1 %147 to i32
%149 = call i32 @assert(i32 %148)
%150 = load i32, i32* @EXIT_SUCCESS
%151 = call i32 @exit(i32 %150)
unreachable
}

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