#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*/ check_final_state();
int /*<<< orphan*/ misc_llseek();
int /*<<< orphan*/ misc_open();
int /*<<< orphan*/ misc_read();
int /*<<< orphan*/ misc_release();
int /*<<< orphan*/ my_init();
int nondet_int();
void main(void) {
  int ldv_s_misc_fops_file_operations;
  int tmp;
  int tmp___0;
  {
    {
      ldv_s_misc_fops_file_operations = 0;
      my_init();
    }
    {
      while (1) {
      while_0_continue:;
        { tmp___0 = nondet_int(); }
        if (tmp___0) {
        } else {
          goto while_0_break;
        }
        { tmp = nondet_int(); }
        if (tmp == 0) {
          goto switch_1_0;
        } else {
          if (tmp == 1) {
            goto switch_1_1;
          } else {
            if (tmp == 2) {
              goto switch_1_2;
            } else {
              if (tmp == 3) {
                goto switch_1_3;
              } else {
                {
                  goto switch_1_default;
                  if (0) {
                  switch_1_0:
                    if (ldv_s_misc_fops_file_operations == 0) {
                      {
                        misc_open();
                        ldv_s_misc_fops_file_operations =
                            ldv_s_misc_fops_file_operations + 1;
                      }
                    } else {
                    }
                    goto switch_1_break;
                  switch_1_1:
                    if (ldv_s_misc_fops_file_operations == 1) {
                      {
                        misc_read();
                        ldv_s_misc_fops_file_operations =
                            ldv_s_misc_fops_file_operations + 1;
                      }
                    } else {
                    }
                    goto switch_1_break;
                  switch_1_2:
                    if (ldv_s_misc_fops_file_operations == 2) {
                      {
                        misc_llseek();
                        ldv_s_misc_fops_file_operations =
                            ldv_s_misc_fops_file_operations + 1;
                      }
                    } else {
                    }
                    goto switch_1_break;
                  switch_1_3:
                    if (ldv_s_misc_fops_file_operations == 3) {
                      {
                        misc_release();
                        ldv_s_misc_fops_file_operations = 0;
                      }
                    } else {
                    }
                    goto switch_1_break;
                  switch_1_default:;
                    goto switch_1_break;
                  } else {
                  switch_1_break:;
                  }
                }
              }
            }
          }
        }
      }
    while_0_break:;
    }
    { check_final_state(); }
    return;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <my_init@plt>
jmp    118b <main+0x1b>
mov    $0x0,%al
call   1040 <nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     11a4 <main+0x34>
jmp    11a9 <main+0x39>
jmp    12b9 <main+0x149>
mov    $0x0,%al
call   1040 <nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11c2 <main+0x52>
jmp    11f4 <main+0x84>
cmpl   $0x1,-0x8(%rbp)
jne    11d1 <main+0x61>
jmp    121d <main+0xad>
cmpl   $0x2,-0x8(%rbp)
jne    11e0 <main+0x70>
jmp    1246 <main+0xd6>
cmpl   $0x3,-0x8(%rbp)
jne    11ef <main+0x7f>
jmp    126f <main+0xff>
jmp    1296 <main+0x126>
cmpl   $0x0,-0x4(%rbp)
jne    1213 <main+0xa3>
mov    $0x0,%al
call   1070 <misc_open@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1218 <main+0xa8>
jmp    1218 <main+0xa8>
jmp    129b <main+0x12b>
cmpl   $0x1,-0x4(%rbp)
jne    123c <main+0xcc>
mov    $0x0,%al
call   1090 <misc_read@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <main+0xd1>
jmp    1241 <main+0xd1>
jmp    129b <main+0x12b>
cmpl   $0x2,-0x4(%rbp)
jne    1265 <main+0xf5>
mov    $0x0,%al
call   1050 <misc_llseek@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    126a <main+0xfa>
jmp    126a <main+0xfa>
jmp    129b <main+0x12b>
cmpl   $0x3,-0x4(%rbp)
jne    128c <main+0x11c>
mov    $0x0,%al
call   1080 <misc_release@plt>
movl   $0x0,-0x4(%rbp)
jmp    1291 <main+0x121>
jmp    1291 <main+0x121>
jmp    129b <main+0x12b>
jmp    129b <main+0x12b>
jmp    12a0 <main+0x130>
jmp    12a5 <main+0x135>
jmp    12aa <main+0x13a>
jmp    12af <main+0x13f>
jmp    12b4 <main+0x144>
jmp    1186 <main+0x16>
mov    $0x0,%al
call   1060 <check_final_state@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1030 <my_init@plt>
xor    %eax,%eax
call   1040 <nondet_int@plt>
test   %eax,%eax
je     1220 <main+0xb0>
xor    %ebx,%ebx
jmp    11ab <main+0x3b>
nopl   0x0(%rax,%rax,1)
cmp    $0x2,%ebx
je     1212 <main+0xa2>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   1040 <nondet_int@plt>
test   %eax,%eax
je     1220 <main+0xb0>
xor    %eax,%eax
call   1040 <nondet_int@plt>
test   %eax,%eax
je     1200 <main+0x90>
cmp    $0x1,%eax
je     11e0 <main+0x70>
cmp    $0x2,%eax
je     1190 <main+0x20>
cmp    $0x3,%eax
jne    11a0 <main+0x30>
cmp    $0x3,%ebx
jne    11a0 <main+0x30>
xor    %ebx,%ebx
xor    %eax,%eax
call   1080 <misc_release@plt>
jmp    11a0 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0x1,%ebx
jne    11a0 <main+0x30>
xor    %eax,%eax
call   1090 <misc_read@plt>
mov    $0x2,%ebx
jmp    11a0 <main+0x30>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
test   %ebx,%ebx
jne    11a0 <main+0x30>
xor    %eax,%eax
call   1070 <misc_open@plt>
mov    $0x1,%ebx
jmp    11a0 <main+0x30>
xor    %eax,%eax
call   1050 <misc_llseek@plt>
mov    $0x3,%ebx
jmp    11a0 <main+0x30>
xor    %eax,%eax
pop    %rbx
jmp    1060 <check_final_state@plt>

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @my_init()
br label %5
5: ; preds = %0, %73
br label %6
6: ; preds = %5
%7 = call i32 (...) @nondet_int()
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %12
11: ; preds = %6
br label %74
12: ; preds = %10
%13 = call i32 (...) @nondet_int()
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
br label %32
17: ; preds = %12
%18 = load i32, i32* %2
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %21
20: ; preds = %17
br label %41
21: ; preds = %17
%22 = load i32, i32* %2
%23 = icmp eq i32 %22, 2
br i1 %23, label %24, label %25
24: ; preds = %21
br label %50
25: ; preds = %21
%26 = load i32, i32* %2
%27 = icmp eq i32 %26, 3
br i1 %27, label %28, label %29
28: ; preds = %25
br label %59
29: ; preds = %25
br label %66
30: ; No predecessors!
br i1 false, label %31, label %67
31: ; preds = %30
br label %32
32: ; preds = %31, %16
%33 = load i32, i32* %1
%34 = icmp eq i32 %33, 0
br i1 %34, label %35, label %39
35: ; preds = %32
%36 = call i32 (...) @misc_open()
%37 = load i32, i32* %1
%38 = add nsw i32 %37, 1
store i32 %38, i32* %1
br label %40
39: ; preds = %32
br label %40
40: ; preds = %39, %35
br label %68
41: ; preds = %20
%42 = load i32, i32* %1
%43 = icmp eq i32 %42, 1
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = call i32 (...) @misc_read()
%46 = load i32, i32* %1
%47 = add nsw i32 %46, 1
store i32 %47, i32* %1
br label %49
48: ; preds = %41
br label %49
49: ; preds = %48, %44
br label %68
50: ; preds = %24
%51 = load i32, i32* %1
%52 = icmp eq i32 %51, 2
br i1 %52, label %53, label %57
53: ; preds = %50
%54 = call i32 (...) @misc_llseek()
%55 = load i32, i32* %1
%56 = add nsw i32 %55, 1
store i32 %56, i32* %1
br label %58
57: ; preds = %50
br label %58
58: ; preds = %57, %53
br label %68
59: ; preds = %28
%60 = load i32, i32* %1
%61 = icmp eq i32 %60, 3
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 (...) @misc_release()
store i32 0, i32* %1
br label %65
64: ; preds = %59
br label %65
65: ; preds = %64, %62
br label %68
66: ; preds = %29
br label %68
67: ; preds = %30
br label %68
68: ; preds = %67, %66, %65, %58, %49, %40
br label %69
69: ; preds = %68
br label %70
70: ; preds = %69
br label %71
71: ; preds = %70
br label %72
72: ; preds = %71
br label %73
73: ; preds = %72
br label %5
74: ; preds = %11
%75 = call i32 (...) @check_final_state()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @my_init()
%2 = tail call i32 (...) @nondet_int()
%3 = icmp eq i32 %2, 0
br i1 %3, label %29, label %4
4: ; preds = %0, %25
%5 = phi i32 [ %26, %25 ], [ 0, %0 ]
%6 = tail call i32 (...) @nondet_int()
switch i32 %6, label %7 [
i32 0, label %11
i32 1, label %15
i32 2, label %19
]
7: ; preds = %4
%8 = icmp eq i32 %6, 3
%9 = icmp eq i32 %5, 3
%10 = select i1 %8, i1 %9, i1 false
br i1 %10, label %23, label %25
11: ; preds = %4
%12 = icmp eq i32 %5, 0
br i1 %12, label %13, label %25
13: ; preds = %11
%14 = tail call i32 (...) @misc_open()
br label %25
15: ; preds = %4
%16 = icmp eq i32 %5, 1
br i1 %16, label %17, label %25
17: ; preds = %15
%18 = tail call i32 (...) @misc_read()
br label %25
19: ; preds = %4
%20 = icmp eq i32 %5, 2
br i1 %20, label %21, label %25
21: ; preds = %19
%22 = tail call i32 (...) @misc_llseek()
br label %25
23: ; preds = %7
%24 = tail call i32 (...) @misc_release()
br label %25
25: ; preds = %11, %13, %15, %17, %19, %21, %23, %7
%26 = phi i32 [ 1, %13 ], [ %5, %11 ], [ 2, %17 ], [ %5, %15 ], [ 3, %21 ], [ %5, %19 ], [ 0, %23 ], [ %5, %7 ]
%27 = tail call i32 (...) @nondet_int()
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %4
29: ; preds = %25, %0
%30 = tail call i32 (...) @check_final_state()
ret void
}