#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 scalar_t__ 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 */
int /*<<< orphan*/ localtime_r(scalar_t__ *, struct tm *);
scalar_t__ mktime(struct tm *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int, int);
void SECS2YYYYMMDDHHMMSS(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;
  ;
  tt1 = mktime(&t1);
  tt2 = tt1 + (unsigned long int)*time;
  t2 = t1;
  localtime_r(&tt2, &t2);
  if (t2.tm_isdst)
    tt2 -= 3600;
  localtime_r(&tt2, &t2);
  sprintf(date, "%04d%02d%02d%02d%02d%02d", 1900 + t2.tm_year, t2.tm_mon + 1,
          t2.tm_mday, t2.tm_hour, t2.tm_min, t2.tm_sec);
}


x86 assembly (clang, -O0):
<SECS2YYYYMMDDHHMMSS>:
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    -0x38(%rbp),%rdi
call   1050 <mktime@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    -0x10(%rbp),%rcx
movsd  (%rcx),%xmm0
movsd  0xe22(%rip),%xmm2
movaps %xmm0,%xmm1
subsd  %xmm2,%xmm1
cvttsd2si %xmm1,%rdx
cvttsd2si %xmm0,%rcx
mov    %rcx,%rsi
sar    $0x3f,%rsi
and    %rsi,%rdx
or     %rdx,%rcx
add    %rcx,%rax
mov    %rax,-0x70(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0x38(%rbp),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <localtime_r@plt>
cmpq   $0x0,-0x40(%rbp)
je     123b <SECS2YYYYMMDDHHMMSS+0xfb>
mov    -0x70(%rbp),%rax
sub    $0xe10,%rax
mov    %rax,-0x70(%rbp)
lea    -0x70(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1030 <localtime_r@plt>
mov    -0x8(%rbp),%rdi
mov    -0x4c(%rbp),%edx
add    $0x76c,%edx
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
mov    -0x54(%rbp),%r8d
mov    -0x58(%rbp),%r9d
mov    -0x5c(%rbp),%r10d
mov    -0x60(%rbp),%eax
lea    0xd97(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
call   1060 <sprintf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SECS2YYYYMMDDHHMMSS>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movaps 0xebc(%rip),%xmm0
movups %xmm0,0x58(%rsp)
movabs $0x6400000000,%rax
mov    %rax,0x50(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
lea    0x40(%rsp),%rdi
call   1040 <mktime@plt>
movsd  (%rbx),%xmm0
cvttsd2si %xmm0,%rcx
mov    %rcx,%rdx
sar    $0x3f,%rdx
subsd  0xe9a(%rip),%xmm0
cvttsd2si %xmm0,%rsi
and    %rdx,%rsi
or     %rcx,%rsi
add    %rax,%rsi
mov    %rsi,0x8(%rsp)
mov    0x60(%rsp),%rax
mov    %rax,0x30(%rsp)
movaps 0x40(%rsp),%xmm0
movaps 0x50(%rsp),%xmm1
movaps %xmm1,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <localtime_r@plt>
cmpq   $0x0,0x30(%rsp)
je     11d7 <SECS2YYYYMMDDHHMMSS+0xa7>
addq   $0xfffffffffffff1f0,0x8(%rsp)
ff ff
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <localtime_r@plt>
mov    $0x76c,%edx
add    0x24(%rsp),%edx
mov    0x20(%rsp),%ecx
add    $0x1,%ecx
mov    0x1c(%rsp),%r8d
mov    0x18(%rsp),%r9d
mov    0x10(%rsp),%eax
mov    0x14(%rsp),%ebx
lea    0xe19(%rip),%rsi
mov    %r14,%rdi
push   %rax
push   %rbx
call   1050 <sprintf@plt>
add    $0x78,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [25 x i8] c"%04d%02d%02d%02d%02d%02d\00"
define void @SECS2YYYYMMDDHHMMSS(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca %struct.tm
%6 = alloca %struct.tm
%7 = alloca i64
%8 = alloca i64
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 = call i64 @mktime(%struct.tm* %5)
store i64 %24, i64* %7
%25 = load i64, i64* %7
%26 = load double*, double** %4
%27 = load double, double* %26
%28 = fptoui double %27 to i64
%29 = add i64 %25, %28
store i64 %29, i64* %8
%30 = bitcast %struct.tm* %6 to i8*
%31 = bitcast %struct.tm* %5 to i8*
%32 = call i32 @localtime_r(i64* %8, %struct.tm* %6)
%33 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 8
%34 = load i64, i64* %33
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %2
%37 = load i64, i64* %8
%38 = sub nsw i64 %37, 3600
store i64 %38, i64* %8
br label %39
39: ; preds = %36, %2
%40 = call i32 @localtime_r(i64* %8, %struct.tm* %6)
%41 = load i8*, i8** %3
%42 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 5
%43 = load i32, i32* %42
%44 = add nsw i32 1900, %43
%45 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 4
%46 = load i32, i32* %45
%47 = add nsw i32 %46, 1
%48 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 3
%49 = load i32, i32* %48
%50 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 2
%51 = load i32, i32* %50
%52 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 1
%53 = load i32, i32* %52
%54 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%55 = load i32, i32* %54
%56 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %44, i32 %47, i32 %49, i32 %51, i32 %53, i32 %55)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i64 }
@.str = [25 x i8] c"%04d%02d%02d%02d%02d%02d\00"
define void @SECS2YYYYMMDDHHMMSS(i8* nocapture writeonly %0, double* nocapture %1) {
%3 = alloca %struct.tm
%4 = alloca %struct.tm
%5 = alloca i64
%6 = bitcast %struct.tm* %3 to i8*
%7 = bitcast %struct.tm* %4 to i8*
%8 = bitcast i64* %5 to i8*
%9 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 4
%10 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 5
%11 = getelementptr inbounds %struct.tm, %struct.tm* %3, i64 0, i32 6
%12 = bitcast i32* %11 to <2 x i64>*
store <2 x i64> <i64 -1, i64 0>, <2 x i64>* %12
store i32 100, i32* %10
store i32 0, i32* %9
%13 = bitcast %struct.tm* %3 to <4 x i32>*
store <4 x i32> <i32 0, i32 0, i32 0, i32 1>, <4 x i32>* %13
%14 = call i64 @mktime(%struct.tm* %3)
%15 = load double, double* %1
%16 = fptoui double %15 to i64
%17 = add i64 %14, %16
store i64 %17, i64* %5
%18 = call i32 @localtime_r(i64* %5, %struct.tm* %4)
%19 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 8
%20 = load i64, i64* %19
%21 = icmp eq i64 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %2
%23 = load i64, i64* %5
%24 = add nsw i64 %23, -3600
store i64 %24, i64* %5
br label %25
25: ; preds = %22, %2
%26 = call i32 @localtime_r(i64* %5, %struct.tm* %4)
%27 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%28 = load i32, i32* %27
%29 = add nsw i32 %28, 1900
%30 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%31 = load i32, i32* %30
%32 = add nsw i32 %31, 1
%33 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%38 = load i32, i32* %37
%39 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%40 = load i32, i32* %39
%41 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %29, i32 %32, i32 %34, i32 %36, i32 %38, i32 %40)
ret void
}