#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 */
int /*<<< orphan*/ plural(long);
int /*<<< orphan*/ printf(char *, long, int /*<<< orphan*/);
void time_print(time_t interval) {
  if (interval > 3600) {
    long hours = interval / 3600;
    printf("%li hour%s ", hours, plural(hours));
    interval = interval % 3600;
  }
  if (interval > 60) {
    long minutes = interval / 60;
    printf("%li minute%s ", minutes, plural(minutes));
    interval = interval % 60;
  }
  printf("%li second%s", (long)interval, plural((long)interval));
}


x86 assembly (clang, -O0):
<time_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xe10,-0x4(%rbp)
jle    117a <time_print+0x5a>
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <plural@plt>
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x3c,-0x4(%rbp)
jle    11c6 <time_print+0xa6>
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <plural@plt>
mov    -0x28(%rbp),%rsi
mov    %eax,%edx
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
movslq -0x4(%rbp),%rax
mov    %rax,-0x30(%rbp)
movslq -0x4(%rbp),%rdi
call   1040 <plural@plt>
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time_print>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
cmp    $0xe11,%edi
jl     115d <time_print+0x3d>
mov    %ebp,%eax
mov    $0x91a2b3c5,%ebx
imul   %rax,%rbx
shr    $0x2b,%rbx
mov    %rbx,%rdi
call   1040 <plural@plt>
lea    0xeb5(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
imul   $0xe10,%ebx,%eax
sub    %eax,%ebp
cmp    $0x3d,%ebp
jl     118f <time_print+0x6f>
movzwl %bp,%eax
imul   $0x8889,%eax,%ebx
shr    $0x15,%ebx
mov    %rbx,%rdi
call   1040 <plural@plt>
lea    0xe8f(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <printf@plt>
imul   $0x3c,%ebx,%eax
sub    %eax,%ebp
movzwl %bp,%ebp
movslq %ebp,%rbx
mov    %rbx,%rdi
call   1040 <plural@plt>
lea    0xe79(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%li hour%s \00"
@.str.1 = [14 x i8] c"%li minute%s \00"
@.str.2 = [13 x i8] c"%li second%s\00"
define void @time_print(i32 %0) {
%2 = alloca i32
%3 = alloca i64
%4 = alloca i64
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp sgt i32 %5, 3600
br i1 %6, label %7, label %17
7: ; preds = %1
%8 = load i32, i32* %2
%9 = sdiv i32 %8, 3600
%10 = sext i32 %9 to i64
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = load i64, i64* %3
%13 = call i32 @plural(i64 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %11, i32 %13)
%15 = load i32, i32* %2
%16 = srem i32 %15, 3600
store i32 %16, i32* %2
br label %17
17: ; preds = %7, %1
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 60
br i1 %19, label %20, label %30
20: ; preds = %17
%21 = load i32, i32* %2
%22 = sdiv i32 %21, 60
%23 = sext i32 %22 to i64
store i64 %23, i64* %4
%24 = load i64, i64* %4
%25 = load i64, i64* %4
%26 = call i32 @plural(i64 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 %24, i32 %26)
%28 = load i32, i32* %2
%29 = srem i32 %28, 60
store i32 %29, i32* %2
br label %30
30: ; preds = %20, %17
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = load i32, i32* %2
%34 = sext i32 %33 to i64
%35 = call i32 @plural(i64 %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 %32, i32 %35)
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%li hour%s \00"
@.str.1 = [14 x i8] c"%li minute%s \00"
@.str.2 = [13 x i8] c"%li second%s\00"
define void @time_print(i32 %0) {
%2 = icmp sgt i32 %0, 3600
br i1 %2, label %3, label %9
3: ; preds = %1
%4 = udiv i32 %0, 3600
%5 = zext i32 %4 to i64
%6 = tail call i32 @plural(i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i64 %5, i32 %6)
%8 = urem i32 %0, 3600
br label %9
9: ; preds = %3, %1
%10 = phi i32 [ %8, %3 ], [ %0, %1 ]
%11 = icmp sgt i32 %10, 60
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = trunc i32 %10 to i16
%14 = udiv i16 %13, 60
%15 = zext i16 %14 to i64
%16 = tail call i32 @plural(i64 %15)
%17 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i64 %15, i32 %16)
%18 = urem i16 %13, 60
%19 = zext i16 %18 to i32
br label %20
20: ; preds = %12, %9
%21 = phi i32 [ %19, %12 ], [ %10, %9 ]
%22 = sext i32 %21 to i64
%23 = tail call i32 @plural(i64 %22)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 %22, i32 %23)
ret void
}