#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_yday;
  int tm_year;
  int tm_hour;
  int tm_min;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void datime(int *d, int *t) {
  time_t tvec;
  struct tm *tptr;
  time(&tvec);
  tptr = localtime(&tvec);
  *d = (tptr->tm_yday + 365 * (tptr->tm_year - 77) + (tptr->tm_year - 77) / 4 -
        (tptr->tm_year - 1) / 100 + (tptr->tm_year + 299) / 400);
  *t = tptr->tm_hour * 60 + tptr->tm_min;
}


x86 assembly (clang, -O0):
<datime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1040 <time@plt>
lea    -0x14(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
sub    $0x4d,%eax
imul   $0x16d,%eax,%eax
add    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
sub    $0x4d,%eax
mov    $0x4,%esi
cltd
idiv   %esi
add    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
sub    $0x1,%eax
mov    $0x64,%esi
cltd
idiv   %esi
sub    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%eax
add    $0x12b,%eax
mov    $0x190,%esi
cltd
idiv   %esi
add    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
imul   $0x3c,0x8(%rax),%ecx
mov    -0x20(%rbp),%rax
add    0xc(%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<datime>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    0x4(%rax),%ecx
lea    -0x4d(%rcx),%edx
imul   $0x16d,%edx,%esi
add    (%rax),%esi
lea    -0x4a(%rcx),%edi
test   %edx,%edx
cmovns %edx,%edi
sar    $0x2,%edi
add    %esi,%edi
lea    -0x1(%rcx),%edx
movslq %edx,%rdx
imul   $0xffffffffae147ae1,%rdx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
sar    $0x25,%rdx
add    %esi,%edx
add    %edi,%edx
add    $0x12b,%ecx
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x27,%rcx
add    %esi,%ecx
add    %edx,%ecx
mov    %ecx,(%r15)
imul   $0x3c,0x8(%rax),%ecx
add    0xc(%rax),%ecx
mov    %ecx,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.tm = type { i32, i32, i32, i32 }
define void @datime(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca %struct.tm*
store i32* %0, i32** %3
store i32* %1, i32** %4
%7 = call i32 @time(i32* %5)
%8 = call %struct.tm* @localtime(i32* %5)
store %struct.tm* %8, %struct.tm** %6
%9 = load %struct.tm*, %struct.tm** %6
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load %struct.tm*, %struct.tm** %6
%13 = getelementptr inbounds %struct.tm, %struct.tm* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = sub nsw i32 %14, 77
%16 = mul nsw i32 365, %15
%17 = add nsw i32 %11, %16
%18 = load %struct.tm*, %struct.tm** %6
%19 = getelementptr inbounds %struct.tm, %struct.tm* %18, i32 0, i32 1
%20 = load i32, i32* %19
%21 = sub nsw i32 %20, 77
%22 = sdiv i32 %21, 4
%23 = add nsw i32 %17, %22
%24 = load %struct.tm*, %struct.tm** %6
%25 = getelementptr inbounds %struct.tm, %struct.tm* %24, i32 0, i32 1
%26 = load i32, i32* %25
%27 = sub nsw i32 %26, 1
%28 = sdiv i32 %27, 100
%29 = sub nsw i32 %23, %28
%30 = load %struct.tm*, %struct.tm** %6
%31 = getelementptr inbounds %struct.tm, %struct.tm* %30, i32 0, i32 1
%32 = load i32, i32* %31
%33 = add nsw i32 %32, 299
%34 = sdiv i32 %33, 400
%35 = add nsw i32 %29, %34
%36 = load i32*, i32** %3
store i32 %35, i32* %36
%37 = load %struct.tm*, %struct.tm** %6
%38 = getelementptr inbounds %struct.tm, %struct.tm* %37, i32 0, i32 2
%39 = load i32, i32* %38
%40 = mul nsw i32 %39, 60
%41 = load %struct.tm*, %struct.tm** %6
%42 = getelementptr inbounds %struct.tm, %struct.tm* %41, i32 0, i32 3
%43 = load i32, i32* %42
%44 = add nsw i32 %40, %43
%45 = load i32*, i32** %4
store i32 %44, i32* %45
ret void
}

LLVM IR (-O2):
%struct.tm = type { i32, i32, i32, i32 }
define void @datime(i32* nocapture writeonly %0, i32* nocapture writeonly %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @time(i32* %3)
%6 = call %struct.tm* @localtime(i32* %3)
%7 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 1
%10 = load i32, i32* %9
%11 = add nsw i32 %10, -77
%12 = mul nsw i32 %11, 365
%13 = add nsw i32 %12, %8
%14 = sdiv i32 %11, 4
%15 = add nsw i32 %13, %14
%16 = add nsw i32 %10, -1
%17 = sdiv i32 %16, -100
%18 = add i32 %15, %17
%19 = add nsw i32 %10, 299
%20 = sdiv i32 %19, 400
%21 = add nsw i32 %18, %20
store i32 %21, i32* %0
%22 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 2
%23 = load i32, i32* %22
%24 = mul nsw i32 %23, 60
%25 = getelementptr inbounds %struct.tm, %struct.tm* %6, i64 0, i32 3
%26 = load i32, i32* %25
%27 = add nsw i32 %24, %26
store i32 %27, i32* %1
ret void
}