#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_Second_Coordinate() {
  int coordinate;
  coordinate = toupper(getche());
  while ((coordinate != '1') && (coordinate != '2') && (coordinate != '3') &&
         (coordinate != '4') && (coordinate != '5') && (coordinate != '6') &&
         (coordinate != '7') && (coordinate != '8')) {
    printf("\nYou must enter a number between 1 and 8 for the second "
           "coordinate\n\n");
    coordinate = toupper(getche());
  }
  return Convert_Coordinate(toupper(coordinate));
}


x86 assembly (clang, -O0):
<Get_Second_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   $0x31,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x32,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x33,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x34,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x35,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x36,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
xor    %eax,%eax
cmpl   $0x37,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     11cc <Get_Second_Coordinate+0x8c>
cmpl   $0x38,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    11dc <Get_Second_Coordinate+0x9c>
jmp    11fe <Get_Second_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_Second_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_Second_Coordinate>:
push   %rbx
xor    %eax,%eax
call   1060 <getche@plt>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
add    $0xffffffc7,%ecx
cmp    $0xfffffff7,%ecx
ja     117e <Get_Second_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    -0x39(%rax),%ecx
cmp    $0xfffffff8,%ecx
jb     1160 <Get_Second_Coordinate+0x20>
mov    %eax,%edi
call   1030 <toupper@plt>
mov    %eax,%edi
pop    %rbx
jmp    1050 <Convert_Coordinate@plt>

LLVM IR (-O0):
@.str = [69 x i8] c"\0AYou must enter a number between 1 and 8 for the second coordinate\0A\0A\00"
define i32 @Get_Second_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, 49
br i1 %6, label %7, label %28
7: ; preds = %4
%8 = load i32, i32* %1
%9 = icmp ne i32 %8, 50
br i1 %9, label %10, label %28
10: ; preds = %7
%11 = load i32, i32* %1
%12 = icmp ne i32 %11, 51
br i1 %12, label %13, label %28
13: ; preds = %10
%14 = load i32, i32* %1
%15 = icmp ne i32 %14, 52
br i1 %15, label %16, label %28
16: ; preds = %13
%17 = load i32, i32* %1
%18 = icmp ne i32 %17, 53
br i1 %18, label %19, label %28
19: ; preds = %16
%20 = load i32, i32* %1
%21 = icmp ne i32 %20, 54
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %1
%24 = icmp ne i32 %23, 55
br i1 %24, label %25, label %28
25: ; preds = %22
%26 = load i32, i32* %1
%27 = icmp ne i32 %26, 56
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 ([69 x i8], [69 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 = [68 x i8] c"\0AYou must enter a number between 1 and 8 for the second coordinate\0A\00"
define i32 @Get_Second_Coordinate() {
%1 = tail call i32 (...) @getche()
%2 = tail call i32 @toupper(i32 %1)
%3 = add i32 %2, -57
%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 ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (...) @getche()
%8 = tail call i32 @toupper(i32 %7)
%9 = add i32 %8, -57
%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
}