#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 calendar_index(char ind) {
  switch (ind) {
  case 'Y':
    return 5;
  case 'M':
    return 4;
  case 'D':
    return 3;
  case 'h':
    return 2;
  case 'm':
    return 1;
  case 's':
    return 0;
  default:
    assert(0);
    return 6;
  }
}


x86 assembly (clang, -O0):
<calendar_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbc,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x2f,%eax
ja     1190 <calendar_index+0x80>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x5,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
movl   $0x4,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
movl   $0x3,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
movl   $0x2,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
movl   $0x1,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
movl   $0x0,-0x4(%rbp)
jmp    119e <calendar_index+0x8e>
xor    %edi,%edi
call   1030 <assert@plt>
movl   $0x6,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calendar_index>:
push   %rax
add    $0xffffffbc,%edi
cmp    $0x2f,%edi
ja     1135 <calendar_index+0x25>
mov    $0x5,%eax
lea    0xedb(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x3,%eax
pop    %rcx
ret
xor    %edi,%edi
call   1030 <assert@plt>
mov    $0x6,%eax
pop    %rcx
ret
mov    $0x4,%eax
pop    %rcx
ret
mov    $0x2,%eax
pop    %rcx
ret
mov    $0x1,%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @calendar_index(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
switch i32 %5, label %12 [
i32 89, label %6
i32 77, label %7
i32 68, label %8
i32 104, label %9
i32 109, label %10
i32 115, label %11
]
6: ; preds = %1
store i32 5, i32* %2
br label %14
7: ; preds = %1
store i32 4, i32* %2
br label %14
8: ; preds = %1
store i32 3, i32* %2
br label %14
9: ; preds = %1
store i32 2, i32* %2
br label %14
10: ; preds = %1
store i32 1, i32* %2
br label %14
11: ; preds = %1
store i32 0, i32* %2
br label %14
12: ; preds = %1
%13 = call i32 @assert(i32 0)
store i32 6, i32* %2
br label %14
14: ; preds = %12, %11, %10, %9, %8, %7, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @calendar_index(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 89, label %10
i32 77, label %3
i32 68, label %4
i32 104, label %5
i32 109, label %6
i32 115, label %7
]
3: ; preds = %1
br label %10
4: ; preds = %1
br label %10
5: ; preds = %1
br label %10
6: ; preds = %1
br label %10
7: ; preds = %1
br label %10
8: ; preds = %1
%9 = tail call i32 @assert(i32 0)
br label %10
10: ; preds = %1, %8, %7, %6, %5, %4, %3
%11 = phi i32 [ 6, %8 ], [ 0, %7 ], [ 1, %6 ], [ 2, %5 ], [ 3, %4 ], [ 4, %3 ], [ 5, %1 ]
ret i32 %11
}