#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 sscanf(char const *, char *, double *, unsigned char *, unsigned char *);
int time_get(const char *str, double *t) {
  unsigned char c1, c2;
  int rc;
  c1 = c2 = 0;
  rc = sscanf(str, "%lf%c%c", t, &c1, &c2);
  if (rc >= 2) {
    switch (c1) {
    case 'h':
      *t *= 60.0 * 60.0;
      break;
    case 'm':
      switch (c2) {
      case 0:
        *t *= 60.0;
        break;
      case 's':
        *t /= 1000.0;
        break;
      default:
        return -1;
      }
      break;
    case 's':
      break;
    case 'u':
    case 0xB5:
      *t /= 1000000.0;
      break;
    default:
      return -1;
    }
  }
  if (rc > 0)
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<time_get>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movb   $0x0,-0x1a(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xee9(%rip),%rsi
lea    -0x19(%rbp),%rcx
lea    -0x1a(%rbp),%r8
call   1030 <sscanf@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x2,-0x20(%rbp)
jl     1264 <time_get+0x154>
movzbl -0x19(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0x68,%eax
je     11ac <time_get+0x9c>
jmp    1166 <time_get+0x56>
mov    -0x24(%rbp),%eax
sub    $0x6d,%eax
je     11c5 <time_get+0xb5>
jmp    1177 <time_get+0x67>
mov    -0x24(%rbp),%eax
sub    $0x73,%eax
je     1231 <time_get+0x121>
jmp    1188 <time_get+0x78>
mov    -0x24(%rbp),%eax
sub    $0x75,%eax
je     1236 <time_get+0x126>
jmp    1199 <time_get+0x89>
mov    -0x24(%rbp),%eax
sub    $0xb5,%eax
je     1236 <time_get+0x126>
jmp    1253 <time_get+0x143>
mov    -0x18(%rbp),%rax
movsd  0xe60(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    125f <time_get+0x14f>
movzbl -0x1a(%rbp),%eax
mov    %eax,-0x28(%rbp)
test   %eax,%eax
je     11ea <time_get+0xda>
jmp    11d9 <time_get+0xc9>
mov    -0x28(%rbp),%eax
sub    $0x73,%eax
je     1203 <time_get+0xf3>
jmp    1220 <time_get+0x110>
mov    -0x18(%rbp),%rax
movsd  0xe1a(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,(%rax)
jmp    122c <time_get+0x11c>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdf5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    122c <time_get+0x11c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1281 <time_get+0x171>
jmp    125f <time_get+0x14f>
jmp    125f <time_get+0x14f>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xdba(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
jmp    125f <time_get+0x14f>
movl   $0xffffffff,-0x4(%rbp)
jmp    1281 <time_get+0x171>
jmp    1264 <time_get+0x154>
cmpl   $0x0,-0x20(%rbp)
jle    127a <time_get+0x16a>
movl   $0x0,-0x4(%rbp)
jmp    1281 <time_get+0x171>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_get>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
movb   $0x0,0xe(%rsp)
movb   $0x0,0xf(%rsp)
lea    0xf2f(%rip),%rsi
lea    0xf(%rsp),%rcx
lea    0xe(%rsp),%r8
mov    %rbx,%rdx
call   1030 <sscanf@plt>
cmp    $0x2,%eax
jl     1189 <time_get+0x79>
mov    $0xffffffff,%ecx
mov    0xf(%rsp),%dl
lea    -0x68(%rdx),%esi
cmp    $0xd,%sil
ja     1174 <time_get+0x64>
movzbl %sil,%edx
lea    0xec3(%rip),%rsi
movslq (%rsi,%rdx,4),%rdx
add    %rsi,%rdx
jmp    *%rdx
movsd  (%rbx),%xmm0
mulsd  0xea6(%rip),%xmm0
jmp    1185 <time_get+0x75>
cmp    $0xb5,%dl
jne    1192 <time_get+0x82>
movsd  (%rbx),%xmm0
divsd  0xe7b(%rip),%xmm0
movsd  %xmm0,(%rbx)
xor    %ecx,%ecx
test   %eax,%eax
setle  %cl
neg    %ecx
mov    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0xe(%rsp),%dl
cmp    $0x73,%dl
je     11b5 <time_get+0xa5>
test   %dl,%dl
jne    1192 <time_get+0x82>
movsd  (%rbx),%xmm0
mulsd  0xe5d(%rip),%xmm0
jmp    1185 <time_get+0x75>
movsd  (%rbx),%xmm0
divsd  0xe47(%rip),%xmm0
jmp    1185 <time_get+0x75>

LLVM IR (-O0):
@.str = [8 x i8] c"%lf%c%c\00"
define i32 @time_get(i8* %0, double* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca double*
%6 = alloca i8
%7 = alloca i8
%8 = alloca i32
store i8* %0, i8** %4
store double* %1, double** %5
store i8 0, i8* %7
store i8 0, i8* %6
%9 = load i8*, i8** %4
%10 = load double*, double** %5
%11 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %10, i8* %6, i8* %7)
store i32 %11, i32* %8
%12 = load i32, i32* %8
%13 = icmp sge i32 %12, 2
br i1 %13, label %14, label %41
14: ; preds = %2
%15 = load i8, i8* %6
%16 = zext i8 %15 to i32
switch i32 %16, label %39 [
i32 104, label %17
i32 109, label %21
i32 115, label %34
i32 117, label %35
i32 181, label %35
]
17: ; preds = %14
%18 = load double*, double** %5
%19 = load double, double* %18
%20 = fmul double %19, 3.600000e+03
store double %20, double* %18
br label %40
21: ; preds = %14
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
switch i32 %23, label %32 [
i32 0, label %24
i32 115, label %28
]
24: ; preds = %21
%25 = load double*, double** %5
%26 = load double, double* %25
%27 = fmul double %26, 6.000000e+01
store double %27, double* %25
br label %33
28: ; preds = %21
%29 = load double*, double** %5
%30 = load double, double* %29
%31 = fdiv double %30, 1.000000e+03
store double %31, double* %29
br label %33
32: ; preds = %21
store i32 -1, i32* %3
br label %46
33: ; preds = %28, %24
br label %40
34: ; preds = %14
br label %40
35: ; preds = %14, %14
%36 = load double*, double** %5
%37 = load double, double* %36
%38 = fdiv double %37, 1.000000e+06
store double %38, double* %36
br label %40
39: ; preds = %14
store i32 -1, i32* %3
br label %46
40: ; preds = %35, %34, %33, %17
br label %41
41: ; preds = %40, %2
%42 = load i32, i32* %8
%43 = icmp sgt i32 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %41
store i32 0, i32* %3
br label %46
45: ; preds = %41
store i32 -1, i32* %3
br label %46
46: ; preds = %45, %44, %39, %32
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str = [8 x i8] c"%lf%c%c\00"
define i32 @time_get(i8* nocapture %0, double* %1) {
%3 = alloca i8
%4 = alloca i8
store i8 0, i8* %4
store i8 0, i8* %3
%5 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double* %1, i8* %3, i8* %4)
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %25
7: ; preds = %2
%8 = load i8, i8* %3
switch i8 %8, label %28 [
i8 104, label %9
i8 109, label %12
i8 115, label %25
i8 117, label %20
i8 -75, label %20
]
9: ; preds = %7
%10 = load double, double* %1
%11 = fmul double %10, 3.600000e+03
br label %23
12: ; preds = %7
%13 = load i8, i8* %4
switch i8 %13, label %28 [
i8 0, label %14
i8 115, label %17
]
14: ; preds = %12
%15 = load double, double* %1
%16 = fmul double %15, 6.000000e+01
br label %23
17: ; preds = %12
%18 = load double, double* %1
%19 = fdiv double %18, 1.000000e+03
br label %23
20: ; preds = %7, %7
%21 = load double, double* %1
%22 = fdiv double %21, 1.000000e+06
br label %23
23: ; preds = %14, %17, %20, %9
%24 = phi double [ %11, %9 ], [ %22, %20 ], [ %19, %17 ], [ %16, %14 ]
store double %24, double* %1
br label %25
25: ; preds = %23, %7, %2
%26 = icmp slt i32 %5, 1
%27 = sext i1 %26 to i32
br label %28
28: ; preds = %25, %7, %12
%29 = phi i32 [ -1, %12 ], [ -1, %7 ], [ %27, %25 ]
ret i32 %29
}