; LLVM IR from chrr/libECP :: example (ex1)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #2

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) #1

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #1

declare void @rewind(ptr noundef) #1

declare i32 @printf(ptr noundef, ...) #1

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @loadECP(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef %7) #3 {
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca ptr, align 8
  %26 = alloca ptr, align 8
  %27 = alloca ptr, align 8
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca ptr, align 8
  %32 = alloca [512 x i8], align 16
  store ptr %0, ptr %9, align 8, !tbaa !5
  store i32 %1, ptr %10, align 4, !tbaa !9
  store ptr %2, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  store ptr %7, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %33 = load ptr, ptr %9, align 8, !tbaa !5
  %34 = call noalias ptr @fopen(ptr noundef %33, ptr noundef @.str)
  store ptr %34, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #5
  %35 = load i32, ptr %10, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = call noalias ptr @calloc(i64 noundef %36, i64 noundef 4) #6
  store ptr %37, ptr %25, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #5
  %38 = load i32, ptr %10, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = call noalias ptr @calloc(i64 noundef %39, i64 noundef 4) #6
  store ptr %40, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.start.p0(i64 512, ptr %32) #5
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %93, %8
  %42 = load i32, ptr %18, align 4, !tbaa !9
  %43 = load i32, ptr %10, align 4, !tbaa !9
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %96

45:                                               ; preds = %41
  %46 = load ptr, ptr %17, align 8, !tbaa !5
  %47 = load ptr, ptr %26, align 8, !tbaa !5
  %48 = load i32, ptr %18, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load ptr, ptr %25, align 8, !tbaa !5
  %52 = load i32, ptr %18, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr %51, i64 %53
  %55 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %46, ptr noundef @.str.9, ptr noundef %22, ptr noundef %50, ptr noundef %54)
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %56

56:                                               ; preds = %82, %45
  %57 = load i32, ptr %19, align 4, !tbaa !9
  %58 = load ptr, ptr %25, align 8, !tbaa !5
  %59 = load i32, ptr %18, align 4, !tbaa !9
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i32, ptr %58, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = icmp slt i32 %57, %62
  br i1 %63, label %64, label %85

64:                                               ; preds = %56
  %65 = load ptr, ptr %17, align 8, !tbaa !5
  %66 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %65, ptr noundef @.str.1, ptr noundef %21, ptr noundef %22)
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %75, %64
  %68 = load i32, ptr %20, align 4, !tbaa !9
  %69 = load i32, ptr %22, align 4, !tbaa !9
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %71, label %78

71:                                               ; preds = %67
  %72 = getelementptr inbounds [512 x i8], ptr %32, i64 0, i64 0
  %73 = load ptr, ptr %17, align 8, !tbaa !5
  %74 = call ptr @fgets(ptr noundef %72, i32 noundef 512, ptr noundef %73)
  br label %75

75:                                               ; preds = %71
  %76 = load i32, ptr %20, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %20, align 4, !tbaa !9
  br label %67, !llvm.loop !11

78:                                               ; preds = %67
  %79 = load i32, ptr %22, align 4, !tbaa !9
  %80 = load i32, ptr %24, align 4, !tbaa !9
  %81 = add nsw i32 %80, %79
  store i32 %81, ptr %24, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %78
  %83 = load i32, ptr %19, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %19, align 4, !tbaa !9
  br label %56, !llvm.loop !13

85:                                               ; preds = %56
  %86 = load ptr, ptr %25, align 8, !tbaa !5
  %87 = load i32, ptr %18, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = load i32, ptr %23, align 4, !tbaa !9
  %92 = add nsw i32 %91, %90
  store i32 %92, ptr %23, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %85
  %94 = load i32, ptr %18, align 4, !tbaa !9
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %18, align 4, !tbaa !9
  br label %41, !llvm.loop !14

