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

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
short *Timemark(short int *v) {
  struct tm *a;
  time_t t;
  time(&t);
  a = localtime(&t);
  v[0] = a->tm_year + 1900;
  v[1] = a->tm_mon + 1;
  v[2] = a->tm_mday;
  v[3] = a->tm_hour;
  v[4] = a->tm_min;
  v[5] = a->tm_sec;
  v[6] = 0;
  return v;
}


x86 assembly (clang, -O0):
<Timemark>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
add    $0x76c,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
add    $0x1,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x2(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0xa(%rax),%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x6(%rax)
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%cx
mov    -0x8(%rbp),%rax
mov    %cx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0xe(%rax),%cx
mov    -0x8(%rbp),%rax
mov    %cx,0xa(%rax)
mov    -0x8(%rbp),%rax
movw   $0x0,0xc(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timemark>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <time@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
mov    $0x76c,%ecx
add    (%rax),%ecx
mov    %cx,(%rbx)
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %cx,0x2(%rbx)
movzwl 0x8(%rax),%ecx
mov    %cx,0x4(%rbx)
movzwl 0xa(%rax),%ecx
mov    %cx,0x6(%rbx)
movzwl 0xc(%rax),%ecx
mov    %cx,0x8(%rbx)
movzwl 0xe(%rax),%eax
mov    %ax,0xa(%rbx)
movw   $0x0,0xc(%rbx)
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i16, i16, i16, i16 }
define i16* @Timemark(i16* %0) {
%2 = alloca i16*
%3 = alloca %struct.tm*
%4 = alloca i32
store i16* %0, i16** %2
%5 = call i32 @time(i32* %4)
%6 = call %struct.tm* @localtime(i32* %4)
store %struct.tm* %6, %struct.tm** %3
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1900
%11 = trunc i32 %10 to i16
%12 = load i16*, i16** %2
%13 = getelementptr inbounds i16, i16* %12, i64 0
store i16 %11, i16* %13
%14 = load %struct.tm*, %struct.tm** %3
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 1
%16 = load i32, i32* %15
%17 = add nsw i32 %16, 1
%18 = trunc i32 %17 to i16
%19 = load i16*, i16** %2
%20 = getelementptr inbounds i16, i16* %19, i64 1
store i16 %18, i16* %20
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 2
%23 = load i16, i16* %22
%24 = load i16*, i16** %2
%25 = getelementptr inbounds i16, i16* %24, i64 2
store i16 %23, i16* %25
%26 = load %struct.tm*, %struct.tm** %3
%27 = getelementptr inbounds %struct.tm, %struct.tm* %26, i32 0, i32 3
%28 = load i16, i16* %27
%29 = load i16*, i16** %2
%30 = getelementptr inbounds i16, i16* %29, i64 3
store i16 %28, i16* %30
%31 = load %struct.tm*, %struct.tm** %3
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 4
%33 = load i16, i16* %32
%34 = load i16*, i16** %2
%35 = getelementptr inbounds i16, i16* %34, i64 4
store i16 %33, i16* %35
%36 = load %struct.tm*, %struct.tm** %3
%37 = getelementptr inbounds %struct.tm, %struct.tm* %36, i32 0, i32 5
%38 = load i16, i16* %37
%39 = load i16*, i16** %2
%40 = getelementptr inbounds i16, i16* %39, i64 5
store i16 %38, i16* %40
%41 = load i16*, i16** %2
%42 = getelementptr inbounds i16, i16* %41, i64 6
store i16 0, i16* %42
%43 = load i16*, i16** %2
ret i16* %43
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i16, i16, i16, i16 }
define i16* @Timemark(i16* returned writeonly %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @localtime(i32* %2)
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 0
%7 = load i32, i32* %6
%8 = trunc i32 %7 to i16
%9 = add i16 %8, 1900
store i16 %9, i16* %0
%10 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 1
%11 = load i32, i32* %10
%12 = trunc i32 %11 to i16
%13 = add i16 %12, 1
%14 = getelementptr inbounds i16, i16* %0, i64 1
store i16 %13, i16* %14
%15 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 2
%16 = load i16, i16* %15
%17 = getelementptr inbounds i16, i16* %0, i64 2
store i16 %16, i16* %17
%18 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 3
%19 = load i16, i16* %18
%20 = getelementptr inbounds i16, i16* %0, i64 3
store i16 %19, i16* %20
%21 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 4
%22 = load i16, i16* %21
%23 = getelementptr inbounds i16, i16* %0, i64 4
store i16 %22, i16* %23
%24 = getelementptr inbounds %struct.tm, %struct.tm* %5, i64 0, i32 5
%25 = load i16, i16* %24
%26 = getelementptr inbounds i16, i16* %0, i64 5
store i16 %25, i16* %26
%27 = getelementptr inbounds i16, i16* %0, i64 6
store i16 0, i16* %27
ret i16* %0
}