; LLVM IR from tangjz/acm-icpc :: hdu/5401.ll (Z4Distixx)

; 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.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::pair<int, std::pair<long long, long long>>, std::pair<const std::pair<int, std::pair<long long, long long>>, int>, std::_Select1st<std::pair<const std::pair<int, std::pair<long long, long long>>, int>>, std::less<std::pair<int, std::pair<long long, long long>>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, std::pair<long long, long long>>, std::pair<const std::pair<int, std::pair<long long, long long>>, int>, std::_Select1st<std::pair<const std::pair<int, std::pair<long long, long long>>, int>>, std::less<std::pair<int, std::pair<long long, long long>>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.6" }
%"struct.std::pair.6" = type { i64, i64 }

@dist = external dso_local global %"class.std::map.0", align 8
@a = external dso_local global [61 x i32], align 16
@b = external dso_local global [61 x i32], align 16
@l = external dso_local global [61 x i32], align 16
@c = external dso_local global [61 x i64], align 16
@d = external dso_local global [61 x i64], align 16
@sz = external dso_local global [61 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z4Distixx(i32 noundef %0, i64 noundef %1, i64 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca %"struct.std::pair.6", align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::pair.6", align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"struct.std::pair.6", align 8
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i64 %2, ptr %7, align 8, !tbaa !9
  %15 = load i32, ptr %5, align 4, !tbaa !5
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %21

17:                                               ; preds = %3
  %18 = load i64, ptr %6, align 8, !tbaa !9
  %19 = load i64, ptr %7, align 8, !tbaa !9
  %20 = icmp eq i64 %18, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %17, %3
  store i32 0, ptr %4, align 4
  br label %137

22:                                               ; preds = %17
  %23 = load i64, ptr %6, align 8, !tbaa !9
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = icmp sgt i64 %23, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  br label %27

27:                                               ; preds = %26, %22
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %28 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %29 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 0
  %30 = extractvalue { i64, i64 } %28, 0
  store i64 %30, ptr %29, align 8
  %31 = getelementptr inbounds { i64, i64 }, ptr %9, i32 0, i32 1
  %32 = extractvalue { i64, i64 } %28, 1
  store i64 %32, ptr %31, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair") align 8 %8, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 8 dereferenceable(16) %9)
  %33 = call noundef i64 @_ZNKSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %8)
  %34 = icmp ne i64 %33, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #4
  br i1 %34, label %35, label %43

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #4
  %36 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %37 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 0
  %38 = extractvalue { i64, i64 } %36, 0
  store i64 %38, ptr %37, align 8
  %39 = getelementptr inbounds { i64, i64 }, ptr %11, i32 0, i32 1
  %40 = extractvalue { i64, i64 } %36, 1
  store i64 %40, ptr %39, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair") align 8 %10, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 8 dereferenceable(16) %11)
  %41 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %10)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #4
  br label %137

43:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  %44 = load i64, ptr %7, align 8, !tbaa !9
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = icmp slt i64 %44, %51
  br i1 %52, label %53, label %61

53:                                               ; preds = %43
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i64, ptr %6, align 8, !tbaa !9
  %59 = load i64, ptr %7, align 8, !tbaa !9
  %60 = call noundef i32 @_Z4Distixx(i32 noundef %57, i64 noundef %58, i64 noundef %59)
  store i32 %60, ptr %12, align 4, !tbaa !5
  br label %129

61:                                               ; preds = %43
  %62 = load i64, ptr %6, align 8, !tbaa !9
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %67
  %69 = load i64, ptr %68, align 8, !tbaa !9
  %70 = icmp sge i64 %62, %69
  br i1 %70, label %71, label %95

71:                                               ; preds = %61
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i64, ptr %6, align 8, !tbaa !9
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !9
  %84 = sub nsw i64 %76, %83
  %85 = load i64, ptr %7, align 8, !tbaa !9
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !9
  %93 = sub nsw i64 %85, %92
  %94 = call noundef i32 @_Z4Distixx(i32 noundef %75, i64 noundef %84, i64 noundef %93)
  store i32 %94, ptr %12, align 4, !tbaa !5
  br label %128

95:                                               ; preds = %61
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !9
  %104 = load i64, ptr %6, align 8, !tbaa !9
  %105 = call noundef i32 @_Z4Distixx(i32 noundef %99, i64 noundef %103, i64 noundef %104)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %12, i32 noundef %105)
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [61 x i32], ptr @b, i64 0, 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 [61 x i64], ptr @d, i64 0, i64 %111
  %113 = load i64, ptr %112, align 8, !tbaa !9
  %114 = load i64, ptr %7, align 8, !tbaa !9
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !9
  %122 = sub nsw i64 %114, %121
  %123 = call noundef i32 @_Z4Distixx(i32 noundef %109, i64 noundef %113, i64 noundef %122)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %12, i32 noundef %123)
  %124 = load i32, ptr %5, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [61 x i32], ptr @l, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %12, i32 noundef %127)
  br label %128

128:                                              ; preds = %95, %71
  br label %129

129:                                              ; preds = %128, %53
  %130 = load i32, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #4
  %131 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %132 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 0
  %133 = extractvalue { i64, i64 } %131, 0
  store i64 %133, ptr %132, align 8
  %134 = getelementptr inbounds { i64, i64 }, ptr %14, i32 0, i32 1
  %135 = extractvalue { i64, i64 } %131, 1
  store i64 %135, ptr %134, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind writable sret(%"struct.std::pair") align 8 %13, ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 8 dereferenceable(16) %14)
  %136 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %13)
  store i32 %130, ptr %136, align 4, !tbaa !5
  store i32 %130, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %137

