#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;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void current_ymd(int *y, int *m, int *d) {
  time_t t = time(NULL);
  struct tm *lt = localtime(&t);
  *y = lt->tm_year + 1900;
  *m = lt->tm_mon + 1;
  *d = lt->tm_mday;
}


x86 assembly (clang, -O0):
<current_ymd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x1c(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%ecx
add    $0x76c,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_ymd>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1030 <localtime@plt>
mov    $0x76c,%ecx
add    (%rax),%ecx
mov    %ecx,(%rbx)
mov    0x4(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%r15)
mov    0x8(%rax),%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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