; LLVM IR from duc0/ContestNeko :: CPPProjects/KMin.ll (Z2okiii)

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

%class.KMin = type { %"class.std::deque", i32, i32, %"class.std::function" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { i8 }

@nRow = external dso_local global i32, align 4
@posLeft = external dso_local global [2020 x [2020 x i32]], align 16
@posRight = external dso_local global [2020 x [2020 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z2okiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %class.KMin, align 8
  %14 = alloca %"class.std::function", align 8
  %15 = alloca %class.anon, align 1
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca %class.KMin, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %25

24:                                               ; preds = %3
  store i1 true, ptr %4, align 1
  br label %157

25:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sub nsw i32 %26, %27
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %10, align 4, !tbaa !5
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %31 = load i32, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  store i32 %31, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %32 = load i32, ptr %8, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = add nsw i32 %32, %33
  %35 = sub nsw i32 %34, 1
  store i32 %35, ptr %11, align 4, !tbaa !5
  %36 = load i32, ptr %11, align 4, !tbaa !5
  %37 = load i32, ptr @nRow, align 4, !tbaa !5
  %38 = icmp sgt i32 %36, %37
  br i1 %38, label %43, label %39

39:                                               ; preds = %25
  %40 = load i32, ptr %8, align 4, !tbaa !5
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = icmp sgt i32 %40, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %39, %25
  store i1 false, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %156

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 120, ptr %13) #4
  %45 = load i32, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #4
  call void @"_ZNSt8functionIFbiiEEC2IZ2okiiiE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %14, ptr noundef nonnull align 1 dereferenceable(1) %15) #4
  invoke void @_ZN4KMinIiEC2EiSt8functionIFbiiEE(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %45, ptr noundef %14)
          to label %46 unwind label %55

46:                                               ; preds = %44
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 120, ptr %18) #4
  %47 = load i32, ptr %5, align 4, !tbaa !5
  invoke void @_ZN4KMinIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %47)
          to label %48 unwind label %59

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %49 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %49, ptr %19, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %82, %48
  %51 = load i32, ptr %19, align 4, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = icmp sle i32 %51, %52
  br i1 %53, label %63, label %54

54:                                               ; preds = %50
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %89

55:                                               ; preds = %44
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %16, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %17, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #4
  br label %155

59:                                               ; preds = %46
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %16, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %17, align 4
  br label %154

63:                                               ; preds = %50
  %64 = load i32, ptr %19, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posLeft, i64 0, i64 %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2020 x i32], ptr %66, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %71)
          to label %72 unwind label %85

72:                                               ; preds = %63
  %73 = load i32, ptr %19, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posRight, i64 0, i64 %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [2020 x i32], ptr %75, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sub nsw i32 %79, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %80)
          to label %81 unwind label %85

81:                                               ; preds = %72
  br label %82

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

85:                                               ; preds = %72, %63
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %16, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  br label %153

89:                                               ; preds = %54
  br label %90

90:                                               ; preds = %149, %89
  br label %91

91:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %92 = invoke noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120) %13)
          to label %93 unwind label %107

93:                                               ; preds = %91
  store i32 %92, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  %94 = invoke noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120) %18)
          to label %95 unwind label %111

95:                                               ; preds = %93
  store i32 %94, ptr %21, align 4, !tbaa !5
  %96 = load i32, ptr %20, align 4, !tbaa !5
  %97 = load i32, ptr %21, align 4, !tbaa !5
  %98 = icmp sle i32 %96, %97
  br i1 %98, label %99, label %115

99:                                               ; preds = %95
  %100 = load i32, ptr %21, align 4, !tbaa !5
  %101 = load i32, ptr %20, align 4, !tbaa !5
  %102 = sub nsw i32 %100, %101
  %103 = add nsw i32 %102, 1
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = icmp sge i32 %103, %104
  br i1 %105, label %106, label %115

106:                                              ; preds = %99
  store i1 true, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %147

107:                                              ; preds = %91
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %16, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %17, align 4
  br label %150

111:                                              ; preds = %137, %128, %93
  %112 = landingpad { ptr, i32 }
          cleanup
  %113 = extractvalue { ptr, i32 } %112, 0
  store ptr %113, ptr %16, align 8
  %114 = extractvalue { ptr, i32 } %112, 1
  store i32 %114, ptr %17, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %150

