#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(char const *);
int time_affix(const char *str) {
  const char *i;
  int multiplier = 1;
  assert(str);
  for (i = str;; ++i) {
    char c = *i;
    if (!c)
      break;
    switch (c) {
    case 'm':
    case 'M':
      multiplier *= 60;
      break;
    case 'h':
    case 'H':
      multiplier *= 3600;
      break;
    case 'd':
    case 'D':
      multiplier *= 86400;
      break;
    }
  }
  return multiplier;
}


x86 assembly (clang, -O0):
<time_affix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x15(%rbp)
cmpb   $0x0,-0x15(%rbp)
jne    114c <time_affix+0x3c>
jmp    11f1 <time_affix+0xe1>
movsbl -0x15(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x44,%eax
je     11d1 <time_affix+0xc1>
jmp    1161 <time_affix+0x51>
mov    -0x1c(%rbp),%eax
sub    $0x48,%eax
je     11c2 <time_affix+0xb2>
jmp    1172 <time_affix+0x62>
mov    -0x1c(%rbp),%eax
sub    $0x4d,%eax
je     11b6 <time_affix+0xa6>
jmp    1183 <time_affix+0x73>
mov    -0x1c(%rbp),%eax
sub    $0x64,%eax
je     11d1 <time_affix+0xc1>
jmp    1194 <time_affix+0x84>
mov    -0x1c(%rbp),%eax
sub    $0x68,%eax
je     11c2 <time_affix+0xb2>
jmp    11a5 <time_affix+0x95>
mov    -0x1c(%rbp),%eax
sub    $0x6d,%eax
jne    11db <time_affix+0xcb>
jmp    11b6 <time_affix+0xa6>
imul   $0x3c,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11db <time_affix+0xcb>
imul   $0xe10,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11db <time_affix+0xcb>
imul   $0x15180,-0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    11e0 <time_affix+0xd0>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1134 <time_affix+0x24>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_affix>:
push   %rbx
mov    %rdi,%rbx
call   1030 <assert@plt>
mov    (%rbx),%dl
test   %dl,%dl
je     119a <time_affix+0x8a>
add    $0x1,%rbx
mov    $0x1,%eax
movabs $0x100000001,%rcx
movabs $0x1000000010,%rdi
movabs $0x20000000200,%rsi
jmp    1161 <time_affix+0x51>
nopl   0x0(%rax,%rax,1)
imul   $0x15180,%eax,%eax
movzbl (%rbx),%edx
add    $0x1,%rbx
test   %dl,%dl
je     1198 <time_affix+0x88>
movsbl %dl,%edx
add    $0xffffffbc,%edx
cmp    $0x29,%edx
ja     1156 <time_affix+0x46>
bt     %rdx,%rcx
jb     1150 <time_affix+0x40>
bt     %rdx,%rdi
jb     1190 <time_affix+0x80>
bt     %rdx,%rsi
jae    1156 <time_affix+0x46>
imul   $0x3c,%eax,%eax
jmp    1156 <time_affix+0x46>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
imul   $0xe10,%eax,%eax
jmp    1156 <time_affix+0x46>
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @time_affix(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %2
store i32 1, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %2
store i8* %8, i8** %3
br label %9
9: ; preds = %28, %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
store i8 %11, i8* %5
%12 = load i8, i8* %5
%13 = icmp ne i8 %12, 0
br i1 %13, label %15, label %14
14: ; preds = %9
br label %31
15: ; preds = %9
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
switch i32 %17, label %27 [
i32 109, label %18
i32 77, label %18
i32 104, label %21
i32 72, label %21
i32 100, label %24
i32 68, label %24
]
18: ; preds = %15, %15
%19 = load i32, i32* %4
%20 = mul nsw i32 %19, 60
store i32 %20, i32* %4
br label %27
21: ; preds = %15, %15
%22 = load i32, i32* %4
%23 = mul nsw i32 %22, 3600
store i32 %23, i32* %4
br label %27
24: ; preds = %15, %15
%25 = load i32, i32* %4
%26 = mul nsw i32 %25, 86400
store i32 %26, i32* %4
br label %27
27: ; preds = %15, %24, %21, %18
br label %28
28: ; preds = %27
%29 = load i8*, i8** %3
%30 = getelementptr inbounds i8, i8* %29, i32 1
store i8* %30, i8** %3
br label %9
31: ; preds = %14
%32 = load i32, i32* %4
ret i32 %32
}

LLVM IR (-O2):
define i32 @time_affix(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %21, label %5
5: ; preds = %1, %16
%6 = phi i8 [ %19, %16 ], [ %3, %1 ]
%7 = phi i8* [ %18, %16 ], [ %0, %1 ]
%8 = phi i32 [ %17, %16 ], [ 1, %1 ]
%9 = sext i8 %6 to i32
switch i32 %9, label %16 [
i32 109, label %10
i32 77, label %10
i32 104, label %12
i32 72, label %12
i32 100, label %14
i32 68, label %14
]
10: ; preds = %5, %5
%11 = mul nsw i32 %8, 60
br label %16
12: ; preds = %5, %5
%13 = mul nsw i32 %8, 3600
br label %16
14: ; preds = %5, %5
%15 = mul nsw i32 %8, 86400
br label %16
16: ; preds = %5, %14, %12, %10
%17 = phi i32 [ %11, %10 ], [ %13, %12 ], [ %15, %14 ], [ %8, %5 ]
%18 = getelementptr inbounds i8, i8* %7, i64 1
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 0
br i1 %20, label %21, label %5
21: ; preds = %16, %1
%22 = phi i32 [ 1, %1 ], [ %17, %16 ]
ret i32 %22
}