96:                                               ; preds = %41
  %97 = load ptr, ptr %17, align 8, !tbaa !5
  call void @rewind(ptr noundef %97)
  %98 = load ptr, ptr %25, align 8, !tbaa !5
  %99 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %98, ptr %99, align 8, !tbaa !5
  %100 = load i32, ptr %23, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = call noalias ptr @calloc(i64 noundef %101, i64 noundef 4) #6
  store ptr %102, ptr %27, align 8, !tbaa !5
  %103 = load ptr, ptr %12, align 8, !tbaa !5
  store ptr %102, ptr %103, align 8, !tbaa !5
  %104 = load i32, ptr %23, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = call noalias ptr @calloc(i64 noundef %105, i64 noundef 4) #6
  store ptr %106, ptr %28, align 8, !tbaa !5
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %106, ptr %107, align 8, !tbaa !5
  %108 = load i32, ptr %24, align 4, !tbaa !9
  %109 = sext i32 %108 to i64
  %110 = call noalias ptr @calloc(i64 noundef %109, i64 noundef 8) #6
  store ptr %110, ptr %30, align 8, !tbaa !5
  %111 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %110, ptr %111, align 8, !tbaa !5
  %112 = load i32, ptr %24, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = call noalias ptr @calloc(i64 noundef %113, i64 noundef 8) #6
  store ptr %114, ptr %29, align 8, !tbaa !5
  %115 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %114, ptr %115, align 8, !tbaa !5
  %116 = load i32, ptr %24, align 4, !tbaa !9
  %117 = sext i32 %116 to i64
  %118 = call noalias ptr @calloc(i64 noundef %117, i64 noundef 8) #6
  store ptr %118, ptr %31, align 8, !tbaa !5
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %118, ptr %119, align 8, !tbaa !5
  store i32 0, ptr %24, align 4, !tbaa !9
  store i32 0, ptr %23, align 4, !tbaa !9
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %228, %96
  %121 = load i32, ptr %18, align 4, !tbaa !9
  %122 = load i32, ptr %10, align 4, !tbaa !9
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %124, label %231

124:                                              ; preds = %120
  %125 = load ptr, ptr %17, align 8, !tbaa !5
  %126 = load ptr, ptr %26, align 8, !tbaa !5
  %127 = load i32, ptr %18, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %126, i64 %128
  %130 = load ptr, ptr %25, align 8, !tbaa !5
  %131 = load i32, ptr %18, align 4, !tbaa !9
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %125, ptr noundef @.str.9, ptr noundef %22, ptr noundef %129, ptr noundef %133)
  %135 = load i32, ptr %22, align 4, !tbaa !9
  %136 = load ptr, ptr %26, align 8, !tbaa !5
  %137 = load i32, ptr %18, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds i32, ptr %136, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !9
  %141 = load ptr, ptr %25, align 8, !tbaa !5
  %142 = load i32, ptr %18, align 4, !tbaa !9
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds i32, ptr %141, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !9
  %146 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %135, i32 noundef %140, i32 noundef %145)
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %147

147:                                              ; preds = %224, %124
  %148 = load i32, ptr %19, align 4, !tbaa !9
  %149 = load ptr, ptr %25, align 8, !tbaa !5
  %150 = load i32, ptr %18, align 4, !tbaa !9
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds i32, ptr %149, i64 %151
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = icmp slt i32 %148, %153
  br i1 %154, label %155, label %227

155:                                              ; preds = %147
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = load ptr, ptr %27, align 8, !tbaa !5
  %158 = load i32, ptr %23, align 4, !tbaa !9
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr %157, i64 %159
  %161 = load ptr, ptr %28, align 8, !tbaa !5
  %162 = load i32, ptr %23, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds i32, ptr %161, i64 %163
  %165 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %156, ptr noundef @.str.1, ptr noundef %160, ptr noundef %164)
  %166 = load ptr, ptr %27, align 8, !tbaa !5
  %167 = load i32, ptr %23, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds i32, ptr %166, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !9
  %171 = load ptr, ptr %28, align 8, !tbaa !5
  %172 = load i32, ptr %23, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds i32, ptr %171, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !9
  %176 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %170, i32 noundef %175)
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %177

177:                                              ; preds = %218, %155
  %178 = load i32, ptr %20, align 4, !tbaa !9
  %179 = load ptr, ptr %28, align 8, !tbaa !5
  %180 = load i32, ptr %23, align 4, !tbaa !9
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds i32, ptr %179, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !9
  %184 = icmp slt i32 %178, %183
  br i1 %184, label %185, label %221

