#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 scalar_t__ time_t;

/* Variables and functions */
int /*<<< orphan*/ ctime(scalar_t__ *);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ strcpy(char *, int /*<<< orphan*/);
scalar_t__ time(int /*<<< orphan*/ *);
void get_time_string(char *buff, time_t last_online) {
  time_t act_time;
  char timebuff[30];
  act_time = time(NULL);
  if (last_online == 0) {
    sprintf(buff, "never");
    return;
  }
  strcpy(timebuff, ctime(&last_online));
  if ((act_time - last_online) > 86400) {
    timebuff[10] = '\0';
    sprintf(buff, "%s", &timebuff[4]);
    return;
  } else {
    timebuff[19] = '\0';
    sprintf(buff, "%s", &timebuff[11]);
    return;
  }
}


x86 assembly (clang, -O0):
<get_time_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117f <get_time_string+0x3f>
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
jmp    11f0 <get_time_string+0xb0>
lea    -0x40(%rbp),%rax
mov    %rax,-0x48(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <ctime@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
cmp    $0x15180,%rax
jle    11d2 <get_time_string+0x92>
movb   $0x0,-0x36(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
add    $0x4,%rdx
lea    0xe40(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
jmp    11f0 <get_time_string+0xb0>
movb   $0x0,-0x2d(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rdx
add    $0xb,%rdx
lea    0xe1d(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time_string>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,0x8(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
test   %rbx,%rbx
je     1183 <get_time_string+0x53>
mov    %rax,%r15
lea    0x8(%rsp),%rdi
call   1040 <ctime@plt>
lea    0x10(%rsp),%rdi
mov    %eax,%esi
call   1030 <strcpy@plt>
sub    0x8(%rsp),%r15
cmp    $0x15181,%r15
jl     1193 <get_time_string+0x63>
movb   $0x0,0x1a(%rsp)
lea    0x14(%rsp),%rsi
jmp    119d <get_time_string+0x6d>
movw   $0x72,0x4(%r14)
movl   $0x6576656e,(%r14)
jmp    11a5 <get_time_string+0x75>
movb   $0x0,0x23(%rsp)
lea    0x1b(%rsp),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"never\00"
@.str.1 = [3 x i8] c"%s\00"
define void @get_time_string(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca [30 x i8]
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = call i64 @time(i32* null)
store i64 %7, i64* %5
%8 = load i64, i64* %4
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %11, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
br label %31
13: ; preds = %2
%14 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 0
%15 = call i32 @ctime(i64* %4)
%16 = call i32 @strcpy(i8* %14, i32 %15)
%17 = load i64, i64* %5
%18 = load i64, i64* %4
%19 = sub nsw i64 %17, %18
%20 = icmp sgt i64 %19, 86400
br i1 %20, label %21, label %26
21: ; preds = %13
%22 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 10
store i8 0, i8* %22
%23 = load i8*, i8** %3
%24 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 4
%25 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %24)
br label %31
26: ; preds = %13
%27 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 19
store i8 0, i8* %27
%28 = load i8*, i8** %3
%29 = getelementptr inbounds [30 x i8], [30 x i8]* %6, i64 0, i64 11
%30 = call i32 (i8*, i8*, ...) @sprintf(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %29)
br label %31
31: ; preds = %26, %21, %10
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"never\00"
define void @get_time_string(i8* %0, i64 %1) {
%3 = alloca i64
%4 = alloca [30 x i8]
store i64 %1, i64* %3
%5 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 0
%6 = tail call i64 @time(i32* null)
%7 = icmp eq i64 %1, 0
br i1 %7, label %8, label %9
8: ; preds = %2
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(6) %0, i8* align 1 dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64 6, i1 false)
br label %23
9: ; preds = %2
%10 = call i32 @ctime(i64* %3)
%11 = call i32 @strcpy(i8* %5, i32 %10)
%12 = load i64, i64* %3
%13 = sub nsw i64 %6, %12
%14 = icmp sgt i64 %13, 86400
br i1 %14, label %15, label %19
15: ; preds = %9
%16 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 10
store i8 0, i8* %16
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 4
%18 = call i8* bitcast (i32 (i8*, i32)* @strcpy to i8* (i8*, i8*)*)(i8* %0, i8* %17)
br label %23
19: ; preds = %9
%20 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 19
store i8 0, i8* %20
%21 = getelementptr inbounds [30 x i8], [30 x i8]* %4, i64 0, i64 11
%22 = call i8* bitcast (i32 (i8*, i32)* @strcpy to i8* (i8*, i8*)*)(i8* %0, i8* %21)
br label %23
23: ; preds = %19, %15, %8
ret void
}