#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 /*<<< orphan*/ time_t;
struct tm {
  int tm_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_wday;
  int tm_yday;
  scalar_t__ tm_isdst;
};

/* Variables and functions */
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ mktime(struct tm *);
int /*<<< orphan*/ sscanf(char *, char *, int *, int *, int *, int *, int *,
                          int *);
void YYYYMMDDHHMMSS2SECS(char *date, double *time) {
  struct tm t1, t2;
  time_t tt1, tt2;
  t1.tm_sec = -1;
  t1.tm_min = -1;
  t1.tm_hour = -1;
  t1.tm_mday = -1;
  t1.tm_mon = -1;
  t1.tm_year = -1;
  t1.tm_wday = -1;
  t1.tm_yday = -1;
  t1.tm_isdst = 0;
  t1.tm_year = 100;
  t1.tm_mon = 0;
  t1.tm_mday = 1;
  t1.tm_hour = 0;
  t1.tm_min = 0;
  t1.tm_sec = 0;
  ;
  t2 = t1;
  sscanf(date, "%4d%2d%2d%2d%2d%2d", &t2.tm_year, &t2.tm_mon, &t2.tm_mday,
         &t2.tm_hour, &t2.tm_min, &t2.tm_sec);
  t2.tm_year -= 1900;
  t2.tm_mon -= 1;
  tt1 = mktime(&t1);
  tt2 = mktime(&t2);
  *time = difftime(tt2, tt1);
}


x86 assembly (clang, -O0):
<YYYYMMDDHHMMSS2SECS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x38(%rbp)
movl   $0xffffffff,-0x34(%rbp)
movl   $0xffffffff,-0x30(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
movl   $0xffffffff,-0x28(%rbp)
movl   $0xffffffff,-0x24(%rbp)
movl   $0xffffffff,-0x20(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x64,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rdx
add    $0x14,%rdx
lea    -0x60(%rbp),%rcx
add    $0x10,%rcx
lea    -0x60(%rbp),%r8
add    $0xc,%r8
lea    -0x60(%rbp),%r9
add    $0x8,%r9
lea    -0x60(%rbp),%r10
add    $0x4,%r10
lea    -0x60(%rbp),%rax
lea    0xdfa(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <sscanf@plt>
mov    -0x4c(%rbp),%eax
sub    $0x76c,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x50(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x50(%rbp)
lea    -0x38(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x64(%rbp)
lea    -0x60(%rbp),%rdi
call   1060 <mktime@plt>
mov    %eax,-0x68(%rbp)
mov    -0x68(%rbp),%edi
mov    -0x64(%rbp),%esi
call   1030 <difftime@plt>
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<YYYYMMDDHHMMSS2SECS>:
push   %rbp
push   %r14
push   %rbx
sub    $0x60,%rsp
mov    %rsi,%r14
movaps 0xebe(%rip),%xmm0
movups %xmm0,0x48(%rsp)
movabs $0x6400000000,%rax
mov    %rax,0x40(%rsp)
movaps 0xeb3(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0x30(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    0x40(%rsp),%rax
mov    %rax,0x10(%rsp)
mov    0x48(%rsp),%rax
mov    %rax,0x18(%rsp)
mov    0x50(%rsp),%rax
mov    %rax,0x20(%rsp)
lea    0x10(%rsp),%rcx
lea    0x14(%rsp),%rdx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
lea    0x4(%rsp),%rax
mov    %rsp,%rbx
lea    0xe74(%rip),%rsi
push   %rbx
push   %rax
call   1040 <sscanf@plt>
add    $0x10,%rsp
addl   $0xfffff894,0x14(%rsp)
ff
addl   $0xffffffff,0x10(%rsp)
lea    0x30(%rsp),%rdi
call   1050 <mktime@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1050 <mktime@plt>
mov    %eax,%edi
mov    %ebp,%esi
call   1030 <difftime@plt>
movsd  %xmm0,(%r14)
add    $0x60,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [19 x i8] c"%4d%2d%2d%2d%2d%2d\00"
define void @YYYYMMDDHHMMSS2SECS(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca %struct.tm
%6 = alloca %struct.tm
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store double* %1, double** %4
%9 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 -1, i32* %9
%10 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
store i32 -1, i32* %10
%11 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
store i32 -1, i32* %11
%12 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
store i32 -1, i32* %12
%13 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
store i32 -1, i32* %13
%14 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
store i32 -1, i32* %14
%15 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 6
store i32 -1, i32* %15
%16 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 7
store i32 -1, i32* %16
%17 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 8
store i64 0, i64* %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 5
store i32 100, i32* %18
%19 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 4
store i32 0, i32* %19
%20 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 3
store i32 1, i32* %20
%21 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
store i32 0, i32* %21
%22 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 1
store i32 0, i32* %22
%23 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 0
store i32 0, i32* %23
%24 = bitcast %struct.tm* %6 to i8*
%25 = bitcast %struct.tm* %5 to i8*
%26 = load i8*, i8** %3
%27 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 5
%28 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 4
%29 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 3
%30 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
%31 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%32 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%33 = call i32 @sscanf(i8* %26, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %27, i32* %28, i32* %29, i32* %30, i32* %31, i32* %32)
%34 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 5
%35 = load i32, i32* %34
%36 = sub nsw i32 %35, 1900
store i32 %36, i32* %34
%37 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 4
%38 = load i32, i32* %37
%39 = sub nsw i32 %38, 1
store i32 %39, i32* %37
%40 = call i32 @mktime(%struct.tm* %5)
store i32 %40, i32* %7
%41 = call i32 @mktime(%struct.tm* %6)
store i32 %41, i32* %8
%42 = load i32, i32* %8
%43 = load i32, i32* %7
%44 = call double @difftime(i32 %42, i32 %43)
%45 = load double*, double** %4
store double %44, double* %45
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [19 x i8] c"%4d%2d%2d%2d%2d%2d\00"
define void @YYYYMMDDHHMMSS2SECS(i8* nocapture %0, double* nocapture writeonly %1) {
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = bitcast %struct.tm* %3 to i8*
%6 = bitcast %struct.tm* %4 to i8*
%7 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%8 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 6
%10 = bitcast i32* %9 to <2 x i64>*
store <2 x i64> <i64 -1, i64 0>, <2 x i64>* %10
store i32 100, i32* %8
store i32 0, i32* %7
%11 = bitcast %struct.tm* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 0, i32 0, i32 1>, <4 x i32>* %11
%12 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%16 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%18 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32* %12, i32* %13, i32* %14, i32* %15, i32* %16, i32* %17)
%19 = load i32, i32* %12
%20 = add nsw i32 %19, -1900
store i32 %20, i32* %12
%21 = load i32, i32* %13
%22 = add nsw i32 %21, -1
store i32 %22, i32* %13
%23 = call i32 @mktime(%struct.tm* %3)
%24 = call i32 @mktime(%struct.tm* %4)
%25 = call double @difftime(i32 %24, i32 %23)
store double %25, double* %1
ret void
}