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

; 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" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, long long>, std::pair<const std::pair<int, long long>, int>, std::_Select1st<std::pair<const std::pair<int, long long>, int>>, std::less<std::pair<int, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, long long>, std::pair<const std::pair<int, long long>, int>, std::_Select1st<std::pair<const std::pair<int, long long>, int>>, std::less<std::pair<int, 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.8" = type { i32, i64 }

@sum = external dso_local global %"class.std::map", align 8
@a = external dso_local global [61 x i32], align 16
@b = 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
declare dso_local noundef i32 @_Z4Distixx(i32 noundef, i64 noundef, i64 noundef) #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: mustprogress uwtable
define dso_local noundef i32 @_Z3Sumix(i32 noundef %0, i64 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair.8", align 8
  %7 = alloca %"struct.std::pair.8", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair.8", align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %10 = load i32, ptr %4, align 4, !tbaa !5
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %13, label %12

12:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  br label %133

13:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #3
  %14 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %15 = getelementptr inbounds { i32, i64 }, ptr %6, i32 0, i32 0
  %16 = extractvalue { i32, i64 } %14, 0
  store i32 %16, ptr %15, align 8
  %17 = getelementptr inbounds { i32, i64 }, ptr %6, i32 0, i32 1
  %18 = extractvalue { i32, i64 } %14, 1
  store i64 %18, ptr %17, align 8
  %19 = call noundef i64 @_ZNKSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %20 = icmp ne i64 %19, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #3
  br i1 %20, label %21, label %29

21:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  %22 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %23 = getelementptr inbounds { i32, i64 }, ptr %7, i32 0, i32 0
  %24 = extractvalue { i32, i64 } %22, 0
  store i32 %24, ptr %23, align 8
  %25 = getelementptr inbounds { i32, i64 }, ptr %7, i32 0, i32 1
  %26 = extractvalue { i32, i64 } %22, 1
  store i64 %26, ptr %25, align 8
  %27 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %28 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %28, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  br label %133

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

39:                                               ; preds = %29
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i64, ptr %5, align 8, !tbaa !9
  %45 = call noundef i32 @_Z3Sumix(i32 noundef %43, i64 noundef %44)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %45)
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [61 x i64], ptr @d, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = call noundef i32 @_Z3Sumix(i32 noundef %49, i64 noundef %53)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, 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 = sext i32 %58 to i64
  %60 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = srem i64 %61, 1000000007
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [61 x i64], ptr @d, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !9
  %75 = add nsw i64 %70, %74
  %76 = load i64, ptr %5, align 8, !tbaa !9
  %77 = call noundef i32 @_Z4Distixx(i32 noundef %63, i64 noundef %75, i64 noundef %76)
  %78 = sext i32 %77 to i64
  %79 = mul nsw i64 %62, %78
  %80 = srem i64 %79, 1000000007
  %81 = trunc i64 %80 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %81)
  br label %125

82:                                               ; preds = %29
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i64, ptr %5, align 8, !tbaa !9
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %92
  %94 = load i64, ptr %93, align 8, !tbaa !9
  %95 = sub nsw i64 %87, %94
  %96 = call noundef i32 @_Z3Sumix(i32 noundef %86, i64 noundef %95)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %96)
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !9
  %105 = call noundef i32 @_Z3Sumix(i32 noundef %100, i64 noundef %104)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %105)
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %110
  %112 = load i64, ptr %111, align 8, !tbaa !9
  %113 = srem i64 %112, 1000000007
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %116
  %118 = load i64, ptr %117, align 8, !tbaa !9
  %119 = load i64, ptr %5, align 8, !tbaa !9
  %120 = call noundef i32 @_Z4Distixx(i32 noundef %114, i64 noundef %118, i64 noundef %119)
  %121 = sext i32 %120 to i64
  %122 = mul nsw i64 %113, %121
  %123 = srem i64 %122, 1000000007
  %124 = trunc i64 %123 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %124)
  br label %125

125:                                              ; preds = %82, %39
  %126 = load i32, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #3
  %127 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %128 = getelementptr inbounds { i32, i64 }, ptr %9, i32 0, i32 0
  %129 = extractvalue { i32, i64 } %127, 0
  store i32 %129, ptr %128, align 8
  %130 = getelementptr inbounds { i32, i64 }, ptr %9, i32 0, i32 1
  %131 = extractvalue { i32, i64 } %127, 1
  store i64 %131, ptr %130, align 8
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %9)
  store i32 %126, ptr %132, align 4, !tbaa !5
  store i32 %126, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %133

