#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 EOF;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fscanf(int /*<<< orphan*/, char *, int *, int *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
double get_sec() {
  int mm = 0;
  int ss = 0;
  int ff = 0;
  int items = fscanf(stdin, "%d:%d:%d\n", &mm, &ss, &ff);
  if (items == EOF)
    return -1;
  if (items != 3) {
    fprintf(stderr, "Timestamp malformed\n");
    exit(-1);
  }
  return (mm * 60 + ss + ((double)ff) / 75);
}


x86 assembly (clang, -O0):
<get_sec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1030 <fscanf@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
jne    1195 <get_sec+0x65>
movsd  0xe7d(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e3 <get_sec+0xb3>
cmpl   $0x3,-0x18(%rbp)
je     11be <get_sec+0x8e>
mov    0x2e2a(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>
imul   $0x3c,-0xc(%rbp),%eax
add    -0x10(%rbp),%eax
cvtsi2sd %eax,%xmm0
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe2a(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_sec>:
sub    $0x18,%rsp
movl   $0x0,0x14(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0xc(%rsp)
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
call   1030 <fscanf@plt>
mov    0x2e69(%rip),%rcx
cmp    (%rcx),%eax
jne    1188 <get_sec+0x58>
movsd  0xe7d(%rip),%xmm0
add    $0x18,%rsp
ret
cmp    $0x3,%eax
jne    11b1 <get_sec+0x81>
imul   $0x3c,0x14(%rsp),%eax
add    0x10(%rsp),%eax
cvtsi2sd %eax,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm0
divsd  0xe60(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret
mov    0x2e18(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0xffffffff,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdin = global i32 0
@.str = [10 x i8] c"%d:%d:%d\0A\00"
@EOF = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"Timestamp malformed\0A\00"
define double @get_sec() {
%1 = alloca double
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
%6 = load i32, i32* @stdin
%7 = call i32 @fscanf(i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %0
store double -1.000000e+00, double* %1
br label %29
12: ; preds = %0
%13 = load i32, i32* %5
%14 = icmp ne i32 %13, 3
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %12
%20 = load i32, i32* %2
%21 = mul nsw i32 %20, 60
%22 = load i32, i32* %3
%23 = add nsw i32 %21, %22
%24 = sitofp i32 %23 to double
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to double
%27 = fdiv double %26, 7.500000e+01
%28 = fadd double %24, %27
store double %28, double* %1
br label %29
29: ; preds = %19, %11
%30 = load double, double* %1
ret double %30
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [10 x i8] c"%d:%d:%d\0A\00"
@EOF = global i32 0
@stderr = global i32 0
@.str.1 = [21 x i8] c"Timestamp malformed\0A\00"
define double @get_sec() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%5 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%6 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%7 = load i32, i32* @stdin
%8 = call i32 @fscanf(i32 %7, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %27, label %11
11: ; preds = %0
%12 = icmp eq i32 %8, 3
br i1 %12, label %17, label %13
13: ; preds = %11
%14 = load i32, i32* @stderr
%15 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 @exit(i32 -1)
unreachable
17: ; preds = %11
%18 = load i32, i32* %1
%19 = mul nsw i32 %18, 60
%20 = load i32, i32* %2
%21 = add nsw i32 %19, %20
%22 = sitofp i32 %21 to double
%23 = load i32, i32* %3
%24 = sitofp i32 %23 to double
%25 = fdiv double %24, 7.500000e+01
%26 = fadd double %25, %22
br label %27
27: ; preds = %0, %17
%28 = phi double [ %26, %17 ], [ -1.000000e+00, %0 ]
ret double %28
}