#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 charToInt(char);
int myPow(int, int);
unsigned int secondHashFunction(char board[7][6]) {
  unsigned int index = 0;
  for (int y = 0; y < 6; y++) {
    for (int x = 0; x < 7; x++) {
      index += (2 - charToInt(board[x][y])) * myPow(3, ((x + y * 7) % 18));
    }
  }
  index = index % 20000000;
  return index;
}


x86 assembly (clang, -O0):
<secondHashFunction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x6,-0x10(%rbp)
jge    11c9 <secondHashFunction+0xa9>
movl   $0x0,-0x14(%rbp)
cmpl   $0x7,-0x14(%rbp)
jge    11b6 <secondHashFunction+0x96>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
imul   $0x6,%rcx,%rcx
add    %rcx,%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <charToInt@plt>
mov    %eax,%ecx
mov    $0x2,%eax
sub    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   $0x7,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    $0x12,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
imul   %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114b <secondHashFunction+0x2b>
jmp    11bb <secondHashFunction+0x9b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    113a <secondHashFunction+0x1a>
mov    -0xc(%rbp),%eax
mov    $0x1312d00,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<secondHashFunction>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    %rdi,%r14
mov    $0x6,%eax
mov    $0xffffffffffffffd6,%r13
mov    $0x5,%r8d
mov    $0x4,%r9d
mov    $0x3,%esi
mov    $0x2,%edi
mov    $0x1,%ecx
xor    %edx,%edx
xor    %r15d,%r15d
nopl   (%rax)
mov    %edx,0x8(%rsp)
mov    %ecx,0xc(%rsp)
mov    %edi,0x10(%rsp)
mov    %esi,0x14(%rsp)
mov    %r9d,0x18(%rsp)
mov    %r8d,0x1c(%rsp)
mov    %eax,0x4(%rsp)
mov    0x4(%rsp),%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %rax,0x40(%rsp)
mov    %r8d,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %rax,0x38(%rsp)
mov    %r9d,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %rax,0x30(%rsp)
mov    %esi,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %rax,0x28(%rsp)
mov    %edi,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%eax
mov    %rax,0x20(%rsp)
mov    %ecx,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%ebp
mov    %edx,%eax
imul   $0x38e38e39,%rax,%rax
shr    $0x22,%rax
add    %eax,%eax
lea    (%rax,%rax,8),%ebx
movsbl (%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r12d
sub    %eax,%r12d
neg    %ebx
lea    (%rbx,%r13,1),%esi
add    $0x2a,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebx
imul   %r12d,%ebx
add    %r15d,%ebx
movsbl 0x6(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r15d
sub    %eax,%r15d
neg    %ebp
lea    0x2b(%r13,%rbp,1),%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebp
imul   %r15d,%ebp
add    %ebx,%ebp
movsbl 0xc(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r15d
sub    %eax,%r15d
mov    0x20(%rsp),%rax
neg    %eax
lea    (%rax,%r13,1),%esi
add    $0x2c,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebx
imul   %r15d,%ebx
add    %ebp,%ebx
movsbl 0x12(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r15d
sub    %eax,%r15d
mov    0x28(%rsp),%rax
neg    %eax
lea    (%rax,%r13,1),%esi
add    $0x2d,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebp
imul   %r15d,%ebp
add    %ebx,%ebp
movsbl 0x18(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r15d
sub    %eax,%r15d
mov    0x30(%rsp),%rax
neg    %eax
lea    (%rax,%r13,1),%esi
add    $0x2e,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebx
imul   %r15d,%ebx
add    %ebp,%ebx
movsbl 0x1e(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%r15d
sub    %eax,%r15d
mov    0x38(%rsp),%rax
neg    %eax
lea    (%rax,%r13,1),%esi
add    $0x2f,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    %eax,%ebp
imul   %r15d,%ebp
add    %ebx,%ebp
movsbl 0x24(%r14),%edi
call   1030 <charToInt@plt>
mov    $0x2,%ebx
sub    %eax,%ebx
mov    0x40(%rsp),%rax
neg    %eax
lea    (%rax,%r13,1),%esi
add    $0x30,%esi
mov    $0x3,%edi
call   1040 <myPow@plt>
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
mov    0x18(%rsp),%r9d
mov    0x1c(%rsp),%r8d
mov    %eax,%r15d
mov    0x4(%rsp),%eax
imul   %ebx,%r15d
add    %ebp,%r15d
add    $0x7,%eax
add    $0x7,%r8d
add    $0x7,%r9d
add    $0x7,%esi
add    $0x7,%edi
add    $0x7,%ecx
add    $0x7,%edx
add    $0x1,%r14
add    $0x7,%r13
jne    1160 <secondHashFunction+0x40>
mov    %r15d,%eax
imul   $0x6b5fca6b,%rax,%rax
shr    $0x37,%rax
imul   $0x1312d00,%eax,%eax
sub    %eax,%r15d
mov    %r15d,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @secondHashFunction([6 x i8]* %0) {
%2 = alloca [6 x i8]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store [6 x i8]* %0, [6 x i8]** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %37, %1
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 6
br i1 %8, label %9, label %40
9: ; preds = %6
store i32 0, i32* %5
br label %10
10: ; preds = %33, %9
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 7
br i1 %12, label %13, label %36
13: ; preds = %10
%14 = load [6 x i8]*, [6 x i8]** %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [6 x i8], [6 x i8]* %14, i64 %16
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [6 x i8], [6 x i8]* %17, i64 0, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @charToInt(i8 signext %21)
%23 = sub nsw i32 2, %22
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 7
%27 = add nsw i32 %24, %26
%28 = srem i32 %27, 18
%29 = call i32 @myPow(i32 3, i32 %28)
%30 = mul nsw i32 %23, %29
%31 = load i32, i32* %3
%32 = add i32 %31, %30
store i32 %32, i32* %3
br label %33
33: ; preds = %13
%34 = load i32, i32* %5
%35 = add nsw i32 %34, 1
store i32 %35, i32* %5
br label %10
36: ; preds = %10
br label %37
37: ; preds = %36
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %6
40: ; preds = %6
%41 = load i32, i32* %3
%42 = urem i32 %41, 20000000
store i32 %42, i32* %3
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
define i32 @secondHashFunction([6 x i8]* nocapture %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i64 [ 0, %1 ], [ %75, %2 ]
%4 = phi i32 [ 0, %1 ], [ %74, %2 ]
%5 = mul nuw nsw i64 %3, 7
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 0, i64 %3
%7 = load i8, i8* %6
%8 = tail call i32 @charToInt(i8 signext %7)
%9 = sub nsw i32 2, %8
%10 = trunc i64 %5 to i32
%11 = urem i32 %10, 18
%12 = tail call i32 @myPow(i32 3, i32 %11)
%13 = mul nsw i32 %9, %12
%14 = add i32 %13, %4
%15 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 1, i64 %3
%16 = load i8, i8* %15
%17 = tail call i32 @charToInt(i8 signext %16)
%18 = sub nsw i32 2, %17
%19 = trunc i64 %5 to i32
%20 = add i32 %19, 1
%21 = urem i32 %20, 18
%22 = tail call i32 @myPow(i32 3, i32 %21)
%23 = mul nsw i32 %18, %22
%24 = add i32 %23, %14
%25 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 2, i64 %3
%26 = load i8, i8* %25
%27 = tail call i32 @charToInt(i8 signext %26)
%28 = sub nsw i32 2, %27
%29 = trunc i64 %5 to i32
%30 = add i32 %29, 2
%31 = urem i32 %30, 18
%32 = tail call i32 @myPow(i32 3, i32 %31)
%33 = mul nsw i32 %28, %32
%34 = add i32 %33, %24
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 3, i64 %3
%36 = load i8, i8* %35
%37 = tail call i32 @charToInt(i8 signext %36)
%38 = sub nsw i32 2, %37
%39 = trunc i64 %5 to i32
%40 = add i32 %39, 3
%41 = urem i32 %40, 18
%42 = tail call i32 @myPow(i32 3, i32 %41)
%43 = mul nsw i32 %38, %42
%44 = add i32 %43, %34
%45 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 4, i64 %3
%46 = load i8, i8* %45
%47 = tail call i32 @charToInt(i8 signext %46)
%48 = sub nsw i32 2, %47
%49 = trunc i64 %5 to i32
%50 = add i32 %49, 4
%51 = urem i32 %50, 18
%52 = tail call i32 @myPow(i32 3, i32 %51)
%53 = mul nsw i32 %48, %52
%54 = add i32 %53, %44
%55 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 5, i64 %3
%56 = load i8, i8* %55
%57 = tail call i32 @charToInt(i8 signext %56)
%58 = sub nsw i32 2, %57
%59 = trunc i64 %5 to i32
%60 = add i32 %59, 5
%61 = urem i32 %60, 18
%62 = tail call i32 @myPow(i32 3, i32 %61)
%63 = mul nsw i32 %58, %62
%64 = add i32 %63, %54
%65 = getelementptr inbounds [6 x i8], [6 x i8]* %0, i64 6, i64 %3
%66 = load i8, i8* %65
%67 = tail call i32 @charToInt(i8 signext %66)
%68 = sub nsw i32 2, %67
%69 = trunc i64 %5 to i32
%70 = add i32 %69, 6
%71 = urem i32 %70, 18
%72 = tail call i32 @myPow(i32 3, i32 %71)
%73 = mul nsw i32 %68, %72
%74 = add i32 %73, %64
%75 = add nuw nsw i64 %3, 1
%76 = icmp eq i64 %75, 6
br i1 %76, label %77, label %2
77: ; preds = %2
%78 = urem i32 %74, 20000000
ret i32 %78
}