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

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
void print_ff(FILE *fileout, double round, double data) {
  if (round == 0) {
    fprintf(fileout, "%.0f", data);
  } else if (round == 4) {
    fprintf(fileout, "%.4f", data);
  } else if (round == 5) {
    fprintf(fileout, "%.5f", data);
  } else if (round == 8) {
    fprintf(fileout, "%.8f", data);
  }
}


x86 assembly (clang, -O0):
<print_ff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1158 <print_ff+0x48>
jp     1158 <print_ff+0x48>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1207 <print_ff+0xf7>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9b(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    118f <print_ff+0x7f>
jp     118f <print_ff+0x7f>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1202 <print_ff+0xf2>
movsd  -0x10(%rbp),%xmm0
movsd  0xe6c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11c6 <print_ff+0xb6>
jp     11c6 <print_ff+0xb6>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xe66(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11fd <print_ff+0xed>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f8 <print_ff+0xe8>
jp     11f8 <print_ff+0xe8>
mov    -0x8(%rbp),%rdi
movsd  -0x18(%rbp),%xmm0
lea    0xe34(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11fd <print_ff+0xed>
jmp    1202 <print_ff+0xf2>
jmp    1207 <print_ff+0xf7>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ff>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jne    112b <print_ff+0x1b>
jp     112b <print_ff+0x1b>
lea    0xef5(%rip),%rsi
movaps %xmm1,%xmm0
jmp    1030 <fprintf@plt>
ucomisd 0xecd(%rip),%xmm0
jne    1146 <print_ff+0x36>
jp     1146 <print_ff+0x36>
lea    0xedf(%rip),%rsi
movaps %xmm1,%xmm0
jmp    1030 <fprintf@plt>
ucomisd 0xeba(%rip),%xmm0
jne    1161 <print_ff+0x51>
jp     1161 <print_ff+0x51>
lea    0xec9(%rip),%rsi
movaps %xmm1,%xmm0
jmp    1030 <fprintf@plt>
ucomisd 0xea7(%rip),%xmm0
jne    117c <print_ff+0x6c>
jp     117c <print_ff+0x6c>
lea    0xeb3(%rip),%rsi
movaps %xmm1,%xmm0
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%.0f\00"
@.str.1 = [5 x i8] c"%.4f\00"
@.str.2 = [5 x i8] c"%.5f\00"
@.str.3 = [5 x i8] c"%.8f\00"
define void @print_ff(i32* %0, double %1, double %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca double
store i32* %0, i32** %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %5
%8 = fcmp oeq double %7, 0.000000e+00
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32*, i32** %4
%11 = load double, double* %6
%12 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), double %11)
br label %37
13: ; preds = %3
%14 = load double, double* %5
%15 = fcmp oeq double %14, 4.000000e+00
br i1 %15, label %16, label %20
16: ; preds = %13
%17 = load i32*, i32** %4
%18 = load double, double* %6
%19 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %18)
br label %36
20: ; preds = %13
%21 = load double, double* %5
%22 = fcmp oeq double %21, 5.000000e+00
br i1 %22, label %23, label %27
23: ; preds = %20
%24 = load i32*, i32** %4
%25 = load double, double* %6
%26 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %25)
br label %35
27: ; preds = %20
%28 = load double, double* %5
%29 = fcmp oeq double %28, 8.000000e+00
br i1 %29, label %30, label %34
30: ; preds = %27
%31 = load i32*, i32** %4
%32 = load double, double* %6
%33 = call i32 @fprintf(i32* %31, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %32)
br label %34
34: ; preds = %30, %27
br label %35
35: ; preds = %34, %23
br label %36
36: ; preds = %35, %16
br label %37
37: ; preds = %36, %9
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%.0f\00"
@.str.1 = [5 x i8] c"%.4f\00"
@.str.2 = [5 x i8] c"%.5f\00"
@.str.3 = [5 x i8] c"%.8f\00"
define void @print_ff(i32* nocapture %0, double %1, double %2) {
%4 = fcmp oeq double %1, 0.000000e+00
br i1 %4, label %11, label %5
5: ; preds = %3
%6 = fcmp oeq double %1, 4.000000e+00
br i1 %6, label %11, label %7
7: ; preds = %5
%8 = fcmp oeq double %1, 5.000000e+00
br i1 %8, label %11, label %9
9: ; preds = %7
%10 = fcmp oeq double %1, 8.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %9, %7, %5, %3
%12 = phi i8* [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), %3 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %5 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), %7 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), %9 ]
%13 = tail call i32 @fprintf(i32* %0, i8* %12, double %2)
br label %14
14: ; preds = %11, %9
ret void
}