#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;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, unsigned int, char *, ...);
char *dissect_time(time_t timeframe) {
  static char buf[64];
  unsigned int years, weeks, days, hours, minutes, seconds;
  years = weeks = days = hours = minutes = seconds = 0;
  while (timeframe >= 60 * 60 * 24 * 365) {
    timeframe -= 60 * 60 * 24 * 365;
    years++;
  }
  while (timeframe >= 60 * 60 * 24 * 7) {
    timeframe -= 60 * 60 * 24 * 7;
    weeks++;
  }
  while (timeframe >= 60 * 60 * 24) {
    timeframe -= 60 * 60 * 24;
    days++;
  }
  while (timeframe >= 60 * 60) {
    timeframe -= 60 * 60;
    hours++;
  }
  while (timeframe >= 60) {
    timeframe -= 60;
    minutes++;
  }
  seconds = timeframe;
  if (years)
    snprintf(buf, sizeof(buf), "%d year%s, %d week%s, %d day%s, %02d:%02d:%02d",
             years, years == 1 ? "" : "s", weeks, weeks == 1 ? "" : "s", days,
             days == 1 ? "" : "s", hours, minutes, seconds);
  else if (weeks)
    snprintf(buf, sizeof(buf), "%d week%s, %d day%s, %02d:%02d:%02d", weeks,
             weeks == 1 ? "" : "s", days, days == 1 ? "" : "s", hours, minutes,
             seconds);
  else if (days)
    snprintf(buf, sizeof(buf), "%d day%s, %02d:%02d:%02d", days,
             days == 1 ? "" : "s", hours, minutes, seconds);
  else if (hours) {
    if (minutes || seconds)
      snprintf(buf, sizeof(buf), "%d hour%s, %d minute%s, %d second%s", hours,
               hours == 1 ? "" : "s", minutes, minutes == 1 ? "" : "s", seconds,
               seconds == 1 ? "" : "s");
    else
      snprintf(buf, sizeof(buf), "%d hour%s", hours, hours == 1 ? "" : "s");
  } else if (minutes)
    snprintf(buf, sizeof(buf), "%d minute%s, %d second%s", minutes,
             minutes == 1 ? "" : "s", seconds, seconds == 1 ? "" : "s");
  else
    snprintf(buf, sizeof(buf), "%d second%s", seconds, seconds == 1 ? "" : "s");
  return (buf);
}


