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

/* Variables and functions */
void calc_time(time_t time, int *d, int *h, int *m, int *s) {
  *d = time / (60 * 60 * 24);
  time %= (60 * 60 * 24);
  *h = time / (60 * 60);
  time %= (60 * 60);
  *m = time / 60;
  *s = time % 60;
}


x86 assembly (clang, -O0):
<calc_time>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x28(%rbp),%rax
mov    %edx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_time>:
movslq %edi,%rax
imul   $0xffffffffc22e4507,%rax,%rdi
shr    $0x20,%rdi
add    %eax,%edi
mov    %edi,%r9d
shr    $0x1f,%r9d
sar    $0x10,%edi
add    %r9d,%edi
mov    %edi,(%rsi)
imul   $0x15180,%edi,%esi
sub    %esi,%eax
cltq
imul   $0xffffffff91a2b3c5,%rax,%rsi
shr    $0x20,%rsi
add    %eax,%esi
mov    %esi,%edi
shr    $0x1f,%edi
sar    $0xb,%esi
add    %edi,%esi
mov    %esi,(%rdx)
imul   $0xe10,%esi,%edx
sub    %edx,%eax
movswl %ax,%edx
imul   $0xffff8889,%edx,%edx
shr    $0x10,%edx
add    %eax,%edx
movzwl %dx,%edx
movswl %dx,%esi
shr    $0xf,%edx
sar    $0x5,%esi
add    %edx,%esi
movswl %si,%edx
mov    %edx,(%rcx)
imul   $0x3c,%esi,%ecx
sub    %ecx,%eax
cwtl
mov    %eax,(%r8)
ret

LLVM IR (-O0):
define void @calc_time(i32 %0, i32* %1, i32* %2, i32* %3, i32* %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32 %0, i32* %6
store i32* %1, i32** %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = load i32, i32* %6
%12 = sdiv i32 %11, 86400
%13 = load i32*, i32** %7
store i32 %12, i32* %13
%14 = load i32, i32* %6
%15 = srem i32 %14, 86400
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = sdiv i32 %16, 3600
%18 = load i32*, i32** %8
store i32 %17, i32* %18
%19 = load i32, i32* %6
%20 = srem i32 %19, 3600
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = sdiv i32 %21, 60
%23 = load i32*, i32** %9
store i32 %22, i32* %23
%24 = load i32, i32* %6
%25 = srem i32 %24, 60
%26 = load i32*, i32** %10
store i32 %25, i32* %26
ret void
}

LLVM IR (-O2):
define void @calc_time(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4) {
%6 = sdiv i32 %0, 86400
store i32 %6, i32* %1
%7 = srem i32 %0, 86400
%8 = sdiv i32 %7, 3600
store i32 %8, i32* %2
%9 = srem i32 %7, 3600
%10 = trunc i32 %9 to i16
%11 = sdiv i16 %10, 60
%12 = sext i16 %11 to i32
store i32 %12, i32* %3
%13 = srem i16 %10, 60
%14 = sext i16 %13 to i32
store i32 %14, i32* %4
ret void
}