#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_mday;
  size_t tm_mon;
  int tm_hour;
  int tm_min;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memcpy(char *, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int, ...);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void getAscTime(time_t mtime, char *mon, int *day, char *yeartime) {
  struct tm *stdtime;
  char *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
                    "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
  int curyear;
  time_t curtime = time(NULL);
  stdtime = localtime(&curtime);
  curyear = stdtime->tm_year;
  stdtime = localtime(&mtime);
  *day = stdtime->tm_mday;
  memcpy(mon, months[stdtime->tm_mon], 4);
  if (curyear == stdtime->tm_year) {
    sprintf(yeartime, "%.2d:%.2d", stdtime->tm_hour, stdtime->tm_min);
  } else {
    sprintf(yeartime, "%d", 1900 + stdtime->tm_year);
  }
}


x86 assembly (clang, -O0):
<getAscTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
lea    0x2c58(%rip),%rsi
mov    $0x60,%edx
call   1040 <memcpy@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x98(%rbp)
lea    -0x98(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%rax
mov    -0x90(%rbp,%rax,8),%rsi
ff
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    -0x94(%rbp),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jne    120c <getAscTime+0xcc>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    0x10(%rax),%edx
mov    -0x28(%rbp),%rax
mov    0x14(%rax),%ecx
lea    0xe30(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
jmp    122a <getAscTime+0xea>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%edx
add    $0x76c,%edx
lea    0xe17(%rip),%rsi
mov    $0x0,%al
call   1060 <sprintf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getAscTime>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %edi,0xc(%rsp)
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rdi
call   1030 <localtime@plt>
mov    (%rax),%ebp
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    0x4(%rax),%eax
mov    %eax,(%r12)
mov    0x8(%rbx),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
mov    %r15,%rdi
mov    $0x4,%edx
call   1040 <memcpy@plt>
mov    (%rbx),%edx
cmp    %edx,%ebp
jne    11c2 <getAscTime+0x82>
mov    0x10(%rbx),%edx
mov    0x14(%rbx),%ecx
lea    0xe7a(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
jmp    11d9 <getAscTime+0x99>
add    $0x76c,%edx
lea    0xe6b(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <sprintf@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i64, i32, i32 }
@.str = [4 x i8] c"Jan\00"
@.str.1 = [4 x i8] c"Feb\00"
@.str.2 = [4 x i8] c"Mar\00"
@.str.3 = [4 x i8] c"Apr\00"
@.str.4 = [4 x i8] c"May\00"
@.str.5 = [4 x i8] c"Jun\00"
@.str.6 = [4 x i8] c"Jul\00"
@.str.7 = [4 x i8] c"Aug\00"
@.str.8 = [4 x i8] c"Sep\00"
@.str.9 = [4 x i8] c"Oct\00"
@.str.10 = [4 x i8] c"Nov\00"
@.str.11 = [4 x i8] c"Dec\00"
@__const.getAscTime.months = [12 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0)]
@.str.12 = [10 x i8] c"%.2d:%.2d\00"
@.str.13 = [3 x i8] c"%d\00"
define void @getAscTime(i32 %0, i8* %1, i32* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca %struct.tm*
%10 = alloca [12 x i8*]
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%13 = bitcast [12 x i8*]* %10 to i8*
%14 = call i32 @time(i32* null)
store i32 %14, i32* %12
%15 = call %struct.tm* @localtime(i32* %12)
store %struct.tm* %15, %struct.tm** %9
%16 = load %struct.tm*, %struct.tm** %9
%17 = getelementptr inbounds %struct.tm, %struct.tm* %16, i32 0, i32 0
%18 = load i32, i32* %17
store i32 %18, i32* %11
%19 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %19, %struct.tm** %9
%20 = load %struct.tm*, %struct.tm** %9
%21 = getelementptr inbounds %struct.tm, %struct.tm* %20, i32 0, i32 1
%22 = load i32, i32* %21
%23 = load i32*, i32** %7
store i32 %22, i32* %23
%24 = load i8*, i8** %6
%25 = load %struct.tm*, %struct.tm** %9
%26 = getelementptr inbounds %struct.tm, %struct.tm* %25, i32 0, i32 2
%27 = load i64, i64* %26
%28 = getelementptr inbounds [12 x i8*], [12 x i8*]* %10, i64 0, i64 %27
%29 = load i8*, i8** %28
%30 = call i32 @memcpy(i8* %24, i8* %29, i32 4)
%31 = load i32, i32* %11
%32 = load %struct.tm*, %struct.tm** %9
%33 = getelementptr inbounds %struct.tm, %struct.tm* %32, i32 0, i32 0
%34 = load i32, i32* %33
%35 = icmp eq i32 %31, %34
br i1 %35, label %36, label %45
36: ; preds = %4
%37 = load i8*, i8** %8
%38 = load %struct.tm*, %struct.tm** %9
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 3
%40 = load i32, i32* %39
%41 = load %struct.tm*, %struct.tm** %9
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 4
%43 = load i32, i32* %42
%44 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 %40, i32 %43)
br label %52
45: ; preds = %4
%46 = load i8*, i8** %8
%47 = load %struct.tm*, %struct.tm** %9
%48 = getelementptr inbounds %struct.tm, %struct.tm* %47, i32 0, i32 0
%49 = load i32, i32* %48
%50 = add nsw i32 1900, %49
%51 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %50)
br label %52
52: ; preds = %45, %36
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i64, i32, i32 }
@.str = [4 x i8] c"Jan\00"
@.str.1 = [4 x i8] c"Feb\00"
@.str.2 = [4 x i8] c"Mar\00"
@.str.3 = [4 x i8] c"Apr\00"
@.str.4 = [4 x i8] c"May\00"
@.str.5 = [4 x i8] c"Jun\00"
@.str.6 = [4 x i8] c"Jul\00"
@.str.7 = [4 x i8] c"Aug\00"
@.str.8 = [4 x i8] c"Sep\00"
@.str.9 = [4 x i8] c"Oct\00"
@.str.10 = [4 x i8] c"Nov\00"
@.str.11 = [4 x i8] c"Dec\00"
@reltable.getAscTime = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.getAscTime to i64)) to i32)]
@.str.12 = [10 x i8] c"%.2d:%.2d\00"
@.str.13 = [3 x i8] c"%d\00"
define void @getAscTime(i32 %0, i8* %1, i32* nocapture writeonly %2, i8* nocapture writeonly %3) {
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %5
%7 = bitcast i32* %6 to i8*
%8 = tail call i32 @time(i32* null)
store i32 %8, i32* %6
%9 = call %struct.tm* @localtime(i32* %6)
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i64 0, i32 0
%11 = load i32, i32* %10
%12 = call %struct.tm* @localtime(i32* %5)
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 1
%14 = load i32, i32* %13
store i32 %14, i32* %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 2
%16 = load i64, i64* %15
%17 = shl i64 %16, 2
%18 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.getAscTime to i8*), i64 %17)
%19 = call i32 @memcpy(i8* %1, i8* %18, i32 4)
%20 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 0
%21 = load i32, i32* %20
%22 = icmp eq i32 %11, %21
br i1 %22, label %23, label %29
23: ; preds = %4
%24 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 3
%25 = load i32, i32* %24
%26 = getelementptr inbounds %struct.tm, %struct.tm* %12, i64 0, i32 4
%27 = load i32, i32* %26
%28 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0), i32 %25, i32 %27)
br label %32
29: ; preds = %4
%30 = add nsw i32 %21, 1900
%31 = call i32 (i8*, i8*, i32, ...) @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %23
ret void
}