; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/Other/DIBZ2016/DZ16SHOP/B.ll (Z5solvev)

; 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"

%"struct.std::greater" = type { i8 }

@X = external dso_local global [310 x i64], align 16
@Y = external dso_local global [310 x i64], align 16
@P = external dso_local global [310 x i64], align 16
@A = external dso_local global [10100 x i64], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::greater", align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  store i64 1, ptr %3, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %31, %0
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %20 = load i64, ptr %1, align 8, !tbaa !5
  %21 = icmp sle i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  br label %34

23:                                               ; preds = %18
  %24 = load i64, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %24
  %26 = load i64, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %26
  %28 = load i64, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds [310 x i64], ptr @P, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25, ptr noundef %27, ptr noundef %29)
  br label %31

31:                                               ; preds = %23
  %32 = load i64, ptr %3, align 8, !tbaa !5
  %33 = add nsw i64 %32, 1
  store i64 %33, ptr %3, align 8, !tbaa !5
  br label %18, !llvm.loop !9

34:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #8
  store i64 1, ptr %4, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %44, %34
  %36 = load i64, ptr %4, align 8, !tbaa !5
  %37 = load i64, ptr %2, align 8, !tbaa !5
  %38 = icmp sle i64 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  br label %47

40:                                               ; preds = %35
  %41 = load i64, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %41
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %42)
  br label %44

44:                                               ; preds = %40
  %45 = load i64, ptr %4, align 8, !tbaa !5
  %46 = add nsw i64 %45, 1
  store i64 %46, ptr %4, align 8, !tbaa !5
  br label %35, !llvm.loop !11

47:                                               ; preds = %39
  %48 = load i64, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds i64, ptr @A, i64 %48
  %50 = getelementptr inbounds i64, ptr %49, i64 1
  call void @_ZSt4sortIPxSt7greaterIxEEvT_S3_T0_(ptr noundef getelementptr inbounds (i64, ptr @A, i64 1), ptr noundef %50)
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %52 = load i64, ptr %51, align 8, !tbaa !5
  store i64 %52, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %53 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 1557464) #9
  %54 = load i64, ptr %1, align 8, !tbaa !5
  invoke void @_ZN9HungarianC2Ex(ptr noundef nonnull align 8 dereferenceable(1557464) %53, i64 noundef %54)
          to label %55 unwind label %61

55:                                               ; preds = %47
  store ptr %53, ptr %6, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  store i64 1000000001, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 1, ptr %10, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %160, %55
  %57 = load i64, ptr %10, align 8, !tbaa !5
  %58 = load i64, ptr %1, align 8, !tbaa !5
  %59 = icmp sle i64 %57, %58
  br i1 %59, label %65, label %60

60:                                               ; preds = %56
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %163

61:                                               ; preds = %47
  %62 = landingpad { ptr, i32 }
          cleanup
  %63 = extractvalue { ptr, i32 } %62, 0
  store ptr %63, ptr %7, align 8
  %64 = extractvalue { ptr, i32 } %62, 1
  store i32 %64, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %53, i64 noundef 1557464) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  br label %188

65:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 1, ptr %12, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %136, %65
  %67 = load i64, ptr %12, align 8, !tbaa !5
  %68 = load i64, ptr %2, align 8, !tbaa !5
  %69 = icmp sle i64 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 11, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %139

71:                                               ; preds = %66
  %72 = load i64, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = load i64, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = add nsw i64 %74, %77
  %79 = load i64, ptr %12, align 8, !tbaa !5
  %80 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !5
  %82 = icmp sle i64 %78, %81
  br i1 %82, label %83, label %107

83:                                               ; preds = %71
  %84 = load ptr, ptr %6, align 8, !tbaa !12
  %85 = load i64, ptr %10, align 8, !tbaa !5
  %86 = load i64, ptr %12, align 8, !tbaa !5
  %87 = load i64, ptr %10, align 8, !tbaa !5
  %88 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = load i64, ptr %10, align 8, !tbaa !5
  %91 = getelementptr inbounds [310 x i64], ptr @P, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = mul nsw i64 %89, %92
  %94 = load i64, ptr %12, align 8, !tbaa !5
  %95 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !5
  %97 = load i64, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %97
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = sub nsw i64 %96, %99
  %101 = load i64, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !5
  %104 = sub nsw i64 %100, %103
  %105 = mul nsw i64 %104, 1000000001
  %106 = add nsw i64 %93, %105
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %84, i64 noundef %85, i64 noundef %86, i64 noundef %106)
  br label %135

