#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 const *, char *, int *, int *, char *);
scalar_t__ wcsutil_str2double(char *, char *, double *);
int parse_date(const char *buf, int *hour, int *minute, double *sec) {
  char ctmp[72];
  if (sscanf(buf, "%2d:%2d:%s", hour, minute, ctmp) < 3 ||
      wcsutil_str2double(ctmp, "%lf", sec)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<parse_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x70(%rbp),%r8
lea    0xeb1(%rip),%rsi
call   1030 <sscanf@plt>
cmp    $0x3,%eax
jl     117b <parse_date+0x5b>
lea    -0x70(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xe9f(%rip),%rsi
call   1040 <wcsutil_str2double@plt>
cmp    $0x0,%rax
je     1187 <parse_date+0x67>
movl   $0x1,-0x4(%rbp)
jmp    118e <parse_date+0x6e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_date>:
push   %rbx
sub    $0x50,%rsp
mov    %rcx,%rbx
mov    %rdx,%rcx
mov    %rsi,%rdx
lea    0xecb(%rip),%rsi
mov    %rsp,%r8
call   1030 <sscanf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x3,%ecx
jl     1166 <parse_date+0x46>
lea    0xebb(%rip),%rsi
mov    %rsp,%rdi
mov    %rbx,%rdx
call   1040 <wcsutil_str2double@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%2d:%2d:%s\00"
@.str.1 = [4 x i8] c"%lf\00"
define i32 @parse_date(i8* %0, i32* %1, i32* %2, double* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double*
%10 = alloca [72 x i8]
store i8* %0, i8** %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store double* %3, double** %9
%11 = load i8*, i8** %6
%12 = load i32*, i32** %7
%13 = load i32*, i32** %8
%14 = getelementptr inbounds [72 x i8], [72 x i8]* %10, i64 0, i64 0
%15 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %12, i32* %13, i8* %14)
%16 = icmp slt i32 %15, 3
br i1 %16, label %22, label %17
17: ; preds = %4
%18 = getelementptr inbounds [72 x i8], [72 x i8]* %10, i64 0, i64 0
%19 = load double*, double** %9
%20 = call i64 @wcsutil_str2double(i8* %18, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17, %4
store i32 1, i32* %5
br label %24
23: ; preds = %17
store i32 0, i32* %5
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %5
ret i32 %25
}

LLVM IR (-O2):
@.str = [11 x i8] c"%2d:%2d:%s\00"
@.str.1 = [4 x i8] c"%lf\00"
define i32 @parse_date(i8* nocapture %0, i32* %1, i32* %2, double* %3) {
%5 = alloca [72 x i8]
%6 = getelementptr inbounds [72 x i8], [72 x i8]* %5, i64 0, i64 0
%7 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i8* %6)
%8 = icmp slt i32 %7, 3
br i1 %8, label %13, label %9
9: ; preds = %4
%10 = call i64 @wcsutil_str2double(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %9, %4
%14 = phi i32 [ 1, %4 ], [ %12, %9 ]
ret i32 %14
}