#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 */
typedef char uint64_t;

/* Variables and functions */
int /*<<< orphan*/ sscanf(char const *, char *, char *, char *, char *, char *);
uint64_t fc_uint64(const char *str) {
  char x1, x2, y1, y2;
  sscanf(str, "%c%c-%c%c", &x1, &y1, &x2, &y2);
  x1 -= 'a';
  x2 -= 'a';
  y1 -= '1';
  y2 -= '1';
  return (((uint64_t)1) << ((y1 * 8) + x1)) |
         (((uint64_t)1) << ((y2 * 8) + x2));
}


x86 assembly (clang, -O0):
<fc_uint64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x9(%rbp),%rdx
lea    -0xb(%rbp),%rcx
lea    -0xa(%rbp),%r8
lea    -0xc(%rbp),%r9
call   1030 <sscanf@plt>
movsbl -0x9(%rbp),%eax
sub    $0x61,%eax
mov    %al,-0x9(%rbp)
movsbl -0xa(%rbp),%eax
sub    $0x61,%eax
mov    %al,-0xa(%rbp)
movsbl -0xb(%rbp),%eax
sub    $0x31,%eax
mov    %al,-0xb(%rbp)
movsbl -0xc(%rbp),%eax
sub    $0x31,%eax
mov    %al,-0xc(%rbp)
movsbl -0xb(%rbp),%ecx
shl    $0x3,%ecx
movsbl -0x9(%rbp),%eax
add    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movsbl -0xc(%rbp),%ecx
shl    $0x3,%ecx
movsbl -0xa(%rbp),%edx
add    %edx,%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fc_uint64>:
push   %rax
lea    0xee8(%rip),%rsi
lea    0x7(%rsp),%rdx
lea    0x5(%rsp),%rcx
lea    0x6(%rsp),%r8
lea    0x4(%rsp),%r9
call   1030 <sscanf@plt>
mov    0x7(%rsp),%al
add    $0x9f,%al
mov    0x6(%rsp),%sil
add    $0x9f,%sil
mov    0x5(%rsp),%dl
add    $0xcf,%dl
mov    0x4(%rsp),%cl
add    $0xcf,%cl
movzbl %dl,%edx
movzbl %al,%eax
lea    (%rax,%rdx,8),%edx
movzbl %cl,%eax
movzbl %sil,%ecx
lea    (%rcx,%rax,8),%ecx
mov    $0x1,%eax
shl    %cl,%eax
bts    %edx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%c%c-%c%c\00"
define signext i8 @fc_uint64(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8* %0, i8** %2
%7 = load i8*, i8** %2
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %3, i8* %5, i8* %4, i8* %6)
%9 = load i8, i8* %3
%10 = sext i8 %9 to i32
%11 = sub nsw i32 %10, 97
%12 = trunc i32 %11 to i8
store i8 %12, i8* %3
%13 = load i8, i8* %4
%14 = sext i8 %13 to i32
%15 = sub nsw i32 %14, 97
%16 = trunc i32 %15 to i8
store i8 %16, i8* %4
%17 = load i8, i8* %5
%18 = sext i8 %17 to i32
%19 = sub nsw i32 %18, 49
%20 = trunc i32 %19 to i8
store i8 %20, i8* %5
%21 = load i8, i8* %6
%22 = sext i8 %21 to i32
%23 = sub nsw i32 %22, 49
%24 = trunc i32 %23 to i8
store i8 %24, i8* %6
%25 = load i8, i8* %5
%26 = sext i8 %25 to i32
%27 = mul nsw i32 %26, 8
%28 = load i8, i8* %3
%29 = sext i8 %28 to i32
%30 = add nsw i32 %27, %29
%31 = shl i32 1, %30
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = mul nsw i32 %33, 8
%35 = load i8, i8* %4
%36 = sext i8 %35 to i32
%37 = add nsw i32 %34, %36
%38 = shl i32 1, %37
%39 = or i32 %31, %38
%40 = trunc i32 %39 to i8
ret i8 %40
}

LLVM IR (-O2):
@.str = [10 x i8] c"%c%c-%c%c\00"
define signext i8 @fc_uint64(i8* nocapture %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %4, i8* %3, i8* %5)
%7 = load i8, i8* %2
%8 = add i8 %7, -97
%9 = load i8, i8* %3
%10 = add i8 %9, -97
%11 = load i8, i8* %4
%12 = add i8 %11, -49
%13 = load i8, i8* %5
%14 = add i8 %13, -49
%15 = sext i8 %12 to i32
%16 = shl nsw i32 %15, 3
%17 = sext i8 %8 to i32
%18 = add nsw i32 %16, %17
%19 = shl nuw i32 1, %18
%20 = sext i8 %14 to i32
%21 = shl nsw i32 %20, 3
%22 = sext i8 %10 to i32
%23 = add nsw i32 %21, %22
%24 = shl nuw i32 1, %23
%25 = or i32 %24, %19
%26 = trunc i32 %25 to i8
ret i8 %26
}