107:                                              ; preds = %71
  %108 = load i64, ptr %10, align 8, !tbaa !5
  %109 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %108
  %110 = load i64, ptr %109, align 8, !tbaa !5
  %111 = load i64, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !5
  %114 = icmp sle i64 %110, %113
  br i1 %114, label %115, label %130

115:                                              ; preds = %107
  %116 = load ptr, ptr %6, align 8, !tbaa !12
  %117 = load i64, ptr %10, align 8, !tbaa !5
  %118 = load i64, ptr %12, align 8, !tbaa !5
  %119 = load i64, ptr %12, align 8, !tbaa !5
  %120 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !5
  %122 = load i64, ptr %10, align 8, !tbaa !5
  %123 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !5
  %125 = sub nsw i64 %121, %124
  %126 = load i64, ptr %10, align 8, !tbaa !5
  %127 = getelementptr inbounds [310 x i64], ptr @P, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !5
  %129 = mul nsw i64 %125, %128
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %116, i64 noundef %117, i64 noundef %118, i64 noundef %129)
  br label %134

130:                                              ; preds = %107
  %131 = load ptr, ptr %6, align 8, !tbaa !12
  %132 = load i64, ptr %10, align 8, !tbaa !5
  %133 = load i64, ptr %12, align 8, !tbaa !5
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %131, i64 noundef %132, i64 noundef %133, i64 noundef 0)
  br label %134

134:                                              ; preds = %130, %115
  br label %135

135:                                              ; preds = %134, %83
  br label %136

136:                                              ; preds = %135
  %137 = load i64, ptr %12, align 8, !tbaa !5
  %138 = add nsw i64 %137, 1
  store i64 %138, ptr %12, align 8, !tbaa !5
  br label %66, !llvm.loop !14

139:                                              ; preds = %70
  %140 = load i64, ptr %2, align 8, !tbaa !5
  %141 = load i64, ptr %1, align 8, !tbaa !5
  %142 = icmp slt i64 %140, %141
  br i1 %142, label %143, label %159

143:                                              ; preds = %139
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %144 = load i64, ptr %2, align 8, !tbaa !5
  %145 = add nsw i64 %144, 1
  store i64 %145, ptr %13, align 8, !tbaa !5
  br label %146

146:                                              ; preds = %155, %143
  %147 = load i64, ptr %13, align 8, !tbaa !5
  %148 = load i64, ptr %1, align 8, !tbaa !5
  %149 = icmp sle i64 %147, %148
  br i1 %149, label %151, label %150

150:                                              ; preds = %146
  store i32 14, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %158

151:                                              ; preds = %146
  %152 = load ptr, ptr %6, align 8, !tbaa !12
  %153 = load i64, ptr %10, align 8, !tbaa !5
  %154 = load i64, ptr %13, align 8, !tbaa !5
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %152, i64 noundef %153, i64 noundef %154, i64 noundef 0)
  br label %155

155:                                              ; preds = %151
  %156 = load i64, ptr %13, align 8, !tbaa !5
  %157 = add nsw i64 %156, 1
  store i64 %157, ptr %13, align 8, !tbaa !5
  br label %146, !llvm.loop !15

158:                                              ; preds = %150
  br label %159

159:                                              ; preds = %158, %139
  br label %160

160:                                              ; preds = %159
  %161 = load i64, ptr %10, align 8, !tbaa !5
  %162 = add nsw i64 %161, 1
  store i64 %162, ptr %10, align 8, !tbaa !5
  br label %56, !llvm.loop !16

163:                                              ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 0, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 1, ptr %15, align 8, !tbaa !5
  br label %164

164:                                              ; preds = %175, %163
  %165 = load i64, ptr %15, align 8, !tbaa !5
  %166 = load i64, ptr %2, align 8, !tbaa !5
  %167 = icmp sle i64 %165, %166
  br i1 %167, label %169, label %168

168:                                              ; preds = %164
  store i32 17, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %178

