#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 */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
void current_time(int *days, int *secs, int *nanosecs) {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  *days = tv.tv_sec / 86400;
  *secs = tv.tv_sec % 86400;
  *nanosecs = tv.tv_usec * 1000;
}


x86 assembly (clang, -O0):
<current_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x20(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
imul   $0x3e8,-0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<current_time>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xffffffffc22e4507,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x10,%ecx
add    %edx,%ecx
mov    %ecx,(%rbx)
imul   $0x15180,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r15)
imul   $0x3e8,0xc(%rsp),%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @current_time(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca %struct.timeval
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%8 = call i32 @gettimeofday(%struct.timeval* %7, i32* null)
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 86400
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 0
%14 = load i32, i32* %13
%15 = srem i32 %14, 86400
%16 = load i32*, i32** %5
store i32 %15, i32* %16
%17 = getelementptr inbounds %struct.timeval, %struct.timeval* %7, i32 0, i32 1
%18 = load i32, i32* %17
%19 = mul nsw i32 %18, 1000
%20 = load i32*, i32** %6
store i32 %19, i32* %20
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @current_time(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = alloca %struct.timeval
%5 = bitcast %struct.timeval* %4 to i8*
%6 = call i32 @gettimeofday(%struct.timeval* %4, i32* null)
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 0
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 86400
store i32 %9, i32* %0
%10 = srem i32 %8, 86400
store i32 %10, i32* %1
%11 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i64 0, i32 1
%12 = load i32, i32* %11
%13 = mul nsw i32 %12, 1000
store i32 %13, i32* %2
ret void
}