#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 {
  scalar_t__ tm_year;
  scalar_t__ tm_mon;
  scalar_t__ tm_mday;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ lua_pushnumber(scalar_t__);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void io_date(void) {
  time_t t;
  struct tm *s;
  time(&t);
  s = localtime(&t);
  lua_pushnumber(s->tm_mday);
  lua_pushnumber(s->tm_mon + 1);
  lua_pushnumber(s->tm_year + 1900);
}


x86 assembly (clang, -O0):
<io_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <time@plt>
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <lua_pushnumber@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
add    $0x1,%rdi
call   1050 <lua_pushnumber@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
add    $0x76c,%rdi
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<io_date>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    %rax,%rbx
mov    0x10(%rax),%rdi
call   1050 <lua_pushnumber@plt>
mov    0x8(%rbx),%rdi
add    $0x1,%rdi
call   1050 <lua_pushnumber@plt>
mov    $0x76c,%edi
add    (%rbx),%rdi
call   1050 <lua_pushnumber@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64 }
define void @io_date() {
%1 = alloca i32
%2 = alloca %struct.tm*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
store %struct.tm* %4, %struct.tm** %2
%5 = load %struct.tm*, %struct.tm** %2
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
%7 = load i64, i64* %6
%8 = call i32 @lua_pushnumber(i64 %7)
%9 = load %struct.tm*, %struct.tm** %2
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 1
%11 = load i64, i64* %10
%12 = add nsw i64 %11, 1
%13 = call i32 @lua_pushnumber(i64 %12)
%14 = load %struct.tm*, %struct.tm** %2
%15 = getelementptr inbounds %struct.tm, %struct.tm* %14, i32 0, i32 0
%16 = load i64, i64* %15
%17 = add nsw i64 %16, 1900
%18 = call i32 @lua_pushnumber(i64 %17)
ret void
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64 }
define void @io_date() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @time(i32* %1)
%4 = call %struct.tm* @localtime(i32* %1)
%5 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 2
%6 = load i64, i64* %5
%7 = call i32 @lua_pushnumber(i64 %6)
%8 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, 1
%11 = call i32 @lua_pushnumber(i64 %10)
%12 = getelementptr inbounds %struct.tm, %struct.tm* %4, i64 0, i32 0
%13 = load i64, i64* %12
%14 = add nsw i64 %13, 1900
%15 = call i32 @lua_pushnumber(i64 %14)
ret void
}