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

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
double difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
void printResults(time_t *pt1, time_t *pt2) {
  double secs;
  int hours, mins, intsecs;
  printf("End: \t%s", ctime(pt2));
  secs = difftime(*pt2, *pt1);
  intsecs = (int)secs;
  printf("Calculations took %d second%s.\n", intsecs,
         (intsecs == 1 ? "" : "s"));
  hours = intsecs / 3600;
  intsecs -= hours * 3600;
  mins = intsecs / 60;
  intsecs -= mins * 60;
  if (hours > 0 || mins > 0) {
    printf("Equals ");
    if (hours > 0) {
      printf("%d hour%s, ", hours, (hours == 1) ? "" : "s");
    }
    if (mins > 0) {
      printf("%d minute%s and ", mins, (mins == 1) ? "" : "s");
    }
    printf("%d second%s.\n", intsecs, (intsecs == 1 ? "" : "s"));
  }
}


x86 assembly (clang, -O0):
<printResults>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <ctime@plt>
mov    %rax,%rsi
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
call   1050 <difftime@plt>
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x24(%rbp),%ecx
lea    0xe82(%rip),%rdx
lea    0xe9c(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
mov    $0xe10,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
imul   $0xe10,-0x1c(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
imul   $0x3c,-0x20(%rbp),%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jg     11ec <printResults+0xbc>
cmpl   $0x0,-0x20(%rbp)
jle    1289 <printResults+0x159>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
jle    122d <printResults+0xfd>
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%ecx
lea    0xdf6(%rip),%rdx
lea    0xe10(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0x20(%rbp)
jle    1260 <printResults+0x130>
mov    -0x20(%rbp),%esi
mov    -0x20(%rbp),%ecx
lea    0xdc3(%rip),%rdx
lea    0xddd(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%esi
mov    -0x24(%rbp),%ecx
lea    0xd9a(%rip),%rdx
lea    0xdb4(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rdx
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printResults>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    %rsi,%rdi
call   1030 <ctime@plt>
lea    0xeb0(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%edi
mov    0x0(%rbp),%esi
call   1050 <difftime@plt>
cvttsd2si %xmm0,%ebp
cmp    $0x1,%ebp
lea    0xeb6(%rip),%rax
lea    0xe8e(%rip),%r14
mov    %r14,%rdx
cmove  %rax,%rdx
lea    0xe82(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebp,%rax
imul   $0xffffffff91a2b3c5,%rax,%rbx
shr    $0x20,%rbx
add    %ebp,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0xb,%ebx
add    %ecx,%ebx
imul   $0xfffff1f0,%ebx,%r13d
add    %ebp,%r13d
cmp    $0xe0f,%eax
jg     11d0 <printResults+0xa0>
cmp    $0x3c,%r13d
jge    11d0 <printResults+0xa0>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movslq %r13d,%rax
imul   $0xffffffff88888889,%rax,%r12
shr    $0x20,%r12
add    %r13d,%r12d
mov    %r12d,%eax
shr    $0x1f,%eax
sar    $0x5,%r12d
add    %eax,%r12d
imul   $0xffffffc4,%r12d,%r15d
lea    0xe30(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0xe10,%ebp
jl     1232 <printResults+0x102>
add    $0xfffff1f0,%ebp
cmp    $0xe10,%ebp
mov    %r14,%rdx
lea    0xe0a(%rip),%rax
cmovb  %rax,%rdx
lea    0xe08(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    %r13d,%r15d
cmp    $0x3c,%r13d
lea    0xde8(%rip),%rbx
jl     1262 <printResults+0x132>
add    $0xffffffc4,%r13d
cmp    $0x3c,%r13d
mov    %r14,%rdx
cmovb  %rbx,%rdx
lea    0xde5(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%r15d
cmove  %rbx,%r14
lea    0xdaa(%rip),%rdi
mov    %r15d,%esi
mov    %r14,%rdx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"End: \09%s\00"
@.str.1 = [32 x i8] c"Calculations took %d second%s.\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [8 x i8] c"Equals \00"
@.str.5 = [12 x i8] c"%d hour%s, \00"
@.str.6 = [17 x i8] c"%d minute%s and \00"
@.str.7 = [14 x i8] c"%d second%s.\0A\00"
define void @printResults(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca double
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%9 = load i32*, i32** %4
%10 = call i8* @ctime(i32* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = load i32*, i32** %3
%15 = load i32, i32* %14
%16 = call double @difftime(i32 %13, i32 %15)
store double %16, double* %5
%17 = load double, double* %5
%18 = fptosi double %17 to i32
store i32 %18, i32* %8
%19 = load i32, i32* %8
%20 = load i32, i32* %8
%21 = icmp eq i32 %20, 1
%22 = zext i1 %21 to i64
%23 = select i1 %21, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %19, i8* %23)
%25 = load i32, i32* %8
%26 = sdiv i32 %25, 3600
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = mul nsw i32 %27, 3600
%29 = load i32, i32* %8
%30 = sub nsw i32 %29, %28
store i32 %30, i32* %8
%31 = load i32, i32* %8
%32 = sdiv i32 %31, 60
store i32 %32, i32* %7
%33 = load i32, i32* %7
%34 = mul nsw i32 %33, 60
%35 = load i32, i32* %8
%36 = sub nsw i32 %35, %34
store i32 %36, i32* %8
%37 = load i32, i32* %6
%38 = icmp sgt i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %2
%40 = load i32, i32* %7
%41 = icmp sgt i32 %40, 0
br i1 %41, label %42, label %70
42: ; preds = %39, %2
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%44 = load i32, i32* %6
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %53
46: ; preds = %42
%47 = load i32, i32* %6
%48 = load i32, i32* %6
%49 = icmp eq i32 %48, 1
%50 = zext i1 %49 to i64
%51 = select i1 %49, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %47, i8* %51)
br label %53
53: ; preds = %46, %42
%54 = load i32, i32* %7
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %63
56: ; preds = %53
%57 = load i32, i32* %7
%58 = load i32, i32* %7
%59 = icmp eq i32 %58, 1
%60 = zext i1 %59 to i64
%61 = select i1 %59, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %57, i8* %61)
br label %63
63: ; preds = %56, %53
%64 = load i32, i32* %8
%65 = load i32, i32* %8
%66 = icmp eq i32 %65, 1
%67 = zext i1 %66 to i64
%68 = select i1 %66, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %64, i8* %68)
br label %70
70: ; preds = %63, %39
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"End: \09%s\00"
@.str.1 = [32 x i8] c"Calculations took %d second%s.\0A\00"
@.str.2 = [1 x i8] zeroinitializer
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [8 x i8] c"Equals \00"
@.str.5 = [12 x i8] c"%d hour%s, \00"
@.str.6 = [17 x i8] c"%d minute%s and \00"
@.str.7 = [14 x i8] c"%d second%s.\0A\00"
define void @printResults(i32* nocapture %0, i32* %1) {
%3 = tail call i8* @ctime(i32* %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i32, i32* %1
%6 = load i32, i32* %0
%7 = tail call double @difftime(i32 %5, i32 %6)
%8 = fptosi double %7 to i32
%9 = icmp eq i32 %8, 1
%10 = select i1 %9, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %10)
%12 = sdiv i32 %8, 3600
%13 = mul nsw i32 %12, -3600
%14 = add i32 %13, %8
%15 = sdiv i32 %14, 60
%16 = mul nsw i32 %15, -60
%17 = add i32 %16, %14
%18 = icmp sgt i32 %8, 3599
%19 = icmp sgt i32 %14, 59
%20 = or i1 %18, %19
br i1 %20, label %21, label %38
21: ; preds = %2
%22 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
br i1 %18, label %23, label %28
23: ; preds = %21
%24 = add nsw i32 %8, -3600
%25 = icmp ult i32 %24, 3600
%26 = select i1 %25, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0), i32 %12, i8* %26)
br label %28
28: ; preds = %23, %21
br i1 %19, label %29, label %34
29: ; preds = %28
%30 = add nsw i32 %14, -60
%31 = icmp ult i32 %30, 60
%32 = select i1 %31, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i32 %15, i8* %32)
br label %34
34: ; preds = %29, %28
%35 = icmp eq i32 %17, 1
%36 = select i1 %35, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.7, i64 0, i64 0), i32 %17, i8* %36)
br label %38
38: ; preds = %2, %34
ret void
}