#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 tm_mon;
  int tm_mday;
  int tm_year;
  int tm_hour;
  int tm_min;
  int tm_sec;
};

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int /*<<< orphan*/ stderr;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t t;
  struct tm *local_gm;
  if ((t = time(NULL)) < 0) {
    fprintf(stderr, "Err.(%s) getting time\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  local_gm = gmtime(&t);
  printf("%d/%d/%d - %d:%d:%d\n", local_gm->tm_mon, local_gm->tm_mday,
         local_gm->tm_year + 1900, local_gm->tm_hour, local_gm->tm_min,
         local_gm->tm_sec);
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jge    11be <main+0x5e>
mov    0x2e55(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
mov    0x2e41(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
mov    -0x14(%rbp),%edi
mov    %rax,%rdx
lea    0xe55(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>
lea    -0x8(%rbp),%rdi
call   1060 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x76c,%ecx
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%r8d
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%r9d
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xe14(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
mov    0x2db6(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0xc(%rsp)
test   %eax,%eax
js     11b4 <main+0x54>
lea    0xc(%rsp),%rdi
call   1060 <gmtime@plt>
mov    (%rax),%esi
mov    $0x76c,%ecx
add    0x8(%rax),%ecx
mov    0x4(%rax),%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
mov    %eax,(%rsp)
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e25(%rip),%rax
mov    (%rax),%ebx
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
call   1080 <strerror@plt>
lea    0xe2e(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    0x2ded(%rip),%rax
mov    (%rax),%edi
call   1070 <exit@plt>

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [23 x i8] c"Err.(%s) getting time\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [21 x i8] c"%d/%d/%d - %d:%d:%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
store i32 %4, i32* %2
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %13
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = load i32, i32* @errno
%9 = call i8* @strerror(i32 %8)
%10 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %0
%14 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %14, %struct.tm** %3
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = load %struct.tm*, %struct.tm** %3
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 1
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 2
%23 = load i32, i32* %22
%24 = add nsw i32 %23, 1900
%25 = load %struct.tm*, %struct.tm** %3
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 3
%27 = load i32, i32* %26
%28 = load %struct.tm*, %struct.tm** %3
%29 = getelementptr inbounds %struct.tm, %struct.tm* %28, i32 0, i32 4
%30 = load i32, i32* %29
%31 = load %struct.tm*, %struct.tm** %3
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 5
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %20, i32 %24, i32 %27, i32 %30, i32 %33)
%35 = load i32, i32* @EXIT_SUCCESS
ret i32 %35
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@stderr = global i32 0
@.str = [23 x i8] c"Err.(%s) getting time\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.1 = [21 x i8] c"%d/%d/%d - %d:%d:%d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %12
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = load i32, i32* @errno
%8 = tail call i8* @strerror(i32 %7)
%9 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %8)
%10 = load i32, i32* @EXIT_FAILURE
%11 = tail call i32 @exit(i32 %10)
unreachable
12: ; preds = %0
%13 = call %struct.tm* @gmtime(i32* %1)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 0
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 1
%17 = load i32, i32* %16
%18 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 2
%19 = load i32, i32* %18
%20 = add nsw i32 %19, 1900
%21 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 3
%22 = load i32, i32* %21
%23 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 4
%24 = load i32, i32* %23
%25 = getelementptr inbounds %struct.tm, %struct.tm* %13, i64 0, i32 5
%26 = load i32, i32* %25
%27 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17, i32 %20, i32 %22, i32 %24, i32 %26)
%28 = load i32, i32* @EXIT_SUCCESS
ret i32 %28
}