#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*/ safef(char *, int, char *, double);
void formatDays(double days, char out[32]) {
  if (days < 1.0)
    safef(out, 32, "%3.1f hour", 24.0 * days);
  else if (days < 2 * 7.0)
    safef(out, 32, "%3.1f day", days);
  else if (days < 2 * 30.0)
    safef(out, 32, "%3.1f week", days / 7);
  else if (days < 2 * 365.0)
    safef(out, 32, "%3.1f month", days / 30);
  else
    safef(out, 32, "%3.1f year", days / 365);
}


x86 assembly (clang, -O0):
<formatDays>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  0xed7(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    115b <formatDays+0x4b>
mov    -0x10(%rbp),%rdi
movsd  0xef8(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
mov    $0x20,%esi
lea    0xeef(%rip),%rdx
call   1030 <safef@plt>
jmp    123e <formatDays+0x12e>
movsd  0xea5(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    118d <formatDays+0x7d>
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
mov    $0x20,%esi
lea    0xec8(%rip),%rdx
call   1030 <safef@plt>
jmp    1239 <formatDays+0x129>
movsd  0xe7b(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    11cb <formatDays+0xbb>
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  0xe7f(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x20,%esi
lea    0xe94(%rip),%rdx
call   1030 <safef@plt>
jmp    1234 <formatDays+0x124>
movsd  0xe45(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1209 <formatDays+0xf9>
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  0xe39(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x20,%esi
lea    0xe61(%rip),%rdx
call   1030 <safef@plt>
jmp    122f <formatDays+0x11f>
mov    -0x10(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  0xe06(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x20,%esi
lea    0xe42(%rip),%rdx
call   1030 <safef@plt>
jmp    1234 <formatDays+0x124>
jmp    1239 <formatDays+0x129>
jmp    123e <formatDays+0x12e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<formatDays>:
movsd  0xee8(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1137 <formatDays+0x27>
mulsd  0xf12(%rip),%xmm0
lea    0xf13(%rip),%rdx
mov    $0x20,%esi
jmp    1030 <safef@plt>
movsd  0xec9(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    1156 <formatDays+0x46>
lea    0xeff(%rip),%rdx
mov    $0x20,%esi
jmp    1030 <safef@plt>
movsd  0xeb2(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    117d <formatDays+0x6d>
divsd  0xec4(%rip),%xmm0
lea    0xee2(%rip),%rdx
mov    $0x20,%esi
jmp    1030 <safef@plt>
movsd  0xe93(%rip),%xmm1
ucomisd %xmm0,%xmm1
jbe    11a4 <formatDays+0x94>
divsd  0xe95(%rip),%xmm0
lea    0xec6(%rip),%rdx
mov    $0x20,%esi
jmp    1030 <safef@plt>
divsd  0xe74(%rip),%xmm0
lea    0xeb9(%rip),%rdx
mov    $0x20,%esi
jmp    1030 <safef@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"%3.1f hour\00"
@.str.1 = [10 x i8] c"%3.1f day\00"
@.str.2 = [11 x i8] c"%3.1f week\00"
@.str.3 = [12 x i8] c"%3.1f month\00"
@.str.4 = [11 x i8] c"%3.1f year\00"
define void @formatDays(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
%5 = load double, double* %3
%6 = fcmp olt double %5, 1.000000e+00
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8*, i8** %4
%9 = load double, double* %3
%10 = fmul double 2.400000e+01, %9
%11 = call i32 @safef(i8* %8, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %10)
br label %43
12: ; preds = %2
%13 = load double, double* %3
%14 = fcmp olt double %13, 1.400000e+01
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i8*, i8** %4
%17 = load double, double* %3
%18 = call i32 @safef(i8* %16, i32 32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %17)
br label %42
19: ; preds = %12
%20 = load double, double* %3
%21 = fcmp olt double %20, 6.000000e+01
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i8*, i8** %4
%24 = load double, double* %3
%25 = fdiv double %24, 7.000000e+00
%26 = call i32 @safef(i8* %23, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %41
27: ; preds = %19
%28 = load double, double* %3
%29 = fcmp olt double %28, 7.300000e+02
br i1 %29, label %30, label %35
30: ; preds = %27
%31 = load i8*, i8** %4
%32 = load double, double* %3
%33 = fdiv double %32, 3.000000e+01
%34 = call i32 @safef(i8* %31, i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double %33)
br label %40
35: ; preds = %27
%36 = load i8*, i8** %4
%37 = load double, double* %3
%38 = fdiv double %37, 3.650000e+02
%39 = call i32 @safef(i8* %36, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %38)
br label %40
40: ; preds = %35, %30
br label %41
41: ; preds = %40, %22
br label %42
42: ; preds = %41, %15
br label %43
43: ; preds = %42, %7
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%3.1f hour\00"
@.str.1 = [10 x i8] c"%3.1f day\00"
@.str.2 = [11 x i8] c"%3.1f week\00"
@.str.3 = [12 x i8] c"%3.1f month\00"
@.str.4 = [11 x i8] c"%3.1f year\00"
define void @formatDays(double %0, i8* %1) {
%3 = fcmp olt double %0, 1.000000e+00
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = fmul double %0, 2.400000e+01
%6 = tail call i32 @safef(i8* %1, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), double %5)
br label %24
7: ; preds = %2
%8 = fcmp olt double %0, 1.400000e+01
br i1 %8, label %9, label %11
9: ; preds = %7
%10 = tail call i32 @safef(i8* %1, i32 32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), double %0)
br label %24
11: ; preds = %7
%12 = fcmp olt double %0, 6.000000e+01
br i1 %12, label %13, label %16
13: ; preds = %11
%14 = fdiv double %0, 7.000000e+00
%15 = tail call i32 @safef(i8* %1, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), double %14)
br label %24
16: ; preds = %11
%17 = fcmp olt double %0, 7.300000e+02
br i1 %17, label %18, label %21
18: ; preds = %16
%19 = fdiv double %0, 3.000000e+01
%20 = tail call i32 @safef(i8* %1, i32 32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), double %19)
br label %24
21: ; preds = %16
%22 = fdiv double %0, 3.650000e+02
%23 = tail call i32 @safef(i8* %1, i32 32, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0), double %22)
br label %24
24: ; preds = %9, %18, %21, %13, %4
ret void
}