; LLVM IR from tangjz/acm-icpc :: codeforces/complete/536D.ll (Z7getDistiPi)

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

@n = external dso_local global i32, align 4
@e = external dso_local global [2001 x [2001 x i32]], align 16
@_ZZ7getDistiPiE3dis = external hidden global [2001 x i64], align 16
@_ZZ7getDistiPiE3vis = external hidden global [2001 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z7getDistiPi(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %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 i64, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  %14 = sext i32 %13 to i64
  %15 = mul i64 %14, 8
  call void @llvm.memset.p0.i64(ptr align 16 @_ZZ7getDistiPiE3dis, i8 63, i64 %15, i1 false)
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = mul i64 %17, 1
  call void @llvm.memset.p0.i64(ptr align 1 getelementptr inbounds (i8, ptr @_ZZ7getDistiPiE3vis, i64 1), i8 0, i64 %18, i1 false)
  %19 = load ptr, ptr %4, align 8, !tbaa !9
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %19, i64 %21
  store i32 0, ptr %22, align 4, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %24
  store i64 0, ptr %25, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %26 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %26, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %126, %2
  %28 = load i32, ptr %6, align 4, !tbaa !5
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = icmp sle i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %129

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %57, %32
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp sle i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %60

38:                                               ; preds = %33
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %40
  %42 = load i8, ptr %41, align 1, !tbaa !13, !range !15, !noundef !16
  %43 = trunc i8 %42 to i1
  br i1 %43, label %56, label %44

44:                                               ; preds = %38
  %45 = load i32, ptr %9, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %46
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !11
  %53 = icmp slt i64 %48, %52
  br i1 %53, label %54, label %56

54:                                               ; preds = %44
  %55 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %55, ptr %8, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %54, %44, %38
  br label %57

57:                                               ; preds = %56
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %9, align 4, !tbaa !5
  br label %33, !llvm.loop !17

60:                                               ; preds = %37
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %62
  store i8 1, ptr %63, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %101, %60
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %104

69:                                               ; preds = %64
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [2001 x [2001 x i32]], ptr @e, i64 0, i64 %71
  %73 = load i32, ptr %10, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [2001 x i32], ptr %72, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp slt i32 %76, 1061109567
  br i1 %77, label %78, label %100

78:                                               ; preds = %69
  %79 = load i32, ptr %10, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [2001 x [2001 x i32]], ptr @e, i64 0, i64 %87
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [2001 x i32], ptr %88, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = add nsw i64 %85, %93
  store i64 %94, ptr %11, align 8, !tbaa !11
  %95 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %96 = load i64, ptr %95, align 8, !tbaa !11
  %97 = load i32, ptr %10, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %98
  store i64 %96, ptr %99, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %100

100:                                              ; preds = %78, %69
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %10, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %10, align 4, !tbaa !5
  br label %64, !llvm.loop !19

104:                                              ; preds = %68
  %105 = load ptr, ptr %4, align 8, !tbaa !9
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %105, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !11
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = icmp slt i64 %113, %117
  %119 = zext i1 %118 to i32
  %120 = add nsw i32 %109, %119
  %121 = load ptr, ptr %4, align 8, !tbaa !9
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  store i32 %120, ptr %124, align 4, !tbaa !5
  %125 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %125, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %126

126:                                              ; preds = %104
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %6, align 4, !tbaa !5
  br label %27, !llvm.loop !20

129:                                              ; preds = %31
  %130 = load ptr, ptr %4, align 8, !tbaa !9
  %131 = load i32, ptr %5, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds i32, ptr %130, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret i32 %135
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

; 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)) #3

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


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

