#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int, ...);
int /*<<< orphan*/ printf(char *);
void print_time_ival7(time_t t, int centi_sec, FILE *fout) {
  if ((long)t < (long)0) {
    printf("   ?   ");
    return;
  }
  if (t >= 48 * 60 * 60)
    fprintf(fout, " %2ludays", t / (24 * 60 * 60));
  else if (t >= 60 * 60)
    fprintf(fout, " %2lu:%02um", t / (60 * 60), (unsigned)((t / 60) % 60));
  else if (t > 60)
    fprintf(fout, " %2lu:%02u ", t / 60, (unsigned)t % 60);
  else
    fprintf(fout, " %2lu.%02us", t, centi_sec);
}


x86 assembly (clang, -O0):
<print_time_ival7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x0,%rax
jge    1151 <print_time_ival7+0x31>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    122e <print_time_ival7+0x10e>
cmpl   $0x2a300,-0x4(%rbp)
jl     1182 <print_time_ival7+0x62>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    $0x15180,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xe92(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    122e <print_time_ival7+0x10e>
cmpl   $0xe10,-0x4(%rbp)
jl     11cc <print_time_ival7+0xac>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,%ecx
mov    -0x14(%rbp),%edx
lea    0xe52(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1229 <print_time_ival7+0x109>
cmpl   $0x3c,-0x4(%rbp)
jle    120c <print_time_ival7+0xec>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%ecx
mov    -0x18(%rbp),%edx
lea    0xe1e(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1224 <print_time_ival7+0x104>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
jmp    1229 <print_time_ival7+0x109>
jmp    122e <print_time_ival7+0x10e>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_time_ival7>:
test   %edi,%edi
js     1150 <print_time_ival7+0x30>
mov    %edi,%eax
cmp    $0x2a300,%edi
jb     115c <print_time_ival7+0x3c>
mov    %eax,%ecx
mov    $0xc22e4507,%eax
imul   %rcx,%rax
shr    $0x30,%rax
lea    0xec4(%rip),%rsi
mov    %rdx,%rdi
mov    %eax,%edx
xor    %eax,%eax
jmp    1040 <fprintf@plt>
lea    0xea9(%rip),%rdi
jmp    1030 <printf@plt>
cmp    $0xe10,%eax
jb     11a6 <print_time_ival7+0x86>
mov    %eax,%ecx
mov    $0x91a2b3c5,%eax
imul   %rcx,%rax
shr    $0x2b,%rax
mov    $0x88888889,%esi
imul   %rcx,%rsi
shr    $0x25,%rsi
movzwl %si,%ecx
imul   $0x8889,%ecx,%ecx
shr    $0x15,%ecx
imul   $0x3c,%ecx,%ecx
sub    %ecx,%esi
movzwl %si,%ecx
lea    0xe78(%rip),%rsi
mov    %rdx,%rdi
mov    %eax,%edx
xor    %eax,%eax
jmp    1040 <fprintf@plt>
cmp    $0x3d,%eax
jb     11d6 <print_time_ival7+0xb6>
movzwl %ax,%ecx
imul   $0x8889,%ecx,%r8d
shr    $0x15,%r8d
imul   $0x3c,%r8d,%ecx
sub    %ecx,%eax
movzwl %ax,%ecx
lea    0xe55(%rip),%rsi
mov    %rdx,%rdi
mov    %r8d,%edx
xor    %eax,%eax
jmp    1040 <fprintf@plt>
mov    %esi,%ecx
lea    0xe4b(%rip),%rsi
mov    %rdx,%rdi
mov    %eax,%edx
xor    %eax,%eax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@.str = [8 x i8] c" ? \00"
@.str.1 = [10 x i8] c" %2ludays\00"
@.str.2 = [12 x i8] c" %2lu:%02um\00"
@.str.3 = [12 x i8] c" %2lu:%02u \00"
@.str.4 = [12 x i8] c" %2lu.%02us\00"
define void @print_time_ival7(i32 %0, i32 %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %48
12: ; preds = %3
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, 172800
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = load i32*, i32** %6
%17 = load i32, i32* %4
%18 = sdiv i32 %17, 86400
%19 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %48
20: ; preds = %12
%21 = load i32, i32* %4
%22 = icmp sge i32 %21, 3600
br i1 %22, label %23, label %31
23: ; preds = %20
%24 = load i32*, i32** %6
%25 = load i32, i32* %4
%26 = sdiv i32 %25, 3600
%27 = load i32, i32* %4
%28 = sdiv i32 %27, 60
%29 = srem i32 %28, 60
%30 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %24, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %26, i32 %29)
br label %47
31: ; preds = %20
%32 = load i32, i32* %4
%33 = icmp sgt i32 %32, 60
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = load i32*, i32** %6
%36 = load i32, i32* %4
%37 = sdiv i32 %36, 60
%38 = load i32, i32* %4
%39 = urem i32 %38, 60
%40 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %35, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %37, i32 %39)
br label %46
41: ; preds = %31
%42 = load i32*, i32** %6
%43 = load i32, i32* %4
%44 = load i32, i32* %5
%45 = call i32 (i32*, i8*, i32, ...) @fprintf(i32* %42, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %43, i32 %44)
br label %46
46: ; preds = %41, %34
br label %47
47: ; preds = %46, %23
br label %48
48: ; preds = %10, %47, %15
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c" ? \00"
@.str.1 = [10 x i8] c" %2ludays\00"
@.str.2 = [12 x i8] c" %2lu:%02um\00"
@.str.3 = [12 x i8] c" %2lu:%02u \00"
@.str.4 = [12 x i8] c" %2lu.%02us\00"
define void @print_time_ival7(i32 %0, i32 %1, i32* nocapture %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %32
7: ; preds = %3
%8 = icmp ugt i32 %0, 172799
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = udiv i32 %0, 86400
%11 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %32
12: ; preds = %7
%13 = icmp ugt i32 %0, 3599
br i1 %13, label %14, label %21
14: ; preds = %12
%15 = udiv i32 %0, 3600
%16 = udiv i32 %0, 60
%17 = trunc i32 %16 to i16
%18 = urem i16 %17, 60
%19 = zext i16 %18 to i32
%20 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %15, i32 %19)
br label %32
21: ; preds = %12
%22 = icmp ugt i32 %0, 60
br i1 %22, label %23, label %30
23: ; preds = %21
%24 = trunc i32 %0 to i16
%25 = udiv i16 %24, 60
%26 = zext i16 %25 to i32
%27 = urem i16 %24, 60
%28 = zext i16 %27 to i32
%29 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %26, i32 %28)
br label %32
30: ; preds = %21
%31 = tail call i32 (i32*, i8*, i32, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0), i32 %0, i32 %1)
br label %32
32: ; preds = %14, %30, %23, %5, %9
ret void
}