#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char k[3];
  scanf("%s", k);
  printf("%d", (3 - (k[0] == 'a' || k[0] == 'h')) *
                       (3 - (k[1] == '1' || k[1] == '8')) -
                   1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x7(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
movsbl -0x7(%rbp),%ecx
mov    $0x1,%al
cmp    $0x61,%ecx
mov    %al,-0x8(%rbp)
je     115e <main+0x3e>
movsbl -0x7(%rbp),%eax
cmp    $0x68,%eax
sete   %al
mov    %al,-0x8(%rbp)
mov    -0x8(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
mov    $0x3,%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x6(%rbp),%ecx
mov    $0x1,%al
cmp    $0x31,%ecx
mov    %al,-0x9(%rbp)
je     118f <main+0x6f>
movsbl -0x6(%rbp),%eax
cmp    $0x38,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
mov    $0x3,%eax
sub    %ecx,%eax
imul   %eax,%esi
sub    $0x1,%esi
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x5(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x5(%rsp),%al
mov    0x6(%rsp),%cl
cmp    $0x61,%al
sete   %dl
cmp    $0x68,%al
sete   %al
or     %dl,%al
movzbl %al,%eax
xor    $0x3,%eax
cmp    $0x31,%cl
sete   %dl
cmp    $0x38,%cl
sete   %cl
or     %dl,%cl
movzbl %cl,%esi
xor    $0x3,%esi
imul   %eax,%esi
add    $0xffffffff,%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp eq i32 %7, 97
br i1 %8, label %14, label %9
9: ; preds = %0
%10 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 104
br label %14
14: ; preds = %9, %0
%15 = phi i1 [ true, %0 ], [ %13, %9 ]
%16 = zext i1 %15 to i32
%17 = sub nsw i32 3, %16
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 49
br i1 %21, label %27, label %22
22: ; preds = %14
%23 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 1
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 56
br label %27
27: ; preds = %22, %14
%28 = phi i1 [ true, %14 ], [ %26, %22 ]
%29 = zext i1 %28 to i32
%30 = sub nsw i32 3, %29
%31 = mul nsw i32 %17, %30
%32 = sub nsw i32 %31, 1
%33 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %1
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 97
%6 = icmp eq i8 %4, 104
%7 = or i1 %5, %6
%8 = select i1 %7, i32 2, i32 3
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 1
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 49
%12 = icmp eq i8 %10, 56
%13 = or i1 %11, %12
%14 = select i1 %13, i32 2, i32 3
%15 = mul nuw nsw i32 %14, %8
%16 = add nsw i32 %15, -1
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}