#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 /*<<< orphan*/);
int ch2ind(char c) {
  if (c <= '9')
    return (int)c + 52 - '0';
  if (c <= 'Z')
    return (int)c + 26 - 'A';
  if (c <= 'z')
    return (int)c - 'a';
  assert(0);
}


x86 assembly (clang, -O0):
<ch2ind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     113d <ch2ind+0x2d>
movsbl -0x5(%rbp),%eax
add    $0x34,%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    117f <ch2ind+0x6f>
movsbl -0x5(%rbp),%eax
cmp    $0x5a,%eax
jg     115c <ch2ind+0x4c>
movsbl -0x5(%rbp),%eax
add    $0x1a,%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    117f <ch2ind+0x6f>
movsbl -0x5(%rbp),%eax
cmp    $0x7a,%eax
jg     1178 <ch2ind+0x68>
movsbl -0x5(%rbp),%eax
sub    $0x61,%eax
mov    %eax,-0x4(%rbp)
jmp    117f <ch2ind+0x6f>
xor    %edi,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ch2ind>:
mov    %edi,%eax
cmp    $0x39,%al
jg     111a <ch2ind+0xa>
add    $0x4,%eax
ret
cmp    $0x5a,%al
ja     1122 <ch2ind+0x12>
add    $0xffffffd9,%eax
ret
cmp    $0x7a,%al
ja     112a <ch2ind+0x1a>
add    $0xffffff9f,%eax
ret
push   %rax
xor    %edi,%edi
call   1030 <assert@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @ch2ind(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sle i32 %5, 57
br i1 %6, label %7, label %12
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, 52
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %31
12: ; preds = %1
%13 = load i8, i8* %3
%14 = sext i8 %13 to i32
%15 = icmp sle i32 %14, 90
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = load i8, i8* %3
%18 = sext i8 %17 to i32
%19 = add nsw i32 %18, 26
%20 = sub nsw i32 %19, 65
store i32 %20, i32* %2
br label %31
21: ; preds = %12
%22 = load i8, i8* %3
%23 = sext i8 %22 to i32
%24 = icmp sle i32 %23, 122
br i1 %24, label %25, label %29
25: ; preds = %21
%26 = load i8, i8* %3
%27 = sext i8 %26 to i32
%28 = sub nsw i32 %27, 97
store i32 %28, i32* %2
br label %31
29: ; preds = %21
%30 = call i32 @assert(i32 0)
br label %31
31: ; preds = %29, %25, %16, %7
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @ch2ind(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = icmp slt i8 %0, 58
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nsw i32 %2, 4
br label %16
6: ; preds = %1
%7 = icmp ult i8 %0, 91
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = add nsw i32 %2, -39
br label %16
10: ; preds = %6
%11 = icmp ult i8 %0, 123
br i1 %11, label %12, label %14
12: ; preds = %10
%13 = add nsw i32 %2, -97
br label %16
14: ; preds = %10
%15 = tail call i32 @assert(i32 0)
br label %16
16: ; preds = %14, %12, %8, %4
%17 = phi i32 [ %5, %4 ], [ %9, %8 ], [ %13, %12 ], [ undef, %14 ]
ret i32 %17
}