#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 */
typedef int uint_fast32_t;

/* Variables and functions */
int /*<<< orphan*/ die(char *, char *);
int sscanf(char *, char *, int *, int *, float *);
uint_fast32_t tc2pts(char *tc) {
  int h, m;
  float sms;
  if (sscanf(tc, "%d:%d:%f", &h, &m, &sms) != 3)
    die("Timecode '%s' format error", tc);
  return h * 3600 * 90000 + m * 60 * 90000 + (int)(sms * 90000.0);
}


x86 assembly (clang, -O0):
<tc2pts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xed1(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
je     1161 <tc2pts+0x41>
mov    -0x8(%rbp),%rsi
lea    0xeb5(%rip),%rdi
call   1040 <die@plt>
imul   $0xe10,-0xc(%rbp),%eax
imul   $0x15f90,%eax,%eax
imul   $0x3c,-0x10(%rbp),%ecx
imul   $0x15f90,%ecx,%ecx
add    %ecx,%eax
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe75(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%ecx
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tc2pts>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xed9(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x4(%rsp),%r8
call   1030 <sscanf@plt>
cmp    $0x3,%eax
je     1157 <tc2pts+0x37>
lea    0xec2(%rip),%rdi
mov    %rbx,%rsi
call   1040 <die@plt>
imul   $0x134fd900,0xc(%rsp),%eax
13
imul   $0x5265c0,0x8(%rsp),%ecx
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xe87(%rip),%xmm0
add    %eax,%ecx
cvttsd2si %xmm0,%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%d:%d:%f\00"
@.str.1 = [27 x i8] c"Timecode '%s' format error\00"
define i32 @tc2pts(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca float
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4, float* %5)
%8 = icmp ne i32 %7, 3
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i8*, i8** %2
%11 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9, %1
%13 = load i32, i32* %3
%14 = mul nsw i32 %13, 3600
%15 = mul nsw i32 %14, 90000
%16 = load i32, i32* %4
%17 = mul nsw i32 %16, 60
%18 = mul nsw i32 %17, 90000
%19 = add nsw i32 %15, %18
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = fmul double %21, 9.000000e+04
%23 = fptosi double %22 to i32
%24 = add nsw i32 %19, %23
ret i32 %24
}

LLVM IR (-O2):
@.str = [9 x i8] c"%d:%d:%f\00"
@.str.1 = [27 x i8] c"Timecode '%s' format error\00"
define i32 @tc2pts(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = bitcast float* %4 to i8*
%8 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, float* %4)
%9 = icmp eq i32 %8, 3
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @die(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %2
%14 = mul i32 %13, 324000000
%15 = load i32, i32* %3
%16 = mul i32 %15, 5400000
%17 = add nsw i32 %16, %14
%18 = load float, float* %4
%19 = fpext float %18 to double
%20 = fmul double %19, 9.000000e+04
%21 = fptosi double %20 to i32
%22 = add nsw i32 %17, %21
ret i32 %22
}