#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*/ free(char *);
char *pipe2string(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *timlib_now_date_time(void) {
  char sys_string[256];
  char *now_date_string;
  char *now_time_string;
  static char now_date_time[32];
  strcpy(sys_string, "now.sh ymd");
  now_date_string = pipe2string(sys_string);
  strcpy(sys_string, "now.sh hhmmss | sed 's/\\([0-9][0-9]\\)$/:&/' | sed "
                     "'s/\\([0-9][0-9]:\\)/:&/'");
  now_time_string = pipe2string(sys_string);
  sprintf(now_date_time, "%s %s", now_date_string, now_time_string);
  free(now_date_string);
  free(now_time_string);
  return now_date_time;
}


x86 assembly (clang, -O0):
<timlib_now_date_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
lea    -0x100(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x100(%rbp),%rdi
call   1050 <pipe2string@plt>
mov    %rax,-0x108(%rbp)
lea    -0x100(%rbp),%rdi
lea    0xe8c(%rip),%rsi
call   1040 <strcpy@plt>
lea    -0x100(%rbp),%rdi
call   1050 <pipe2string@plt>
mov    %rax,-0x110(%rbp)
mov    -0x108(%rbp),%rdx
mov    -0x110(%rbp),%rcx
lea    0x2ea4(%rip),%rdi
lea    0xea2(%rip),%rsi
call   1060 <sprintf@plt>
mov    -0x108(%rbp),%rdi
call   1030 <free@plt>
mov    -0x110(%rbp),%rdi
call   1030 <free@plt>
lea    0x2e79(%rip),%rax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timlib_now_date_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x100,%rsp
lea    0xead(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1050 <pipe2string@plt>
mov    %rax,%r15
lea    0xe9b(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %r14,%rdi
call   1050 <pipe2string@plt>
mov    %rax,%rbx
lea    0x2ec6(%rip),%r14
lea    0xec4(%rip),%rsi
mov    %r14,%rdi
mov    %r15,%rdx
mov    %rax,%rcx
call   1060 <sprintf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@timlib_now_date_time.now_date_time = internal global [32 x i8] zeroinitializer
@.str = [11 x i8] c"now.sh ymd\00"
@.str.1 = [74 x i8] c"now.sh hhmmss | sed 's/\\([0-9][0-9]\\)$/:&/' | sed 's/\\([0-9][0-9]:\\)/:&/'\00"
@.str.2 = [6 x i8] c"%s %s\00"
define i8* @timlib_now_date_time() {
%1 = alloca [256 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = call i32 @strcpy(i8* %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%7 = call i8* @pipe2string(i8* %6)
store i8* %7, i8** %2
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%9 = call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%11 = call i8* @pipe2string(i8* %10)
store i8* %11, i8** %3
%12 = load i8*, i8** %2
%13 = load i8*, i8** %3
%14 = call i32 @sprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timlib_now_date_time.now_date_time, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %13)
%15 = load i8*, i8** %2
%16 = call i32 @free(i8* %15)
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timlib_now_date_time.now_date_time, i64 0, i64 0)
}

LLVM IR (-O2):
@timlib_now_date_time.now_date_time = internal global [32 x i8] zeroinitializer
@.str = [11 x i8] c"now.sh ymd\00"
@.str.1 = [74 x i8] c"now.sh hhmmss | sed 's/\\([0-9][0-9]\\)$/:&/' | sed 's/\\([0-9][0-9]:\\)/:&/'\00"
@.str.2 = [6 x i8] c"%s %s\00"
define i8* @timlib_now_date_time() {
%1 = alloca [256 x i8]
%2 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%3 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = call i8* @pipe2string(i8* %2)
%5 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.1, i64 0, i64 0))
%6 = call i8* @pipe2string(i8* %2)
%7 = call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @timlib_now_date_time.now_date_time, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* %6)
%8 = call i32 @free(i8* %4)
%9 = call i32 @free(i8* %6)
ret i8* getelementptr inbounds ([32 x i8], [32 x i8]* @timlib_now_date_time.now_date_time, i64 0, i64 0)
}