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

/* Variables and functions */
char *asctime(struct tm *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
struct tm *gmtime(int /*<<< orphan*/ *);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strncpy(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int zulutime(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ zulutime1(int /*<<< orphan*/ *);
int main(void) {
  struct tm *tms;
  time_t ltime = time(NULL);
  char timestamp[26];
  char zulu[22];
  bzero(timestamp, 26);
  strncpy(timestamp, ctime(&ltime), 24);
  fprintf(stdout, "%s\thello world\n", timestamp);
  bzero(timestamp, 26);
  strncpy(timestamp, zulutime1(&ltime), 22);
  fprintf(stdout, "%s\thello world\n", timestamp);
  printf("%s\tasctime(localtime())\n", asctime(localtime(&ltime)));
  printf("%s\tasctime(localtime())\n", asctime(gmtime(&ltime)));
  tms = gmtime(&ltime);
  printf("zulu time: %.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ\n", tms->tm_year + 1900,
         tms->tm_mon + 1, tms->tm_mday, tms->tm_hour, tms->tm_min, tms->tm_sec);
  if (-1 == zulutime(&ltime, zulu, 22)) {
    fprintf(stderr, "zulutime error\n");
  }
  printf("zulutime: %s\n", zulu);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1090 <time@plt>
mov    %eax,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x1a,%esi
call   10a0 <bzero@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <ctime@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
mov    $0x18,%edx
call   1040 <strncpy@plt>
mov    0x2dd7(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rdx
lea    0xdf2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x30(%rbp),%rdi
mov    $0x1a,%esi
call   10a0 <bzero@plt>
lea    -0x30(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x14(%rbp),%rdi
call   10c0 <zulutime1@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%esi
mov    $0x16,%edx
call   1040 <strncpy@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%edi
lea    -0x30(%rbp),%rdx
lea    0xda8(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1060 <asctime@plt>
mov    %rax,%rsi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x14(%rbp),%rdi
call   10b0 <gmtime@plt>
mov    %rax,%rdi
call   1060 <asctime@plt>
mov    %rax,%rsi
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x14(%rbp),%rdi
call   10b0 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
add    $0x76c,%esi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edx
add    $0x1,%edx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%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    0xd3e(%rip),%rdi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x50(%rbp),%rsi
lea    -0x14(%rbp),%rdi
mov    $0x16,%edx
call   10d0 <zulutime@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
jne    132d <main+0x17d>
mov    0x2cc3(%rip),%rax
mov    (%rax),%edi
lea    0xd2e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x50(%rbp),%rsi
lea    0xd2c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x58,%rsp
xor    %edi,%edi
call   1090 <time@plt>
mov    %eax,0xc(%rsp)
lea    0x30(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1a,%esi
call   10a0 <bzero@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1050 <ctime@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x18,%edx
call   1040 <strncpy@plt>
mov    0x2ddd(%rip),%r12
mov    (%r12),%edi
lea    0xdfa(%rip),%r15
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %rbx,%rdi
mov    $0x1a,%esi
call   10a0 <bzero@plt>
mov    %r14,%rdi
call   10c0 <zulutime1@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    $0x16,%edx
call   1040 <strncpy@plt>
mov    (%r12),%edi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    %r14,%rdi
call   1030 <localtime@plt>
mov    %rax,%rdi
call   1060 <asctime@plt>
lea    0xdb1(%rip),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   10b0 <gmtime@plt>
mov    %rax,%rdi
call   1060 <asctime@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
call   10b0 <gmtime@plt>
mov    $0x76c,%esi
add    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
add    $0x1,%edx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
mov    %eax,(%rsp)
lea    0xd73(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
mov    $0x16,%edx
call   10d0 <zulutime@plt>
cmp    $0xffffffff,%eax
jne    12eb <main+0x13b>
mov    0x2d05(%rip),%rax
mov    (%rax),%edi
lea    0xd70(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xd72(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@stdout = global i32 0
@.str = [16 x i8] c"%s\09hello world\0A\00"
@.str.1 = [25 x i8] c"%s\09asctime(localtime())\0A\00"
@.str.2 = [43 x i8] c"zulu time: %.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ\0A\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"zulutime error\0A\00"
@.str.4 = [14 x i8] c"zulutime: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = alloca i32
%4 = alloca [26 x i8]
%5 = alloca [22 x i8]
store i32 0, i32* %1
%6 = call i32 @time(i32* null)
store i32 %6, i32* %3
%7 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%8 = call i32 @bzero(i8* %7, i32 26)
%9 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%10 = call i32 @ctime(i32* %3)
%11 = call i32 @strncpy(i8* %9, i32 %10, i32 24)
%12 = load i32, i32* @stdout
%13 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %12, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%16 = call i32 @bzero(i8* %15, i32 26)
%17 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%18 = call i32 @zulutime1(i32* %3)
%19 = call i32 @strncpy(i8* %17, i32 %18, i32 22)
%20 = load i32, i32* @stdout
%21 = getelementptr inbounds [26 x i8], [26 x i8]* %4, i64 0, i64 0
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %20, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call %struct.tm* @localtime(i32* %3)
%24 = call i8* @asctime(%struct.tm* %23)
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = call %struct.tm* @gmtime(i32* %3)
%27 = call i8* @asctime(%struct.tm* %26)
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = call %struct.tm* @gmtime(i32* %3)
store %struct.tm* %29, %struct.tm** %2
%30 = load %struct.tm*, %struct.tm** %2
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 0
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 1900
%34 = load %struct.tm*, %struct.tm** %2
%35 = getelementptr inbounds %struct.tm, %struct.tm* %34, i32 0, i32 1
%36 = load i32, i32* %35
%37 = add nsw i32 %36, 1
%38 = load %struct.tm*, %struct.tm** %2
%39 = getelementptr inbounds %struct.tm, %struct.tm* %38, i32 0, i32 2
%40 = load i32, i32* %39
%41 = load %struct.tm*, %struct.tm** %2
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 3
%43 = load i32, i32* %42
%44 = load %struct.tm*, %struct.tm** %2
%45 = getelementptr inbounds %struct.tm, %struct.tm* %44, i32 0, i32 4
%46 = load i32, i32* %45
%47 = load %struct.tm*, %struct.tm** %2
%48 = getelementptr inbounds %struct.tm, %struct.tm* %47, i32 0, i32 5
%49 = load i32, i32* %48
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %33, i32 %37, i32 %40, i32 %43, i32 %46, i32 %49)
%51 = getelementptr inbounds [22 x i8], [22 x i8]* %5, i64 0, i64 0
%52 = call i32 @zulutime(i32* %3, i8* %51, i32 22)
%53 = icmp eq i32 -1, %52
br i1 %53, label %54, label %57
54: ; preds = %0
%55 = load i32, i32* @stderr
%56 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %57
57: ; preds = %54, %0
%58 = getelementptr inbounds [22 x i8], [22 x i8]* %5, i64 0, i64 0
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %58)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@stdout = global i32 0
@.str = [16 x i8] c"%s\09hello world\0A\00"
@.str.1 = [25 x i8] c"%s\09asctime(localtime())\0A\00"
@.str.2 = [43 x i8] c"zulu time: %.4d-%.2d-%.2dT%.2d:%.2d:%.2dZ\0A\00"
@stderr = global i32 0
@.str.3 = [16 x i8] c"zulutime error\0A\00"
@.str.4 = [14 x i8] c"zulutime: %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [26 x i8]
%3 = alloca [22 x i8]
%4 = bitcast i32* %1 to i8*
%5 = tail call i32 @time(i32* null)
store i32 %5, i32* %1
%6 = getelementptr inbounds [26 x i8], [26 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [22 x i8], [22 x i8]* %3, i64 0, i64 0
%8 = call i32 @bzero(i8* %6, i32 26)
%9 = call i32 @ctime(i32* %1)
%10 = call i32 @strncpy(i8* %6, i32 %9, i32 24)
%11 = load i32, i32* @stdout
%12 = call i32 (i32, i8*, ...) @fprintf(i32 %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%13 = call i32 @bzero(i8* %6, i32 26)
%14 = call i32 @zulutime1(i32* %1)
%15 = call i32 @strncpy(i8* %6, i32 %14, i32 22)
%16 = load i32, i32* @stdout
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %6)
%18 = call %struct.tm* @localtime(i32* %1)
%19 = call i8* @asctime(%struct.tm* %18)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %19)
%21 = call %struct.tm* @gmtime(i32* %1)
%22 = call i8* @asctime(%struct.tm* %21)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = call %struct.tm* @gmtime(i32* %1)
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 0
%26 = load i32, i32* %25
%27 = add nsw i32 %26, 1900
%28 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 1
%29 = load i32, i32* %28
%30 = add nsw i32 %29, 1
%31 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 2
%32 = load i32, i32* %31
%33 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 3
%34 = load i32, i32* %33
%35 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 4
%36 = load i32, i32* %35
%37 = getelementptr inbounds %struct.tm, %struct.tm* %24, i64 0, i32 5
%38 = load i32, i32* %37
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.2, i64 0, i64 0), i32 %27, i32 %30, i32 %32, i32 %34, i32 %36, i32 %38)
%40 = call i32 @zulutime(i32* %1, i8* %7, i32 22)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %45
42: ; preds = %0
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
br label %45
45: ; preds = %42, %0
%46 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i8* %7)
ret i32 0
}