185:                                              ; preds = %177
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = load ptr, ptr %30, align 8, !tbaa !5
  %188 = load i32, ptr %24, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds double, ptr %187, i64 %189
  %191 = load ptr, ptr %29, align 8, !tbaa !5
  %192 = load i32, ptr %24, align 4, !tbaa !9
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds double, ptr %191, i64 %193
  %195 = load ptr, ptr %31, align 8, !tbaa !5
  %196 = load i32, ptr %24, align 4, !tbaa !9
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds double, ptr %195, i64 %197
  %199 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %186, ptr noundef @.str.11, ptr noundef %22, ptr noundef %190, ptr noundef %194, ptr noundef %198)
  %200 = load ptr, ptr %30, align 8, !tbaa !5
  %201 = load i32, ptr %24, align 4, !tbaa !9
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds double, ptr %200, i64 %202
  %204 = load double, ptr %203, align 8, !tbaa !15
  %205 = load ptr, ptr %29, align 8, !tbaa !5
  %206 = load i32, ptr %24, align 4, !tbaa !9
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds double, ptr %205, i64 %207
  %209 = load double, ptr %208, align 8, !tbaa !15
  %210 = load ptr, ptr %31, align 8, !tbaa !5
  %211 = load i32, ptr %24, align 4, !tbaa !9
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds double, ptr %210, i64 %212
  %214 = load double, ptr %213, align 8, !tbaa !15
  %215 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, double noundef %204, double noundef %209, double noundef %214)
  %216 = load i32, ptr %24, align 4, !tbaa !9
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %24, align 4, !tbaa !9
  br label %218

218:                                              ; preds = %185
  %219 = load i32, ptr %20, align 4, !tbaa !9
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %20, align 4, !tbaa !9
  br label %177, !llvm.loop !17

221:                                              ; preds = %177
  %222 = load i32, ptr %23, align 4, !tbaa !9
  %223 = add nsw i32 %222, 1
  store i32 %223, ptr %23, align 4, !tbaa !9
  br label %224

224:                                              ; preds = %221
  %225 = load i32, ptr %19, align 4, !tbaa !9
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %19, align 4, !tbaa !9
  br label %147, !llvm.loop !18

227:                                              ; preds = %147
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %18, align 4, !tbaa !9
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %18, align 4, !tbaa !9
  br label %120, !llvm.loop !19

