#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*/ deleteln();
int /*<<< orphan*/ move(int, int);
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ scanw(char *, char *, int *);
scalar_t__ strcmp(char *, char *);
char toupper(char);
int get_coords(int *row, int *col, int wx, int wy, char *msg) {
  char *DEFAULT_MSG = "Please enter coordinates.  (e.g. A 1)";
  char r;
  char *r_msg;
  r_msg = (strcmp(msg, "") == 0) ? DEFAULT_MSG : msg;
  move(wy, wx);
  printw("%s", r_msg);
  move(wy + 1, wx + 1);
  do {
    deleteln();
    scanw(" %c %d", &r, col);
    r = toupper(r);
    *row = ((int)r) - 65;
  } while ((*row < 0 || *row > 9) || (*col < 0 || *col > 9));
  return 0;
}


x86 assembly (clang, -O0):
<get_coords>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
lea    0xe7f(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xe95(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11ac <get_coords+0x4c>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40(%rbp)
jmp    11b4 <get_coords+0x54>
mov    -0x20(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1080 <move@plt>
mov    -0x38(%rbp),%rsi
lea    0xe54(%rip),%rdi
call   1050 <printw@plt>
mov    -0x18(%rbp),%edi
add    $0x1,%edi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1080 <move@plt>
mov    $0x0,%al
call   1060 <deleteln@plt>
mov    -0x10(%rbp),%rdx
lea    0xe2f(%rip),%rdi
lea    -0x29(%rbp),%rsi
call   1070 <scanw@plt>
movsbl -0x29(%rbp),%edi
call   1030 <toupper@plt>
mov    %al,-0x29(%rbp)
movsbl -0x29(%rbp),%ecx
sub    $0x41,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x0,(%rcx)
mov    %al,-0x41(%rbp)
jl     1265 <get_coords+0x105>
mov    -0x8(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x9,(%rcx)
mov    %al,-0x41(%rbp)
jg     1265 <get_coords+0x105>
mov    -0x10(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x0,(%rcx)
mov    %al,-0x42(%rbp)
jl     125f <get_coords+0xff>
mov    -0x10(%rbp),%rax
cmpl   $0x9,(%rax)
setg   %al
mov    %al,-0x42(%rbp)
mov    -0x42(%rbp),%al
mov    %al,-0x41(%rbp)
mov    -0x41(%rbp),%al
test   $0x1,%al
jne    11e8 <get_coords+0x88>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_coords>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r12
mov    %ecx,%r13d
mov    %edx,%r15d
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xea4(%rip),%rsi
mov    %r8,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
lea    0xe6d(%rip),%rbp
cmovne %r12,%rbp
mov    %r13d,%edi
mov    %r15d,%esi
call   1080 <move@plt>
lea    0xe7d(%rip),%rdi
mov    %rbp,%rsi
call   1050 <printw@plt>
add    $0x1,%r13d
add    $0x1,%r15d
mov    %r13d,%edi
mov    %r15d,%esi
call   1080 <move@plt>
lea    0xe5e(%rip),%r15
lea    0x7(%rsp),%r12
xor    %eax,%eax
call   1060 <deleteln@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1070 <scanw@plt>
movsbl 0x7(%rsp),%edi
call   1030 <toupper@plt>
mov    %al,0x7(%rsp)
movsbl %al,%eax
lea    -0x41(%rax),%ecx
mov    %ecx,(%r14)
add    $0xb5,%al
cmp    $0xf6,%al
jb     11d0 <get_coords+0x70>
cmpl   $0x9,(%rbx)
ja     11d0 <get_coords+0x70>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Please enter coordinates. (e.g. A 1)\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c" %c %d\00"
define i32 @get_coords(i32* %0, i32* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8
%13 = alloca i8*
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8** %11
%14 = load i8*, i8** %10
%15 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %5
%18 = load i8*, i8** %11
br label %21
19: ; preds = %5
%20 = load i8*, i8** %10
br label %21
21: ; preds = %19, %17
%22 = phi i8* [ %18, %17 ], [ %20, %19 ]
store i8* %22, i8** %13
%23 = load i32, i32* %9
%24 = load i32, i32* %8
%25 = call i32 @move(i32 %23, i32 %24)
%26 = load i8*, i8** %13
%27 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
%32 = call i32 @move(i32 %29, i32 %31)
br label %33
33: ; preds = %61, %21
%34 = call i32 (...) @deleteln()
%35 = load i32*, i32** %7
%36 = call i32 @scanw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %12, i32* %35)
%37 = load i8, i8* %12
%38 = call signext i8 @toupper(i8 signext %37)
store i8 %38, i8* %12
%39 = load i8, i8* %12
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 65
%42 = load i32*, i32** %6
store i32 %41, i32* %42
br label %43
43: ; preds = %33
%44 = load i32*, i32** %6
%45 = load i32, i32* %44
%46 = icmp slt i32 %45, 0
br i1 %46, label %61, label %47
47: ; preds = %43
%48 = load i32*, i32** %6
%49 = load i32, i32* %48
%50 = icmp sgt i32 %49, 9
br i1 %50, label %61, label %51
51: ; preds = %47
%52 = load i32*, i32** %7
%53 = load i32, i32* %52
%54 = icmp slt i32 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %51
%56 = load i32*, i32** %7
%57 = load i32, i32* %56
%58 = icmp sgt i32 %57, 9
br label %59
59: ; preds = %55, %51
%60 = phi i1 [ true, %51 ], [ %58, %55 ]
br label %61
61: ; preds = %59, %47, %43
%62 = phi i1 [ true, %47 ], [ true, %43 ], [ %60, %59 ]
br i1 %62, label %33, label %63
63: ; preds = %61
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"Please enter coordinates. (e.g. A 1)\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [3 x i8] c"%s\00"
@.str.3 = [7 x i8] c" %c %d\00"
define i32 @get_coords(i32* nocapture writeonly %0, i32* %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i8
%7 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %4
%10 = tail call i32 @move(i32 %3, i32 %2)
%11 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%12 = add nsw i32 %3, 1
%13 = add nsw i32 %2, 1
%14 = tail call i32 @move(i32 %12, i32 %13)
br label %15
15: ; preds = %24, %5
%16 = call i32 (...) @deleteln()
%17 = call i32 @scanw(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %6, i32* %1)
%18 = load i8, i8* %6
%19 = call signext i8 @toupper(i8 signext %18)
store i8 %19, i8* %6
%20 = sext i8 %19 to i32
%21 = add nsw i32 %20, -65
store i32 %21, i32* %0
%22 = add i8 %19, -75
%23 = icmp ult i8 %22, -10
br i1 %23, label %24, label %25
24: ; preds = %15, %25
br label %15
25: ; preds = %15
%26 = load i32, i32* %1
%27 = icmp ugt i32 %26, 9
br i1 %27, label %24, label %28
28: ; preds = %25
ret i32 0
}