115:                                              ; preds = %99, %95
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %8, align 4, !tbaa !5
  %118 = load i32, ptr %11, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %11, align 4, !tbaa !5
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = load i32, ptr @nRow, align 4, !tbaa !5
  %122 = icmp sgt i32 %120, %121
  br i1 %122, label %127, label %123

123:                                              ; preds = %115
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = icmp sgt i32 %124, %125
  br i1 %126, label %127, label %128

127:                                              ; preds = %123, %115
  store i32 6, ptr %12, align 4
  br label %147

128:                                              ; preds = %123
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posLeft, i64 0, i64 %130
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [2020 x i32], ptr %131, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %13, i32 noundef %136)
          to label %137 unwind label %111

137:                                              ; preds = %128
  %138 = load i32, ptr %11, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posRight, i64 0, i64 %139
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2020 x i32], ptr %140, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  %145 = sub nsw i32 %144, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %18, i32 noundef %145)
          to label %146 unwind label %111

146:                                              ; preds = %137
  store i32 0, ptr %12, align 4
  br label %147

147:                                              ; preds = %146, %127, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  %148 = load i32, ptr %12, align 4
  switch i32 %148, label %152 [
    i32 0, label %149
    i32 6, label %151
  ]

149:                                              ; preds = %147
  br label %90, !llvm.loop !11

150:                                              ; preds = %111, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %153

151:                                              ; preds = %147
  store i1 false, ptr %4, align 1
  store i32 1, ptr %12, align 4
  br label %152

152:                                              ; preds = %151, %147
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %18) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr %18) #4
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %13) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr %13) #4
  br label %156

153:                                              ; preds = %150, %85
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %18) #4
  br label %154

154:                                              ; preds = %153, %59
  call void @llvm.lifetime.end.p0(i64 120, ptr %18) #4
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %13) #4
  br label %155

155:                                              ; preds = %154, %55
  call void @llvm.lifetime.end.p0(i64 120, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %159

156:                                              ; preds = %152, %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %157

157:                                              ; preds = %156, %24
  %158 = load i1, ptr %4, align 1
  ret i1 %158

159:                                              ; preds = %155
  %160 = load ptr, ptr %16, align 8
  %161 = load i32, ptr %17, align 4
  %162 = insertvalue { ptr, i32 } poison, ptr %160, 0
  %163 = insertvalue { ptr, i32 } %162, i32 %161, 1
  resume { ptr, i32 } %163
}

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFbiiEEC2IZ2okiiiE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiEC2EiSt8functionIFbiiEE(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #2 align 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 = { 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 #3 = { 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 #4 = { 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 = !{!"int", !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}


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

%class.KMin = type { %"class.std::deque", i32, i32, %"class.std::function" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon = type { i8 }

@nRow = external dso_local local_unnamed_addr global i32, align 4
@posLeft = external dso_local local_unnamed_addr global [2020 x [2020 x i32]], align 16
@posRight = external dso_local local_unnamed_addr global [2020 x [2020 x i32]], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z2okiii(i32 noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %class.KMin, align 8
  %7 = alloca %"class.std::function", align 8
  %8 = alloca %class.anon, align 1
  %9 = alloca %class.KMin, align 8
  %10 = icmp eq i32 %0, 1
  br i1 %10, label %63, label %11

11:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %reass.sub = sub i32 %1, %0
  %12 = add i32 %reass.sub, 1
  store i32 %12, ptr %5, align 4, !tbaa !5
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %14 = load i32, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  %15 = add nsw i32 %14, %0
  %16 = add nsw i32 %15, -1
  %17 = load i32, ptr @nRow, align 4, !tbaa !5
  %18 = icmp sgt i32 %16, %17
  %19 = icmp sgt i32 %14, %1
  %or.cond = or i1 %19, %18
  br i1 %or.cond, label %63, label %20

20:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #4
  call void @"_ZNSt8functionIFbiiEEC2IZ2okiiiE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 1 dereferenceable(1) %8) #4
  invoke void @_ZN4KMinIiEC2EiSt8functionIFbiiEE(ptr noundef nonnull align 8 dereferenceable(120) %6, i32 noundef %0, ptr noundef nonnull %7)
          to label %21 unwind label %26

21:                                               ; preds = %20
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %9) #4
  invoke void @_ZN4KMinIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(120) %9, i32 noundef %0)
          to label %.preheader70 unwind label %28

.preheader70:                                     ; preds = %21
  %.not.not71 = icmp sgt i32 %0, 0
  %22 = sext i32 %2 to i64
  br i1 %.not.not71, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %.preheader70
  %23 = sext i32 %14 to i64
  %24 = sext i32 %15 to i64
  br label %30

.preheader:                                       ; preds = %38, %.preheader70
  %25 = sext i32 %16 to i64
  br label %41

26:                                               ; preds = %20
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #4
  br label %62

28:                                               ; preds = %21
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %61

30:                                               ; preds = %.lr.ph, %38
  %indvars.iv = phi i64 [ %23, %.lr.ph ], [ %indvars.iv.next, %38 ]
  %31 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posLeft, i64 0, i64 %indvars.iv, i64 %22
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %6, i32 noundef %33)
          to label %34 unwind label %39

