#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 */
double strtod(char const *, char **);
double strtodelay(const char *str, char **pendp) {
  double result;
  char *endp;
  if (!pendp)
    pendp = &endp;
  result = strtod(str, pendp);
  switch (**pendp) {
  case 'w':
    result *= 7;
  case 'd':
    result *= 24;
  case 'h':
    result *= 60;
  case 'm':
    result *= 60;
  case 's':
    ++(*pendp);
    break;
  }
  return result;
}


x86 assembly (clang, -O0):
<strtodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <strtodelay+0x23>
lea    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
add    $0xffffff9c,%eax
mov    %eax,%ecx
mov    %rcx,-0x28(%rbp)
sub    $0x13,%eax
ja     11cb <strtodelay+0xbb>
mov    -0x28(%rbp),%rax
lea    0xeac(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movsd  0xe83(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe79(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe6f(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xe5d(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtodelay>:
push   %rbx
sub    $0x10,%rsp
test   %rsi,%rsi
lea    0x8(%rsp),%rbx
cmovne %rsi,%rbx
mov    %rbx,%rsi
call   1030 <strtod@plt>
mov    (%rbx),%rax
movsbl (%rax),%ecx
add    $0xffffff9c,%ecx
cmp    $0x13,%ecx
ja     116e <strtodelay+0x5e>
lea    0xeda(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mulsd  0xeb1(%rip),%xmm0
mulsd  0xeb1(%rip),%xmm0
mulsd  0xeb1(%rip),%xmm0
mulsd  0xea9(%rip),%xmm0
add    $0x1,%rax
mov    %rax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @strtodelay(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca double
%6 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
%7 = load i8**, i8*** %4
%8 = icmp ne i8** %7, null
br i1 %8, label %10, label %9
9: ; preds = %2
store i8** %6, i8*** %4
br label %10
10: ; preds = %9, %2
%11 = load i8*, i8** %3
%12 = load i8**, i8*** %4
%13 = call double @strtod(i8* %11, i8** %12)
store double %13, double* %5
%14 = load i8**, i8*** %4
%15 = load i8*, i8** %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
switch i32 %17, label %34 [
i32 119, label %18
i32 100, label %21
i32 104, label %24
i32 109, label %27
i32 115, label %30
]
18: ; preds = %10
%19 = load double, double* %5
%20 = fmul double %19, 7.000000e+00
store double %20, double* %5
br label %21
21: ; preds = %10, %18
%22 = load double, double* %5
%23 = fmul double %22, 2.400000e+01
store double %23, double* %5
br label %24
24: ; preds = %10, %21
%25 = load double, double* %5
%26 = fmul double %25, 6.000000e+01
store double %26, double* %5
br label %27
27: ; preds = %10, %24
%28 = load double, double* %5
%29 = fmul double %28, 6.000000e+01
store double %29, double* %5
br label %30
30: ; preds = %10, %27
%31 = load i8**, i8*** %4
%32 = load i8*, i8** %31
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %31
br label %34
34: ; preds = %10, %30
%35 = load double, double* %5
ret double %35
}

LLVM IR (-O2):
define double @strtodelay(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = icmp eq i8** %1, null
%6 = select i1 %5, i8** %3, i8** %1
%7 = call double @strtod(i8* %0, i8** %6)
%8 = load i8*, i8** %6
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
switch i32 %10, label %25 [
i32 119, label %11
i32 100, label %13
i32 104, label %16
i32 109, label %19
i32 115, label %22
]
11: ; preds = %2
%12 = fmul double %7, 7.000000e+00
br label %13
13: ; preds = %2, %11
%14 = phi double [ %7, %2 ], [ %12, %11 ]
%15 = fmul double %14, 2.400000e+01
br label %16
16: ; preds = %2, %13
%17 = phi double [ %7, %2 ], [ %15, %13 ]
%18 = fmul double %17, 6.000000e+01
br label %19
19: ; preds = %2, %16
%20 = phi double [ %7, %2 ], [ %18, %16 ]
%21 = fmul double %20, 6.000000e+01
br label %22
22: ; preds = %2, %19
%23 = phi double [ %7, %2 ], [ %21, %19 ]
%24 = getelementptr inbounds i8, i8* %8, i64 1
store i8* %24, i8** %6
br label %25
25: ; preds = %2, %22
%26 = phi double [ %7, %2 ], [ %23, %22 ]
ret double %26
}