#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 */
char tolower(char);
double ucl_lex_time_multiplier(const unsigned char c) {
  const struct {
    char c;
    double mult;
  } multipliers[] = {{'m', 60},
                     {'h', 60 * 60},
                     {'d', 60 * 60 * 24},
                     {'w', 60 * 60 * 24 * 7},
                     {'y', 60 * 60 * 24 * 7 * 365}};
  int i;
  for (i = 0; i < 5; i++) {
    if (tolower(c) == multipliers[i].c) {
      return multipliers[i].mult;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<ucl_lex_time_multiplier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %dil,%al
mov    %al,-0x9(%rbp)
lea    -0x60(%rbp),%rdi
lea    0xed7(%rip),%rsi
mov    $0x50,%edx
call   1030 <memcpy@plt>
movl   $0x0,-0x64(%rbp)
cmpl   $0x5,-0x64(%rbp)
jge    11ab <ucl_lex_time_multiplier+0x8b>
movsbl -0x9(%rbp),%edi
call   1040 <tolower@plt>
movsbl %al,%eax
movslq -0x64(%rbp),%rdx
lea    -0x60(%rbp),%rcx
shl    $0x4,%rdx
add    %rdx,%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1198 <ucl_lex_time_multiplier+0x78>
movslq -0x64(%rbp),%rcx
lea    -0x60(%rbp),%rax
shl    $0x4,%rcx
add    %rcx,%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11b8 <ucl_lex_time_multiplier+0x98>
jmp    119d <ucl_lex_time_multiplier+0x7d>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    114a <ucl_lex_time_multiplier+0x2a>
movsd  0xe4d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ucl_lex_time_multiplier>:
push   %rbx
movsbl %dil,%ebx
mov    %ebx,%edi
call   1030 <tolower@plt>
cmp    $0x6d,%al
jne    1124 <ucl_lex_time_multiplier+0x14>
xor    %ecx,%ecx
jmp    1164 <ucl_lex_time_multiplier+0x54>
mov    %ebx,%edi
call   1030 <tolower@plt>
mov    $0x1,%ecx
cmp    $0x68,%al
je     1164 <ucl_lex_time_multiplier+0x54>
mov    %ebx,%edi
call   1030 <tolower@plt>
mov    $0x2,%ecx
cmp    $0x64,%al
je     1164 <ucl_lex_time_multiplier+0x54>
mov    %ebx,%edi
call   1030 <tolower@plt>
mov    $0x3,%ecx
cmp    $0x77,%al
je     1164 <ucl_lex_time_multiplier+0x54>
mov    %ebx,%edi
call   1030 <tolower@plt>
mov    $0x4,%ecx
cmp    $0x79,%al
jne    1177 <ucl_lex_time_multiplier+0x67>
shl    $0x4,%rcx
lea    0xea1(%rip),%rax
movsd  0x8(%rcx,%rax,1),%xmm0
pop    %rbx
ret
movsd  0xe81(%rip),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
%struct.anon = type { i8, double }
@__const.ucl_lex_time_multiplier.multipliers = [5 x %struct.anon] [%struct.anon { i8 109, double 6.000000e+01 }, %struct.anon { i8 104, double 3.600000e+03 }, %struct.anon { i8 100, double 8.640000e+04 }, %struct.anon { i8 119, double 6.048000e+05 }, %struct.anon { i8 121, double 2.207520e+08 }]
define double @ucl_lex_time_multiplier(i8 zeroext %0) {
%2 = alloca double
%3 = alloca i8
%4 = alloca [5 x %struct.anon]
%5 = alloca i32
store i8 %0, i8* %3
%6 = bitcast [5 x %struct.anon]* %4 to i8*
store i32 0, i32* %5
br label %7
7: ; preds = %28, %1
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %31
10: ; preds = %7
%11 = load i8, i8* %3
%12 = call signext i8 @tolower(i8 signext %11)
%13 = sext i8 %12 to i32
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* %4, i64 0, i64 %15
%17 = getelementptr inbounds %struct.anon, %struct.anon* %16, i32 0, i32 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %13, %19
br i1 %20, label %21, label %27
21: ; preds = %10
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* %4, i64 0, i64 %23
%25 = getelementptr inbounds %struct.anon, %struct.anon* %24, i32 0, i32 1
%26 = load double, double* %25
store double %26, double* %2
br label %32
27: ; preds = %10
br label %28
28: ; preds = %27
%29 = load i32, i32* %5
%30 = add nsw i32 %29, 1
store i32 %30, i32* %5
br label %7
31: ; preds = %7
store double 1.000000e+00, double* %2
br label %32
32: ; preds = %31, %21
%33 = load double, double* %2
ret double %33
}

LLVM IR (-O2):
%struct.anon = type { i8, double }
@__const.ucl_lex_time_multiplier.multipliers = [5 x %struct.anon] [%struct.anon { i8 109, double 6.000000e+01 }, %struct.anon { i8 104, double 3.600000e+03 }, %struct.anon { i8 100, double 8.640000e+04 }, %struct.anon { i8 119, double 6.048000e+05 }, %struct.anon { i8 121, double 2.207520e+08 }]
define double @ucl_lex_time_multiplier(i8 zeroext %0) {
%2 = tail call signext i8 @tolower(i8 signext %0)
%3 = icmp eq i8 %2, 109
br i1 %3, label %4, label %8
4: ; preds = %17, %14, %11, %8, %1
%5 = phi i64 [ 0, %1 ], [ 1, %8 ], [ 2, %11 ], [ 3, %14 ], [ 4, %17 ]
%6 = getelementptr inbounds [5 x %struct.anon], [5 x %struct.anon]* @__const.ucl_lex_time_multiplier.multipliers, i64 0, i64 %5, i32 1
%7 = load double, double* %6
br label %20
8: ; preds = %1
%9 = tail call signext i8 @tolower(i8 signext %0)
%10 = icmp eq i8 %9, 104
br i1 %10, label %4, label %11
11: ; preds = %8
%12 = tail call signext i8 @tolower(i8 signext %0)
%13 = icmp eq i8 %12, 100
br i1 %13, label %4, label %14
14: ; preds = %11
%15 = tail call signext i8 @tolower(i8 signext %0)
%16 = icmp eq i8 %15, 119
br i1 %16, label %4, label %17
17: ; preds = %14
%18 = tail call signext i8 @tolower(i8 signext %0)
%19 = icmp eq i8 %18, 121
br i1 %19, label %4, label %20
20: ; preds = %17, %4
%21 = phi double [ %7, %4 ], [ 1.000000e+00, %17 ]
ret double %21
}