#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 */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
char *str_dup(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *time_str(time_t last_time) {
  char *strtime = ctime(&last_time);
  char buf1[100], buf2[100];
  strtime[strlen(strtime) - 6] = '\0';
  strcpy(buf1, strtime);
  strcpy(buf2, &buf1[4]);
  return str_dup(buf2);
}


x86 assembly (clang, -O0):
<time_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <ctime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0xf8(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0xf8(%rbp),%rax
sub    $0x6,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    -0x80(%rbp),%rsi
add    $0x4,%rsi
call   1030 <strcpy@plt>
lea    -0xf0(%rbp),%rdi
call   1060 <str_dup@plt>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_str>:
push   %rbx
sub    $0xf0,%rsp
mov    %edi,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1040 <ctime@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x6(%rax,%rbx,1)
lea    0x10(%rsp),%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
lea    0x14(%rsp),%rsi
lea    0x80(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
call   1060 <str_dup@plt>
add    $0xf0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i8* @time_str(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
store i32 %0, i32* %2
%6 = call i8* @ctime(i32* %2)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @strlen(i8* %8)
%10 = sub nsw i32 %9, 6
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
store i8 0, i8* %12
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = load i8*, i8** %3
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%17 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 4
%18 = call i32 @strcpy(i8* %16, i8* %17)
%19 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%20 = call i8* @str_dup(i8* %19)
ret i8* %20
}

LLVM IR (-O2):
define i8* @time_str(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
store i32 %0, i32* %2
%5 = call i8* @ctime(i32* %2)
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%8 = call i32 @strlen(i8* %5)
%9 = add nsw i32 %8, -6
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %5, i64 %10
store i8 0, i8* %11
%12 = call i32 @strcpy(i8* %6, i8* %5)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 4
%14 = call i32 @strcpy(i8* %7, i8* %13)
%15 = call i8* @str_dup(i8* %7)
ret i8* %15
}