void split_uptime(long uptime, unsigned int *secs, unsigned int *mins,
                  unsigned int *hrs, unsigned int *days) {
  *secs = (unsigned int)uptime % 60;
  *mins = (unsigned int)(uptime / 60) % 60;
  *hrs = (unsigned int)(uptime / 3600) % 24;
  *days = (unsigned int)(uptime / 86400);
  return;
}


x86 assembly (clang, -O0):
<split_uptime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x10(%rbp),%rax
mov    %edx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x3c,%ecx
cqto
idiv   %rcx
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x18(%rbp),%rax
mov    %edx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0xe10,%ecx
cqto
idiv   %rcx
mov    $0x18,%ecx
xor    %edx,%edx
div    %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
mov    -0x8(%rbp),%rax
mov    $0x15180,%ecx
cqto
idiv   %rcx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<split_uptime>:
mov    %rdx,%r9
mov    %edi,%eax
mov    $0x88888889,%r10d
imul   %r10,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%r11d
movabs $0x8888888888888889,%rdx
88 88 88
mov    %rdi,%rax
imul   %rdx
add    %rdi,%rdx
mov    %edi,%eax
sub    %r11d,%eax
mov    %eax,(%rsi)
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x5,%rdx
add    %rax,%rdx
mov    %edx,%eax
imul   %r10,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%eax
sub    %eax,%edx
mov    %edx,(%r9)
movabs $0x48d159e26af37c05,%rdx
59 d1 48
mov    %rdi,%rax
imul   %rdx
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0xa,%rdx
add    %rax,%rdx
mov    %edx,%eax
mov    $0xaaaaaaab,%esi
imul   %rax,%rsi
shr    $0x24,%rsi
shl    $0x3,%esi
lea    (%rsi,%rsi,2),%eax
sub    %eax,%edx
mov    %edx,(%rcx)
movabs $0x1845c8a0ce512957,%rcx
c8 45 18
mov    %rdi,%rax
imul   %rcx
mov    %rdx,%rax
shr    $0x3f,%rax
shr    $0xd,%rdx
add    %eax,%edx
mov    %edx,(%r8)
ret

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

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