137:                                              ; preds = %129, %35, %21
  %138 = load i32, ptr %4, align 4
  ret i32 %138
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(16)) #1

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}


; 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.std::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<std::pair<int, std::pair<long long, long long>>, std::pair<const std::pair<int, std::pair<long long, long long>>, int>, std::_Select1st<std::pair<const std::pair<int, std::pair<long long, long long>>, int>>, std::less<std::pair<int, std::pair<long long, long long>>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, std::pair<long long, long long>>, std::pair<const std::pair<int, std::pair<long long, long long>>, int>, std::_Select1st<std::pair<const std::pair<int, std::pair<long long, long long>>, int>>, std::less<std::pair<int, std::pair<long long, long long>>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type { i32, %"struct.std::pair.6" }
%"struct.std::pair.6" = type { i64, i64 }

@dist = external dso_local global %"class.std::map.0", align 8
@a = external dso_local local_unnamed_addr global [61 x i32], align 16
@b = external dso_local local_unnamed_addr global [61 x i32], align 16
@l = external dso_local local_unnamed_addr global [61 x i32], align 16
@c = external dso_local local_unnamed_addr global [61 x i64], align 16
@d = external dso_local local_unnamed_addr global [61 x i64], align 16
@sz = external dso_local local_unnamed_addr global [61 x i64], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z4Distixx(i32 noundef %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca %"struct.std::pair.6", align 8
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca %"struct.std::pair.6", align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca %"struct.std::pair.6", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  %.not = icmp eq i32 %0, 0
  %14 = icmp eq i64 %1, %2
  %or.cond = or i1 %.not, %14
  br i1 %or.cond, label %80, label %15

15:                                               ; preds = %3
  %16 = icmp sgt i64 %1, %2
  br i1 %16, label %17, label %18

17:                                               ; preds = %15
  call void @_ZSt4swapIxENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #4
  br label %18

18:                                               ; preds = %17, %15
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #4
  %19 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %20 = extractvalue { i64, i64 } %19, 0
  store i64 %20, ptr %8, align 8
  %21 = getelementptr inbounds i8, ptr %8, i64 8
  %22 = extractvalue { i64, i64 } %19, 1
  store i64 %22, ptr %21, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair") align 8 %7, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(16) %8)
  %23 = call noundef i64 @_ZNKSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %7)
  %.not7 = icmp eq i64 %23, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #4
  br i1 %.not7, label %31, label %24

24:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %10) #4
  %25 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %26 = extractvalue { i64, i64 } %25, 0
  store i64 %26, ptr %10, align 8
  %27 = getelementptr inbounds i8, ptr %10, i64 8
  %28 = extractvalue { i64, i64 } %25, 1
  store i64 %28, ptr %27, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair") align 8 %9, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %29 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %9)
  %30 = load i32, ptr %29, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9) #4
  br label %80

31:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = icmp slt i64 %32, %39
  %41 = load i64, ptr %5, align 8, !tbaa !9
  br i1 %40, label %42, label %44

42:                                               ; preds = %31
  %43 = call noundef i32 @_Z4Distixx(i32 noundef %36, i64 noundef %41, i64 noundef %32)
  store i32 %43, ptr %11, align 4, !tbaa !5
  br label %73

44:                                               ; preds = %31
  %.not8 = icmp slt i64 %41, %39
  br i1 %.not8, label %51, label %45

45:                                               ; preds = %44
  %46 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %34
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sub nsw i64 %41, %39
  %49 = sub nsw i64 %32, %39
  %50 = call noundef i32 @_Z4Distixx(i32 noundef %47, i64 noundef %48, i64 noundef %49)
  store i32 %50, ptr %11, align 4, !tbaa !5
  br label %73

51:                                               ; preds = %44
  %52 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %34
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = call noundef i32 @_Z4Distixx(i32 noundef %36, i64 noundef %53, i64 noundef %41)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %11, i32 noundef %54)
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = getelementptr inbounds [61 x i64], ptr @d, i64 0, i64 %56
  %60 = load i64, ptr %59, align 8, !tbaa !9
  %61 = load i64, ptr %6, align 8, !tbaa !9
  %62 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %56
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %64
  %66 = load i64, ptr %65, align 8, !tbaa !9
  %67 = sub nsw i64 %61, %66
  %68 = call noundef i32 @_Z4Distixx(i32 noundef %58, i64 noundef %60, i64 noundef %67)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %11, i32 noundef %68)
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [61 x i32], ptr @l, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %11, i32 noundef %72)
  %.pre = load i32, ptr %11, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %45, %51, %42
  %74 = phi i32 [ %50, %45 ], [ %.pre, %51 ], [ %43, %42 ]
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %12) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #4
  %75 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %76 = extractvalue { i64, i64 } %75, 0
  store i64 %76, ptr %13, align 8
  %77 = getelementptr inbounds i8, ptr %13, i64 8
  %78 = extractvalue { i64, i64 } %75, 1
  store i64 %78, ptr %77, align 8
  call void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind nonnull writable sret(%"struct.std::pair") align 8 %12, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(16) %13)
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48) @dist, ptr noundef nonnull align 8 dereferenceable(24) %12)
  store i32 %74, ptr %79, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #4
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  br label %80

80:                                               ; preds = %3, %73, %24
  %.0 = phi i32 [ %30, %24 ], [ %74, %73 ], [ 0, %3 ]
  ret i32 %.0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZSt9make_pairIRiSt4pairIxxEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr dead_on_unwind noalias writable sret(%"struct.std::pair") align 8, ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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) #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIiS0_IxxEEiSt4lessIS2_ESaIS0_IKS2_iEEEixEOS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass