#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 tm {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_datestamp(char *, struct tm *);
int /*<<< orphan*/ do_timestamp(char *, struct tm *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
char *do_long_timestamp(struct tm *t) {
  static char longbuf[40];
  char datebuf[20], timebuf[20];
  do_datestamp(datebuf, t);
  do_timestamp(timebuf, t);
  if (timebuf[0] == ' ')
    sprintf(longbuf, "%s %s", datebuf, timebuf + 1);
  else
    sprintf(longbuf, "%s %s", datebuf, timebuf);
  return longbuf;
}


x86 assembly (clang, -O0):
<do_long_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <do_datestamp@plt>
lea    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <do_timestamp@plt>
movsbl -0x40(%rbp),%eax
cmp    $0x20,%eax
jne    1187 <do_long_timestamp+0x57>
lea    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
add    $0x1,%rcx
lea    0x2eda(%rip),%rdi
lea    0xe83(%rip),%rsi
call   1050 <sprintf@plt>
jmp    11a2 <do_long_timestamp+0x72>
lea    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    0x2eba(%rip),%rdi
lea    0xe63(%rip),%rsi
call   1050 <sprintf@plt>
lea    0x2ea7(%rip),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_long_timestamp>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdi,%rbx
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <do_datestamp@plt>
mov    %rsp,%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <do_timestamp@plt>
cmpb   $0x20,(%rsp)
lea    0x1(%rsp),%rcx
cmovne %r15,%rcx
lea    0x2ee2(%rip),%rbx
lea    0xe8b(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@do_long_timestamp.longbuf = internal global [40 x i8] zeroinitializer
@.str = [6 x i8] c"%s %s\00"
define i8* @do_long_timestamp(%struct.tm* %0) {
%2 = alloca %struct.tm*
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
store %struct.tm* %0, %struct.tm** %2
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = load %struct.tm*, %struct.tm** %2
%7 = call i32 @do_datestamp(i8* %5, %struct.tm* %6)
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%9 = load %struct.tm*, %struct.tm** %2
%10 = call i32 @do_timestamp(i8* %8, %struct.tm* %9)
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %20
15: ; preds = %1
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%18 = getelementptr inbounds i8, i8* %17, i64 1
%19 = call i32 @sprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @do_long_timestamp.longbuf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %16, i8* %18)
br label %24
20: ; preds = %1
%21 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%23 = call i32 @sprintf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @do_long_timestamp.longbuf, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %21, i8* %22)
br label %24
24: ; preds = %20, %15
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @do_long_timestamp.longbuf, i64 0, i64 0)
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@do_long_timestamp.longbuf = internal global [40 x i8] zeroinitializer
@.str = [6 x i8] c"%s %s\00"
define i8* @do_long_timestamp(%struct.tm* %0) {
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%6 = call i32 @do_datestamp(i8* %4, %struct.tm* %0)
%7 = call i32 @do_timestamp(i8* %5, %struct.tm* %0)
%8 = load i8, i8* %5
%9 = icmp eq i8 %8, 32
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 1
%11 = select i1 %9, i8* %10, i8* %5
%12 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @do_long_timestamp.longbuf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %11)
ret i8* getelementptr inbounds ([40 x i8], [40 x i8]* @do_long_timestamp.longbuf, i64 0, i64 0)
}