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

/* Variables and functions */
int /*<<< orphan*/ snprintf(char *, int, char *, double const);
const char *lb_wtime_string(double sec) {
  static char buf[64 + 1];
  if (sec / 60 < 1.0)
    snprintf(buf, 64, "%f sec", sec);
  else if (sec / (60 * 60) < 1.0) {
    const double min = sec / 60;
    snprintf(buf, 64, "%f min", min);
  } else {
    const double hours = sec / (60 * 60);
    snprintf(buf, 64, "%f hours", hours);
  }
  return buf;
}


x86 assembly (clang, -O0):
<lb_wtime_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xede(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeca(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1162 <lb_wtime_string+0x52>
movsd  -0x8(%rbp),%xmm0
lea    0x2ef4(%rip),%rdi
mov    $0x40,%esi
lea    0xec0(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11f5 <lb_wtime_string+0xe5>
movsd  -0x8(%rbp),%xmm1
movsd  0xea1(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe85(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11bd <lb_wtime_string+0xad>
movsd  -0x8(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0x2e99(%rip),%rdi
mov    $0x40,%esi
lea    0xe6c(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11f0 <lb_wtime_string+0xe0>
movsd  -0x8(%rbp),%xmm0
movsd  0xe46(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0x2e61(%rip),%rdi
mov    $0x40,%esi
lea    0xe3b(%rip),%rdx
call   1030 <snprintf@plt>
jmp    11f5 <lb_wtime_string+0xe5>
lea    0x2e44(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lb_wtime_string>:
push   %rax
movapd %xmm0,%xmm1
divsd  0xee3(%rip),%xmm1
movsd  0xee3(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    113b <lb_wtime_string+0x2b>
lea    0x2f0e(%rip),%rdi
lea    0xedf(%rip),%rdx
jmp    1169 <lb_wtime_string+0x59>
divsd  0xecd(%rip),%xmm0
lea    0x2ef6(%rip),%rdi
ucomisd %xmm0,%xmm2
jbe    1162 <lb_wtime_string+0x52>
lea    0xec8(%rip),%rdx
mov    $0x40,%esi
movapd %xmm1,%xmm0
jmp    116e <lb_wtime_string+0x5e>
lea    0xebd(%rip),%rdx
mov    $0x40,%esi
call   1030 <snprintf@plt>
lea    0x2ec6(%rip),%rax
pop    %rcx
ret

LLVM IR (-O0):
@lb_wtime_string.buf = internal global [65 x i8] zeroinitializer
@.str = [7 x i8] c"%f sec\00"
@.str.1 = [7 x i8] c"%f min\00"
@.str.2 = [9 x i8] c"%f hours\00"
define i8* @lb_wtime_string(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
%5 = load double, double* %2
%6 = fdiv double %5, 6.000000e+01
%7 = fcmp olt double %6, 1.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load double, double* %2
%10 = call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %9)
br label %26
11: ; preds = %1
%12 = load double, double* %2
%13 = fdiv double %12, 3.600000e+03
%14 = fcmp olt double %13, 1.000000e+00
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load double, double* %2
%17 = fdiv double %16, 6.000000e+01
store double %17, double* %3
%18 = load double, double* %3
%19 = call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %18)
br label %25
20: ; preds = %11
%21 = load double, double* %2
%22 = fdiv double %21, 3.600000e+03
store double %22, double* %4
%23 = load double, double* %4
%24 = call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %23)
br label %25
25: ; preds = %20, %15
br label %26
26: ; preds = %25, %8
ret i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@lb_wtime_string.buf = internal global [65 x i8] zeroinitializer
@.str = [7 x i8] c"%f sec\00"
@.str.1 = [7 x i8] c"%f min\00"
@.str.2 = [9 x i8] c"%f hours\00"
define i8* @lb_wtime_string(double %0) {
%2 = fdiv double %0, 6.000000e+01
%3 = fcmp olt double %2, 1.000000e+00
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %0)
br label %13
6: ; preds = %1
%7 = fdiv double %0, 3.600000e+03
%8 = fcmp olt double %7, 1.000000e+00
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %2)
br label %13
11: ; preds = %6
%12 = tail call i32 @snprintf(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0), i32 64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), double %7)
br label %13
13: ; preds = %9, %11, %4
ret i8* getelementptr inbounds ([65 x i8], [65 x i8]* @lb_wtime_string.buf, i64 0, i64 0)
}