#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 */
scalar_t__ EOF;
double bench(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
scalar_t__ scanf(char *, int *, int *);
int main() {
  int npasses, faedge;
  FILE *fp = fopen("ffbench.csv", "w");
  printf("npasses, faedge, time(s)\n");
  fprintf(fp, "npasses, faedge, time(s)\n");
  while (scanf("%d%d", &npasses, &faedge) != EOF) {
    double t = bench(npasses, faedge);
    printf("%d, %d, %lf\n", npasses, faedge, t);
    fprintf(fp, "%d, %d, %lf\n", npasses, faedge, t);
    fflush(fp);
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
lea    0xe7f(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe5f(%rip),%rsi
mov    $0x0,%al
call   1060 <fprintf@plt>
lea    0xe6b(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1080 <scanf@plt>
mov    0x2e17(%rip),%rcx
cmp    (%rcx),%rax
je     122e <main+0xbe>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <bench@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
movsd  -0x20(%rbp),%xmm0
lea    0xe31(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
lea    0xe14(%rip),%rsi
mov    $0x1,%al
call   1060 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <fflush@plt>
jmp    11b6 <main+0x46>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe5b(%rip),%rdi
lea    0xe60(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%rbx
lea    0xe7f(%rip),%rdi
call   1030 <puts@plt>
lea    0xe47(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   10b0 <fwrite@plt>
lea    0xe48(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1090 <scanf@plt>
mov    0x2df2(%rip),%rbp
cmp    0x0(%rbp),%rax
je     127c <main+0xec>
lea    0xe26(%rip),%r14
lea    0xe1a(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%r13
nopl   0x0(%rax,%rax,1)
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
call   1050 <bench@plt>
movsd  %xmm0,0x10(%rsp)
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    %r14,%rsi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1070 <fprintf@plt>
mov    %rbx,%rdi
call   1080 <fflush@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1090 <scanf@plt>
cmp    0x0(%rbp),%rax
jne    1220 <main+0x90>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"ffbench.csv\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c"npasses, faedge, time(s)\0A\00"
@.str.3 = [5 x i8] c"%d%d\00"
@EOF = global i64 0
@.str.4 = [13 x i8] c"%d, %d, %lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32*, i32** %4
%9 = call i32 (i32*, i8*, ...) @fprintf(i32* %8, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
br label %10
10: ; preds = %14, %0
%11 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3)
%12 = load i64, i64* @EOF
%13 = icmp ne i64 %11, %12
br i1 %13, label %14, label %29
14: ; preds = %10
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = call double @bench(i32 %15, i32 %16)
store double %17, double* %5
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load double, double* %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %19, double %20)
%22 = load i32*, i32** %4
%23 = load i32, i32* %2
%24 = load i32, i32* %3
%25 = load double, double* %5
%26 = call i32 (i32*, i8*, ...) @fprintf(i32* %22, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %23, i32 %24, double %25)
%27 = load i32*, i32** %4
%28 = call i32 @fflush(i32* %27)
br label %10
29: ; preds = %10
%30 = load i32*, i32** %4
%31 = call i32 @fclose(i32* %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"ffbench.csv\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [26 x i8] c"npasses, faedge, time(s)\0A\00"
@.str.3 = [5 x i8] c"%d%d\00"
@EOF = global i64 0
@.str.4 = [13 x i8] c"%d, %d, %lf\0A\00"
@str = [25 x i8] c"npasses, faedge, time(s)\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i64 25, i64 1, i32* %5)
%8 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%9 = load i64, i64* @EOF
%10 = icmp eq i64 %8, %9
br i1 %10, label %25, label %11
11: ; preds = %0, %11
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = call double @bench(i32 %12, i32 %13)
%15 = load i32, i32* %1
%16 = load i32, i32* %2
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %15, i32 %16, double %14)
%18 = load i32, i32* %1
%19 = load i32, i32* %2
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %18, i32 %19, double %14)
%21 = call i32 @fflush(i32* %5)
%22 = call i64 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%23 = load i64, i64* @EOF
%24 = icmp eq i64 %22, %23
br i1 %24, label %25, label %11
25: ; preds = %11, %0
%26 = call i32 @fclose(i32* %5)
ret i32 0
}