x86 assembly (clang, -O0):
<dissect_time>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x58,%rsp
mov    %edi,-0x1c(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x1e13380,-0x1c(%rbp)
jl     1170 <dissect_time+0x60>
mov    -0x1c(%rbp),%eax
sub    $0x1e13380,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114a <dissect_time+0x3a>
jmp    1175 <dissect_time+0x65>
cmpl   $0x93a80,-0x1c(%rbp)
jl     119b <dissect_time+0x8b>
mov    -0x1c(%rbp),%eax
sub    $0x93a80,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1175 <dissect_time+0x65>
jmp    11a0 <dissect_time+0x90>
cmpl   $0x15180,-0x1c(%rbp)
jl     11c6 <dissect_time+0xb6>
mov    -0x1c(%rbp),%eax
sub    $0x15180,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11a0 <dissect_time+0x90>
jmp    11cb <dissect_time+0xbb>
cmpl   $0xe10,-0x1c(%rbp)
jl     11f1 <dissect_time+0xe1>
mov    -0x1c(%rbp),%eax
sub    $0xe10,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11cb <dissect_time+0xbb>
jmp    11f6 <dissect_time+0xe6>
cmpl   $0x3c,-0x1c(%rbp)
jl     1217 <dissect_time+0x107>
mov    -0x1c(%rbp),%eax
sub    $0x3c,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11f6 <dissect_time+0xe6>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x20(%rbp)
je     12c0 <dissect_time+0x1b0>
mov    -0x20(%rbp),%ecx
mov    -0x20(%rbp),%edx
lea    0xe1d(%rip),%r8
lea    0xdf3(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
mov    -0x24(%rbp),%r9d
mov    -0x24(%rbp),%edx
lea    0xe01(%rip),%r15
lea    0xdd7(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r15
mov    -0x28(%rbp),%r14d
mov    -0x28(%rbp),%edx
lea    0xde5(%rip),%rbx
lea    0xdbb(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%rbx
mov    -0x2c(%rbp),%r11d
mov    -0x30(%rbp),%r10d
mov    -0x34(%rbp),%eax
lea    0x2db4(%rip),%rdi
mov    $0x40,%esi
lea    0xd68(%rip),%rdx
mov    %r15,(%rsp)
mov    %r14d,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10d,0x20(%rsp)
mov    %eax,0x28(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1519 <dissect_time+0x409>
cmpl   $0x0,-0x24(%rbp)
je     133d <dissect_time+0x22d>
mov    -0x24(%rbp),%ecx
mov    -0x24(%rbp),%edx
lea    0xd7a(%rip),%r8
lea    0xd50(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
mov    -0x28(%rbp),%r9d
mov    -0x28(%rbp),%edx
lea    0xd5e(%rip),%rbx
lea    0xd34(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%rbx
mov    -0x2c(%rbp),%r11d
mov    -0x30(%rbp),%r10d
mov    -0x34(%rbp),%eax
lea    0x2d2d(%rip),%rdi
mov    $0x40,%esi
lea    0xcec(%rip),%rdx
mov    %rbx,(%rsp)
mov    %r11d,0x8(%rsp)
mov    %r10d,0x10(%rsp)
mov    %eax,0x18(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1514 <dissect_time+0x404>
cmpl   $0x0,-0x28(%rbp)
je     1394 <dissect_time+0x284>
mov    -0x28(%rbp),%ecx
mov    -0x28(%rbp),%edx
lea    0xcfd(%rip),%r8
lea    0xcd3(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
mov    -0x2c(%rbp),%r9d
mov    -0x30(%rbp),%r10d
mov    -0x34(%rbp),%eax
lea    0x2ccc(%rip),%rdi
mov    $0x40,%esi
lea    0xc96(%rip),%rdx
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    150f <dissect_time+0x3ff>
cmpl   $0x0,-0x2c(%rbp)
je     146c <dissect_time+0x35c>
cmpl   $0x0,-0x30(%rbp)
jne    13b2 <dissect_time+0x2a2>
cmpl   $0x0,-0x34(%rbp)
je     1432 <dissect_time+0x322>
mov    -0x2c(%rbp),%ecx
mov    -0x2c(%rbp),%edx
lea    0xc92(%rip),%r8
lea    0xc68(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
mov    -0x30(%rbp),%r9d
mov    -0x30(%rbp),%edx
lea    0xc76(%rip),%r11
lea    0xc4c(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r11
mov    -0x34(%rbp),%r10d
mov    -0x34(%rbp),%esi
lea    0xc5a(%rip),%rax
lea    0xc30(%rip),%rdx
cmp    $0x1,%esi
cmove  %rdx,%rax
lea    0x2c34(%rip),%rdi
mov    $0x40,%esi
lea    0xc17(%rip),%rdx
mov    %r11,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1467 <dissect_time+0x357>
mov    -0x2c(%rbp),%ecx
mov    -0x2c(%rbp),%edx
lea    0xc12(%rip),%r8
lea    0xbe8(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
lea    0x2bec(%rip),%rdi
mov    $0x40,%esi
lea    0xbf3(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    150a <dissect_time+0x3fa>
cmpl   $0x0,-0x30(%rbp)
je     14d0 <dissect_time+0x3c0>
mov    -0x30(%rbp),%ecx
mov    -0x30(%rbp),%edx
lea    0xbce(%rip),%r8
lea    0xba4(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
mov    -0x34(%rbp),%r9d
mov    -0x34(%rbp),%esi
lea    0xbb2(%rip),%rax
lea    0xb88(%rip),%rdx
cmp    $0x1,%esi
cmove  %rdx,%rax
lea    0x2b8c(%rip),%rdi
mov    $0x40,%esi
lea    0xb7a(%rip),%rdx
mov    %rax,(%rsp)
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    1505 <dissect_time+0x3f5>
mov    -0x34(%rbp),%ecx
mov    -0x34(%rbp),%edx
lea    0xb74(%rip),%r8
lea    0xb4a(%rip),%rax
cmp    $0x1,%edx
cmove  %rax,%r8
lea    0x2b4e(%rip),%rdi
mov    $0x40,%esi
lea    0xb49(%rip),%rdx
mov    $0x0,%al
call   1030 <snprintf@plt>
jmp    150a <dissect_time+0x3fa>
jmp    150f <dissect_time+0x3ff>
jmp    1514 <dissect_time+0x404>
jmp    1519 <dissect_time+0x409>
lea    0x2b20(%rip),%rax
add    $0x58,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<dissect_time>:
mov    %edi,%r10d
xor    %r9d,%r9d
cmp    $0x1e13380,%edi
jl     1161 <dissect_time+0x51>
cmp    $0x3c266ff,%r10d
mov    $0x3c266ff,%eax
cmovl  %r10d,%eax
neg    %eax
add    %r10d,%eax
add    $0x1e1337f,%eax
imul   $0x4418a47b,%rax,%rcx
shr    $0x37,%rcx
imul   $0xfe1ecc80,%ecx,%eax
add    %eax,%r10d
add    $0xfe1ecc80,%r10d
add    $0x1,%ecx
cmp    $0x93a80,%r10d
jge    116c <dissect_time+0x5c>
jmp    11a6 <dissect_time+0x96>
xor    %ecx,%ecx
cmp    $0x93a80,%r10d
jl     11a6 <dissect_time+0x96>
cmp    $0x1274ff,%r10d
mov    $0x1274ff,%eax
cmovl  %r10d,%eax
neg    %eax
add    %r10d,%eax
add    $0x93a7f,%eax
imul   $0x6ef5de4d,%rax,%r9
shr    $0x32,%r9
imul   $0xfff6c580,%r9d,%eax
add    %eax,%r10d
add    $0xfff6c580,%r10d
add    $0x1,%r9d
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r11d,%r11d
cmp    $0x15180,%r10d
jl     1202 <dissect_time+0xf2>
cmp    $0x2a2ff,%r10d
mov    $0x2a2ff,%eax
cmovl  %r10d,%eax
neg    %eax
add    %r10d,%eax
add    $0x1517f,%eax
mov    $0xc22e4507,%r15d
imul   %rax,%r15
shr    $0x30,%r15
imul   $0xfffeae80,%r15d,%eax
add    %eax,%r10d
add    $0xfffeae80,%r10d
add    $0x1,%r15d
cmp    $0xe10,%r10d
jge    120e <dissect_time+0xfe>
jmp    124b <dissect_time+0x13b>
xor    %r15d,%r15d
cmp    $0xe10,%r10d
jl     124b <dissect_time+0x13b>
cmp    $0x1c1f,%r10d
mov    $0x1c1f,%eax
cmovl  %r10d,%eax
neg    %eax
add    %r10d,%eax
add    $0xe0f,%eax
mov    $0x91a2b3c5,%r11d
imul   %rax,%r11
shr    $0x2b,%r11
imul   $0xfffff1f0,%r11d,%eax
add    %eax,%r10d
add    $0xfffff1f0,%r10d
add    $0x1,%r11d
xor    %r14d,%r14d
cmp    $0x3c,%r10d
jl     1286 <dissect_time+0x176>
cmp    $0x77,%r10d
mov    $0x77,%eax
cmovl  %r10d,%eax
neg    %eax
add    %r10d,%eax
add    $0x3b,%eax
mov    $0x88888889,%r14d
imul   %rax,%r14
shr    $0x25,%r14
imul   $0xffffffc4,%r14d,%eax
add    %eax,%r10d
add    $0xffffffc4,%r10d
add    $0x1,%r14d
test   %ecx,%ecx
je     12e3 <dissect_time+0x1d3>
cmp    $0x1,%ecx
lea    0xd9a(%rip),%rax
lea    0xdb6(%rip),%rbx
mov    %rbx,%r8
cmove  %rax,%r8
cmp    $0x1,%r9d
mov    %rbx,%r12
cmove  %rax,%r12
cmp    $0x1,%r15d
cmove  %rax,%rbx
lea    0x2d84(%rip),%rdi
lea    0xd3d(%rip),%rdx
mov    $0x40,%esi
xor    %eax,%eax
push   %r10
push   %r14
push   %r11
push   %rbx
push   %r15
push   %r12
call   1030 <snprintf@plt>
add    $0x30,%rsp
jmp    1379 <dissect_time+0x269>
test   %r9d,%r9d
je     1336 <dissect_time+0x226>
cmp    $0x1,%r9d
lea    0xd3b(%rip),%rax
lea    0xd57(%rip),%rbx
mov    %rbx,%r8
cmove  %rax,%r8
cmp    $0x1,%r15d
cmove  %rax,%rbx
lea    0x2d30(%rip),%rdi
lea    0xcf4(%rip),%rdx
mov    $0x40,%esi
mov    %r9d,%ecx
mov    %r15d,%r9d
xor    %eax,%eax
push   %r10
push   %r14
push   %r11
push   %rbx
call   1030 <snprintf@plt>
add    $0x20,%rsp
jmp    1379 <dissect_time+0x269>
test   %r15d,%r15d
je     138c <dissect_time+0x27c>
cmp    $0x1,%r15d
lea    0xce8(%rip),%rax
lea    0xd04(%rip),%r8
cmove  %rax,%r8
lea    0x2ce8(%rip),%rdi
lea    0xcb7(%rip),%rdx
mov    $0x40,%esi
mov    %r15d,%ecx
mov    %r11d,%r9d
xor    %eax,%eax
push   %r10
push   %r14
call   1030 <snprintf@plt>
add    $0x10,%rsp
lea    0x2cc0(%rip),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
test   %r11d,%r11d
je     13f2 <dissect_time+0x2e2>
cmp    $0x1,%r11d
lea    0xc92(%rip),%rax
lea    0xcae(%rip),%rbx
mov    %rbx,%r8
cmove  %rax,%r8
mov    %r14d,%ecx
or     %r10d,%ecx
je     143d <dissect_time+0x32d>
cmp    $0x1,%r14d
mov    %rbx,%r15
cmove  %rax,%r15
cmp    $0x1,%r10d
cmove  %rax,%rbx
sub    $0x8,%rsp
lea    0x2c6c(%rip),%rdi
lea    0xc54(%rip),%rdx
mov    $0x40,%esi
mov    %r11d,%ecx
mov    %r14d,%r9d
xor    %eax,%eax
push   %rbx
push   %r10
push   %r15
jmp    132b <dissect_time+0x21b>
test   %r14d,%r14d
je     1455 <dissect_time+0x345>
cmp    $0x1,%r14d
lea    0xc2c(%rip),%rax
lea    0xc48(%rip),%rbx
mov    %rbx,%r8
cmove  %rax,%r8
cmp    $0x1,%r10d
cmove  %rax,%rbx
sub    $0x8,%rsp
lea    0x2c1d(%rip),%rdi
lea    0xc10(%rip),%rdx
mov    $0x40,%esi
mov    %r14d,%ecx
mov    %r10d,%r9d
xor    %eax,%eax
push   %rbx
jmp    1370 <dissect_time+0x260>
lea    0x2bfc(%rip),%rdi
lea    0xc08(%rip),%rdx
mov    $0x40,%esi
mov    %r11d,%ecx
jmp    1481 <dissect_time+0x371>
cmp    $0x1,%r10d
lea    0xbce(%rip),%rax
lea    0xbea(%rip),%r8
cmove  %rax,%r8
lea    0x2bce(%rip),%rdi
lea    0xbce(%rip),%rdx
mov    $0x40,%esi
mov    %r10d,%ecx
xor    %eax,%eax
call   1030 <snprintf@plt>
jmp    1379 <dissect_time+0x269>

LLVM IR (-O0):
@dissect_time.buf = internal global [64 x i8] zeroinitializer
@.str = [47 x i8] c"%d year%s, %d week%s, %d day%s, %02d:%02d:%02d\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [36 x i8] c"%d week%s, %d day%s, %02d:%02d:%02d\00"
@.str.4 = [25 x i8] c"%d day%s, %02d:%02d:%02d\00"
@.str.5 = [36 x i8] c"%d hour%s, %d minute%s, %d second%s\00"
@.str.6 = [10 x i8] c"%d hour%s\00"
@.str.7 = [25 x i8] c"%d minute%s, %d second%s\00"
@.str.8 = [12 x i8] c"%d second%s\00"
define i8* @dissect_time(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %8
store i32 0, i32* %7
store i32 0, i32* %6
store i32 0, i32* %5
store i32 0, i32* %4
store i32 0, i32* %3
br label %9
9: ; preds = %12, %1
%10 = load i32, i32* %2
%11 = icmp sge i32 %10, 31536000
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = load i32, i32* %2
%14 = sub nsw i32 %13, 31536000
store i32 %14, i32* %2
%15 = load i32, i32* %3
%16 = add i32 %15, 1
store i32 %16, i32* %3
br label %9
17: ; preds = %9
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, 604800
br i1 %20, label %21, label %26
21: ; preds = %18
%22 = load i32, i32* %2
%23 = sub nsw i32 %22, 604800
store i32 %23, i32* %2
%24 = load i32, i32* %4
%25 = add i32 %24, 1
store i32 %25, i32* %4
br label %18
26: ; preds = %18
br label %27
27: ; preds = %30, %26
%28 = load i32, i32* %2
%29 = icmp sge i32 %28, 86400
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i32, i32* %2
%32 = sub nsw i32 %31, 86400
store i32 %32, i32* %2
%33 = load i32, i32* %5
%34 = add i32 %33, 1
store i32 %34, i32* %5
br label %27
35: ; preds = %27
br label %36
36: ; preds = %39, %35
%37 = load i32, i32* %2
%38 = icmp sge i32 %37, 3600
br i1 %38, label %39, label %44
39: ; preds = %36
%40 = load i32, i32* %2
%41 = sub nsw i32 %40, 3600
store i32 %41, i32* %2
%42 = load i32, i32* %6
%43 = add i32 %42, 1
store i32 %43, i32* %6
br label %36
44: ; preds = %36
br label %45
45: ; preds = %48, %44
%46 = load i32, i32* %2
%47 = icmp sge i32 %46, 60
br i1 %47, label %48, label %53
48: ; preds = %45
%49 = load i32, i32* %2
%50 = sub nsw i32 %49, 60
store i32 %50, i32* %2
%51 = load i32, i32* %7
%52 = add i32 %51, 1
store i32 %52, i32* %7
br label %45
53: ; preds = %45
%54 = load i32, i32* %2
store i32 %54, i32* %8
%55 = load i32, i32* %3
%56 = icmp ne i32 %55, 0
br i1 %56, label %57, label %77
57: ; preds = %53
%58 = load i32, i32* %3
%59 = load i32, i32* %3
%60 = icmp eq i32 %59, 1
%61 = zext i1 %60 to i64
%62 = select i1 %60, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%63 = load i32, i32* %4
%64 = load i32, i32* %4
%65 = icmp eq i32 %64, 1
%66 = zext i1 %65 to i64
%67 = select i1 %65, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%68 = load i32, i32* %5
%69 = load i32, i32* %5
%70 = icmp eq i32 %69, 1
%71 = zext i1 %70 to i64
%72 = select i1 %70, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%73 = load i32, i32* %6
%74 = load i32, i32* %7
%75 = load i32, i32* %8
%76 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %58, i8* %62, i32 %63, i8* %67, i32 %68, i8* %72, i32 %73, i32 %74, i32 %75)
br label %168
77: ; preds = %53
%78 = load i32, i32* %4
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %95
80: ; preds = %77
%81 = load i32, i32* %4
%82 = load i32, i32* %4
%83 = icmp eq i32 %82, 1
%84 = zext i1 %83 to i64
%85 = select i1 %83, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%86 = load i32, i32* %5
%87 = load i32, i32* %5
%88 = icmp eq i32 %87, 1
%89 = zext i1 %88 to i64
%90 = select i1 %88, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%91 = load i32, i32* %6
%92 = load i32, i32* %7
%93 = load i32, i32* %8
%94 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %81, i8* %85, i32 %86, i8* %90, i32 %91, i32 %92, i32 %93)
br label %167
95: ; preds = %77
%96 = load i32, i32* %5
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %108
98: ; preds = %95
%99 = load i32, i32* %5
%100 = load i32, i32* %5
%101 = icmp eq i32 %100, 1
%102 = zext i1 %101 to i64
%103 = select i1 %101, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%104 = load i32, i32* %6
%105 = load i32, i32* %7
%106 = load i32, i32* %8
%107 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %99, i8* %103, i32 %104, i32 %105, i32 %106)
br label %166
108: ; preds = %95
%109 = load i32, i32* %6
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %142
111: ; preds = %108
%112 = load i32, i32* %7
%113 = icmp ne i32 %112, 0
br i1 %113, label %117, label %114
114: ; preds = %111
%115 = load i32, i32* %8
%116 = icmp ne i32 %115, 0
br i1 %116, label %117, label %134
117: ; preds = %114, %111
%118 = load i32, i32* %6
%119 = load i32, i32* %6
%120 = icmp eq i32 %119, 1
%121 = zext i1 %120 to i64
%122 = select i1 %120, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%123 = load i32, i32* %7
%124 = load i32, i32* %7
%125 = icmp eq i32 %124, 1
%126 = zext i1 %125 to i64
%127 = select i1 %125, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%128 = load i32, i32* %8
%129 = load i32, i32* %8
%130 = icmp eq i32 %129, 1
%131 = zext i1 %130 to i64
%132 = select i1 %130, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%133 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %118, i8* %122, i32 %123, i8* %127, i32 %128, i8* %132)
br label %141
134: ; preds = %114
%135 = load i32, i32* %6
%136 = load i32, i32* %6
%137 = icmp eq i32 %136, 1
%138 = zext i1 %137 to i64
%139 = select i1 %137, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%140 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %135, i8* %139)
br label %141
141: ; preds = %134, %117
br label %165
142: ; preds = %108
%143 = load i32, i32* %7
%144 = icmp ne i32 %143, 0
br i1 %144, label %145, label %157
145: ; preds = %142
%146 = load i32, i32* %7
%147 = load i32, i32* %7
%148 = icmp eq i32 %147, 1
%149 = zext i1 %148 to i64
%150 = select i1 %148, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%151 = load i32, i32* %8
%152 = load i32, i32* %8
%153 = icmp eq i32 %152, 1
%154 = zext i1 %153 to i64
%155 = select i1 %153, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%156 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %146, i8* %150, i32 %151, i8* %155)
br label %164
157: ; preds = %142
%158 = load i32, i32* %8
%159 = load i32, i32* %8
%160 = icmp eq i32 %159, 1
%161 = zext i1 %160 to i64
%162 = select i1 %160, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%163 = call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %158, i8* %162)
br label %164
164: ; preds = %157, %145
br label %165
165: ; preds = %164, %141
br label %166
166: ; preds = %165, %98
br label %167
167: ; preds = %166, %80
br label %168
168: ; preds = %167, %57
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@dissect_time.buf = internal global [64 x i8] zeroinitializer
@.str = [47 x i8] c"%d year%s, %d week%s, %d day%s, %02d:%02d:%02d\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"s\00"
@.str.3 = [36 x i8] c"%d week%s, %d day%s, %02d:%02d:%02d\00"
@.str.4 = [25 x i8] c"%d day%s, %02d:%02d:%02d\00"
@.str.5 = [36 x i8] c"%d hour%s, %d minute%s, %d second%s\00"
@.str.6 = [10 x i8] c"%d hour%s\00"
@.str.7 = [25 x i8] c"%d minute%s, %d second%s\00"
@.str.8 = [12 x i8] c"%d second%s\00"
define i8* @dissect_time(i32 %0) {
%2 = icmp sgt i32 %0, 31535999
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = add nsw i32 %0, -31536000
%5 = add nuw i32 %0, 31535999
%6 = call i32 @llvm.smin.i32(i32 %0, i32 63071999)
%7 = sub nuw i32 %5, %6
%8 = udiv i32 %7, 31536000
%9 = mul nsw i32 %8, -31536000
%10 = add nsw i32 %9, %4
%11 = add nuw nsw i32 %8, 1
br label %12
12: ; preds = %3, %1
%13 = phi i32 [ %0, %1 ], [ %10, %3 ]
%14 = phi i32 [ 0, %1 ], [ %11, %3 ]
%15 = icmp sgt i32 %13, 604799
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = add nsw i32 %13, -604800
%18 = add nuw nsw i32 %13, 604799
%19 = call i32 @llvm.smin.i32(i32 %13, i32 1209599)
%20 = sub nuw nsw i32 %18, %19
%21 = udiv i32 %20, 604800
%22 = mul nsw i32 %21, -604800
%23 = add nsw i32 %22, %17
%24 = add nuw nsw i32 %21, 1
br label %25
25: ; preds = %16, %12
%26 = phi i32 [ %13, %12 ], [ %23, %16 ]
%27 = phi i32 [ 0, %12 ], [ %24, %16 ]
%28 = icmp sgt i32 %26, 86399
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = add nsw i32 %26, -86400
%31 = add nuw nsw i32 %26, 86399
%32 = call i32 @llvm.smin.i32(i32 %26, i32 172799)
%33 = sub nuw nsw i32 %31, %32
%34 = udiv i32 %33, 86400
%35 = mul nsw i32 %34, -86400
%36 = add nsw i32 %35, %30
%37 = add nuw nsw i32 %34, 1
br label %38
38: ; preds = %29, %25
%39 = phi i32 [ %26, %25 ], [ %36, %29 ]
%40 = phi i32 [ 0, %25 ], [ %37, %29 ]
%41 = icmp sgt i32 %39, 3599
br i1 %41, label %42, label %51
42: ; preds = %38
%43 = add nsw i32 %39, -3600
%44 = add nuw nsw i32 %39, 3599
%45 = call i32 @llvm.smin.i32(i32 %39, i32 7199)
%46 = sub nuw nsw i32 %44, %45
%47 = udiv i32 %46, 3600
%48 = mul nsw i32 %47, -3600
%49 = add nsw i32 %48, %43
%50 = add nuw nsw i32 %47, 1
br label %51
51: ; preds = %42, %38
%52 = phi i32 [ %39, %38 ], [ %49, %42 ]
%53 = phi i32 [ 0, %38 ], [ %50, %42 ]
%54 = icmp sgt i32 %52, 59
br i1 %54, label %55, label %64
55: ; preds = %51
%56 = add nsw i32 %52, -60
%57 = add nuw nsw i32 %52, 59
%58 = call i32 @llvm.smin.i32(i32 %52, i32 119)
%59 = sub nuw nsw i32 %57, %58
%60 = udiv i32 %59, 60
%61 = mul nsw i32 %60, -60
%62 = add nsw i32 %61, %56
%63 = add nuw nsw i32 %60, 1
br label %64
64: ; preds = %55, %51
%65 = phi i32 [ %52, %51 ], [ %62, %55 ]
%66 = phi i32 [ 0, %51 ], [ %63, %55 ]
%67 = icmp eq i32 %14, 0
br i1 %67, label %76, label %68
68: ; preds = %64
%69 = icmp eq i32 %14, 1
%70 = select i1 %69, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%71 = icmp eq i32 %27, 1
%72 = select i1 %71, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%73 = icmp eq i32 %40, 1
%74 = select i1 %73, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%75 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i32 %14, i8* %70, i32 %27, i8* %72, i32 %40, i8* %74, i32 %53, i32 %66, i32 %65)
br label %118
76: ; preds = %64
%77 = icmp eq i32 %27, 0
br i1 %77, label %84, label %78
78: ; preds = %76
%79 = icmp eq i32 %27, 1
%80 = select i1 %79, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%81 = icmp eq i32 %40, 1
%82 = select i1 %81, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%83 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0), i32 %27, i8* %80, i32 %40, i8* %82, i32 %53, i32 %66, i32 %65)
br label %118
84: ; preds = %76
%85 = icmp eq i32 %40, 0
br i1 %85, label %90, label %86
86: ; preds = %84
%87 = icmp eq i32 %40, 1
%88 = select i1 %87, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%89 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i32 %40, i8* %88, i32 %53, i32 %66, i32 %65)
br label %118
90: ; preds = %84
%91 = icmp eq i32 %53, 0
br i1 %91, label %106, label %92
92: ; preds = %90
%93 = icmp ne i32 %66, 0
%94 = icmp ne i32 %65, 0
%95 = select i1 %93, i1 true, i1 %94
%96 = icmp eq i32 %53, 1
%97 = select i1 %96, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
br i1 %95, label %98, label %104
98: ; preds = %92
%99 = icmp eq i32 %66, 1
%100 = select i1 %99, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%101 = icmp eq i32 %65, 1
%102 = select i1 %101, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%103 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %53, i8* %97, i32 %66, i8* %100, i32 %65, i8* %102)
br label %118
104: ; preds = %92
%105 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %53, i8* %97)
br label %118
106: ; preds = %90
%107 = icmp eq i32 %66, 0
br i1 %107, label %114, label %108
108: ; preds = %106
%109 = icmp eq i32 %66, 1
%110 = select i1 %109, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%111 = icmp eq i32 %65, 1
%112 = select i1 %111, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%113 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %66, i8* %110, i32 %65, i8* %112)
br label %118
114: ; preds = %106
%115 = icmp eq i32 %65, 1
%116 = select i1 %115, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)
%117 = tail call i32 (i8*, i32, i8*, i32, i8*, ...) @snprintf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.8, i64 0, i64 0), i32 %65, i8* %116)
br label %118
118: ; preds = %78, %104, %98, %114, %108, %86, %68
ret i8* getelementptr inbounds ([64 x i8], [64 x i8]* @dissect_time.buf, i64 0, i64 0)
}