169:                                              ; preds = %164
  %170 = load i64, ptr %15, align 8, !tbaa !5
  %171 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %170
  %172 = load i64, ptr %171, align 8, !tbaa !5
  %173 = load i64, ptr %14, align 8, !tbaa !5
  %174 = add nsw i64 %173, %172
  store i64 %174, ptr %14, align 8, !tbaa !5
  br label %175

175:                                              ; preds = %169
  %176 = load i64, ptr %15, align 8, !tbaa !5
  %177 = add nsw i64 %176, 1
  store i64 %177, ptr %15, align 8, !tbaa !5
  br label %164, !llvm.loop !17

178:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %179 = load ptr, ptr %6, align 8, !tbaa !12
  %180 = call noundef i64 @_ZN9Hungarian24minCostBipartiteMatchingEv(ptr noundef nonnull align 8 dereferenceable(1557464) %179)
  store i64 %180, ptr %16, align 8, !tbaa !5
  %181 = load i64, ptr %14, align 8, !tbaa !5
  %182 = load i64, ptr %16, align 8, !tbaa !5
  %183 = sdiv i64 %182, 1000000001
  %184 = sub nsw i64 %181, %183
  %185 = load i64, ptr %16, align 8, !tbaa !5
  %186 = srem i64 %185, 1000000001
  %187 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %184, i64 noundef %186)
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  ret void

188:                                              ; preds = %61
  %189 = load ptr, ptr %7, align 8
  %190 = load i32, ptr %8, align 4
  %191 = insertvalue { ptr, i32 } poison, ptr %189, 0
  %192 = insertvalue { ptr, i32 } %191, i32 %190, 1
  resume { ptr, i32 } %192
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxSt7greaterIxEEvT_S3_T0_(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9HungarianC2Ex(ptr noundef nonnull align 8 dereferenceable(1557464), i64 noundef) unnamed_addr #6 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #7

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464), i64 noundef, i64 noundef, i64 noundef) #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN9Hungarian24minCostBipartiteMatchingEv(ptr noundef nonnull align 8 dereferenceable(1557464)) #0 align 2

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

attributes #0 = { mustprogress 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { nobuiltin allocsize(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 #6 = { mustprogress 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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; 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"

@X = external dso_local global [310 x i64], align 16
@Y = external dso_local global [310 x i64], align 16
@P = external dso_local global [310 x i64], align 16
@A = external dso_local global [10100 x i64], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %4 = load i64, ptr %1, align 8, !tbaa !5
  %.not67 = icmp slt i64 %4, 1
  br i1 %.not67, label %.preheader65, label %.lr.ph

.preheader65:                                     ; preds = %.lr.ph, %0
  %5 = load i64, ptr %2, align 8, !tbaa !5
  %.not5669 = icmp slt i64 %5, 1
  br i1 %.not5669, label %._crit_edge, label %.lr.ph71

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.068 = phi i64 [ %10, %.lr.ph ], [ 1, %0 ]
  %6 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %.068
  %7 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %.068
  %8 = getelementptr inbounds [310 x i64], ptr @P, i64 0, i64 %.068
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %10 = add nuw nsw i64 %.068, 1
  %11 = load i64, ptr %1, align 8, !tbaa !5
  %.not.not = icmp slt i64 %.068, %11
  br i1 %.not.not, label %.lr.ph, label %.preheader65, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph71, %.preheader65
  %.lcssa66 = phi i64 [ %5, %.preheader65 ], [ %22, %.lr.ph71 ]
  %12 = getelementptr inbounds i64, ptr @A, i64 %.lcssa66
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  call void @_ZSt4sortIPxSt7greaterIxEEvT_S3_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8), ptr noundef nonnull %13)
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %15 = load i64, ptr %14, align 8, !tbaa !5
  store i64 %15, ptr %2, align 8, !tbaa !5
  %16 = call noalias noundef nonnull dereferenceable(1557464) ptr @_Znwm(i64 noundef 1557464) #9
  %17 = load i64, ptr %1, align 8, !tbaa !5
  call void @_ZN9HungarianC2Ex(ptr noundef nonnull align 8 dereferenceable(1557464) %16, i64 noundef %17)
  %18 = load i64, ptr %1, align 8
  %.not5780 = icmp slt i64 %18, 1
  br i1 %.not5780, label %.preheader, label %.preheader64