@n = external dso_local local_unnamed_addr global i32, align 4
@e = external dso_local local_unnamed_addr global [2001 x [2001 x i32]], align 16
@_ZZ7getDistiPiE3dis = external hidden global [2001 x i64], align 16
@_ZZ7getDistiPiE3vis = external hidden local_unnamed_addr global [2001 x i8], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 -2147483647, -2147483648) i32 @_Z7getDistiPi(i32 noundef %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = alloca i64, align 8
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = add nsw i32 %4, 1
  %6 = sext i32 %5 to i64
  %7 = shl nsw i64 %6, 3
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @_ZZ7getDistiPiE3dis, i8 63, i64 %7, i1 false)
  %8 = sext i32 %4 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @_ZZ7getDistiPiE3vis, i64 1), i8 0, i64 %8, i1 false)
  %9 = sext i32 %0 to i64
  %10 = getelementptr inbounds i32, ptr %1, i64 %9
  store i32 0, ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %9
  store i64 0, ptr %11, align 8, !tbaa !9
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %.not44 = icmp slt i32 %12, 1
  br i1 %.not44, label %._crit_edge47, label %.preheader

.preheader:                                       ; preds = %2, %._crit_edge43
  %13 = phi i64 [ %61, %._crit_edge43 ], [ 0, %2 ]
  %14 = phi i32 [ %64, %._crit_edge43 ], [ 0, %2 ]
  %15 = phi i32 [ %67, %._crit_edge43 ], [ %12, %2 ]
  %.03246 = phi i32 [ %66, %._crit_edge43 ], [ 1, %2 ]
  %.03345 = phi i32 [ %.031.lcssa61, %._crit_edge43 ], [ %0, %2 ]
  %.not3436 = icmp slt i32 %15, 1
  br i1 %.not3436, label %._crit_edge.thread, label %.lr.ph.preheader

._crit_edge.thread:                               ; preds = %.preheader
  store i8 1, ptr @_ZZ7getDistiPiE3vis, align 16, !tbaa !11
  br label %._crit_edge43

.lr.ph.preheader:                                 ; preds = %.preheader
  %16 = zext nneg i32 %15 to i64
  %xtraiter = and i64 %16, 1
  %17 = icmp eq i32 %15, 1
  br i1 %17, label %._crit_edge.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %16, 2147483646
  br label %.lr.ph

._crit_edge47.loopexit:                           ; preds = %._crit_edge43
  %18 = add nsw i32 %64, 1
  br label %._crit_edge47

._crit_edge47:                                    ; preds = %._crit_edge47.loopexit, %2
  %19 = phi i32 [ %18, %._crit_edge47.loopexit ], [ 1, %2 ]
  ret i32 %19

._crit_edge.unr-lcssa:                            ; preds = %56, %.lr.ph.preheader
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %.1.1, %56 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.1, %56 ]
  %.03137.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %.1.1, %56 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.unr-lcssa
  %20 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %indvars.iv.unr
  %21 = load i8, ptr %20, align 1, !tbaa !11, !range !13, !noundef !14
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %._crit_edge, label %23

23:                                               ; preds = %.lr.ph.epil
  %24 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %indvars.iv.unr
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = sext i32 %.03137.unr to i64
  %27 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = icmp slt i64 %25, %28
  %30 = trunc nuw nsw i64 %indvars.iv.unr to i32
  %spec.select.epil = select i1 %29, i32 %30, i32 %.03137.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.epil, %23, %._crit_edge.unr-lcssa
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.03137.unr, %.lr.ph.epil ], [ %spec.select.epil, %23 ]
  %31 = sext i32 %.1.lcssa to i64
  %32 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %31
  store i8 1, ptr %32, align 1, !tbaa !11
  br i1 %.not3436, label %._crit_edge43, label %.lr.ph42

.lr.ph42:                                         ; preds = %._crit_edge
  %33 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %31
  br label %68

.lr.ph:                                           ; preds = %56, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %56 ]
  %.03137 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %.1.1, %56 ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %56 ]
  %34 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %indvars.iv
  %35 = load i8, ptr %34, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %.lr.ph.1, label %37

37:                                               ; preds = %.lr.ph
  %38 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %indvars.iv
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = sext i32 %.03137 to i64
  %41 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = icmp slt i64 %39, %42
  %44 = trunc nuw nsw i64 %indvars.iv to i32
  %spec.select = select i1 %43, i32 %44, i32 %.03137
  br label %.lr.ph.1

