#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int rem;
  int quot;
};
typedef TYPE_1__ div_t;

/* Variables and functions */
TYPE_1__ div(int, int);
int /*<<< orphan*/ printf(char *, ...);
void PrintTime(double timeval) {
  int time, days, hours, minutes, seconds;
  div_t divres;
  time = (int)timeval;
  if (time == 0) {
    printf("0s ");
    return;
  }
  divres = div(time, 60);
  seconds = divres.rem;
  time = divres.quot;
  divres = div(time, 60);
  minutes = divres.rem;
  time = divres.quot;
  divres = div(time, 24);
  hours = divres.rem;
  days = divres.quot;
  if (days != 0)
    printf("%dD ", days);
  if (hours != 0)
    printf("%dH ", hours);
  if (minutes != 0)
    printf("%dm ", minutes);
  if (seconds != 0)
    printf("%ds ", seconds);
}


x86 assembly (clang, -O0):
<PrintTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1152 <PrintTime+0x32>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122d <PrintTime+0x10d>
mov    -0xc(%rbp),%edi
mov    $0x3c,%esi
call   1040 <div@plt>
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x3c,%esi
call   1040 <div@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x18,%esi
call   1040 <div@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11dc <PrintTime+0xbc>
mov    -0x10(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x14(%rbp)
je     11f7 <PrintTime+0xd7>
mov    -0x14(%rbp),%esi
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     1212 <PrintTime+0xf2>
mov    -0x18(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x1c(%rbp)
je     122d <PrintTime+0x10d>
mov    -0x1c(%rbp),%esi
lea    0xded(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintTime>:
push   %r15
push   %r14
push   %rbx
cvttsd2si %xmm0,%edi
test   %edi,%edi
je     11c2 <PrintTime+0xa2>
mov    $0x3c,%esi
call   1040 <div@plt>
mov    %rax,%r14
mov    %rax,%rdi
shr    $0x20,%rdi
mov    $0x3c,%esi
call   1040 <div@plt>
mov    %rax,%r15
mov    %rax,%rdi
shr    $0x20,%rdi
mov    $0x18,%esi
call   1040 <div@plt>
mov    %rax,%rbx
mov    %rax,%rsi
shr    $0x20,%rsi
je     117d <PrintTime+0x5d>
lea    0xe8e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     1191 <PrintTime+0x71>
lea    0xe81(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r15d,%r15d
je     11a7 <PrintTime+0x87>
lea    0xe71(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
test   %r14d,%r14d
je     11d5 <PrintTime+0xb5>
lea    0xe60(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
lea    0xe37(%rip),%rdi
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <printf@plt>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i32 }
@.str = [4 x i8] c"0s \00"
@.str.1 = [5 x i8] c"%dD \00"
@.str.2 = [5 x i8] c"%dH \00"
@.str.3 = [5 x i8] c"%dm \00"
@.str.4 = [5 x i8] c"%ds \00"
define void @PrintTime(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.TYPE_3__
%9 = alloca %struct.TYPE_3__
%10 = alloca %struct.TYPE_3__
%11 = alloca %struct.TYPE_3__
store double %0, double* %2
%12 = load double, double* %2
%13 = fptosi double %12 to i32
store i32 %13, i32* %3
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %69
18: ; preds = %1
%19 = load i32, i32* %3
%20 = call i64 @div(i32 %19, i32 60)
%21 = bitcast %struct.TYPE_3__* %9 to i64*
store i64 %20, i64* %21
%22 = bitcast %struct.TYPE_3__* %8 to i8*
%23 = bitcast %struct.TYPE_3__* %9 to i8*
%24 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%25 = load i32, i32* %24
store i32 %25, i32* %7
%26 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%27 = load i32, i32* %26
store i32 %27, i32* %3
%28 = load i32, i32* %3
%29 = call i64 @div(i32 %28, i32 60)
%30 = bitcast %struct.TYPE_3__* %10 to i64*
store i64 %29, i64* %30
%31 = bitcast %struct.TYPE_3__* %8 to i8*
%32 = bitcast %struct.TYPE_3__* %10 to i8*
%33 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%34 = load i32, i32* %33
store i32 %34, i32* %6
%35 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%36 = load i32, i32* %35
store i32 %36, i32* %3
%37 = load i32, i32* %3
%38 = call i64 @div(i32 %37, i32 24)
%39 = bitcast %struct.TYPE_3__* %11 to i64*
store i64 %38, i64* %39
%40 = bitcast %struct.TYPE_3__* %8 to i8*
%41 = bitcast %struct.TYPE_3__* %11 to i8*
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
%43 = load i32, i32* %42
store i32 %43, i32* %5
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 1
%45 = load i32, i32* %44
store i32 %45, i32* %4
%46 = load i32, i32* %4
%47 = icmp ne i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %18
%49 = load i32, i32* %4
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %49)
br label %51
51: ; preds = %48, %18
%52 = load i32, i32* %5
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = load i32, i32* %5
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %55)
br label %57
57: ; preds = %54, %51
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32, i32* %6
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %60, %57
%64 = load i32, i32* %7
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i32, i32* %7
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %16, %66, %63
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"0s \00"
@.str.1 = [5 x i8] c"%dD \00"
@.str.2 = [5 x i8] c"%dH \00"
@.str.3 = [5 x i8] c"%dm \00"
@.str.4 = [5 x i8] c"%ds \00"
define void @PrintTime(double %0) {
%2 = fptosi double %0 to i32
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %34
6: ; preds = %1
%7 = tail call i64 @div(i32 %2, i32 60)
%8 = trunc i64 %7 to i32
%9 = lshr i64 %7, 32
%10 = trunc i64 %9 to i32
%11 = tail call i64 @div(i32 %10, i32 60)
%12 = trunc i64 %11 to i32
%13 = lshr i64 %11, 32
%14 = trunc i64 %13 to i32
%15 = tail call i64 @div(i32 %14, i32 24)
%16 = trunc i64 %15 to i32
%17 = lshr i64 %15, 32
%18 = trunc i64 %17 to i32
%19 = icmp eq i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %6
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %18)
br label %22
22: ; preds = %20, %6
%23 = icmp eq i32 %16, 0
br i1 %23, label %26, label %24
24: ; preds = %22
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %26
26: ; preds = %24, %22
%27 = icmp eq i32 %12, 0
br i1 %27, label %30, label %28
28: ; preds = %26
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %12)
br label %30
30: ; preds = %28, %26
%31 = icmp eq i32 %8, 0
br i1 %31, label %34, label %32
32: ; preds = %30
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %8)
br label %34
34: ; preds = %30, %32, %4
ret void
}