#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 */

/* Variables and functions */
int TK_GetTimeMs();
void __datetime(void *ptr) {
  struct dt_s {
    int year;
    int month;
    int day;
    int hours;
    int minutes;
    int seconds;
    int hundredths;
  } dt, *pdt;
  int ms;
  ms = TK_GetTimeMs();
  pdt = ptr;
  pdt->hundredths = (ms / 10) % 100;
  pdt->seconds = (ms / 1000) % 60;
  pdt->minutes = (ms / 60000) % 60;
  pdt->hours = 0;
  pdt->day = 0;
  pdt->month = 0;
  pdt->year = 0;
}


x86 assembly (clang, -O0):
<__datetime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <TK_GetTimeMs@plt>
mov    %eax,-0x34(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x34(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
mov    %edx,0x18(%rax)
mov    -0x34(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
mov    %edx,0x14(%rax)
mov    -0x34(%rbp),%eax
mov    $0xea60,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
mov    %edx,0x10(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x30(%rbp),%rax
movl   $0x0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__datetime>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <TK_GetTimeMs@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x2,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
imul   $0x51eb851f,%rcx,%rdx
mov    %rdx,%rsi
shr    $0x3f,%rsi
shr    $0x20,%rdx
sar    $0x5,%edx
add    %esi,%edx
imul   $0x64,%edx,%edx
sub    %edx,%ecx
mov    %ecx,0x18(%rbx)
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
sar    $0x6,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
imul   $0xffffffff88888889,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
sar    $0x5,%edx
add    %esi,%edx
imul   $0x3c,%edx,%edx
sub    %edx,%ecx
mov    %ecx,0x14(%rbx)
imul   $0x45e7b273,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
sar    $0xe,%eax
add    %ecx,%eax
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,0x10(%rbx)
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.dt_s = type { i32, i32, i32, i32, i32, i32, i32 }
define void @__datetime(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.dt_s
%4 = alloca %struct.dt_s*
%5 = alloca i32
store i8* %0, i8** %2
%6 = call i32 (...) @TK_GetTimeMs()
store i32 %6, i32* %5
%7 = load i8*, i8** %2
%8 = bitcast i8* %7 to %struct.dt_s*
store %struct.dt_s* %8, %struct.dt_s** %4
%9 = load i32, i32* %5
%10 = sdiv i32 %9, 10
%11 = srem i32 %10, 100
%12 = load %struct.dt_s*, %struct.dt_s** %4
%13 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %12, i32 0, i32 6
store i32 %11, i32* %13
%14 = load i32, i32* %5
%15 = sdiv i32 %14, 1000
%16 = srem i32 %15, 60
%17 = load %struct.dt_s*, %struct.dt_s** %4
%18 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %17, i32 0, i32 5
store i32 %16, i32* %18
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 60000
%21 = srem i32 %20, 60
%22 = load %struct.dt_s*, %struct.dt_s** %4
%23 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %22, i32 0, i32 4
store i32 %21, i32* %23
%24 = load %struct.dt_s*, %struct.dt_s** %4
%25 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %24, i32 0, i32 3
store i32 0, i32* %25
%26 = load %struct.dt_s*, %struct.dt_s** %4
%27 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %26, i32 0, i32 2
store i32 0, i32* %27
%28 = load %struct.dt_s*, %struct.dt_s** %4
%29 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %28, i32 0, i32 1
store i32 0, i32* %29
%30 = load %struct.dt_s*, %struct.dt_s** %4
%31 = getelementptr inbounds %struct.dt_s, %struct.dt_s* %30, i32 0, i32 0
store i32 0, i32* %31
ret void
}

LLVM IR (-O2):
%struct.dt_s = type { i32, i32, i32, i32, i32, i32, i32 }
define void @__datetime(i8* nocapture writeonly %0) {
%2 = tail call i32 (...) @TK_GetTimeMs()
%3 = sdiv i32 %2, 10
%4 = srem i32 %3, 100
%5 = getelementptr inbounds i8, i8* %0, i64 24
%6 = bitcast i8* %5 to i32*
store i32 %4, i32* %6
%7 = sdiv i32 %2, 1000
%8 = srem i32 %7, 60
%9 = getelementptr inbounds i8, i8* %0, i64 20
%10 = bitcast i8* %9 to i32*
store i32 %8, i32* %10
%11 = sdiv i32 %2, 60000
%12 = srem i32 %11, 60
%13 = getelementptr inbounds i8, i8* %0, i64 16
%14 = bitcast i8* %13 to i32*
store i32 %12, i32* %14
ret void
}