#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 strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int getMoveFromLine2(char *line, char *move, int boardSize) {
  if (strlen(line) < 6) {
    return -1;
  }
  char *szB = ";B[";
  char *szW = ";W[";
  if (strncmp(line, szB, 3) && strncmp(line, szW, 3)) {
    return -2;
  }
  if (line[5] != ']') {
    return -3;
  }
  if (line[3] < 97 || line[3] > 97 + boardSize - 1) {
    return -4;
  }
  if (line[4] < 97 || line[4] > 97 + boardSize - 1) {
    return -5;
  }
  move[0] = line[3];
  move[1] = line[4];
  move[2] = '\0';
  return 0;
}


x86 assembly (clang, -O0):
<getMoveFromLine2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x6,%eax
jge    1151 <getMoveFromLine2+0x31>
movl   $0xffffffff,-0x4(%rbp)
jmp    125e <getMoveFromLine2+0x13e>
lea    0xea8(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xea1(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11ab <getMoveFromLine2+0x8b>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     11ab <getMoveFromLine2+0x8b>
movl   $0xfffffffe,-0x4(%rbp)
jmp    125e <getMoveFromLine2+0x13e>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x5d,%eax
je     11c8 <getMoveFromLine2+0xa8>
movl   $0xfffffffd,-0x4(%rbp)
jmp    125e <getMoveFromLine2+0x13e>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
cmp    $0x61,%eax
jl     11f2 <getMoveFromLine2+0xd2>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%eax
mov    -0x1c(%rbp),%ecx
add    $0x61,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    11fe <getMoveFromLine2+0xde>
movl   $0xfffffffc,-0x4(%rbp)
jmp    125e <getMoveFromLine2+0x13e>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x61,%eax
jl     1228 <getMoveFromLine2+0x108>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
mov    -0x1c(%rbp),%ecx
add    $0x61,%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1234 <getMoveFromLine2+0x114>
movl   $0xfffffffb,-0x4(%rbp)
jmp    125e <getMoveFromLine2+0x13e>
mov    -0x10(%rbp),%rax
mov    0x3(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x2(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMoveFromLine2>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    $0x6,%ecx
jl     11bc <getMoveFromLine2+0x9c>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1177 <getMoveFromLine2+0x57>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
mov    $0xfffffffe,%eax
test   %rcx,%rcx
jne    11bc <getMoveFromLine2+0x9c>
mov    $0xfffffffd,%eax
cmpb   $0x5d,0x5(%rbx)
jne    11bc <getMoveFromLine2+0x9c>
mov    0x3(%rbx),%cl
mov    $0xfffffffc,%eax
cmp    $0x61,%cl
jl     11bc <getMoveFromLine2+0x9c>
movzbl %cl,%edx
add    $0x60,%ebp
cmp    %edx,%ebp
jl     11bc <getMoveFromLine2+0x9c>
movsbl 0x4(%rbx),%edx
mov    $0xfffffffb,%eax
cmp    $0x61,%edx
jl     11bc <getMoveFromLine2+0x9c>
cmp    %edx,%ebp
jl     11bc <getMoveFromLine2+0x9c>
mov    %cl,(%r14)
mov    0x4(%rbx),%al
mov    %al,0x1(%r14)
movb   $0x0,0x2(%r14)
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c";B[\00"
@.str.1 = [4 x i8] c";W[\00"
define i32 @getMoveFromLine2(i8* %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%10 = load i8*, i8** %5
%11 = call i32 @strlen(i8* %10)
%12 = icmp slt i32 %11, 6
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 -1, i32* %4
br label %77
14: ; preds = %3
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8** %9
%15 = load i8*, i8** %5
%16 = load i8*, i8** %8
%17 = call i64 @strncmp(i8* %15, i8* %16, i32 3)
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %14
%20 = load i8*, i8** %5
%21 = load i8*, i8** %9
%22 = call i64 @strncmp(i8* %20, i8* %21, i32 3)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %19
store i32 -2, i32* %4
br label %77
25: ; preds = %19, %14
%26 = load i8*, i8** %5
%27 = getelementptr inbounds i8, i8* %26, i64 5
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %29, 93
br i1 %30, label %31, label %32
31: ; preds = %25
store i32 -3, i32* %4
br label %77
32: ; preds = %25
%33 = load i8*, i8** %5
%34 = getelementptr inbounds i8, i8* %33, i64 3
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp slt i32 %36, 97
br i1 %37, label %47, label %38
38: ; preds = %32
%39 = load i8*, i8** %5
%40 = getelementptr inbounds i8, i8* %39, i64 3
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = load i32, i32* %7
%44 = add nsw i32 97, %43
%45 = sub nsw i32 %44, 1
%46 = icmp sgt i32 %42, %45
br i1 %46, label %47, label %48
47: ; preds = %38, %32
store i32 -4, i32* %4
br label %77
48: ; preds = %38
%49 = load i8*, i8** %5
%50 = getelementptr inbounds i8, i8* %49, i64 4
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp slt i32 %52, 97
br i1 %53, label %63, label %54
54: ; preds = %48
%55 = load i8*, i8** %5
%56 = getelementptr inbounds i8, i8* %55, i64 4
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = load i32, i32* %7
%60 = add nsw i32 97, %59
%61 = sub nsw i32 %60, 1
%62 = icmp sgt i32 %58, %61
br i1 %62, label %63, label %64
63: ; preds = %54, %48
store i32 -5, i32* %4
br label %77
64: ; preds = %54
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 3
%67 = load i8, i8* %66
%68 = load i8*, i8** %6
%69 = getelementptr inbounds i8, i8* %68, i64 0
store i8 %67, i8* %69
%70 = load i8*, i8** %5
%71 = getelementptr inbounds i8, i8* %70, i64 4
%72 = load i8, i8* %71
%73 = load i8*, i8** %6
%74 = getelementptr inbounds i8, i8* %73, i64 1
store i8 %72, i8* %74
%75 = load i8*, i8** %6
%76 = getelementptr inbounds i8, i8* %75, i64 2
store i8 0, i8* %76
store i32 0, i32* %4
br label %77
77: ; preds = %64, %63, %47, %31, %24, %13
%78 = load i32, i32* %4
ret i32 %78
}

LLVM IR (-O2):
@.str = [4 x i8] c";B[\00"
@.str.1 = [4 x i8] c";W[\00"
define i32 @getMoveFromLine2(i8* %0, i8* nocapture writeonly %1, i32 %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = icmp slt i32 %4, 6
br i1 %5, label %35, label %6
6: ; preds = %3
%7 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 3)
%8 = icmp eq i64 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 3)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %35
12: ; preds = %9, %6
%13 = getelementptr inbounds i8, i8* %0, i64 5
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 93
br i1 %15, label %16, label %35
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %0, i64 3
%18 = load i8, i8* %17
%19 = icmp slt i8 %18, 97
br i1 %19, label %35, label %20
20: ; preds = %16
%21 = zext i8 %18 to i32
%22 = add nsw i32 %2, 96
%23 = icmp slt i32 %22, %21
br i1 %23, label %35, label %24
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %0, i64 4
%26 = load i8, i8* %25
%27 = icmp slt i8 %26, 97
%28 = sext i8 %26 to i32
%29 = icmp slt i32 %22, %28
%30 = select i1 %27, i1 true, i1 %29
br i1 %30, label %35, label %31
31: ; preds = %24
store i8 %18, i8* %1
%32 = load i8, i8* %25
%33 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %32, i8* %33
%34 = getelementptr inbounds i8, i8* %1, i64 2
store i8 0, i8* %34
br label %35
35: ; preds = %31, %9, %12, %20, %16, %24, %3
%36 = phi i32 [ -1, %3 ], [ 0, %31 ], [ -2, %9 ], [ -3, %12 ], [ -4, %20 ], [ -4, %16 ], [ -5, %24 ]
ret i32 %36
}