#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 parse_npt(char const *);
double parse_smpte(char *, double);
int sscanf(char const *, char *, char *);
double parse_timespec(const char *str) {
  char timespec[16];
  if (str == NULL)
    return -1.0;
  if (sscanf(str, "npt:%16s", timespec) == 1) {
    return parse_npt(timespec);
  }
  if (sscanf(str, "smpte-24:%16s", timespec) == 1) {
    return parse_smpte(timespec, 24.0);
  }
  if (sscanf(str, "smpte-24-drop:%16s", timespec) == 1) {
    return parse_smpte(timespec, 23.976);
  }
  if (sscanf(str, "smpte-25:%16s", timespec) == 1) {
    return parse_smpte(timespec, 25.0);
  }
  if (sscanf(str, "smpte-30:%16s", timespec) == 1) {
    return parse_smpte(timespec, 30.0);
  }
  if (sscanf(str, "smpte-30-drop:%16s", timespec) == 1) {
    return parse_smpte(timespec, 29.97);
  }
  if (sscanf(str, "smpte-50:%16s", timespec) == 1) {
    return parse_smpte(timespec, 50.0);
  }
  if (sscanf(str, "smpte-60:%16s", timespec) == 1) {
    return parse_smpte(timespec, 60);
  }
  if (sscanf(str, "smpte-60-drop:%16s", timespec) == 1) {
    return parse_smpte(timespec, 59.94);
  }
  return parse_npt(str);
}


