#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*/ flag_add(char *, int);
int /*<<< orphan*/ flag_del(char *);
scalar_t__ flag_has(char *);
int gph_execute(char key) {
  if (flag_has("menu_mode") != 0) {
    if (key == '1') {
      flag_del("hard_difficulty");
      flag_add("easy_difficulty", 1);
      flag_del("menu_mode");
      flag_add("game_mode", 1);
    } else if (key == '2') {
      flag_del("easy_difficulty");
      flag_add("hard_difficulty", 1);
      flag_del("menu_mode");
      flag_add("game_mode", 1);
    } else if (key == 's') {
      flag_del("menu_mode");
      flag_add("showhigh_mode", 1);
    }
    return 1;
  }
  if (flag_has("showhigh_mode") != 0) {
    if (key == 'q')
      flag_del("showhigh_mode");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<gph_execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
lea    0xebb(%rip),%rdi
call   1030 <flag_has@plt>
cmp    $0x0,%rax
je     122c <gph_execute+0xfc>
movsbl -0x5(%rbp),%eax
cmp    $0x31,%eax
jne    11a0 <gph_execute+0x70>
lea    0xea2(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xea6(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
lea    0xe7b(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe99(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
jmp    1220 <gph_execute+0xf0>
movsbl -0x5(%rbp),%eax
cmp    $0x32,%eax
jne    11ec <gph_execute+0xbc>
lea    0xe66(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe4a(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
lea    0xe2f(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe4d(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
jmp    121b <gph_execute+0xeb>
movsbl -0x5(%rbp),%eax
cmp    $0x73,%eax
jne    1216 <gph_execute+0xe6>
lea    0xe00(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe28(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
jmp    121b <gph_execute+0xeb>
jmp    1220 <gph_execute+0xf0>
movl   $0x1,-0x4(%rbp)
jmp    126e <gph_execute+0x13e>
lea    0xe01(%rip),%rdi
call   1030 <flag_has@plt>
cmp    $0x0,%rax
je     1267 <gph_execute+0x137>
movsbl -0x5(%rbp),%eax
cmp    $0x71,%eax
jne    125b <gph_execute+0x12b>
lea    0xdde(%rip),%rdi
call   1040 <flag_del@plt>
movl   $0x1,-0x4(%rbp)
jmp    126e <gph_execute+0x13e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gph_execute>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
lea    0xec4(%rip),%rdi
call   1030 <flag_has@plt>
test   %rax,%rax
je     1176 <gph_execute+0x46>
cmp    $0x73,%bpl
je     11a0 <gph_execute+0x70>
cmp    $0x32,%bpl
je     11ba <gph_execute+0x8a>
mov    $0x1,%ebx
cmp    $0x31,%bpl
jne    11fd <gph_execute+0xcd>
lea    0xea2(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xea6(%rip),%rdi
jmp    11cd <gph_execute+0x9d>
lea    0xeb7(%rip),%rdi
call   1030 <flag_has@plt>
test   %rax,%rax
je     11fb <gph_execute+0xcb>
mov    $0x1,%ebx
cmp    $0x71,%bpl
jne    11fd <gph_execute+0xcd>
lea    0xe9b(%rip),%rdi
call   1040 <flag_del@plt>
jmp    11fd <gph_execute+0xcd>
lea    0xe59(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe81(%rip),%rdi
mov    $0x1,%ebx
jmp    11ef <gph_execute+0xbf>
lea    0xe59(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe3d(%rip),%rdi
mov    $0x1,%ebx
mov    $0x1,%esi
call   1050 <flag_add@plt>
lea    0xe1d(%rip),%rdi
call   1040 <flag_del@plt>
lea    0xe3b(%rip),%rdi
mov    $0x1,%esi
call   1050 <flag_add@plt>
jmp    11fd <gph_execute+0xcd>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"menu_mode\00"
@.str.1 = [16 x i8] c"hard_difficulty\00"
@.str.2 = [16 x i8] c"easy_difficulty\00"
@.str.3 = [10 x i8] c"game_mode\00"
@.str.4 = [14 x i8] c"showhigh_mode\00"
define i32 @gph_execute(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = call i64 @flag_has(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %34
6: ; preds = %1
%7 = load i8, i8* %3
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 49
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = call i32 @flag_del(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%12 = call i32 @flag_add(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 1)
%13 = call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %33
15: ; preds = %6
%16 = load i8, i8* %3
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 50
br i1 %18, label %19, label %24
19: ; preds = %15
%20 = call i32 @flag_del(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%21 = call i32 @flag_add(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1)
%22 = call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %32
24: ; preds = %15
%25 = load i8, i8* %3
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 115
br i1 %27, label %28, label %31
28: ; preds = %24
%29 = call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%30 = call i32 @flag_add(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %31
31: ; preds = %28, %24
br label %32
32: ; preds = %31, %19
br label %33
33: ; preds = %32, %10
store i32 1, i32* %2
br label %45
34: ; preds = %1
%35 = call i64 @flag_has(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load i8, i8* %3
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 113
br i1 %40, label %41, label %43
41: ; preds = %37
%42 = call i32 @flag_del(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %43
43: ; preds = %41, %37
store i32 1, i32* %2
br label %45
44: ; preds = %34
store i32 0, i32* %2
br label %45
45: ; preds = %44, %43, %33
%46 = load i32, i32* %2
ret i32 %46
}

LLVM IR (-O2):
@.str = [10 x i8] c"menu_mode\00"
@.str.1 = [16 x i8] c"hard_difficulty\00"
@.str.2 = [16 x i8] c"easy_difficulty\00"
@.str.3 = [10 x i8] c"game_mode\00"
@.str.4 = [14 x i8] c"showhigh_mode\00"
define i32 @gph_execute(i8 signext %0) {
%2 = tail call i64 @flag_has(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %18, label %4
4: ; preds = %1
switch i8 %0, label %25 [
i8 49, label %5
i8 50, label %10
i8 115, label %15
]
5: ; preds = %4
%6 = tail call i32 @flag_del(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 @flag_add(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i32 1)
%8 = tail call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %25
10: ; preds = %4
%11 = tail call i32 @flag_del(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @flag_add(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1)
%13 = tail call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%14 = tail call i32 @flag_add(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 1)
br label %25
15: ; preds = %4
%16 = tail call i32 @flag_del(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%17 = tail call i32 @flag_add(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 1)
br label %25
18: ; preds = %1
%19 = tail call i64 @flag_has(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %25, label %21
21: ; preds = %18
%22 = icmp eq i8 %0, 113
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = tail call i32 @flag_del(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
br label %25
25: ; preds = %18, %21, %23, %5, %15, %10, %4
%26 = phi i32 [ 1, %4 ], [ 1, %10 ], [ 1, %15 ], [ 1, %5 ], [ 1, %23 ], [ 1, %21 ], [ 0, %18 ]
ret i32 %26
}