#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
void writeOVRData(const char *fname, double runtime, int wr_flag) {
  FILE *fp;
  if (wr_flag)
    fp = fopen(fname, "w");
  else
    fp = fopen(fname, "a");
  fprintf(fp, "%lf,\n", runtime);
  fclose(fp);
}


x86 assembly (clang, -O0):
<writeOVRData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1167 <writeOVRData+0x37>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
jmp    117b <writeOVRData+0x4b>
mov    -0x8(%rbp),%rdi
lea    0xe90(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
lea    0xe79(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeOVRData>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
test   %esi,%esi
lea    0xebe(%rip),%rax
lea    0xeb5(%rip),%rsi
cmove  %rax,%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
lea    0xea6(%rip),%rsi
mov    %rax,%rdi
movsd  0x8(%rsp),%xmm0
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [6 x i8] c"%lf,\0A\00"
define void @writeOVRData(i8* %0, double %1, i32 %2) {
%4 = alloca i8*
%5 = alloca double
%6 = alloca i32
%7 = alloca i32*
store i8* %0, i8** %4
store double %1, double* %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = call i32* @fopen(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %12, i32** %7
br label %16
13: ; preds = %3
%14 = load i8*, i8** %4
%15 = call i32* @fopen(i8* %14, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %7
br label %16
16: ; preds = %13, %10
%17 = load i32*, i32** %7
%18 = load double, double* %5
%19 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %18)
%20 = load i32*, i32** %7
%21 = call i32 @fclose(i32* %20)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [2 x i8] c"a\00"
@.str.2 = [6 x i8] c"%lf,\0A\00"
define void @writeOVRData(i8* nocapture %0, double %1, i32 %2) {
%4 = icmp eq i32 %2, 0
%5 = select i1 %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%6 = tail call i32* @fopen(i8* %0, i8* %5)
%7 = tail call i32 @fprintf(i32* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %1)
%8 = tail call i32 @fclose(i32* %6)
ret void
}