#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*/ clearScreen();
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int optionsScreen(int diff) {
  clearScreen();
  printf("\n\t   ---OPTIONS---");
  printf("\n");
  printf("\n\tDifficulty is now set to ");
  switch (diff) {
  case 1:
    printf("EASY");
    break;
  case 2:
    printf("MEDIUM (default)");
    break;
  case 3:
    printf("HARD");
    break;
  }
  int opts1;
  printf("\n\t");
  printf("\n\tHere you can change level of difficulty:");
  printf("\n\t  1- Easy");
  printf("\n\t  2- Medium (default)");
  printf("\n\t  3- Hard");
  printf("\n");
  printf("\n\t  4- Go back to main menu");
  printf("\n\t Select: ");
  scanf(" %d", &opts1);
  while (opts1 > 4 && opts1 < 1) {
    printf("\tOption '%d' not recognised, try again: ", opts1);
    scanf(" %d", &opts1);
  }
  if (opts1 >= 1 && opts1 <= 3) {
    printf("\n\tThe difficulty was set to ");
    switch (opts1) {
    case 1:
      diff = 1;
      printf("Easy");
      break;
    case 2:
      diff = 2;
      printf("Medium");
      break;
    case 3:
      diff = 3;
      printf("Hard");
      break;
    }
  }
  if (opts1 == 4) {
    printf("\n\n\tThe difficulty was not changed");
  }
  printf("\n");
  printf("\n\tPress 'Enter' to continue... ");
  getchar();
  getchar();
  return diff;
}


x86 assembly (clang, -O0):
<optionsScreen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    %al,-0xd(%rbp)
call   1050 <clearScreen@plt>
mov    -0xd(%rbp),%al
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xd(%rbp),%al
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0xd(%rbp),%al
lea    0xe98(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     11b8 <optionsScreen+0x78>
jmp    1196 <optionsScreen+0x56>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     11cb <optionsScreen+0x8b>
jmp    11a7 <optionsScreen+0x67>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     11de <optionsScreen+0x9e>
jmp    11ec <optionsScreen+0xac>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <optionsScreen+0xac>
lea    0xe64(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ec <optionsScreen+0xac>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6f(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x4,-0x8(%rbp)
mov    %al,-0xe(%rbp)
jle    1285 <optionsScreen+0x145>
cmpl   $0x1,-0x8(%rbp)
setl   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    1295 <optionsScreen+0x155>
jmp    12bb <optionsScreen+0x17b>
mov    -0x8(%rbp),%esi
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe25(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
jmp    126c <optionsScreen+0x12c>
cmpl   $0x1,-0x8(%rbp)
jl     1361 <optionsScreen+0x221>
cmpl   $0x3,-0x8(%rbp)
jg     1361 <optionsScreen+0x221>
lea    0xe29(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     1313 <optionsScreen+0x1d3>
jmp    12f1 <optionsScreen+0x1b1>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     132d <optionsScreen+0x1ed>
jmp    1302 <optionsScreen+0x1c2>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1347 <optionsScreen+0x207>
jmp    135c <optionsScreen+0x21c>
movl   $0x1,-0x4(%rbp)
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135c <optionsScreen+0x21c>
movl   $0x2,-0x4(%rbp)
lea    0xde1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    135c <optionsScreen+0x21c>
movl   $0x3,-0x4(%rbp)
lea    0xd50(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1361 <optionsScreen+0x221>
cmpl   $0x4,-0x8(%rbp)
jne    1379 <optionsScreen+0x239>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xc93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<optionsScreen>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%r14d
xor    %eax,%eax
call   1060 <clearScreen@plt>
lea    0xe9b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe96(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    -0x1(%r14),%eax
cmp    $0x2,%eax
ja     11a4 <optionsScreen+0x54>
cltq
lea    0xfa6(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe94(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb1(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x2,%ecx
ja     126b <optionsScreen+0x11b>
lea    0xea0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%ebx
lea    -0x1(%rbx),%eax
cmp    $0x2,%eax
ja     1269 <optionsScreen+0x119>
cltq
lea    0xef8(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
cmp    $0x4,%eax
je     1273 <optionsScreen+0x123>
jmp    1281 <optionsScreen+0x131>
mov    %ebx,%eax
mov    %r14d,%ebx
cmp    $0x4,%eax
jne    1281 <optionsScreen+0x131>
lea    0xe7e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [19 x i8] c"\0A\09 ---OPTIONS---\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [28 x i8] c"\0A\09Difficulty is now set to \00"
@.str.3 = [5 x i8] c"EASY\00"
@.str.4 = [17 x i8] c"MEDIUM (default)\00"
@.str.5 = [5 x i8] c"HARD\00"
@.str.6 = [3 x i8] c"\0A\09\00"
@.str.7 = [43 x i8] c"\0A\09Here you can change level of difficulty:\00"
@.str.8 = [12 x i8] c"\0A\09 1- Easy\00"
@.str.9 = [24 x i8] c"\0A\09 2- Medium (default)\00"
@.str.10 = [12 x i8] c"\0A\09 3- Hard\00"
@.str.11 = [28 x i8] c"\0A\09 4- Go back to main menu\00"
@.str.12 = [12 x i8] c"\0A\09 Select: \00"
@.str.13 = [4 x i8] c" %d\00"
@.str.14 = [41 x i8] c"\09Option '%d' not recognised, try again: \00"
@.str.15 = [29 x i8] c"\0A\09The difficulty was set to \00"
@.str.16 = [5 x i8] c"Easy\00"
@.str.17 = [7 x i8] c"Medium\00"
@.str.18 = [5 x i8] c"Hard\00"
@.str.19 = [34 x i8] c"\0A\0A\09The difficulty was not changed\00"
@.str.20 = [32 x i8] c"\0A\09Press 'Enter' to continue... \00"
define i32 @optionsScreen(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @clearScreen()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
switch i32 %8, label %15 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
]
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %15
11: ; preds = %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %15
13: ; preds = %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
br label %15
15: ; preds = %1, %13, %11, %9
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32* %3)
br label %25
25: ; preds = %33, %15
%26 = load i32, i32* %3
%27 = icmp sgt i32 %26, 4
br i1 %27, label %28, label %31
28: ; preds = %25
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 1
br label %31
31: ; preds = %28, %25
%32 = phi i1 [ false, %25 ], [ %30, %28 ]
br i1 %32, label %33, label %37
33: ; preds = %31
%34 = load i32, i32* %3
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.14, i64 0, i64 0), i32 %34)
%36 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32* %3)
br label %25
37: ; preds = %31
%38 = load i32, i32* %3
%39 = icmp sge i32 %38, 1
br i1 %39, label %40, label %53
40: ; preds = %37
%41 = load i32, i32* %3
%42 = icmp sle i32 %41, 3
br i1 %42, label %43, label %53
43: ; preds = %40
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0))
%45 = load i32, i32* %3
switch i32 %45, label %52 [
i32 1, label %46
i32 2, label %48
i32 3, label %50
]
46: ; preds = %43
store i32 1, i32* %2
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i64 0, i64 0))
br label %52
48: ; preds = %43
store i32 2, i32* %2
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0))
br label %52
50: ; preds = %43
store i32 3, i32* %2
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.18, i64 0, i64 0))
br label %52
52: ; preds = %43, %50, %48, %46
br label %53
53: ; preds = %52, %40, %37
%54 = load i32, i32* %3
%55 = icmp eq i32 %54, 4
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0))
br label %58
58: ; preds = %56, %53
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.20, i64 0, i64 0))
%61 = call i32 (...) @getchar()
%62 = call i32 (...) @getchar()
%63 = load i32, i32* %2
ret i32 %63
}

