void time_format(unsigned int *ctry, unsigned int *yr, unsigned int *mth,
                 unsigned int *wk, unsigned int *dy, unsigned int *hr,
                 unsigned int *min, unsigned int *sec, unsigned int N) {
  unsigned int century, year, month, week, day, hour, minute, second;
  second = N % 60;
  minute = (N / 60) % 60;
  hour = (N / 3600) % 24;
  day = (N / 86400) % 7;
  week = (N / 604800) % 4;
  month = (N / 2592000) % 12;
  year = (N / 31536000) % 100;
  century = (N / 3153600000);
  *sec = second;
  *min = minute;
  *hr = hour;
  *dy = day;
  *wk = week;
  *mth = month;
  *yr = year;
  *ctry = century;
}


x86 assembly (clang, -O0):
<time_format>:
push   %rbp
mov    %rsp,%rbp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x20(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x50(%rbp)
mov    0x20(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x4c(%rbp)
mov    0x20(%rbp),%eax
mov    $0xe10,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x18,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x48(%rbp)
mov    0x20(%rbp),%eax
mov    $0x15180,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x7,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x44(%rbp)
mov    0x20(%rbp),%eax
mov    $0x93a80,%ecx
xor    %edx,%edx
div    %ecx
and    $0x3,%eax
mov    %eax,-0x40(%rbp)
mov    0x20(%rbp),%eax
mov    $0x278d00,%ecx
xor    %edx,%edx
div    %ecx
mov    $0xc,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x3c(%rbp)
mov    0x20(%rbp),%eax
mov    $0x1e13380,%ecx
xor    %edx,%edx
div    %ecx
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,-0x38(%rbp)
mov    0x20(%rbp),%eax
mov    $0xbbf81e00,%ecx
cqto
idiv   %rcx
mov    %eax,-0x34(%rbp)
mov    -0x50(%rbp),%ecx
mov    0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4c(%rbp),%ecx
mov    0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x48(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x44(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x40(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x3c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x34(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_format>:
push   %rbp
push   %r14
push   %rbx
mov    0x30(%rsp),%r14d
mov    %r14,%rax
shr    $0x9,%rax
xor    %r10d,%r10d
cmp    $0x5dfc0f,%eax
setae  %r10b
mov    $0x88888889,%r11d
mov    %r14d,%ebp
mov    %r14,%rbx
imul   %r11,%rbx
shr    $0x25,%rbx
imul   $0x3c,%ebx,%eax
sub    %eax,%ebp
mov    0x28(%rsp),%rax
mov    %ebp,(%rax)
mov    %rbx,%rax
imul   %r11,%rax
shr    $0x25,%rax
imul   $0x3c,%eax,%eax
sub    %eax,%ebx
mov    0x20(%rsp),%rax
mov    %ebx,(%rax)
mov    $0x91a2b3c5,%eax
imul   %r14,%rax
shr    $0x2b,%rax
mov    $0xaaaaaaab,%ebp
imul   %rax,%rbp
shr    $0x24,%rbp
shl    $0x3,%ebp
lea    0x0(%rbp,%rbp,2),%ebp
sub    %ebp,%eax
mov    $0xc22e4507,%ebp
imul   %r14,%rbp
shr    $0x30,%rbp
mov    %eax,(%r9)
imul   $0x2493,%ebp,%eax
shr    $0x10,%eax
mov    %ebp,%ebx
sub    %eax,%ebx
movzwl %bx,%ebx
shr    %ebx
add    %eax,%ebx
shr    $0x2,%ebx
lea    0x0(,%rbx,8),%eax
sub    %eax,%ebx
add    %ebp,%ebx
movzwl %bx,%eax
mov    %eax,(%r8)
imul   $0x6ef5de4d,%r14,%rax
shr    $0x32,%rax
and    $0x3,%eax
mov    %eax,(%rcx)
mov    $0xcf2049a1,%eax
imul   %r14,%rax
shr    $0x35,%rax
imul   $0xaaab,%eax,%ecx
shr    $0x11,%ecx
and    $0xfffffffc,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
movzwl %ax,%eax
mov    %eax,(%rdx)
imul   $0x4418a47b,%r14,%rax
shr    $0x37,%rax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,8),%ecx
movzwl %cx,%ecx
shr    $0xc,%ecx
imul   $0x64,%ecx,%ecx
sub    %cl,%al
movzbl %al,%eax
mov    %eax,(%rsi)
mov    %r10d,(%rdi)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @time_format(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32* %6, i32* %7, i32 %8) {
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
store i32* %0, i32** %10
store i32* %1, i32** %11
store i32* %2, i32** %12
store i32* %3, i32** %13
store i32* %4, i32** %14
store i32* %5, i32** %15
store i32* %6, i32** %16
store i32* %7, i32** %17
store i32 %8, i32* %18
%27 = load i32, i32* %18
%28 = urem i32 %27, 60
store i32 %28, i32* %26
%29 = load i32, i32* %18
%30 = udiv i32 %29, 60
%31 = urem i32 %30, 60
store i32 %31, i32* %25
%32 = load i32, i32* %18
%33 = udiv i32 %32, 3600
%34 = urem i32 %33, 24
store i32 %34, i32* %24
%35 = load i32, i32* %18
%36 = udiv i32 %35, 86400
%37 = urem i32 %36, 7
store i32 %37, i32* %23
%38 = load i32, i32* %18
%39 = udiv i32 %38, 604800
%40 = urem i32 %39, 4
store i32 %40, i32* %22
%41 = load i32, i32* %18
%42 = udiv i32 %41, 2592000
%43 = urem i32 %42, 12
store i32 %43, i32* %21
%44 = load i32, i32* %18
%45 = udiv i32 %44, 31536000
%46 = urem i32 %45, 100
store i32 %46, i32* %20
%47 = load i32, i32* %18
%48 = zext i32 %47 to i64
%49 = sdiv i64 %48, 3153600000
%50 = trunc i64 %49 to i32
store i32 %50, i32* %19
%51 = load i32, i32* %26
%52 = load i32*, i32** %17
store i32 %51, i32* %52
%53 = load i32, i32* %25
%54 = load i32*, i32** %16
store i32 %53, i32* %54
%55 = load i32, i32* %24
%56 = load i32*, i32** %15
store i32 %55, i32* %56
%57 = load i32, i32* %23
%58 = load i32*, i32** %14
store i32 %57, i32* %58
%59 = load i32, i32* %22
%60 = load i32*, i32** %13
store i32 %59, i32* %60
%61 = load i32, i32* %21
%62 = load i32*, i32** %12
store i32 %61, i32* %62
%63 = load i32, i32* %20
%64 = load i32*, i32** %11
store i32 %63, i32* %64
%65 = load i32, i32* %19
%66 = load i32*, i32** %10
store i32 %65, i32* %66
ret void
}

LLVM IR (-O2):
define void @time_format(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3, i32* nocapture writeonly %4, i32* nocapture writeonly %5, i32* nocapture writeonly %6, i32* nocapture writeonly %7, i32 %8) {
%10 = urem i32 %8, 60
%11 = udiv i32 %8, 60
%12 = urem i32 %11, 60
%13 = udiv i32 %8, 3600
%14 = urem i32 %13, 24
%15 = udiv i32 %8, 86400
%16 = trunc i32 %15 to i16
%17 = urem i16 %16, 7
%18 = zext i16 %17 to i32
%19 = udiv i32 %8, 604800
%20 = and i32 %19, 3
%21 = udiv i32 %8, 2592000
%22 = trunc i32 %21 to i16
%23 = urem i16 %22, 12
%24 = zext i16 %23 to i32
%25 = udiv i32 %8, 31536000
%26 = trunc i32 %25 to i8
%27 = urem i8 %26, 100
%28 = zext i8 %27 to i32
%29 = icmp ugt i32 %8, -1141367297
%30 = zext i1 %29 to i32
store i32 %10, i32* %7
store i32 %12, i32* %6
store i32 %14, i32* %5
store i32 %18, i32* %4
store i32 %20, i32* %3
store i32 %24, i32* %2
store i32 %28, i32* %1
store i32 %30, i32* %0
ret void
}