.lr.ph71:                                         ; preds = %.preheader65, %.lr.ph71
  %.05170 = phi i64 [ %21, %.lr.ph71 ], [ 1, %.preheader65 ]
  %19 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %.05170
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %19)
  %21 = add nuw nsw i64 %.05170, 1
  %22 = load i64, ptr %2, align 8, !tbaa !5
  %.not56.not = icmp slt i64 %.05170, %22
  br i1 %.not56.not, label %.lr.ph71, label %._crit_edge, !llvm.loop !11

.preheader64:                                     ; preds = %._crit_edge, %.loopexit
  %23 = phi i64 [ %58, %.loopexit ], [ %18, %._crit_edge ]
  %.05081 = phi i64 [ %59, %.loopexit ], [ 1, %._crit_edge ]
  %24 = load i64, ptr %2, align 8, !tbaa !5
  %.not5972 = icmp slt i64 %24, 1
  br i1 %.not5972, label %._crit_edge75, label %.lr.ph74

.lr.ph74:                                         ; preds = %.preheader64
  %25 = getelementptr inbounds [310 x i64], ptr @X, i64 0, i64 %.05081
  %26 = getelementptr inbounds [310 x i64], ptr @Y, i64 0, i64 %.05081
  %27 = getelementptr inbounds [310 x i64], ptr @P, i64 0, i64 %.05081
  br label %37

.preheader:                                       ; preds = %.loopexit, %._crit_edge
  %28 = load i64, ptr %2, align 8, !tbaa !5
  %.not5883 = icmp slt i64 %28, 1
  br i1 %.not5883, label %._crit_edge87, label %.lr.ph86.preheader

.lr.ph86.preheader:                               ; preds = %.preheader
  %min.iters.check = icmp ult i64 %28, 4
  br i1 %min.iters.check, label %.lr.ph86.preheader102, label %vector.ph

.lr.ph86.preheader102:                            ; preds = %middle.block, %.lr.ph86.preheader
  %.04685.ph = phi i64 [ 1, %.lr.ph86.preheader ], [ %ind.end, %middle.block ]
  %.04784.ph = phi i64 [ 0, %.lr.ph86.preheader ], [ %34, %middle.block ]
  br label %.lr.ph86

vector.ph:                                        ; preds = %.lr.ph86.preheader
  %n.vec = and i64 %28, 9223372036854775804
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %31, %vector.body ]
  %vec.phi100 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %32, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %29 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %offset.idx
  %30 = getelementptr inbounds i8, ptr %29, i64 16
  %wide.load = load <2 x i64>, ptr %29, align 8, !tbaa !5
  %wide.load101 = load <2 x i64>, ptr %30, align 8, !tbaa !5
  %31 = add <2 x i64> %wide.load, %vec.phi
  %32 = add <2 x i64> %wide.load101, %vec.phi100
  %index.next = add nuw i64 %index, 4
  %33 = icmp eq i64 %index.next, %n.vec
  br i1 %33, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %32, %31
  %34 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %28, %n.vec
  br i1 %cmp.n, label %._crit_edge87, label %.lr.ph86.preheader102

._crit_edge75.loopexit:                           ; preds = %54
  %.pre = load i64, ptr %1, align 8
  br label %._crit_edge75

._crit_edge75:                                    ; preds = %._crit_edge75.loopexit, %.preheader64
  %35 = phi i64 [ %23, %.preheader64 ], [ %.pre, %._crit_edge75.loopexit ]
  %.lcssa = phi i64 [ %24, %.preheader64 ], [ %56, %._crit_edge75.loopexit ]
  %36 = icmp slt i64 %.lcssa, %35
  br i1 %36, label %.lr.ph79, label %.loopexit

37:                                               ; preds = %.lr.ph74, %54
  %.04973 = phi i64 [ 1, %.lr.ph74 ], [ %55, %54 ]
  %38 = load i64, ptr %25, align 8, !tbaa !5
  %39 = load i64, ptr %26, align 8, !tbaa !5
  %40 = add nsw i64 %39, %38
  %41 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %.04973
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %.not61 = icmp sgt i64 %40, %42
  br i1 %.not61, label %49, label %43