34:                                               ; preds = %30
  %35 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posRight, i64 0, i64 %indvars.iv, i64 %22
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %9, i32 noundef %37)
          to label %38 unwind label %39

38:                                               ; preds = %34
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %.not.not = icmp slt i64 %indvars.iv.next, %24
  br i1 %.not.not, label %30, label %.preheader, !llvm.loop !9

39:                                               ; preds = %34, %30
  %40 = landingpad { ptr, i32 }
          cleanup
  br label %60

41:                                               ; preds = %.preheader, %56
  %indvars.iv75 = phi i64 [ %25, %.preheader ], [ %indvars.iv.next76, %56 ]
  %.035 = phi i32 [ %14, %.preheader ], [ %49, %56 ]
  %42 = call noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120) %6)
  %43 = call noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120) %9)
  %.not = icmp sgt i32 %42, %43
  br i1 %.not, label %48, label %44

44:                                               ; preds = %41
  %reass.sub73 = sub i32 %43, %42
  %45 = add i32 %reass.sub73, 1
  %.not55 = icmp slt i32 %45, %0
  br i1 %.not55, label %48, label %.thread

46:                                               ; preds = %56, %52
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %60

48:                                               ; preds = %44, %41
  %49 = add nsw i32 %.035, 1
  %indvars.iv.next76 = add nsw i64 %indvars.iv75, 1
  %50 = load i32, ptr @nRow, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %.not56 = icmp slt i64 %indvars.iv75, %51
  %.not57 = icmp slt i32 %.035, %1
  %or.cond61 = select i1 %.not56, i1 %.not57, i1 false
  br i1 %or.cond61, label %52, label %.thread

52:                                               ; preds = %48
  %53 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posLeft, i64 0, i64 %indvars.iv.next76, i64 %22
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %6, i32 noundef %55)
          to label %56 unwind label %46

56:                                               ; preds = %52
  %57 = getelementptr inbounds [2020 x [2020 x i32]], ptr @posRight, i64 0, i64 %indvars.iv.next76, i64 %22
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, -1
  invoke void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120) %9, i32 noundef %59)
          to label %41 unwind label %46

.thread:                                          ; preds = %44, %48
  %.2 = phi i1 [ false, %48 ], [ true, %44 ]
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %9) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %9) #4
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %6) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %6) #4
  br label %63

60:                                               ; preds = %46, %39
  %.pn = phi { ptr, i32 } [ %40, %39 ], [ %47, %46 ]
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %9) #4
  br label %61

61:                                               ; preds = %60, %28
  %.pn.pn = phi { ptr, i32 } [ %.pn, %60 ], [ %29, %28 ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %9) #4
  call void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120) %6) #4
  br label %62

62:                                               ; preds = %61, %26
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %61 ], [ %27, %26 ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %6) #4
  resume { ptr, i32 } %.pn.pn.pn

63:                                               ; preds = %.thread, %11, %3
  %.4 = phi i1 [ true, %3 ], [ %.2, %.thread ], [ false, %11 ]
  ret i1 %.4
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFbiiEEC2IZ2okiiiE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiEC2EiSt8functionIFbiiEE(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef, ptr noundef) unnamed_addr #0 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiEC2Ei(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4KMinIiE6absorbEi(ptr noundef nonnull align 8 dereferenceable(120), i32 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZN4KMinIiE6getMinEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN4KMinIiED2Ev(ptr noundef nonnull align 8 dereferenceable(120)) unnamed_addr #2 align 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass