#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 doubleout_file(FILE *outfile, double number, int mode) {
  double fabs(double);
  if (outfile == NULL) {
    return;
  }
  if (mode == 1) {
    if (fabs(number) < 100) {
      fprintf(outfile, "  %19.16f", number);
    } else {
      fprintf(outfile, "  %19g", number);
    }
  }
}


x86 assembly (clang, -O0):
<doubleout_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1134 <doubleout_file+0x24>
jmp    1194 <doubleout_file+0x84>
cmpl   $0x1,-0x14(%rbp)
jne    1194 <doubleout_file+0x84>
movsd  -0x10(%rbp),%xmm1
movaps 0xec6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    117a <doubleout_file+0x6a>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xeb0(%rip),%rsi
call   1030 <fprintf@plt>
jmp    118f <doubleout_file+0x7f>
mov    -0x8(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
jmp    1194 <doubleout_file+0x84>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doubleout_file>:
test   %rdi,%rdi
je     1149 <doubleout_file+0x39>
cmp    $0x1,%esi
jne    1149 <doubleout_file+0x39>
movapd 0xede(%rip),%xmm1
andpd  %xmm0,%xmm1
movsd  0xee2(%rip),%xmm2
ucomisd %xmm1,%xmm2
lea    0xedf(%rip),%rax
lea    0xee2(%rip),%rsi
cmova  %rax,%rsi
jmp    1030 <fprintf@plt>
ret

LLVM IR (-O0):
@.str = [10 x i8] c" %19.16f\00"
@.str.1 = [7 x i8] c" %19g\00"
define void @doubleout_file(i32* %0, double %1, i32 %2) {
%4 = alloca i32*
%5 = alloca double
%6 = alloca i32
store i32* %0, i32** %4
store double %1, double* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %10
9: ; preds = %3
br label %26
10: ; preds = %3
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 1
br i1 %12, label %13, label %26
13: ; preds = %10
%14 = load double, double* %5
%15 = call double @llvm.fabs.f64(double %14)
%16 = fcmp olt double %15, 1.000000e+02
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load double, double* %5
%20 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %19)
br label %25
21: ; preds = %13
%22 = load i32*, i32** %4
%23 = load double, double* %5
%24 = call i32 @fprintf(i32* %22, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %23)
br label %25
25: ; preds = %21, %17
br label %26
26: ; preds = %9, %25, %10
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c" %19.16f\00"
@.str.1 = [7 x i8] c" %19g\00"
define void @doubleout_file(i32* %0, double %1, i32 %2) {
%4 = icmp ne i32* %0, null
%5 = icmp eq i32 %2, 1
%6 = and i1 %4, %5
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = tail call double @llvm.fabs.f64(double %1)
%9 = fcmp olt double %8, 1.000000e+02
%10 = select i1 %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0)
%11 = tail call i32 @fprintf(i32* %0, i8* %10, double %1)
br label %12
12: ; preds = %7, %3
ret void
}