#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 */
struct tm *gmtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, int, int, int, int, int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t now;
  struct tm *tm_now;
  time(&now);
  tm_now = gmtime(&now);
  printf("now datetime: %d-%d-%d %d:%d:%d\n", tm_now->tm_year, tm_now->tm_mon,
         tm_now->tm_mday, tm_now->tm_hour, tm_now->tm_min, tm_now->tm_sec);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <time@plt>
lea    -0x8(%rbp),%rdi
call   1050 <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
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    0xe79(%rip),%rdi
mov    %eax,(%rsp)
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1050 <gmtime@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
mov    0x8(%rax),%ecx
mov    0xc(%rax),%r8d
mov    0x10(%rax),%r9d
mov    0x14(%rax),%eax
mov    %eax,(%rsp)
lea    0xe99(%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 }
@.str = [33 x i8] c"now datetime: %d-%d-%d %d:%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 0, i32* %1
%4 = call i32 @time(i32* %2)
%5 = call %struct.tm* @gmtime(i32* %2)
store %struct.tm* %5, %struct.tm** %3
%6 = load %struct.tm*, %struct.tm** %3
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.tm*, %struct.tm** %3
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
%11 = load i32, i32* %10
%12 = load %struct.tm*, %struct.tm** %3
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 2
%14 = load i32, i32* %13
%15 = load %struct.tm*, %struct.tm** %3
%16 = getelementptr inbounds %struct.tm, %struct.tm* %15, i32 0, i32 3
%17 = load i32, i32* %16
%18 = load %struct.tm*, %struct.tm** %3
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 4
%20 = load i32, i32* %19
%21 = load %struct.tm*, %struct.tm** %3
%22 = getelementptr inbounds %struct.tm, %struct.tm* %21, i32 0, i32 5
%23 = load i32, i32* %22
%24 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14, i32 %17, i32 %20, i32 %23)
ret i32 0
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@.str = [33 x i8] c"now datetime: %d-%d-%d %d:%d:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(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 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 3
%12 = load i32, i32* %11
%13 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 4
%14 = load i32, i32* %13
%15 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 5
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %10, i32 %12, i32 %14, i32 %16)
ret i32 0
}