#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*/ clear();
char getch();
int /*<<< orphan*/ gettext(char *);
int /*<<< orphan*/ mvaddstr(int, int, int /*<<< orphan*/);
int fileselmenu(void) {
  int a, cpos, k;
  clear();
  mvaddstr(2, 5, gettext("Dictionaries :"));
  mvaddstr(4, 5, gettext("1. C Sharp"));
  mvaddstr(5, 5, gettext("2. English"));
  mvaddstr(6, 5, gettext("3. French"));
  mvaddstr(7, 5, gettext("4. DOS"));
  mvaddstr(8, 5, gettext("5. Programming"));
  mvaddstr(9, 5, gettext("6. Unix"));
  mvaddstr(12, 5, gettext("Choose a dictionary :"));
  char c;
  c = getch();
  while (c < '1' || c > '6') {
    c = getch();
  }
  k = c - '0';
  return k;
}


x86 assembly (clang, -O0):
<fileselmenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <clear@plt>
lea    0xeaa(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x2,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe9c(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x4,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe8a(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x5,%esi
mov    %esi,%edi
call   1050 <mvaddstr@plt>
lea    0xe7b(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x6,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe68(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x7,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe52(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x8,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe44(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0x9,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
lea    0xe2f(%rip),%rdi
call   1030 <gettext@plt>
mov    %eax,%edx
mov    $0xc,%edi
mov    $0x5,%esi
call   1050 <mvaddstr@plt>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0xd(%rbp)
movsbl -0xd(%rbp),%ecx
mov    $0x1,%al
cmp    $0x31,%ecx
mov    %al,-0xe(%rbp)
jl     125d <fileselmenu+0x11d>
movsbl -0xd(%rbp),%eax
cmp    $0x36,%eax
setg   %al
mov    %al,-0xe(%rbp)
mov    -0xe(%rbp),%al
test   $0x1,%al
jne    126d <fileselmenu+0x12d>
jmp    127c <fileselmenu+0x13c>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %al,-0xd(%rbp)
jmp    123e <fileselmenu+0xfe>
movsbl -0xd(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fileselmenu>:
push   %rax
xor    %eax,%eax
call   1060 <clear@plt>
lea    0xeb1(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x2,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xea3(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x4,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe91(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x5,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe7f(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x6,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe6c(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x7,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe56(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x8,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe48(%rip),%rdi
call   1030 <gettext@plt>
mov    $0x9,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
lea    0xe33(%rip),%rdi
call   1030 <gettext@plt>
mov    $0xc,%edi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <mvaddstr@plt>
xor    %eax,%eax
call   1040 <getch@plt>
mov    %eax,%ecx
add    $0xc9,%cl
cmp    $0xf9,%cl
ja     125f <fileselmenu+0x11f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getch@plt>
lea    -0x37(%rax),%ecx
cmp    $0xfa,%cl
jb     1250 <fileselmenu+0x110>
movzbl %al,%eax
add    $0xffffffd0,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Dictionaries :\00"
@.str.1 = [11 x i8] c"1. C Sharp\00"
@.str.2 = [11 x i8] c"2. English\00"
@.str.3 = [10 x i8] c"3. French\00"
@.str.4 = [7 x i8] c"4. DOS\00"
@.str.5 = [15 x i8] c"5. Programming\00"
@.str.6 = [8 x i8] c"6. Unix\00"
@.str.7 = [22 x i8] c"Choose a dictionary :\00"
define i32 @fileselmenu() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
%5 = call i32 (...) @clear()
%6 = call i32 @gettext(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @mvaddstr(i32 2, i32 5, i32 %6)
%8 = call i32 @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @mvaddstr(i32 4, i32 5, i32 %8)
%10 = call i32 @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @mvaddstr(i32 5, i32 5, i32 %10)
%12 = call i32 @gettext(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @mvaddstr(i32 6, i32 5, i32 %12)
%14 = call i32 @gettext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%15 = call i32 @mvaddstr(i32 7, i32 5, i32 %14)
%16 = call i32 @gettext(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%17 = call i32 @mvaddstr(i32 8, i32 5, i32 %16)
%18 = call i32 @gettext(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%19 = call i32 @mvaddstr(i32 9, i32 5, i32 %18)
%20 = call i32 @gettext(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%21 = call i32 @mvaddstr(i32 12, i32 5, i32 %20)
%22 = call signext i8 (...) @getch()
store i8 %22, i8* %4
br label %23
23: ; preds = %33, %0
%24 = load i8, i8* %4
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 49
br i1 %26, label %31, label %27
27: ; preds = %23
%28 = load i8, i8* %4
%29 = sext i8 %28 to i32
%30 = icmp sgt i32 %29, 54
br label %31
31: ; preds = %27, %23
%32 = phi i1 [ true, %23 ], [ %30, %27 ]
br i1 %32, label %33, label %35
33: ; preds = %31
%34 = call signext i8 (...) @getch()
store i8 %34, i8* %4
br label %23
35: ; preds = %31
%36 = load i8, i8* %4
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 48
store i32 %38, i32* %3
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
@.str = [15 x i8] c"Dictionaries :\00"
@.str.1 = [11 x i8] c"1. C Sharp\00"
@.str.2 = [11 x i8] c"2. English\00"
@.str.3 = [10 x i8] c"3. French\00"
@.str.4 = [7 x i8] c"4. DOS\00"
@.str.5 = [15 x i8] c"5. Programming\00"
@.str.6 = [8 x i8] c"6. Unix\00"
@.str.7 = [22 x i8] c"Choose a dictionary :\00"
define i32 @fileselmenu() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 @gettext(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @mvaddstr(i32 2, i32 5, i32 %2)
%4 = tail call i32 @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @mvaddstr(i32 4, i32 5, i32 %4)
%6 = tail call i32 @gettext(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%7 = tail call i32 @mvaddstr(i32 5, i32 5, i32 %6)
%8 = tail call i32 @gettext(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 @mvaddstr(i32 6, i32 5, i32 %8)
%10 = tail call i32 @gettext(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%11 = tail call i32 @mvaddstr(i32 7, i32 5, i32 %10)
%12 = tail call i32 @gettext(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.5, i64 0, i64 0))
%13 = tail call i32 @mvaddstr(i32 8, i32 5, i32 %12)
%14 = tail call i32 @gettext(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%15 = tail call i32 @mvaddstr(i32 9, i32 5, i32 %14)
%16 = tail call i32 @gettext(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0))
%17 = tail call i32 @mvaddstr(i32 12, i32 5, i32 %16)
%18 = tail call signext i8 (...) @getch()
%19 = add i8 %18, -55
%20 = icmp ult i8 %19, -6
br i1 %20, label %21, label %25
21: ; preds = %0, %21
%22 = tail call signext i8 (...) @getch()
%23 = add i8 %22, -55
%24 = icmp ult i8 %23, -6
br i1 %24, label %21, label %25
25: ; preds = %21, %0
%26 = phi i8 [ %18, %0 ], [ %22, %21 ]
%27 = zext i8 %26 to i32
%28 = add nsw i32 %27, -48
ret i32 %28
}