#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 */
char *date_get_now_hh_colon_mm_colon_ss(int /*<<< orphan*/);
int /*<<< orphan*/ date_utc_offset();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *date_append_hhmmss(char *date_string) {
  static char date_hhmmss[32];
  char *hhmmss;
  if (!date_string || !*date_string)
    return "";
  hhmmss = date_get_now_hh_colon_mm_colon_ss(date_utc_offset());
  sprintf(date_hhmmss, "%s %s", date_string, hhmmss);
  free(hhmmss);
  return date_hhmmss;
}


x86 assembly (clang, -O0):
<date_append_hhmmss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1164 <date_append_hhmmss+0x24>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1174 <date_append_hhmmss+0x34>
lea    0xe9a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b5 <date_append_hhmmss+0x75>
mov    $0x0,%al
call   1050 <date_utc_offset@plt>
mov    %eax,%edi
call   1040 <date_get_now_hh_colon_mm_colon_ss@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0x2ebb(%rip),%rdi
lea    0xe64(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
lea    0x2e9f(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<date_append_hhmmss>:
push   %r15
push   %r14
push   %rbx
lea    0xeb9(%rip),%r14
test   %rdi,%rdi
je     118e <date_append_hhmmss+0x4e>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     118e <date_append_hhmmss+0x4e>
xor    %eax,%eax
call   1050 <date_utc_offset@plt>
mov    %eax,%edi
call   1040 <date_get_now_hh_colon_mm_colon_ss@plt>
mov    %rax,%r15
lea    0x2edf(%rip),%r14
lea    0xe88(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
mov    %rax,%rcx
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@date_append_hhmmss.date_hhmmss = internal global [32 x i8] zeroinitializer
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"%s %s\00"
define i8* @date_append_hhmmss(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = icmp ne i8 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %7, %1
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %2
br label %20
12: ; preds = %7
%13 = call i32 (...) @date_utc_offset()
%14 = call i8* @date_get_now_hh_colon_mm_colon_ss(i32 %13)
store i8* %14, i8** %4
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @date_append_hhmmss.date_hhmmss, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i8*, i8** %4
%19 = call i32 @free(i8* %18)
store i8* getelementptr inbounds ([32 x i8], [32 x i8]* @date_append_hhmmss.date_hhmmss, i64 0, i64 0), i8** %2
br label %20
20: ; preds = %12, %11
%21 = load i8*, i8** %2
ret i8* %21
}

LLVM IR (-O2):
@date_append_hhmmss.date_hhmmss = internal global [32 x i8] zeroinitializer
@.str = [1 x i8] zeroinitializer
@.str.1 = [6 x i8] c"%s %s\00"
define i8* @date_append_hhmmss(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i32 (...) @date_utc_offset()
%8 = tail call i8* @date_get_now_hh_colon_mm_colon_ss(i32 %7)
%9 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @date_append_hhmmss.date_hhmmss, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %8)
%10 = tail call i32 @free(i8* %8)
br label %11
11: ; preds = %1, %3, %6
%12 = phi i8* [ getelementptr inbounds ([32 x i8], [32 x i8]* @date_append_hhmmss.date_hhmmss, i64 0, i64 0), %6 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %12
}