#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*/ localtime(scalar_t__ *);
int /*<<< orphan*/ strftime(char *, int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strncpy(char *, char *, int);
scalar_t__ time(int /*<<< orphan*/ *);
void repr_arrival_time(char *buffer, time_t arrival) {
  time_t current_time = time(NULL);
  if (arrival == 0)
    strncpy(buffer, "unknown", (128) - 1);
  else {
    if (arrival <= current_time)
      arrival = current_time + 3;
    strftime(buffer, (128), "%a %b %e %T %Y", localtime(&arrival));
  }
}


x86 assembly (clang, -O0):
<repr_arrival_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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    1182 <repr_arrival_time+0x42>
mov    -0x8(%rbp),%rdi
lea    0xe8d(%rip),%rsi
mov    $0x7f,%edx
call   1040 <strncpy@plt>
jmp    11c4 <repr_arrival_time+0x84>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jg     119c <repr_arrival_time+0x5c>
mov    -0x18(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <localtime@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%ecx
mov    $0x80,%esi
lea    0xe49(%rip),%rdx
call   1060 <strftime@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repr_arrival_time>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
test   %rbx,%rbx
je     118d <repr_arrival_time+0x4d>
cmp    %rbx,%rax
jl     1167 <repr_arrival_time+0x27>
add    $0x3,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
call   1030 <localtime@plt>
lea    0xe92(%rip),%rdx
mov    %r14,%rdi
mov    $0x80,%esi
mov    %eax,%ecx
call   1060 <strftime@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xe6c(%rip),%rsi
mov    %r14,%rdi
mov    $0x7f,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <strncpy@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [15 x i8] c"%a %b %e %T %Y\00"
define void @repr_arrival_time(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = call i64 @time(i32* null)
store i64 %6, i64* %5
%7 = load i64, i64* %4
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %3
%11 = call i32 @strncpy(i8* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 127)
br label %23
12: ; preds = %2
%13 = load i64, i64* %4
%14 = load i64, i64* %5
%15 = icmp sle i64 %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i64, i64* %5
%18 = add nsw i64 %17, 3
store i64 %18, i64* %4
br label %19
19: ; preds = %16, %12
%20 = load i8*, i8** %3
%21 = call i32 @localtime(i64* %4)
%22 = call i32 @strftime(i8* %20, i32 128, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %19, %9
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
@.str.1 = [15 x i8] c"%a %b %e %T %Y\00"
define void @repr_arrival_time(i8* %0, i64 %1) {
%3 = alloca i64
store i64 %1, i64* %3
%4 = tail call i64 @time(i32* null)
%5 = icmp eq i64 %1, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strncpy(i8* %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 127)
br label %15
8: ; preds = %2
%9 = icmp slt i64 %4, %1
br i1 %9, label %12, label %10
10: ; preds = %8
%11 = add nsw i64 %4, 3
store i64 %11, i64* %3
br label %12
12: ; preds = %10, %8
%13 = call i32 @localtime(i64* %3)
%14 = call i32 @strftime(i8* %0, i32 128, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %13)
br label %15
15: ; preds = %12, %6
ret void
}