231:                                              ; preds = %120
  %232 = load ptr, ptr %17, align 8, !tbaa !5
  %233 = call i32 @fclose(ptr noundef %232)
  %234 = load ptr, ptr %26, align 8, !tbaa !5
  call void @free(ptr noundef %234) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %32) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  ret void
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind allocsize(0,1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { nounwind allocsize(0,1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [29 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #2

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare void @rewind(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @loadECP(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4, ptr nocapture noundef writeonly %5, ptr nocapture noundef writeonly %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #4 {
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [512 x i8], align 16
  %12 = tail call noalias ptr @fopen(ptr noundef %0, ptr noundef nonnull @.str)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #6
  %13 = sext i32 %1 to i64
  %14 = tail call noalias ptr @calloc(i64 noundef %13, i64 noundef 4) #7
  %15 = tail call noalias ptr @calloc(i64 noundef %13, i64 noundef 4) #7
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %11) #6
  %16 = icmp sgt i32 %1, 0
  br i1 %16, label %.lr.ph106.preheader, label %._crit_edge107

.lr.ph106.preheader:                              ; preds = %8
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph106

.lr.ph106:                                        ; preds = %.lr.ph106.preheader, %._crit_edge99
  %indvars.iv = phi i64 [ 0, %.lr.ph106.preheader ], [ %indvars.iv.next, %._crit_edge99 ]
  %.085103 = phi i32 [ 0, %.lr.ph106.preheader ], [ %33, %._crit_edge99 ]
  %.087102 = phi i32 [ 0, %.lr.ph106.preheader ], [ %.188.lcssa, %._crit_edge99 ]
  %17 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv
  %18 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv
  %19 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %12, ptr noundef nonnull @.str.9, ptr noundef nonnull %10, ptr noundef %17, ptr noundef %18) #6
  %20 = load i32, ptr %18, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph98, label %._crit_edge99

.lr.ph98:                                         ; preds = %.lr.ph106, %._crit_edge
  %.08196 = phi i32 [ %30, %._crit_edge ], [ 0, %.lr.ph106 ]
  %.18895 = phi i32 [ %29, %._crit_edge ], [ %.087102, %.lr.ph106 ]
  %22 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %12, ptr noundef nonnull @.str.1, ptr noundef nonnull %9, ptr noundef nonnull %10) #6
  %23 = load i32, ptr %10, align 4, !tbaa !5
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph98, %.lr.ph
  %.08394 = phi i32 [ %26, %.lr.ph ], [ 0, %.lr.ph98 ]
  %25 = call ptr @fgets(ptr noundef nonnull %11, i32 noundef 512, ptr noundef %12)
  %26 = add nuw nsw i32 %.08394, 1
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph98
  %.lcssa = phi i32 [ %23, %.lr.ph98 ], [ %27, %.lr.ph ]
  %29 = add nsw i32 %.lcssa, %.18895
  %30 = add nuw nsw i32 %.08196, 1
  %31 = load i32, ptr %18, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %.lr.ph98, label %._crit_edge99, !llvm.loop !11

._crit_edge99:                                    ; preds = %._crit_edge, %.lr.ph106
  %.188.lcssa = phi i32 [ %.087102, %.lr.ph106 ], [ %29, %._crit_edge ]
  %.lcssa93 = phi i32 [ %20, %.lr.ph106 ], [ %31, %._crit_edge ]
  %33 = add nsw i32 %.lcssa93, %.085103
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge107.loopexit, label %.lr.ph106, !llvm.loop !12

._crit_edge107.loopexit:                          ; preds = %._crit_edge99
  %34 = sext i32 %33 to i64
  %35 = sext i32 %.188.lcssa to i64
  br label %._crit_edge107

._crit_edge107:                                   ; preds = %._crit_edge107.loopexit, %8
  %.087.lcssa = phi i64 [ 0, %8 ], [ %35, %._crit_edge107.loopexit ]
  %.085.lcssa = phi i64 [ 0, %8 ], [ %34, %._crit_edge107.loopexit ]
  call void @rewind(ptr noundef %12)
  store ptr %14, ptr %2, align 8, !tbaa !13
  %36 = call noalias ptr @calloc(i64 noundef %.085.lcssa, i64 noundef 4) #7
  store ptr %36, ptr %3, align 8, !tbaa !13
  %37 = call noalias ptr @calloc(i64 noundef %.085.lcssa, i64 noundef 4) #7
  store ptr %37, ptr %4, align 8, !tbaa !13
  %38 = call noalias ptr @calloc(i64 noundef %.087.lcssa, i64 noundef 8) #7
  store ptr %38, ptr %5, align 8, !tbaa !13
  %39 = call noalias ptr @calloc(i64 noundef %.087.lcssa, i64 noundef 8) #7
  store ptr %39, ptr %6, align 8, !tbaa !13
  %40 = call noalias ptr @calloc(i64 noundef %.087.lcssa, i64 noundef 8) #7
  store ptr %40, ptr %7, align 8, !tbaa !13
  br i1 %16, label %.lr.ph128.preheader, label %._crit_edge129

.lr.ph128.preheader:                              ; preds = %._crit_edge107
  %wide.trip.count146 = zext nneg i32 %1 to i64
  br label %.lr.ph128

.lr.ph128:                                        ; preds = %.lr.ph128.preheader, %._crit_edge121
  %indvars.iv143 = phi i64 [ 0, %.lr.ph128.preheader ], [ %indvars.iv.next144, %._crit_edge121 ]
  %.186125 = phi i32 [ 0, %.lr.ph128.preheader ], [ %.2.lcssa, %._crit_edge121 ]
  %.289124 = phi i32 [ 0, %.lr.ph128.preheader ], [ %.3.lcssa, %._crit_edge121 ]
  %41 = getelementptr inbounds i32, ptr %15, i64 %indvars.iv143
  %42 = getelementptr inbounds i32, ptr %14, i64 %indvars.iv143
  %43 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %12, ptr noundef nonnull @.str.9, ptr noundef nonnull %10, ptr noundef %41, ptr noundef %42) #6
  %44 = load i32, ptr %10, align 4, !tbaa !5
  %45 = load i32, ptr %41, align 4, !tbaa !5
  %46 = load i32, ptr %42, align 4, !tbaa !5
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %44, i32 noundef %45, i32 noundef %46)
  %48 = load i32, ptr %42, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph120.preheader, label %._crit_edge121

.lr.ph120.preheader:                              ; preds = %.lr.ph128
  %50 = sext i32 %.186125 to i64
  br label %.lr.ph120

.lr.ph120:                                        ; preds = %.lr.ph120.preheader, %._crit_edge114
  %indvars.iv140 = phi i64 [ %50, %.lr.ph120.preheader ], [ %indvars.iv.next141, %._crit_edge114 ]
  %.182118 = phi i32 [ 0, %.lr.ph120.preheader ], [ %72, %._crit_edge114 ]
  %.3116 = phi i32 [ %.289124, %.lr.ph120.preheader ], [ %.4.lcssa, %._crit_edge114 ]
  %51 = getelementptr inbounds i32, ptr %36, i64 %indvars.iv140
  %52 = getelementptr inbounds i32, ptr %37, i64 %indvars.iv140
  %53 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %12, ptr noundef nonnull @.str.1, ptr noundef %51, ptr noundef %52) #6
  %54 = load i32, ptr %51, align 4, !tbaa !5
  %55 = load i32, ptr %52, align 4, !tbaa !5
  %56 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %54, i32 noundef %55)
  %57 = load i32, ptr %52, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph113.preheader, label %._crit_edge114