LLVM IR (-O2):
@.str = [19 x i8] c"\0A\09 ---OPTIONS---\00"
@.str.2 = [28 x i8] c"\0A\09Difficulty is now set to \00"
@.str.3 = [5 x i8] c"EASY\00"
@.str.4 = [17 x i8] c"MEDIUM (default)\00"
@.str.5 = [5 x i8] c"HARD\00"
@.str.6 = [3 x i8] c"\0A\09\00"
@.str.7 = [43 x i8] c"\0A\09Here you can change level of difficulty:\00"
@.str.8 = [12 x i8] c"\0A\09 1- Easy\00"
@.str.9 = [24 x i8] c"\0A\09 2- Medium (default)\00"
@.str.10 = [12 x i8] c"\0A\09 3- Hard\00"
@.str.11 = [28 x i8] c"\0A\09 4- Go back to main menu\00"
@.str.12 = [12 x i8] c"\0A\09 Select: \00"
@.str.13 = [4 x i8] c" %d\00"
@.str.15 = [29 x i8] c"\0A\09The difficulty was set to \00"
@.str.16 = [5 x i8] c"Easy\00"
@.str.17 = [7 x i8] c"Medium\00"
@.str.18 = [5 x i8] c"Hard\00"
@.str.19 = [34 x i8] c"\0A\0A\09The difficulty was not changed\00"
@.str.20 = [32 x i8] c"\0A\09Press 'Enter' to continue... \00"
@reltable.optionsScreen = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.3 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([17 x i8]* @.str.4 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.5 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen to i64)) to i32)]
@reltable.optionsScreen.22 = [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.16 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen.22 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.17 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen.22 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.18 to i64), i64 ptrtoint ([3 x i32]* @reltable.optionsScreen.22 to i64)) to i32)]
define i32 @optionsScreen(i32 %0) {
%2 = alloca i32
%3 = tail call i32 (...) @clearScreen()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
%7 = add i32 %0, -1
%8 = icmp ult i32 %7, 3
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = sext i32 %7 to i64
%11 = shl i64 %10, 2
%12 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.optionsScreen to i8*), i64 %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %12)
br label %14
14: ; preds = %1, %9
%15 = bitcast i32* %2 to i8*
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0))
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0))
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i64 0, i64 0))
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0))
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.11, i64 0, i64 0))
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.13, i64 0, i64 0), i32* %2)
%25 = load i32, i32* %2
%26 = add i32 %25, -1
%27 = icmp ult i32 %26, 3
br i1 %27, label %28, label %39
28: ; preds = %14
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i64 0, i64 0))
%30 = load i32, i32* %2
%31 = add i32 %30, -1
%32 = icmp ult i32 %31, 3
br i1 %32, label %33, label %39
33: ; preds = %28
%34 = sext i32 %31 to i64
%35 = shl i64 %34, 2
%36 = call i8* @llvm.load.relative.i64(i8* bitcast ([3 x i32]* @reltable.optionsScreen.22 to i8*), i64 %35)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %36)
%38 = load i32, i32* %2
br label %39
39: ; preds = %28, %33, %14
%40 = phi i32 [ %38, %33 ], [ %30, %28 ], [ %25, %14 ]
%41 = phi i32 [ %30, %33 ], [ %0, %28 ], [ %0, %14 ]
%42 = icmp eq i32 %40, 4
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0))
br label %45
45: ; preds = %43, %39
%46 = call i32 @putchar(i32 10)
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.20, i64 0, i64 0))
%48 = call i32 (...) @getchar()
%49 = call i32 (...) @getchar()
ret i32 %41
}