#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_coverage3(char *opname1, char *opname2, char *opname3, 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], fn3[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);
      sprintf(fn3, "data/%s_%s%d.txt", opname3, imsets[i], fno);
      nlocs = load_locations(fn3, locs, nlocs);
      coverage(locs, nlocs, &cov, &np, &nc);
      csum += cov;
      nfiles += 1;
    }
  }
  return csum / nfiles;
}


x86 assembly (clang, -O0):
<mean_coverage3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x186cb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x186a44(%rbp)
ff
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    12a4 <mean_coverage3+0x174>
movl   $0x1,-0x30(%rbp)
cmpl   $0x7,-0x30(%rbp)
jge    1291 <mean_coverage3+0x161>
lea    -0x186b10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x30(%rbp),%r8d
lea    0xe59(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x186b10(%rbp),%rdi
lea    -0x186a40(%rbp),%rsi
xor    %edx,%edx
call   1050 <load_locations@plt>
mov    %eax,-0x34(%rbp)
lea    -0x186be0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x30(%rbp),%r8d
lea    0xe1a(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x186be0(%rbp),%rdi
lea    -0x186a40(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1050 <load_locations@plt>
mov    %eax,-0x34(%rbp)
lea    -0x186cb0(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x30(%rbp),%r8d
lea    0xdda(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x186cb0(%rbp),%rdi
lea    -0x186a40(%rbp),%rsi
mov    -0x34(%rbp),%edx
call   1050 <load_locations@plt>
mov    %eax,-0x34(%rbp)
lea    -0x186a40(%rbp),%rdi
mov    -0x34(%rbp),%esi
lea    -0x186a48(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x3c(%rbp),%r8
call   1030 <coverage@plt>
movss  -0x186a48(%rbp),%xmm0
ff
addss  -0x186a44(%rbp),%xmm0
ff
movss  %xmm0,-0x186a44(%rbp)
ff
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    117b <mean_coverage3+0x4b>
jmp    1296 <mean_coverage3+0x166>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1168 <mean_coverage3+0x38>
movss  -0x186a44(%rbp),%xmm0
ff
cvtsi2ssl -0x28(%rbp),%xmm1
divss  %xmm1,%xmm0
add    $0x186cb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mean_coverage3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x186cc8,%rsp
mov    %rdx,0x40(%rsp)
mov    %rsi,0x38(%rsp)
test   %r8d,%r8d
jle    129a <mean_coverage3+0x16a>
mov    %rcx,0x30(%rsp)
mov    %r8,0x18(%rsp)
mov    %r8d,%eax
mov    %rax,0x20(%rsp)
xorps  %xmm0,%xmm0
xor    %eax,%eax
lea    0xe92(%rip),%r13
lea    0x50(%rsp),%rbx
mov    %rdi,0x28(%rsp)
nopl   0x0(%rax)
mov    %rax,0x10(%rsp)
mov    $0x1,%r14d
nopl   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
mov    0x10(%rsp),%r12
mov    0x30(%rsp),%rbp
mov    0x0(%rbp,%r12,8),%rcx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    0x28(%rsp),%rdx
mov    %r14d,%r8d
call   1040 <sprintf@plt>
mov    %rbx,%rdi
lea    0x2c0(%rsp),%rsi
xor    %edx,%edx
call   1050 <load_locations@plt>
mov    %eax,%r15d
mov    0x0(%rbp,%r12,8),%rcx
lea    0x1f0(%rsp),%rbx
mov    %rbx,%rdi
mov    %r13,%rsi
mov    0x38(%rsp),%rdx
mov    %r14d,%r8d
call   1040 <sprintf@plt>
mov    %rbx,%rdi
lea    0x2c0(%rsp),%rsi
mov    %r15d,%edx
mov    0x40(%rsp),%r15
call   1050 <load_locations@plt>
mov    %eax,%ebx
mov    0x0(%rbp,%r12,8),%rcx
lea    0x120(%rsp),%rbp
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r14d,%r8d
call   1040 <sprintf@plt>
mov    %rbp,%rdi
lea    0x2c0(%rsp),%rbp
mov    %rbp,%rsi
mov    %ebx,%edx
lea    0x50(%rsp),%rbx
call   1050 <load_locations@plt>
mov    %rbp,%rdi
mov    %eax,%esi
lea    0xc(%rsp),%rdx
lea    0x4c(%rsp),%rcx
lea    0x48(%rsp),%r8
call   1030 <coverage@plt>
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
add    $0x1,%r14d
cmp    $0x7,%r14d
jne    1190 <mean_coverage3+0x60>
mov    0x10(%rsp),%rax
add    $0x1,%rax
cmp    0x20(%rsp),%rax
jne    1180 <mean_coverage3+0x50>
mov    0x18(%rsp),%rax
add    %eax,%eax
lea    (%rax,%rax,2),%eax
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
jmp    12a2 <mean_coverage3+0x172>
movss  0xd5e(%rip),%xmm0
add    $0x186cc8,%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_coverage3(i8* %0, i8* %1, i8* %2, i8** %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [200000 x [2 x float]]
%18 = alloca float
%19 = alloca float
%20 = alloca [200 x i8]
%21 = alloca [200 x i8]
%22 = alloca [200 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8** %3, i8*** %9
store i32 %4, i32* %10
store i32 0, i32* %11
store float 0.000000e+00, float* %18
store i32 0, i32* %12
br label %23
23: ; preds = %86, %5
%24 = load i32, i32* %12
%25 = load i32, i32* %10
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %89
27: ; preds = %23
store i32 1, i32* %13
br label %28
28: ; preds = %82, %27
%29 = load i32, i32* %13
%30 = icmp slt i32 %29, 7
br i1 %30, label %31, label %85
31: ; preds = %28
%32 = getelementptr inbounds [200 x i8], [200 x i8]* %20, i64 0, i64 0
%33 = load i8*, i8** %6
%34 = load i8**, i8*** %9
%35 = load i32, i32* %12
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds i8*, i8** %34, i64 %36
%38 = load i8*, i8** %37
%39 = load i32, i32* %13
%40 = call i32 @sprintf(i8* %32, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %33, i8* %38, i32 %39)
%41 = getelementptr inbounds [200 x i8], [200 x i8]* %20, i64 0, i64 0
%42 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %17, i64 0, i64 0
%43 = bitcast [2 x float]* %42 to float**
%44 = call i32 @load_locations(i8* %41, float** %43, i32 0)
store i32 %44, i32* %14
%45 = getelementptr inbounds [200 x i8], [200 x i8]* %21, i64 0, i64 0
%46 = load i8*, i8** %7
%47 = load i8**, i8*** %9
%48 = load i32, i32* %12
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8*, i8** %47, i64 %49
%51 = load i8*, i8** %50
%52 = load i32, i32* %13
%53 = call i32 @sprintf(i8* %45, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %46, i8* %51, i32 %52)
%54 = getelementptr inbounds [200 x i8], [200 x i8]* %21, i64 0, i64 0
%55 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %17, i64 0, i64 0
%56 = bitcast [2 x float]* %55 to float**
%57 = load i32, i32* %14
%58 = call i32 @load_locations(i8* %54, float** %56, i32 %57)
store i32 %58, i32* %14
%59 = getelementptr inbounds [200 x i8], [200 x i8]* %22, i64 0, i64 0
%60 = load i8*, i8** %8
%61 = load i8**, i8*** %9
%62 = load i32, i32* %12
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = load i32, i32* %13
%67 = call i32 @sprintf(i8* %59, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %60, i8* %65, i32 %66)
%68 = getelementptr inbounds [200 x i8], [200 x i8]* %22, i64 0, i64 0
%69 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %17, i64 0, i64 0
%70 = bitcast [2 x float]* %69 to float**
%71 = load i32, i32* %14
%72 = call i32 @load_locations(i8* %68, float** %70, i32 %71)
store i32 %72, i32* %14
%73 = getelementptr inbounds [200000 x [2 x float]], [200000 x [2 x float]]* %17, i64 0, i64 0
%74 = bitcast [2 x float]* %73 to float**
%75 = load i32, i32* %14
%76 = call i32 @coverage(float** %74, i32 %75, float* %19, i32* %15, i32* %16)
%77 = load float, float* %19
%78 = load float, float* %18
%79 = fadd float %78, %77
store float %79, float* %18
%80 = load i32, i32* %11
%81 = add nsw i32 %80, 1
store i32 %81, i32* %11
br label %82
82: ; preds = %31
%83 = load i32, i32* %13
%84 = add nsw i32 %83, 1
store i32 %84, i32* %13
br label %28
85: ; preds = %28
br label %86
86: ; preds = %85
%87 = load i32, i32* %12
%88 = add nsw i32 %87, 1
store i32 %88, i32* %12
br label %23
89: ; preds = %23
%90 = load float, float* %18
%91 = load i32, i32* %11
%92 = sitofp i32 %91 to float
%93 = fdiv float %90, %92
ret float %93
}

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