#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*/ assert(int);
int trieindex(int d1, int d2) {
  int i;
  i = 27 * (d1 == '.' ? 0 : d1 - 'a' + 1) + (d2 == '.' ? 0 : d2 - 'a' + 1);
  assert(0 <= i && i < 27 * 27);
  return i;
}


x86 assembly (clang, -O0):
<trieindex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x2e,-0x4(%rbp)
jne    1132 <trieindex+0x22>
xor    %eax,%eax
mov    %eax,-0x10(%rbp)
jmp    113e <trieindex+0x2e>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   $0x1b,%eax,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x2e,-0x8(%rbp)
jne    115b <trieindex+0x4b>
xor    %eax,%eax
mov    %eax,-0x18(%rbp)
jmp    1167 <trieindex+0x57>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0xc(%rbp),%ecx
mov    %al,-0x19(%rbp)
jg     118f <trieindex+0x7f>
cmpl   $0x2d9,-0xc(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trieindex>:
push   %rbx
xor    %eax,%eax
cmp    $0x2e,%edi
lea    (%rdi,%rdi,8),%ecx
lea    -0xa20(%rcx,%rcx,2),%ecx
cmove  %eax,%ecx
lea    -0x60(%rsi),%ebx
cmp    $0x2e,%esi
cmove  %eax,%ebx
add    %ecx,%ebx
xor    %edi,%edi
cmp    $0x2d9,%ebx
setb   %dil
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @trieindex(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp eq i32 %6, 46
br i1 %7, label %8, label %9
8: ; preds = %2
br label %13
9: ; preds = %2
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 97
%12 = add nsw i32 %11, 1
br label %13
13: ; preds = %9, %8
%14 = phi i32 [ 0, %8 ], [ %12, %9 ]
%15 = mul nsw i32 27, %14
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 46
br i1 %17, label %18, label %19
18: ; preds = %13
br label %23
19: ; preds = %13
%20 = load i32, i32* %4
%21 = sub nsw i32 %20, 97
%22 = add nsw i32 %21, 1
br label %23
23: ; preds = %19, %18
%24 = phi i32 [ 0, %18 ], [ %22, %19 ]
%25 = add nsw i32 %15, %24
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = icmp sle i32 0, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* %5
%30 = icmp slt i32 %29, 729
br label %31
31: ; preds = %28, %23
%32 = phi i1 [ false, %23 ], [ %30, %28 ]
%33 = zext i1 %32 to i32
%34 = call i32 @assert(i32 %33)
%35 = load i32, i32* %5
ret i32 %35
}

LLVM IR (-O2):
define i32 @trieindex(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 46
%4 = mul i32 %0, 27
%5 = add i32 %4, -2592
%6 = select i1 %3, i32 0, i32 %5
%7 = icmp eq i32 %1, 46
%8 = add nsw i32 %1, -96
%9 = select i1 %7, i32 0, i32 %8
%10 = add nsw i32 %6, %9
%11 = icmp ult i32 %10, 729
%12 = zext i1 %11 to i32
%13 = tail call i32 @assert(i32 %12)
ret i32 %10
}