.lr.ph.1:                                         ; preds = %37, %.lr.ph
  %.1 = phi i32 [ %.03137, %.lr.ph ], [ %spec.select, %37 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %45 = getelementptr inbounds [2001 x i8], ptr @_ZZ7getDistiPiE3vis, i64 0, i64 %indvars.iv.next
  %46 = load i8, ptr %45, align 1, !tbaa !11, !range !13, !noundef !14
  %47 = trunc nuw i8 %46 to i1
  br i1 %47, label %56, label %48

48:                                               ; preds = %.lr.ph.1
  %49 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %indvars.iv.next
  %50 = load i64, ptr %49, align 8, !tbaa !9
  %51 = sext i32 %.1 to i64
  %52 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = icmp slt i64 %50, %53
  %55 = trunc nuw nsw i64 %indvars.iv.next to i32
  %spec.select.1 = select i1 %54, i32 %55, i32 %.1
  br label %56

56:                                               ; preds = %48, %.lr.ph.1
  %.1.1 = phi i32 [ %.1, %.lr.ph.1 ], [ %spec.select.1, %48 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph, !llvm.loop !15

._crit_edge43.loopexit:                           ; preds = %80
  %.phi.trans.insert = sext i32 %.03345 to i64
  %.phi.trans.insert53 = getelementptr inbounds i32, ptr %1, i64 %.phi.trans.insert
  %.pre54 = load i32, ptr %.phi.trans.insert53, align 4, !tbaa !5
  %.phi.trans.insert56 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %.phi.trans.insert
  %.pre57 = load i64, ptr %.phi.trans.insert56, align 8, !tbaa !9
  br label %._crit_edge43

._crit_edge43:                                    ; preds = %._crit_edge, %._crit_edge.thread, %._crit_edge43.loopexit
  %57 = phi i64 [ %31, %._crit_edge43.loopexit ], [ 0, %._crit_edge.thread ], [ %31, %._crit_edge ]
  %.031.lcssa61 = phi i32 [ %.1.lcssa, %._crit_edge43.loopexit ], [ 0, %._crit_edge.thread ], [ %.1.lcssa, %._crit_edge ]
  %58 = phi i64 [ %.pre57, %._crit_edge43.loopexit ], [ %13, %._crit_edge.thread ], [ %13, %._crit_edge ]
  %59 = phi i32 [ %.pre54, %._crit_edge43.loopexit ], [ %14, %._crit_edge.thread ], [ %14, %._crit_edge ]
  %60 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %57
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = icmp slt i64 %58, %61
  %63 = zext i1 %62 to i32
  %64 = add nsw i32 %59, %63
  %65 = getelementptr inbounds i32, ptr %1, i64 %57
  store i32 %64, ptr %65, align 4, !tbaa !5
  %66 = add nuw nsw i32 %.03246, 1
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03246, %67
  br i1 %.not.not, label %.preheader, label %._crit_edge47.loopexit, !llvm.loop !17

68:                                               ; preds = %.lr.ph42, %80
  %69 = phi i32 [ %15, %.lr.ph42 ], [ %81, %80 ]
  %indvars.iv50 = phi i64 [ 1, %.lr.ph42 ], [ %indvars.iv.next51, %80 ]
  %70 = getelementptr inbounds [2001 x [2001 x i32]], ptr @e, i64 0, i64 %31, i64 %indvars.iv50
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp slt i32 %71, 1061109567
  br i1 %72, label %73, label %80

73:                                               ; preds = %68
  %74 = getelementptr inbounds [2001 x i64], ptr @_ZZ7getDistiPiE3dis, i64 0, i64 %indvars.iv50
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %75 = load i64, ptr %33, align 8, !tbaa !9
  %76 = sext i32 %71 to i64
  %77 = add nsw i64 %75, %76
  store i64 %77, ptr %3, align 8, !tbaa !9
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %79 = load i64, ptr %78, align 8, !tbaa !9
  store i64 %79, ptr %74, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %68, %73
  %81 = phi i32 [ %69, %68 ], [ %.pre, %73 ]
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %82 = sext i32 %81 to i64
  %.not35.not = icmp slt i64 %indvars.iv50, %82
  br i1 %.not35.not, label %68, label %._crit_edge43.loopexit, !llvm.loop !18
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

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

; 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 #3

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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