#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*/ date_to_isodate(char const *, char *);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ time_to_isotime(char const *, char *);
void date_time_to_isodate(const char *datestr, const char *timestr,
                          char *isodatestr) {
  date_to_isodate(datestr, isodatestr);
  if (strcmp(isodatestr, "INVALID") == 0)
    return;
  char *stdtimestr = strchr(isodatestr, '\0');
  *stdtimestr++ = 'T';
  time_to_isotime(timestr, stdtimestr);
}


x86 assembly (clang, -O0):
<date_time_to_isodate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1060 <date_to_isodate@plt>
mov    -0x18(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1180 <date_time_to_isodate+0x40>
jmp    11ae <date_time_to_isodate+0x6e>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
call   1040 <strchr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movb   $0x54,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <time_to_isotime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_time_to_isodate>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdx,%rsi
call   1060 <date_to_isodate@plt>
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1189 <date_time_to_isodate+0x49>
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,1),%rsi
add    $0x1,%rsi
movb   $0x54,(%rbx,%rax,1)
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <time_to_isotime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INVALID\00"
define void @date_time_to_isodate(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %6
%10 = call i32 @date_to_isodate(i8* %8, i8* %9)
%11 = load i8*, i8** %6
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %3
br label %23
15: ; preds = %3
%16 = load i8*, i8** %6
%17 = call i8* @strchr(i8* %16, i8 signext 0)
store i8* %17, i8** %7
%18 = load i8*, i8** %7
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %7
store i8 84, i8* %18
%20 = load i8*, i8** %5
%21 = load i8*, i8** %7
%22 = call i32 @time_to_isotime(i8* %20, i8* %21)
br label %23
23: ; preds = %15, %14
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"INVALID\00"
define void @date_time_to_isodate(i8* %0, i8* %1, i8* %2) {
%4 = tail call i32 @date_to_isodate(i8* %0, i8* %2)
%5 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = tail call i64 @strlen(i8* dereferenceable(1) %2)
%9 = getelementptr i8, i8* %2, i64 %8
%10 = getelementptr inbounds i8, i8* %9, i64 1
store i8 84, i8* %9
%11 = tail call i32 @time_to_isotime(i8* %1, i8* %10)
br label %12
12: ; preds = %3, %7
ret void
}