#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 */
unsigned long long strtol(char *, char **, int);
unsigned long long argtot(char *s) {
  char *p;
  unsigned long long n = strtol(s, &p, 10), f = 1;
  switch (*p) {
  case 'h':
    f = 3600000;
    break;
  case 'm':
    f = 60000;
    break;
  case 's':
    f = 1000;
    break;
  case 'M':
    f = 1;
    break;
  default:
    f = 1000;
  }
  return n * f;
}


x86 assembly (clang, -O0):
<argtot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    %rax,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
add    $0xffffffb3,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x26,%eax
ja     119b <argtot+0x8b>
mov    -0x28(%rbp),%rax
lea    0xea2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movq   $0x36ee80,-0x20(%rbp)
jmp    11a3 <argtot+0x93>
movq   $0xea60,-0x20(%rbp)
jmp    11a3 <argtot+0x93>
movq   $0x3e8,-0x20(%rbp)
jmp    11a3 <argtot+0x93>
movq   $0x1,-0x20(%rbp)
jmp    11a3 <argtot+0x93>
movq   $0x3e8,-0x20(%rbp)
mov    -0x18(%rbp),%rax
imul   -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<argtot>:
push   %rax
mov    %rsp,%rsi
mov    $0xa,%edx
call   1030 <strtol@plt>
mov    (%rsp),%rcx
movsbl (%rcx),%edx
add    $0xffffffb3,%edx
cmp    $0x26,%edx
ja     1142 <argtot+0x32>
mov    $0x36ee80,%ecx
lea    0xec7(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
mov    $0x3e8,%ecx
jmp    1155 <argtot+0x45>
mov    $0x1,%ecx
jmp    1155 <argtot+0x45>
mov    $0xea60,%ecx
imul   %rax,%rcx
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @argtot(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i64 @strtol(i8* %6, i8** %3, i32 10)
store i64 %7, i64* %4
store i64 1, i64* %5
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %15 [
i32 104, label %11
i32 109, label %12
i32 115, label %13
i32 77, label %14
]
11: ; preds = %1
store i64 3600000, i64* %5
br label %16
12: ; preds = %1
store i64 60000, i64* %5
br label %16
13: ; preds = %1
store i64 1000, i64* %5
br label %16
14: ; preds = %1
store i64 1, i64* %5
br label %16
15: ; preds = %1
store i64 1000, i64* %5
br label %16
16: ; preds = %15, %14, %13, %12, %11
%17 = load i64, i64* %4
%18 = load i64, i64* %5
%19 = mul i64 %17, %18
ret i64 %19
}

LLVM IR (-O2):
define i64 @argtot(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 10)
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
switch i32 %7, label %11 [
i32 104, label %12
i32 109, label %8
i32 115, label %9
i32 77, label %10
]
8: ; preds = %1
br label %12
9: ; preds = %1
br label %12
10: ; preds = %1
br label %12
11: ; preds = %1
br label %12
12: ; preds = %1, %11, %10, %9, %8
%13 = phi i64 [ 1000, %11 ], [ 1, %10 ], [ 1000, %9 ], [ 60000, %8 ], [ 3600000, %1 ]
%14 = mul i64 %13, %4
ret i64 %14
}