#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 */
struct timeparts {
  int dummy;
};

/* Variables and functions */
int d_tptodatestr(struct timeparts const *, char *, int);
int d_tptotimestr(struct timeparts const *, char *, int);
int d_tptostr(const struct timeparts *tp, char *buf, int addtz) {
  int len = d_tptodatestr(tp, buf, addtz);
  *(buf + len) = ' ';
  return d_tptotimestr(tp, buf + len + 1, addtz) + len + 1;
}


x86 assembly (clang, -O0):
<d_tptostr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1040 <d_tptodatestr@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x18(%rbp),%rax
add    %rax,%rsi
add    $0x1,%rsi
mov    -0x14(%rbp),%edx
call   1030 <d_tptotimestr@plt>
add    -0x18(%rbp),%eax
add    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_tptostr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
call   1040 <d_tptodatestr@plt>
movslq %eax,%rbp
movb   $0x20,(%rbx,%rbp,1)
lea    (%rbx,%rbp,1),%rsi
add    $0x1,%rsi
mov    %r15,%rdi
mov    %r14d,%edx
call   1030 <d_tptotimestr@plt>
add    %ebp,%eax
add    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeparts = type { i32 }
define i32 @d_tptostr(%struct.timeparts* %0, i8* %1, i32 %2) {
%4 = alloca %struct.timeparts*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store %struct.timeparts* %0, %struct.timeparts** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load %struct.timeparts*, %struct.timeparts** %4
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i32 @d_tptodatestr(%struct.timeparts* %8, i8* %9, i32 %10)
store i32 %11, i32* %7
%12 = load i8*, i8** %5
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 32, i8* %15
%16 = load %struct.timeparts*, %struct.timeparts** %4
%17 = load i8*, i8** %5
%18 = load i32, i32* %7
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = getelementptr inbounds i8, i8* %20, i64 1
%22 = load i32, i32* %6
%23 = call i32 @d_tptotimestr(%struct.timeparts* %16, i8* %21, i32 %22)
%24 = load i32, i32* %7
%25 = add nsw i32 %23, %24
%26 = add nsw i32 %25, 1
ret i32 %26
}

LLVM IR (-O2):
%struct.timeparts = type { i32 }
define i32 @d_tptostr(%struct.timeparts* %0, i8* %1, i32 %2) {
%4 = tail call i32 @d_tptodatestr(%struct.timeparts* %0, i8* %1, i32 %2)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 32, i8* %6
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = tail call i32 @d_tptotimestr(%struct.timeparts* %0, i8* %7, i32 %2)
%9 = add i32 %4, 1
%10 = add i32 %9, %8
ret i32 %10
}