#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*/ coverage(float **, int, float *, int *, int *);
int load_locations(char *, float **, int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, int);
float mean_coverage2(char *opname1, char *opname2, char **imsets, int nimsets) {
  int nfiles = 0, i, fno, nlocs, np, nc;
  float locs[200000][2];
  float csum = 0.0, cov;
  char fn1[200], fn2[200];
  for (i = 0; i < nimsets; i++) {
    for (fno = 1; fno < 7; fno++) {
      sprintf(fn1, "data/%s_%s%d.txt", opname1, imsets[i], fno);
      nlocs = load_locations(fn1, locs, 0);
      sprintf(fn2, "data/%s_%s%d.txt", opname2, imsets[i], fno);
      nlocs = load_locations(fn2, locs, nlocs);
      coverage(locs, nlocs, &cov, &np, &nc);
      csum += cov;
      nfiles += 1;
    }
  }
  return csum / nfiles;
}


x86 assembly (clang, -O0):
<mean_coverage2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186be0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x186a44(%rbp)
ff
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    125f <mean_coverage2+0x12f>
movl   $0x1,-0x28(%rbp)
cmpl   $0x7,-0x28(%rbp)
jge    124c <mean_coverage2+0x11c>
lea    -0x186b10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x28(%rbp),%r8d
lea    0xe5e(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x186b10(%rbp),%rdi
lea    -0x186a40(%rbp),%rsi
xor    %edx,%edx
call   1050 <load_locations@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x186be0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x28(%rbp),%r8d
lea    0xe1f(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x186be0(%rbp),%rdi
lea    -0x186a40(%rbp),%rsi
mov    -0x2c(%rbp),%edx
call   1050 <load_locations@plt>
mov    %eax,-0x2c(%rbp)
lea    -0x186a40(%rbp),%rdi
mov    -0x2c(%rbp),%esi
lea    -0x186a48(%rbp),%rdx
lea    -0x30(%rbp),%rcx
lea    -0x34(%rbp),%r8
call   1030 <coverage@plt>
movss  -0x186a48(%rbp),%xmm0
ff
addss  -0x186a44(%rbp),%xmm0
ff
movss  %xmm0,-0x186a44(%rbp)
ff
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1176 <mean_coverage2+0x46>
jmp    1251 <mean_coverage2+0x121>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1163 <mean_coverage2+0x33>
movss  -0x186a44(%rbp),%xmm0
ff
cvtsi2ssl -0x20(%rbp),%xmm1
divss  %xmm1,%xmm0
add    $0x186be0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mean_coverage2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186be8,%rsp
test   %ecx,%ecx
jle    125b <mean_coverage2+0x12b>
mov    %rdx,0x28(%rsp)
mov    %rsi,0x30(%rsp)
mov    %rcx,0x10(%rsp)
mov    %ecx,%ecx
mov    %rcx,0x18(%rsp)
xorps  %xmm0,%xmm0
xor    %eax,%eax
lea    0xe99(%rip),%r14
lea    0x40(%rsp),%rbx
lea    0x1e0(%rsp),%r15
mov    %rdi,0x20(%rsp)
nopl   (%rax)
mov    %rax,0x8(%rsp)
mov    $0x1,%r12d
nopl   0x0(%rax,%rax,1)
movss  %xmm0,(%rsp)
mov    0x8(%rsp),%r13
mov    0x28(%rsp),%rbp
mov    0x0(%rbp,%r13,8),%rcx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    0x20(%rsp),%rdx
mov    %r12d,%r8d
call   1040 <sprintf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %edx,%edx
call   1050 <load_locations@plt>
mov    %eax,%ebx
mov    0x0(%rbp,%r13,8),%rcx
lea    0x110(%rsp),%rbp
mov    %rbp,%rdi
mov    %r14,%rsi
mov    0x30(%rsp),%rdx
mov    %r12d,%r8d
call   1040 <sprintf@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %ebx,%edx
lea    0x4(%rsp),%rbp
lea    0x3c(%rsp),%r13
lea    0x40(%rsp),%rbx
call   1050 <load_locations@plt>
mov    %r15,%rdi
mov    %eax,%esi
mov    %rbp,%rdx
mov    %r13,%rcx
lea    0x38(%rsp),%r8
call   1030 <coverage@plt>
movss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
add    $0x1,%r12d
cmp    $0x7,%r12d
jne    1190 <mean_coverage2+0x60>
mov    0x8(%rsp),%rcx
add    $0x1,%rcx
cmp    0x18(%rsp),%rcx
mov    %rcx,%rax
jne    1180 <mean_coverage2+0x50>
mov    0x10(%rsp),%rax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
jmp    1263 <mean_coverage2+0x133>
movss  0xd9d(%rip),%xmm0
add    $0x186be8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"data/%s_%s%d.txt\00"
define float @mean_coverage2(i8* %0, i8* %1, i8** %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca [200000 x [2 x float]]
%16 = alloca float
%17 = alloca float
%18 = alloca [200 x i8]
%19 = alloca [200 x i8]
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
store i32 0, i32* %9
store float 0.000000e+00, float* %16
store i32 0, i32* %10
br label %20
20: ; preds = %69, %4
%21 = load i32, i32* %10
%22 = load i32, i32* %8
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %72
24: ; preds = %20
store i32 1, i32* %11
br label %25
25: ; preds = %65, %24
%26 = load i32, i32* %11
%27 = icmp slt i32 %26, 7
br i1 %27, label %28, label %68
28: ; preds = %25
%29 = getelementptr inbounds [200 x i8], [200 x i8]* %18, i64 0, i64 0
%30 = load i8*, i8** %5
%31 = load i8**, i8*** %7
%32 = load i32, i32* %10
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %31, i64 %33
%35 = load i8*, i8** %34
%36 = load i32, i32* %11
%37 = call i32 @sprintf(i8* %29, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %30, i8* %35, i32 %36)
%38 = getelementptr inbounds [200 x i8], [200 x i8]* %18, i64 0, i64 0
%39 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %15, i64 0, i64 0
%40 = bitcast [2 x float]* %39 to float**
%41 = call i32 @load_locations(i8* %38, float** %40, i32 0)
store i32 %41, i32* %12
%42 = getelementptr inbounds [200 x i8], [200 x i8]* %19, i64 0, i64 0
%43 = load i8*, i8** %6
%44 = load i8**, i8*** %7
%45 = load i32, i32* %10
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8*, i8** %44, i64 %46
%48 = load i8*, i8** %47
%49 = load i32, i32* %11
%50 = call i32 @sprintf(i8* %42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %43, i8* %48, i32 %49)
%51 = getelementptr inbounds [200 x i8], [200 x i8]* %19, i64 0, i64 0
%52 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %15, i64 0, i64 0
%53 = bitcast [2 x float]* %52 to float**
%54 = load i32, i32* %12
%55 = call i32 @load_locations(i8* %51, float** %53, i32 %54)
store i32 %55, i32* %12
%56 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %15, i64 0, i64 0
%57 = bitcast [2 x float]* %56 to float**
%58 = load i32, i32* %12
%59 = call i32 @coverage(float** %57, i32 %58, float* %17, i32* %13, i32* %14)
%60 = load float, float* %17
%61 = load float, float* %16
%62 = fadd float %61, %60
store float %62, float* %16
%63 = load i32, i32* %9
%64 = add nsw i32 %63, 1
store i32 %64, i32* %9
br label %65
65: ; preds = %28
%66 = load i32, i32* %11
%67 = add nsw i32 %66, 1
store i32 %67, i32* %11
br label %25
68: ; preds = %25
br label %69
69: ; preds = %68
%70 = load i32, i32* %10
%71 = add nsw i32 %70, 1
store i32 %71, i32* %10
br label %20
72: ; preds = %20
%73 = load float, float* %16
%74 = load i32, i32* %9
%75 = sitofp i32 %74 to float
%76 = fdiv float %73, %75
ret float %76
}

LLVM IR (-O2):
@.str = [17 x i8] c"data/%s_%s%d.txt\00"
define float @mean_coverage2(i8* %0, i8* %1, i8** nocapture %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca [200000 x [2 x float]]
%8 = alloca float
%9 = alloca [200 x i8]
%10 = alloca [200 x i8]
%11 = bitcast i32* %5 to i8*
%12 = bitcast i32* %6 to i8*
%13 = bitcast [200000 x [2 x float]]* %7 to i8*
%14 = bitcast float* %8 to i8*
%15 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %10, i64 0, i64 0
%17 = icmp sgt i32 %3, 0
br i1 %17, label %18, label %46
18: ; preds = %4
%19 = bitcast [200000 x [2 x float]]* %7 to float**
%20 = zext i32 %3 to i64
br label %21
21: ; preds = %18, %39
%22 = phi i64 [ 0, %18 ], [ %40, %39 ]
%23 = phi float [ 0.000000e+00, %18 ], [ %36, %39 ]
%24 = getelementptr inbounds i8*, i8** %2, i64 %22
br label %25
25: ; preds = %21, %25
%26 = phi float [ %23, %21 ], [ %36, %25 ]
%27 = phi i32 [ 1, %21 ], [ %37, %25 ]
%28 = load i8*, i8** %24
%29 = call i32 @sprintf(i8* %15, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %28, i32 %27)
%30 = call i32 @load_locations(i8* %15, float** %19, i32 0)
%31 = load i8*, i8** %24
%32 = call i32 @sprintf(i8* %16, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %31, i32 %27)
%33 = call i32 @load_locations(i8* %16, float** %19, i32 %30)
%34 = call i32 @coverage(float** %19, i32 %33, float* %8, i32* %5, i32* %6)
%35 = load float, float* %8
%36 = fadd float %26, %35
%37 = add nuw nsw i32 %27, 1
%38 = icmp eq i32 %37, 7
br i1 %38, label %39, label %25
39: ; preds = %25
%40 = add nuw nsw i64 %22, 1
%41 = icmp eq i64 %40, %20
br i1 %41, label %42, label %21
42: ; preds = %39
%43 = mul i32 %3, 6
%44 = sitofp i32 %43 to float
%45 = fdiv float %36, %44
br label %46
46: ; preds = %42, %4
%47 = phi float [ %45, %42 ], [ 0x7FF8000000000000, %4 ]
ret float %47
}