#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 *, char *, int *, int *, ...);
float time_decode_(char *strtime) {
  int ih, im, ok;
  float ss;
  char str1[2];
  if (sscanf(strtime, "%d:%d:%f%1s", &ih, &im, &ss, str1) == 3) {
    ok = 1;
  } else if (sscanf(strtime, "%d:%d%1s", &ih, &im, str1) == 2) {
    ss = 0.0;
    ok = 1;
  } else {
    ok = 0;
  }
  if (ok)
    return im + 60. * ih + ss / 60.;
  else
    return -1.e34;
}


x86 assembly (clang, -O0):
<time_decode_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%r9
lea    0xee5(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x20(%rbp),%r8
mov    $0x0,%al
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jne    1153 <time_decode_+0x43>
movl   $0x1,-0x1c(%rbp)
jmp    119a <time_decode_+0x8a>
mov    -0x10(%rbp),%rdi
lea    -0x22(%rbp),%r8
lea    0xeba(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
mov    $0x0,%al
call   1030 <sscanf@plt>
cmp    $0x2,%eax
jne    118e <time_decode_+0x7e>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
jmp    1195 <time_decode_+0x85>
movl   $0x0,-0x1c(%rbp)
jmp    119a <time_decode_+0x8a>
cmpl   $0x0,-0x1c(%rbp)
je     11e5 <time_decode_+0xd5>
cvtsi2sdl -0x18(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe52(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe39(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    11f2 <time_decode_+0xe2>
movss  0xe13(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_decode_>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xef1(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x2(%rsp),%r9
xor    %eax,%eax
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jne    114b <time_decode_+0x3b>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
jmp    1173 <time_decode_+0x63>
lea    0xeca(%rip),%rsi
lea    0x8(%rsp),%rdx
lea    0x4(%rsp),%rcx
lea    0x2(%rsp),%r8
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <sscanf@plt>
xorps  %xmm0,%xmm0
cmp    $0x2,%eax
jne    119d <time_decode_+0x8d>
cvtsi2sdl 0x4(%rsp),%xmm1
cvtsi2sdl 0x8(%rsp),%xmm2
movsd  0xe81(%rip),%xmm3
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
divsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
cvtsd2ss %xmm0,%xmm0
jmp    11a5 <time_decode_+0x95>
movss  0xe5b(%rip),%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%d:%d:%f%1s\00"
@.str.1 = [9 x i8] c"%d:%d%1s\00"
define float @time_decode_(i8* %0) {
%2 = alloca float
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca [2 x i8]
store i8* %0, i8** %3
%9 = load i8*, i8** %3
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%11 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* %9, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5, float* %7, i8* %10)
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 1, i32* %6
br label %22
14: ; preds = %1
%15 = load i8*, i8** %3
%16 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%17 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* %15, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %4, i32* %5, i8* %16)
%18 = icmp eq i32 %17, 2
br i1 %18, label %19, label %20
19: ; preds = %14
store float 0.000000e+00, float* %7
store i32 1, i32* %6
br label %21
20: ; preds = %14
store i32 0, i32* %6
br label %21
21: ; preds = %20, %19
br label %22
22: ; preds = %21, %13
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = load i32, i32* %5
%27 = sitofp i32 %26 to double
%28 = load i32, i32* %4
%29 = sitofp i32 %28 to double
%30 = call double @llvm.fmuladd.f64(double 6.000000e+01, double %29, double %27)
%31 = load float, float* %7
%32 = fpext float %31 to double
%33 = fdiv double %32, 6.000000e+01
%34 = fadd double %30, %33
%35 = fptrunc double %34 to float
store float %35, float* %2
br label %37
36: ; preds = %22
store float 0xC6FED09BE0000000, float* %2
br label %37
37: ; preds = %36, %25
%38 = load float, float* %2
ret float %38
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d:%d:%f%1s\00"
@.str.1 = [9 x i8] c"%d:%d%1s\00"
define float @time_decode_(i8* nocapture %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca [2 x i8]
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%10 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, float* %4, i8* %9)
%11 = icmp eq i32 %10, 3
br i1 %11, label %12, label %15
12: ; preds = %1
%13 = load float, float* %4
%14 = fpext float %13 to double
br label %18
15: ; preds = %1
%16 = call i32 (i8*, i8*, i32*, i32*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i8* %9)
%17 = icmp eq i32 %16, 2
br i1 %17, label %18, label %28
18: ; preds = %15, %12
%19 = phi double [ %14, %12 ], [ 0.000000e+00, %15 ]
%20 = load i32, i32* %3
%21 = sitofp i32 %20 to double
%22 = load i32, i32* %2
%23 = sitofp i32 %22 to double
%24 = call double @llvm.fmuladd.f64(double %23, double 6.000000e+01, double %21)
%25 = fdiv double %19, 6.000000e+01
%26 = fadd double %24, %25
%27 = fptrunc double %26 to float
br label %28
28: ; preds = %15, %18
%29 = phi float [ %27, %18 ], [ 0xC6FED09BE0000000, %15 ]
ret float %29
}