#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 */
scalar_t__ str_toDouble(char const *, char const *, char const **);
double str_toInt64(char const *, char const *, char const **);
double str_toTime(const char *start, const char *end, const char **pos) {
  double sec;
  int neg;
  if (*start == '-') {
    ++start;
    neg = 1;
  } else
    neg = 0;
  sec = 3600.0 * str_toInt64(start, end, &start);
  if (*start == ':') {
    ++start;
    sec += 60.0 * str_toInt64(start, end, &start);
    if (*start == ':') {
      ++start;
      sec += str_toDouble(start, end, &start);
    }
  }
  if (pos)
    *pos = start;
  return neg ? -sec : sec;
}


x86 assembly (clang, -O0):
<str_toTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    115c <str_toTime+0x3c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
movl   $0x1,-0x24(%rbp)
jmp    1163 <str_toTime+0x43>
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <str_toInt64@plt>
movaps %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    1210 <str_toTime+0xf0>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1040 <str_toInt64@plt>
movsd  -0x20(%rbp),%xmm1
movsd  0xe46(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    120b <str_toTime+0xeb>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <str_toDouble@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1210 <str_toTime+0xf0>
cmpq   $0x0,-0x18(%rbp)
je     1226 <str_toTime+0x106>
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
cmpl   $0x0,-0x24(%rbp)
je     1256 <str_toTime+0x136>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1260 <str_toTime+0x140>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_toTime>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,0x8(%rsp)
mov    (%rdi),%bpl
cmp    $0x2d,%bpl
jne    1145 <str_toTime+0x25>
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
call   1040 <str_toInt64@plt>
mulsd  0xea6(%rip),%xmm0
mov    0x8(%rsp),%rdi
cmpb   $0x3a,(%rdi)
jne    11dc <str_toTime+0xbc>
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
movapd %xmm0,0x10(%rsp)
call   1040 <str_toInt64@plt>
mulsd  0xe80(%rip),%xmm0
movapd 0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movapd 0x10(%rsp),%xmm0
mov    0x8(%rsp),%rdi
cmpb   $0x3a,(%rdi)
jne    11dc <str_toTime+0xbc>
add    $0x1,%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rdx
mov    %rbx,%rsi
call   1030 <str_toDouble@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movapd 0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
movapd 0x10(%rsp),%xmm0
test   %r14,%r14
je     11e9 <str_toTime+0xc9>
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
cmp    $0x2d,%bpl
jne    11f7 <str_toTime+0xd7>
xorpd  0xe19(%rip),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @str_toTime(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca double
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 45
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
store i32 1, i32* %8
br label %17
16: ; preds = %3
store i32 0, i32* %8
br label %17
17: ; preds = %16, %13
%18 = load i8*, i8** %4
%19 = load i8*, i8** %5
%20 = call double @str_toInt64(i8* %18, i8* %19, i8** %4)
%21 = fmul double 3.600000e+03, %20
store double %21, double* %7
%22 = load i8*, i8** %4
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 58
br i1 %25, label %26, label %48
26: ; preds = %17
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %4
%29 = load i8*, i8** %4
%30 = load i8*, i8** %5
%31 = call double @str_toInt64(i8* %29, i8* %30, i8** %4)
%32 = load double, double* %7
%33 = call double @llvm.fmuladd.f64(double 6.000000e+01, double %31, double %32)
store double %33, double* %7
%34 = load i8*, i8** %4
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 58
br i1 %37, label %38, label %47
38: ; preds = %26
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i32 1
store i8* %40, i8** %4
%41 = load i8*, i8** %4
%42 = load i8*, i8** %5
%43 = call i64 @str_toDouble(i8* %41, i8* %42, i8** %4)
%44 = sitofp i64 %43 to double
%45 = load double, double* %7
%46 = fadd double %45, %44
store double %46, double* %7
br label %47
47: ; preds = %38, %26
br label %48
48: ; preds = %47, %17
%49 = load i8**, i8*** %6
%50 = icmp ne i8** %49, null
br i1 %50, label %51, label %54
51: ; preds = %48
%52 = load i8*, i8** %4
%53 = load i8**, i8*** %6
store i8* %52, i8** %53
br label %54
54: ; preds = %51, %48
%55 = load i32, i32* %8
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %54
%58 = load double, double* %7
%59 = fneg double %58
br label %62
60: ; preds = %54
%61 = load double, double* %7
br label %62
62: ; preds = %60, %57
%63 = phi double [ %59, %57 ], [ %61, %60 ]
ret double %63
}

LLVM IR (-O2):
define double @str_toTime(i8* %0, i8* %1, i8** writeonly %2) {
%4 = alloca i8*
store i8* %0, i8** %4
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 45
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %8, i8** %4
br label %9
9: ; preds = %3, %7
%10 = phi i8* [ %0, %3 ], [ %8, %7 ]
%11 = call double @str_toInt64(i8* %10, i8* %1, i8** %4)
%12 = fmul double %11, 3.600000e+03
%13 = load i8*, i8** %4
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 58
br i1 %15, label %16, label %28
16: ; preds = %9
%17 = getelementptr inbounds i8, i8* %13, i64 1
store i8* %17, i8** %4
%18 = call double @str_toInt64(i8* %17, i8* %1, i8** %4)
%19 = call double @llvm.fmuladd.f64(double %18, double 6.000000e+01, double %12)
%20 = load i8*, i8** %4
%21 = load i8, i8* %20
%22 = icmp eq i8 %21, 58
br i1 %22, label %23, label %28
23: ; preds = %16
%24 = getelementptr inbounds i8, i8* %20, i64 1
store i8* %24, i8** %4
%25 = call i64 @str_toDouble(i8* %24, i8* %1, i8** %4)
%26 = sitofp i64 %25 to double
%27 = fadd double %19, %26
br label %28
28: ; preds = %16, %23, %9
%29 = phi double [ %27, %23 ], [ %19, %16 ], [ %12, %9 ]
%30 = icmp eq i8** %2, null
br i1 %30, label %33, label %31
31: ; preds = %28
%32 = load i8*, i8** %4
store i8* %32, i8** %2
br label %33
33: ; preds = %31, %28
%34 = fneg double %29
%35 = select i1 %6, double %34, double %29
ret double %35
}