.lr.ph113.preheader:                              ; preds = %.lr.ph120
  %59 = sext i32 %.3116 to i64
  br label %.lr.ph113

.lr.ph113:                                        ; preds = %.lr.ph113.preheader, %.lr.ph113
  %indvars.iv137 = phi i64 [ %59, %.lr.ph113.preheader ], [ %indvars.iv.next138, %.lr.ph113 ]
  %.184111 = phi i32 [ 0, %.lr.ph113.preheader ], [ %68, %.lr.ph113 ]
  %60 = getelementptr inbounds double, ptr %38, i64 %indvars.iv137
  %61 = getelementptr inbounds double, ptr %39, i64 %indvars.iv137
  %62 = getelementptr inbounds double, ptr %40, i64 %indvars.iv137
  %63 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %12, ptr noundef nonnull @.str.11, ptr noundef nonnull %10, ptr noundef %60, ptr noundef %61, ptr noundef %62) #6
  %64 = load double, ptr %60, align 8, !tbaa !15
  %65 = load double, ptr %61, align 8, !tbaa !15
  %66 = load double, ptr %62, align 8, !tbaa !15
  %67 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, double noundef %64, double noundef %65, double noundef %66)
  %indvars.iv.next138 = add nsw i64 %indvars.iv137, 1
  %68 = add nuw nsw i32 %.184111, 1
  %69 = load i32, ptr %52, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph113, label %._crit_edge114.loopexit, !llvm.loop !17

._crit_edge114.loopexit:                          ; preds = %.lr.ph113
  %71 = trunc nsw i64 %indvars.iv.next138 to i32
  br label %._crit_edge114

._crit_edge114:                                   ; preds = %._crit_edge114.loopexit, %.lr.ph120
  %.4.lcssa = phi i32 [ %.3116, %.lr.ph120 ], [ %71, %._crit_edge114.loopexit ]
  %indvars.iv.next141 = add nsw i64 %indvars.iv140, 1
  %72 = add nuw nsw i32 %.182118, 1
  %73 = load i32, ptr %42, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %.lr.ph120, label %._crit_edge121.loopexit, !llvm.loop !18

._crit_edge121.loopexit:                          ; preds = %._crit_edge114
  %75 = trunc nsw i64 %indvars.iv.next141 to i32
  br label %._crit_edge121

._crit_edge121:                                   ; preds = %._crit_edge121.loopexit, %.lr.ph128
  %.3.lcssa = phi i32 [ %.289124, %.lr.ph128 ], [ %.4.lcssa, %._crit_edge121.loopexit ]
  %.2.lcssa = phi i32 [ %.186125, %.lr.ph128 ], [ %75, %._crit_edge121.loopexit ]
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146
  br i1 %exitcond147.not, label %._crit_edge129, label %.lr.ph128, !llvm.loop !19

._crit_edge129:                                   ; preds = %._crit_edge121, %._crit_edge107
  %76 = call i32 @fclose(ptr noundef %12)
  call void @free(ptr noundef %15) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #6
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0,1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass