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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strftime(char *, int, char *, struct tm *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void get_time(char *date_time) {
  time_t now = time(NULL);
  struct tm *now_local = localtime(&now);
  char new_date[70];
  if (strftime(new_date, sizeof new_date, "%Y-%m-%d-%H:%M", now_local)) {
    fprintf(stdout, "Device seen on %s\n", new_date);
    strcpy(date_time, new_date);
  } else {
    fprintf(stderr, "strftime failed");
  }
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x18(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rcx
mov    $0x46,%esi
lea    0xe77(%rip),%rdx
call   1070 <strftime@plt>
cmp    $0x0,%rax
je     11c5 <get_time+0x75>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    -0x60(%rbp),%rdx
lea    0xe63(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <strcpy@plt>
jmp    11dc <get_time+0x8c>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
lea    0xe4d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %rdi,%r14
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
lea    0xe8a(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    $0x46,%esi
mov    %rax,%rcx
call   1070 <strftime@plt>
test   %rax,%rax
je     11b9 <get_time+0x69>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
lea    0xe72(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <strcpy@plt>
jmp    11d0 <get_time+0x80>
mov    0x2e20(%rip),%rax
mov    (%rax),%edi
lea    0xe59(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
add    $0x58,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%Y-%m-%d-%H:%M\00"
@stdout = global i32 0
@.str.1 = [19 x i8] c"Device seen on %s\0A\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"strftime failed\00"
define void @get_time(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca %struct.tm*
%5 = alloca [70 x i8]
store i8* %0, i8** %2
%6 = call i32 @time(i32* null)
store i32 %6, i32* %3
%7 = call %struct.tm* @localtime(i32* %3)
store %struct.tm* %7, %struct.tm** %4
%8 = getelementptr inbounds [70 x i8], [70 x i8]* %5, i64 0, i64 0
%9 = load %struct.tm*, %struct.tm** %4
%10 = call i64 @strftime(i8* %8, i32 70, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %19
12: ; preds = %1
%13 = load i32, i32* @stdout
%14 = getelementptr inbounds [70 x i8], [70 x i8]* %5, i64 0, i64 0
%15 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i8*, i8** %2
%17 = getelementptr inbounds [70 x i8], [70 x i8]* %5, i64 0, i64 0
%18 = call i32 @strcpy(i8* %16, i8* %17)
br label %22
19: ; preds = %1
%20 = load i32, i32* @stderr
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %22
22: ; preds = %19, %12
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32 }
@.str = [15 x i8] c"%Y-%m-%d-%H:%M\00"
@stdout = global i32 0
@.str.1 = [19 x i8] c"Device seen on %s\0A\00"
@stderr = global i32 0
@.str.2 = [16 x i8] c"strftime failed\00"
define void @get_time(i8* %0) {
%2 = alloca i32
%3 = alloca [70 x i8]
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call %struct.tm* @localtime(i32* %2)
%7 = getelementptr inbounds [70 x i8], [70 x i8]* %3, i64 0, i64 0
%8 = call i64 @strftime(i8* %7, i32 70, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.tm* %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %1
%11 = load i32, i32* @stdout
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%13 = call i32 @strcpy(i8* %0, i8* %7)
br label %17
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %14, %10
ret void
}