x86 assembly (clang, -O0):
<parse_timespec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1159 <parse_timespec+0x29>
movsd  0xef1(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xee0(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1189 <parse_timespec+0x59>
lea    -0x20(%rbp),%rdi
call   1040 <parse_npt@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xeb9(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11c1 <parse_timespec+0x91>
lea    -0x20(%rbp),%rdi
movsd  0xe86(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe8f(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11f9 <parse_timespec+0xc9>
lea    -0x20(%rbp),%rdi
movsd  0xe46(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe6a(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1231 <parse_timespec+0x101>
lea    -0x20(%rbp),%rdi
movsd  0xe06(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe40(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1269 <parse_timespec+0x139>
lea    -0x20(%rbp),%rdi
movsd  0xdc6(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xe16(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    12a1 <parse_timespec+0x171>
lea    -0x20(%rbp),%rdi
movsd  0xd86(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xdf1(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    12d9 <parse_timespec+0x1a9>
lea    -0x20(%rbp),%rdi
movsd  0xd46(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xdc7(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1311 <parse_timespec+0x1e1>
lea    -0x20(%rbp),%rdi
movsd  0xd06(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    0xd9d(%rip),%rsi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1349 <parse_timespec+0x219>
lea    -0x20(%rbp),%rdi
movsd  0xcc6(%rip),%xmm0
call   1030 <parse_smpte@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1357 <parse_timespec+0x227>
mov    -0x10(%rbp),%rdi
call   1040 <parse_npt@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_timespec>:
push   %rbx
sub    $0x10,%rsp
test   %rdi,%rdi
je     115e <parse_timespec+0x2e>
mov    %rdi,%rbx
lea    0xf04(%rip),%rsi
mov    %rsp,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    116b <parse_timespec+0x3b>
mov    %rsp,%rdi
call   1040 <parse_npt@plt>
jmp    129a <parse_timespec+0x16a>
movsd  0xe9a(%rip),%xmm0
jmp    129a <parse_timespec+0x16a>
lea    0xedf(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1192 <parse_timespec+0x62>
mov    %rsp,%rdi
movsd  0xeb3(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xec6(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11b9 <parse_timespec+0x89>
mov    %rsp,%rdi
movsd  0xe84(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xeb2(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    11e0 <parse_timespec+0xb0>
mov    %rsp,%rdi
movsd  0xe55(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xe99(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1207 <parse_timespec+0xd7>
mov    %rsp,%rdi
movsd  0xe26(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xe80(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    122b <parse_timespec+0xfb>
mov    %rsp,%rdi
movsd  0xdf7(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xe6f(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    124f <parse_timespec+0x11f>
mov    %rsp,%rdi
movsd  0xdcb(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xe59(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1273 <parse_timespec+0x143>
mov    %rsp,%rdi
movsd  0xd9f(%rip),%xmm0
jmp    1295 <parse_timespec+0x165>
lea    0xe43(%rip),%rsi
mov    %rsp,%rdx
mov    %rbx,%rdi
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    12a0 <parse_timespec+0x170>
mov    %rsp,%rdi
movsd  0xd73(%rip),%xmm0
call   1030 <parse_smpte@plt>
add    $0x10,%rsp
pop    %rbx
ret
mov    %rbx,%rdi
jmp    1154 <parse_timespec+0x24>

LLVM IR (-O0):
@.str = [9 x i8] c"npt:%16s\00"
@.str.1 = [14 x i8] c"smpte-24:%16s\00"
@.str.2 = [19 x i8] c"smpte-24-drop:%16s\00"
@.str.3 = [14 x i8] c"smpte-25:%16s\00"
@.str.4 = [14 x i8] c"smpte-30:%16s\00"
@.str.5 = [19 x i8] c"smpte-30-drop:%16s\00"
@.str.6 = [14 x i8] c"smpte-50:%16s\00"
@.str.7 = [14 x i8] c"smpte-60:%16s\00"
@.str.8 = [19 x i8] c"smpte-60-drop:%16s\00"
define double @parse_timespec(i8* %0) {
%2 = alloca double
%3 = alloca i8*
%4 = alloca [16 x i8]
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %1
store double -1.000000e+00, double* %2
br label %83
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%11 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %16
13: ; preds = %8
%14 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%15 = call double @parse_npt(i8* %14)
store double %15, double* %2
br label %83
16: ; preds = %8
%17 = load i8*, i8** %3
%18 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%19 = call i32 @sscanf(i8* %17, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %24
21: ; preds = %16
%22 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%23 = call double @parse_smpte(i8* %22, double 2.400000e+01)
store double %23, double* %2
br label %83
24: ; preds = %16
%25 = load i8*, i8** %3
%26 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%27 = call i32 @sscanf(i8* %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %26)
%28 = icmp eq i32 %27, 1
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%31 = call double @parse_smpte(i8* %30, double 2.397600e+01)
store double %31, double* %2
br label %83
32: ; preds = %24
%33 = load i8*, i8** %3
%34 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%35 = call i32 @sscanf(i8* %33, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %34)
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %40
37: ; preds = %32
%38 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%39 = call double @parse_smpte(i8* %38, double 2.500000e+01)
store double %39, double* %2
br label %83
40: ; preds = %32
%41 = load i8*, i8** %3
%42 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%43 = call i32 @sscanf(i8* %41, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %42)
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %48
45: ; preds = %40
%46 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%47 = call double @parse_smpte(i8* %46, double 3.000000e+01)
store double %47, double* %2
br label %83
48: ; preds = %40
%49 = load i8*, i8** %3
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%51 = call i32 @sscanf(i8* %49, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %50)
%52 = icmp eq i32 %51, 1
br i1 %52, label %53, label %56
53: ; preds = %48
%54 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%55 = call double @parse_smpte(i8* %54, double 2.997000e+01)
store double %55, double* %2
br label %83
56: ; preds = %48
%57 = load i8*, i8** %3
%58 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%59 = call i32 @sscanf(i8* %57, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %58)
%60 = icmp eq i32 %59, 1
br i1 %60, label %61, label %64
61: ; preds = %56
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%63 = call double @parse_smpte(i8* %62, double 5.000000e+01)
store double %63, double* %2
br label %83
64: ; preds = %56
%65 = load i8*, i8** %3
%66 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%67 = call i32 @sscanf(i8* %65, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %66)
%68 = icmp eq i32 %67, 1
br i1 %68, label %69, label %72
69: ; preds = %64
%70 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%71 = call double @parse_smpte(i8* %70, double 6.000000e+01)
store double %71, double* %2
br label %83
72: ; preds = %64
%73 = load i8*, i8** %3
%74 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%75 = call i32 @sscanf(i8* %73, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %74)
%76 = icmp eq i32 %75, 1
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%79 = call double @parse_smpte(i8* %78, double 0x404DF851EB851EB8)
store double %79, double* %2
br label %83
80: ; preds = %72
%81 = load i8*, i8** %3
%82 = call double @parse_npt(i8* %81)
store double %82, double* %2
br label %83
83: ; preds = %80, %77, %69, %61, %53, %45, %37, %29, %21, %13, %7
%84 = load double, double* %2
ret double %84
}

LLVM IR (-O2):
@.str = [9 x i8] c"npt:%16s\00"
@.str.1 = [14 x i8] c"smpte-24:%16s\00"
@.str.2 = [19 x i8] c"smpte-24-drop:%16s\00"
@.str.3 = [14 x i8] c"smpte-25:%16s\00"
@.str.4 = [14 x i8] c"smpte-30:%16s\00"
@.str.5 = [19 x i8] c"smpte-30-drop:%16s\00"
@.str.6 = [14 x i8] c"smpte-50:%16s\00"
@.str.7 = [14 x i8] c"smpte-60:%16s\00"
@.str.8 = [19 x i8] c"smpte-60-drop:%16s\00"
define double @parse_timespec(i8* %0) {
%2 = alloca [16 x i8]
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %2, i64 0, i64 0
%4 = icmp eq i8* %0, null
br i1 %4, label %52, label %5
5: ; preds = %1
%6 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call double @parse_npt(i8* %3)
br label %52
10: ; preds = %5
%11 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = call double @parse_smpte(i8* %3, double 2.400000e+01)
br label %52
15: ; preds = %10
%16 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = call double @parse_smpte(i8* %3, double 2.397600e+01)
br label %52
20: ; preds = %15
%21 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = call double @parse_smpte(i8* %3, double 2.500000e+01)
br label %52
25: ; preds = %20
%26 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %3)
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = call double @parse_smpte(i8* %3, double 3.000000e+01)
br label %52
30: ; preds = %25
%31 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), i8* %3)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %35
33: ; preds = %30
%34 = call double @parse_smpte(i8* %3, double 2.997000e+01)
br label %52
35: ; preds = %30
%36 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %3)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call double @parse_smpte(i8* %3, double 5.000000e+01)
br label %52
40: ; preds = %35
%41 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i8* %3)
%42 = icmp eq i32 %41, 1
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call double @parse_smpte(i8* %3, double 6.000000e+01)
br label %52
45: ; preds = %40
%46 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i8* %3)
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call double @parse_smpte(i8* %3, double 0x404DF851EB851EB8)
br label %52
50: ; preds = %45
%51 = call double @parse_npt(i8* %0)
br label %52
52: ; preds = %1, %50, %48, %43, %38, %33, %28, %23, %18, %13, %8
%53 = phi double [ %9, %8 ], [ %14, %13 ], [ %19, %18 ], [ %24, %23 ], [ %29, %28 ], [ %34, %33 ], [ %39, %38 ], [ %44, %43 ], [ %49, %48 ], [ %51, %50 ], [ -1.000000e+00, %1 ]
ret double %53
}