133:                                              ; preds = %125, %21, %12
  %134 = load i32, ptr %3, align 4
  ret i32 %134
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::pair<int, long long>, std::pair<const std::pair<int, long long>, int>, std::_Select1st<std::pair<const std::pair<int, long long>, int>>, std::less<std::pair<int, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<int, long long>, std::pair<const std::pair<int, long long>, int>, std::_Select1st<std::pair<const std::pair<int, long long>, int>>, std::less<std::pair<int, 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.8" = type { i32, i64 }

@sum = external dso_local global %"class.std::map", 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
@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
declare dso_local noundef i32 @_Z4Distixx(i32 noundef, i64 noundef, i64 noundef) local_unnamed_addr #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: mustprogress uwtable
define dso_local noundef i32 @_Z3Sumix(i32 noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca %"struct.std::pair.8", align 8
  %6 = alloca %"struct.std::pair.8", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::pair.8", align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %92, label %9

9:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %10 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %11 = extractvalue { i32, i64 } %10, 0
  store i32 %11, ptr %5, align 8
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  %13 = extractvalue { i32, i64 } %10, 1
  store i64 %13, ptr %12, align 8
  %14 = call noundef i64 @_ZNKSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %5)
  %.not3 = icmp eq i64 %14, 0
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  br i1 %.not3, label %22, label %15

15:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #3
  %16 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %17 = extractvalue { i32, i64 } %16, 0
  store i32 %17, ptr %6, align 8
  %18 = getelementptr inbounds i8, ptr %6, i64 8
  %19 = extractvalue { i32, i64 } %16, 1
  store i64 %19, ptr %18, align 8
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %6)
  %21 = load i32, ptr %20, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #3
  br label %92

22:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %28
  %30 = load i64, ptr %29, align 8, !tbaa !9
  %31 = icmp slt i64 %23, %30
  br i1 %31, label %32, label %58

32:                                               ; preds = %22
  %33 = call noundef i32 @_Z3Sumix(i32 noundef %27, i64 noundef %23)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %33)
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %35
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [61 x i64], ptr @d, i64 0, i64 %35
  %39 = load i64, ptr %38, align 8, !tbaa !9
  %40 = call noundef i32 @_Z3Sumix(i32 noundef %37, i64 noundef %39)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %40)
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %42
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds [61 x i64], ptr @d, i64 0, i64 %42
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = add nsw i64 %54, %52
  %56 = load i64, ptr %4, align 8, !tbaa !9
  %57 = call noundef i32 @_Z4Distixx(i32 noundef %41, i64 noundef %55, i64 noundef %56)
  br label %81

58:                                               ; preds = %22
  %59 = getelementptr inbounds [61 x i32], ptr @b, i64 0, i64 %25
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sub nsw i64 %23, %30
  %62 = call noundef i32 @_Z3Sumix(i32 noundef %60, i64 noundef %61)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %62)
  %63 = load i32, ptr %3, 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 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %64
  %68 = load i64, ptr %67, align 8, !tbaa !9
  %69 = call noundef i32 @_Z3Sumix(i32 noundef %66, i64 noundef %68)
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %69)
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [61 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [61 x i64], ptr @sz, i64 0, i64 %74
  %76 = load i64, ptr %75, align 8, !tbaa !9
  %77 = getelementptr inbounds [61 x i64], ptr @c, i64 0, i64 %71
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = load i64, ptr %4, align 8, !tbaa !9
  %80 = call noundef i32 @_Z4Distixx(i32 noundef %70, i64 noundef %78, i64 noundef %79)
  br label %81

81:                                               ; preds = %58, %32
  %.sink = phi i32 [ %80, %58 ], [ %57, %32 ]
  %.sink5.in = phi i64 [ %76, %58 ], [ %47, %32 ]
  %.sink5 = srem i64 %.sink5.in, 1000000007
  %82 = sext i32 %.sink to i64
  %83 = mul nsw i64 %.sink5, %82
  %84 = srem i64 %83, 1000000007
  %85 = trunc nsw i64 %84 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %85)
  %86 = load i32, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #3
  %87 = call { i32, i64 } @_ZSt9make_pairIRiRxESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %88 = extractvalue { i32, i64 } %87, 0
  store i32 %88, ptr %8, align 8
  %89 = getelementptr inbounds i8, ptr %8, i64 8
  %90 = extractvalue { i32, i64 } %87, 1
  store i64 %90, ptr %89, align 8
  %91 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @sum, ptr noundef nonnull align 8 dereferenceable(16) %8)
  store i32 %86, ptr %91, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  br label %92

92:                                               ; preds = %2, %81, %15
  %.0 = phi i32 [ %21, %15 ], [ %86, %81 ], [ 0, %2 ]
  ret i32 %.0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapISt4pairIixEiSt4lessIS1_ESaIS0_IKS1_iEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass