#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_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_wday;
  int tm_yday;
  int tm_isdst;
};

/* Variables and functions */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t t;
  struct tm *ts;
  char buf[80];
  t = time(NULL);
  ts = gmtime(&t);
  printf("%d seconds\n", ts->tm_sec);
  printf("%d min\n", ts->tm_min);
  printf("%d hour\n", ts->tm_hour);
  printf("%d day\n", ts->tm_mday);
  printf("%d month\n", ts->tm_mon);
  printf("%d year since 1900\n", ts->tm_year);
  printf("%d day since sunday\n", ts->tm_wday);
  printf("%d days since jan\n", ts->tm_yday);
  printf("%d daylight saving time\n", ts->tm_isdst);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1050 <gmtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%esi
lea    0xe7f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%esi
lea    0xe6e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <gmtime@plt>
mov    %rax,%rbx
mov    (%rax),%esi
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
mov    0x8(%rbx),%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
mov    0xc(%rbx),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    0x10(%rbx),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    0x14(%rbx),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
mov    0x18(%rbx),%esi
lea    0xe93(%rip),%rdi
call   1030 <printf@plt>
mov    0x1c(%rbx),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    0x20(%rbx),%esi
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [12 x i8] c"%d seconds\0A\00"
@.str.1 = [8 x i8] c"%d min\0A\00"
@.str.2 = [9 x i8] c"%d hour\0A\00"
@.str.3 = [8 x i8] c"%d day\0A\00"
@.str.4 = [10 x i8] c"%d month\0A\00"
@.str.5 = [20 x i8] c"%d year since 1900\0A\00"
@.str.6 = [21 x i8] c"%d day since sunday\0A\00"
@.str.7 = [19 x i8] c"%d days since jan\0A\00"
@.str.8 = [25 x i8] c"%d daylight saving time\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
%4 = alloca [80 x i8]
store i32 0, i32* %1
%5 = call i32 @time(i32* null)
store i32 %5, i32* %2
%6 = call %struct.tm* @gmtime(i32* %2)
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 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = load %struct.tm*, %struct.tm** %3
%12 = getelementptr inbounds %struct.tm, %struct.tm* %11, i32 0, i32 1
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 2
%17 = load i32, i32* %16
%18 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = load %struct.tm*, %struct.tm** %3
%20 = getelementptr inbounds %struct.tm, %struct.tm* %19, i32 0, i32 3
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %21)
%23 = load %struct.tm*, %struct.tm** %3
%24 = getelementptr inbounds %struct.tm, %struct.tm* %23, i32 0, i32 4
%25 = load i32, i32* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = load %struct.tm*, %struct.tm** %3
%28 = getelementptr inbounds %struct.tm, %struct.tm* %27, i32 0, i32 5
%29 = load i32, i32* %28
%30 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %29)
%31 = load %struct.tm*, %struct.tm** %3
%32 = getelementptr inbounds %struct.tm, %struct.tm* %31, i32 0, i32 6
%33 = load i32, i32* %32
%34 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %33)
%35 = load %struct.tm*, %struct.tm** %3
%36 = getelementptr inbounds %struct.tm, %struct.tm* %35, i32 0, i32 7
%37 = load i32, i32* %36
%38 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = load %struct.tm*, %struct.tm** %3
%40 = getelementptr inbounds %struct.tm, %struct.tm* %39, i32 0, i32 8
%41 = load i32, i32* %40
%42 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %41)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
@.str = [12 x i8] c"%d seconds\0A\00"
@.str.1 = [8 x i8] c"%d min\0A\00"
@.str.2 = [9 x i8] c"%d hour\0A\00"
@.str.3 = [8 x i8] c"%d day\0A\00"
@.str.4 = [10 x i8] c"%d month\0A\00"
@.str.5 = [20 x i8] c"%d year since 1900\0A\00"
@.str.6 = [21 x i8] c"%d day since sunday\0A\00"
@.str.7 = [19 x i8] c"%d days since jan\0A\00"
@.str.8 = [25 x i8] c"%d daylight saving time\0A\00"
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 = call %struct.tm* @gmtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%6 = load i32, i32* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%9 = load i32, i32* %8
%10 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%12 = load i32, i32* %11
%13 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 %12)
%14 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%20 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0), i32 %21)
%23 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 6
%24 = load i32, i32* %23
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.6, i64 0, i64 0), i32 %24)
%26 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 7
%27 = load i32, i32* %26
%28 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 %27)
%29 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 8
%30 = load i32, i32* %29
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i32 %30)
ret i32 0
}