#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 __VERIFIER_nondet_int();
int calculate_output(int);
int main() {
  int output = -1;
  while (1) {
    int input;
    input = __VERIFIER_nondet_int();
    if ((input != 1) && (input != 3) && (input != 4) && (input != 5) &&
        (input != 6))
      return -2;
    output = calculate_output(input);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x3,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x4,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x5,-0xc(%rbp)
je     117d <main+0x5d>
cmpl   $0x6,-0xc(%rbp)
je     117d <main+0x5d>
mov    $0xfffffffe,%eax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0xc(%rbp),%edi
call   1030 <calculate_output@plt>
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %eax,%ebx
lea    -0x3(%rbx),%ebp
cmp    $0x4,%ebp
jae    1160 <main+0x40>
mov    %ebx,%edi
call   1030 <calculate_output@plt>
mov    %r14d,%eax
mov    %eax,%r14d
cmp    $0x4,%ebp
jb     1130 <main+0x10>
mov    %eax,%r14d
cmp    $0x1,%ebx
je     1130 <main+0x10>
jmp    116c <main+0x4c>
nopl   (%rax)
mov    $0xfffffffe,%eax
cmp    $0x1,%ebx
je     1141 <main+0x21>
jmp    114b <main+0x2b>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
br label %4
4: ; preds = %0, %21
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 4
br i1 %13, label %14, label %21
14: ; preds = %11
%15 = load i32, i32* %3
%16 = icmp ne i32 %15, 5
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = load i32, i32* %3
%19 = icmp ne i32 %18, 6
br i1 %19, label %20, label %21
20: ; preds = %17
ret i32 -2
21: ; preds = %17, %14, %11, %8, %4
%22 = load i32, i32* %3
%23 = call i32 @calculate_output(i32 %22)
store i32 %23, i32* %2
br label %4
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %8, %0
%2 = phi i32 [ 0, %0 ], [ %7, %8 ]
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
switch i32 %3, label %6 [
i32 6, label %4
i32 5, label %4
i32 4, label %4
i32 3, label %4
i32 1, label %4
]
4: ; preds = %1, %1, %1, %1, %1
%5 = tail call i32 @calculate_output(i32 %3)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %2, %4 ], [ -2, %1 ]
switch i32 %3, label %9 [
i32 6, label %8
i32 5, label %8
i32 4, label %8
i32 3, label %8
i32 1, label %8
]
8: ; preds = %6, %6, %6, %6, %6
br label %1
9: ; preds = %6
ret i32 %7
}