#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 /*<<< orphan*/ fmtdate(char *, double);
int /*<<< orphan*/ fmttime(char *, double, double);
int /*<<< orphan*/ isfinite(double);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *fmtdatetime(char *buf, double t, double tza) {
  char dbuf[20], tbuf[20];
  if (!isfinite(t))
    return "Invalid Date";
  fmtdate(dbuf, t);
  fmttime(tbuf, t, tza);
  sprintf(buf, "%sT%s", dbuf, tbuf);
  return buf;
}


x86 assembly (clang, -O0):
<fmtdatetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <isfinite@plt>
cmp    $0x0,%eax
jne    1179 <fmtdatetime+0x39>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11ba <fmtdatetime+0x7a>
lea    -0x40(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
call   1060 <fmtdate@plt>
lea    -0x60(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <fmttime@plt>
mov    -0x10(%rbp),%rdi
lea    -0x40(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    0xe60(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmtdatetime>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movsd  %xmm1,0x8(%rsp)
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
call   1040 <isfinite@plt>
test   %eax,%eax
je     11a1 <fmtdatetime+0x61>
lea    0x30(%rsp),%r14
mov    %r14,%rdi
movsd  (%rsp),%xmm0
call   1060 <fmtdate@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <fmttime@plt>
lea    0xe7c(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <sprintf@plt>
jmp    11a8 <fmtdatetime+0x68>
lea    0xe58(%rip),%rbx
mov    %rbx,%rax
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Invalid Date\00"
@.str.1 = [6 x i8] c"%sT%s\00"
define i8* @fmtdatetime(i8* %0, double %1, double %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca double
%7 = alloca double
%8 = alloca [20 x i8]
%9 = alloca [20 x i8]
store i8* %0, i8** %5
store double %1, double* %6
store double %2, double* %7
%10 = load double, double* %6
%11 = call i32 @isfinite(double %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %3
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %4
br label %27
14: ; preds = %3
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%16 = load double, double* %6
%17 = call i32 @fmtdate(i8* %15, double %16)
%18 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%19 = load double, double* %6
%20 = load double, double* %7
%21 = call i32 @fmttime(i8* %18, double %19, double %20)
%22 = load i8*, i8** %5
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %8, i64 0, i64 0
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %9, i64 0, i64 0
%25 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %23, i8* %24)
%26 = load i8*, i8** %5
store i8* %26, i8** %4
br label %27
27: ; preds = %14, %13
%28 = load i8*, i8** %4
ret i8* %28
}

LLVM IR (-O2):
@.str = [13 x i8] c"Invalid Date\00"
@.str.1 = [6 x i8] c"%sT%s\00"
define i8* @fmtdatetime(i8* writeonly %0, double %1, double %2) {
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @isfinite(double %1)
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %3
%11 = call i32 @fmtdate(i8* %6, double %1)
%12 = call i32 @fmttime(i8* %7, double %1, double %2)
%13 = call i32 @sprintf(i8* dereferenceable(1) %0, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %6, i8* %7)
br label %14
14: ; preds = %3, %10
%15 = phi i8* [ %0, %10 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), %3 ]
ret i8* %15
}