43:                                               ; preds = %37
  %44 = load i64, ptr %27, align 8, !tbaa !5
  %45 = mul nsw i64 %44, %39
  %46 = sub i64 %42, %40
  %47 = mul nsw i64 %46, 1000000001
  %48 = add nsw i64 %45, %47
  br label %54

49:                                               ; preds = %37
  %.not62 = icmp sgt i64 %38, %42
  br i1 %.not62, label %54, label %50

50:                                               ; preds = %49
  %51 = sub nsw i64 %42, %38
  %52 = load i64, ptr %27, align 8, !tbaa !5
  %53 = mul nsw i64 %52, %51
  br label %54

54:                                               ; preds = %49, %43, %50
  %.sink = phi i64 [ %48, %43 ], [ %53, %50 ], [ 0, %49 ]
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %16, i64 noundef %.05081, i64 noundef %.04973, i64 noundef %.sink)
  %55 = add nuw nsw i64 %.04973, 1
  %56 = load i64, ptr %2, align 8, !tbaa !5
  %.not59.not = icmp slt i64 %.04973, %56
  br i1 %.not59.not, label %37, label %._crit_edge75.loopexit, !llvm.loop !15

.lr.ph79:                                         ; preds = %._crit_edge75, %.lr.ph79
  %.048.in78 = phi i64 [ %.048, %.lr.ph79 ], [ %.lcssa, %._crit_edge75 ]
  %.048 = add nsw i64 %.048.in78, 1
  call void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464) %16, i64 noundef %.05081, i64 noundef %.048, i64 noundef 0)
  %57 = load i64, ptr %1, align 8
  %.not60.not = icmp slt i64 %.048, %57
  br i1 %.not60.not, label %.lr.ph79, label %.loopexit, !llvm.loop !16

.loopexit:                                        ; preds = %.lr.ph79, %._crit_edge75
  %58 = phi i64 [ %35, %._crit_edge75 ], [ %57, %.lr.ph79 ]
  %59 = add nuw nsw i64 %.05081, 1
  %.not57.not = icmp slt i64 %.05081, %58
  br i1 %.not57.not, label %.preheader64, label %.preheader, !llvm.loop !17

._crit_edge87:                                    ; preds = %.lr.ph86, %middle.block, %.preheader
  %.047.lcssa = phi i64 [ 0, %.preheader ], [ %34, %middle.block ], [ %66, %.lr.ph86 ]
  %60 = call noundef i64 @_ZN9Hungarian24minCostBipartiteMatchingEv(ptr noundef nonnull align 8 dereferenceable(1557464) %16)
  %.neg = sdiv i64 %60, -1000000001
  %61 = add i64 %.neg, %.047.lcssa
  %62 = srem i64 %60, 1000000001
  %63 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %61, i64 noundef %62)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret void

.lr.ph86:                                         ; preds = %.lr.ph86.preheader102, %.lr.ph86
  %.04685 = phi i64 [ %67, %.lr.ph86 ], [ %.04685.ph, %.lr.ph86.preheader102 ]
  %.04784 = phi i64 [ %66, %.lr.ph86 ], [ %.04784.ph, %.lr.ph86.preheader102 ]
  %64 = getelementptr inbounds [10100 x i64], ptr @A, i64 0, i64 %.04685
  %65 = load i64, ptr %64, align 8, !tbaa !5
  %66 = add nsw i64 %65, %.04784
  %67 = add nuw i64 %.04685, 1
  %exitcond.not = icmp eq i64 %.04685, %28
  br i1 %exitcond.not, label %._crit_edge87, label %.lr.ph86, !llvm.loop !18
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxSt7greaterIxEEvT_S3_T0_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9HungarianC2Ex(ptr noundef nonnull align 8 dereferenceable(1557464), i64 noundef) unnamed_addr #6 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9Hungarian7addEdgeExxx(ptr noundef nonnull align 8 dereferenceable(1557464), i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZN9Hungarian24minCostBipartiteMatchingEv(ptr noundef nonnull align 8 dereferenceable(1557464)) local_unnamed_addr #0 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #7

attributes #0 = { mustprogress 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint mustprogress 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 = { inlinehint mustprogress 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 = { nobuiltin allocsize(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 #6 = { mustprogress 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }

!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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10, !13, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !14, !13}


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