#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 Convert_Coordinate(int);
int getche();
int /*<<< orphan*/ printf(char *);
int toupper(int);
int Get_First_Coordinate() {
  int coordinate;
  coordinate = toupper(getche());
  while ((coordinate != 'A') && (coordinate != 'B') && (coordinate != 'C') &&
         (coordinate != 'D') && (coordinate != 'E') && (coordinate != 'F') &&
         (coordinate != 'G') && (coordinate != 'H')) {
    printf("\nYou must enter a letter between A and H for the first "
           "coordinate\n\n");
    coordinate = toupper(getche());
  }
  return Convert_Coordinate(toupper(coordinate));
}


x86 assembly (clang, -O0):
<Get_First_Coordinate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <getche@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x41,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x42,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x43,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x44,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x45,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x46,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x47,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_First_Coordinate+0x8c>
cmpl   $0x48,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    11dc <Get_First_Coordinate+0x9c>
jmp    11fe <Get_First_Coordinate+0xbe>
lea    0xe1d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <getche@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,-0x4(%rbp)
jmp    1159 <Get_First_Coordinate+0x19>
mov    -0x4(%rbp),%edi
call   1030 <toupper@plt>
mov    %eax,%edi
call   1050 <Convert_Coordinate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_First_Coordinate>:
push   %rbx
xor    %eax,%eax
call   1060 <getche@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
add    $0xffffffb7,%ecx
cmp    $0xfffffff7,%ecx
ja     117e <Get_First_Coordinate+0x3e>
lea    0xea0(%rip),%rbx
mov    %rbx,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <getche@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
lea    -0x49(%rax),%ecx
cmp    $0xfffffff8,%ecx
jb     1160 <Get_First_Coordinate+0x20>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <Convert_Coordinate@plt>

LLVM IR (-O0):
@.str = [68 x i8] c"\0AYou must enter a letter between A and H for the first coordinate\0A\0A\00"
define i32 @Get_First_Coordinate() {
%1 = alloca i32
%2 = call i32 (...) @getche()
%3 = call i32 @toupper(i32 %2)
store i32 %3, i32* %1
br label %4
4: ; preds = %30, %0
%5 = load i32, i32* %1
%6 = icmp ne i32 %5, 65
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 66
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = load i32, i32* %1
%12 = icmp ne i32 %11, 67
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp ne i32 %14, 68
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 69
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 70
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %1
%24 = icmp ne i32 %23, 71
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %1
%27 = icmp ne i32 %26, 72
br label %28
28: ; preds = %25, %22, %19, %16, %13, %10, %7, %4
%29 = phi i1 [ false, %22 ], [ false, %19 ], [ false, %16 ], [ false, %13 ], [ false, %10 ], [ false, %7 ], [ false, %4 ], [ %27, %25 ]
br i1 %29, label %30, label %34
30: ; preds = %28
%31 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str, i64 0, i64 0))
%32 = call i32 (...) @getche()
%33 = call i32 @toupper(i32 %32)
store i32 %33, i32* %1
br label %4
34: ; preds = %28
%35 = load i32, i32* %1
%36 = call i32 @toupper(i32 %35)
%37 = call i32 @Convert_Coordinate(i32 %36)
ret i32 %37
}

LLVM IR (-O2):
@str = [67 x i8] c"\0AYou must enter a letter between A and H for the first coordinate\0A\00"
define i32 @Get_First_Coordinate() {
%1 = tail call i32 (...) @getche()
%2 = tail call i32 @toupper(i32 %1)
%3 = add i32 %2, -73
%4 = icmp ult i32 %3, -8
br i1 %4, label %5, label %11
5: ; preds = %0, %5
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (...) @getche()
%8 = tail call i32 @toupper(i32 %7)
%9 = add i32 %8, -73
%10 = icmp ult i32 %9, -8
br i1 %10, label %5, label %11
11: ; preds = %5, %0
%12 = phi i32 [ %2, %0 ], [ %8, %5 ]
%13 = tail call i32 @toupper(i32 %12)
%14 = tail call i32 @Convert_Coordinate(i32 %13)
ret i32 %14
}