; LLVM IR from sunkafei/xcpc-algorithm-templates :: 算法/数据结构 (zkw线段树（单点加-区间加-单点查询-区间求和）)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.anon = type { i32, i32, [440000 x i64], [440000 x i64] }
%"class.std::linear_congruential_engine" = type { i64 }
%"class.std::uniform_int_distribution" = type { %"struct.std::uniform_int_distribution<>::param_type" }
%"struct.std::uniform_int_distribution<>::param_type" = type { i32, i32 }

@A = external dso_local global [110000 x i64], align 16
@tree = external hidden global %struct.anon, align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::linear_congruential_engine", align 8
  %3 = alloca %"class.std::uniform_int_distribution", align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %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 i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  call void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #8
  call void @_ZNSt24uniform_int_distributionIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %3, i32 noundef 1, i32 noundef 100000)
  call void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EE4seedEm(ptr noundef nonnull align 8 dereferenceable(8) %2, i64 noundef 35345)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 100000, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %31, %0
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %34

25:                                               ; preds = %20
  %26 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %27 = sext i32 %26 to i64
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %29
  store i64 %27, ptr %30, align 8, !tbaa !9
  br label %31

31:                                               ; preds = %25
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %5, align 4, !tbaa !5
  br label %20, !llvm.loop !11

34:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %35 = call i64 @clock() #8
  store i64 %35, ptr %6, align 8, !tbaa !13
  %36 = load i32, ptr %4, align 4, !tbaa !5
  call void @"_ZN3$_05buildEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %36)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %121, %34
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = icmp slt i32 %38, 1000000
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %42 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %43 = srem i32 %42, 4
  store i32 %43, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %44 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = srem i32 %44, %45
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %48 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = srem i32 %48, %49
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %52 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %53 = load i32, ptr %52, align 4, !tbaa !5
  store i32 %53, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %55 = load i32, ptr %54, align 4, !tbaa !5
  store i32 %55, ptr %13, align 4, !tbaa !5
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %77

58:                                               ; preds = %41
  %59 = load i32, ptr %12, align 4, !tbaa !5
  %60 = load i32, ptr %13, align 4, !tbaa !5
  call void @"_ZN3$_06updateEiii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %59, i32 noundef %60, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %61 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %61, ptr %14, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %73, %58
  %63 = load i32, ptr %14, align 4, !tbaa !5
  %64 = load i32, ptr %13, align 4, !tbaa !5
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %76

67:                                               ; preds = %62
  %68 = load i32, ptr %14, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = add nsw i64 %71, 1
  store i64 %72, ptr %70, align 8, !tbaa !9
  br label %73

73:                                               ; preds = %67
  %74 = load i32, ptr %14, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %14, align 4, !tbaa !5
  br label %62, !llvm.loop !15

76:                                               ; preds = %66
  br label %120

77:                                               ; preds = %41
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %97

80:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %81 = load i32, ptr %12, align 4, !tbaa !5
  %82 = load i32, ptr %13, align 4, !tbaa !5
  %83 = call noundef i64 @"_ZN3$_05queryEii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %81, i32 noundef %82)
  store i64 %83, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %84 = load i32, ptr %12, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i64, ptr @A, i64 %85
  %87 = load i32, ptr %13, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i64, ptr @A, i64 %88
  %90 = getelementptr inbounds i64, ptr %89, i64 1
  %91 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef %86, ptr noundef %90, i64 noundef 0)
  store i64 %91, ptr %16, align 8, !tbaa !9
  %92 = load i64, ptr %15, align 8, !tbaa !9
  %93 = load i64, ptr %16, align 8, !tbaa !9
  %94 = icmp ne i64 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %80
  call void @abort() #9
  unreachable

96:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %119

97:                                               ; preds = %77
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = icmp eq i32 %98, 2
  br i1 %99, label %100, label %107

100:                                              ; preds = %97
  %101 = load i32, ptr %12, align 4, !tbaa !5
  call void @"_ZN3$_06updateEii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %101, i32 noundef 7)
  %102 = load i32, ptr %12, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !9
  %106 = add nsw i64 %105, 7
  store i64 %106, ptr %104, align 8, !tbaa !9
  br label %118

107:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %108 = load i32, ptr %12, align 4, !tbaa !5
  %109 = call noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %108)
  store i64 %109, ptr %17, align 8, !tbaa !9
  %110 = load i64, ptr %17, align 8, !tbaa !9
  %111 = load i32, ptr %12, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !9
  %115 = icmp ne i64 %110, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %107
  call void @abort() #9
  unreachable

117:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %118

118:                                              ; preds = %117, %100
  br label %119

119:                                              ; preds = %118, %96
  br label %120

120:                                              ; preds = %119, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %121

121:                                              ; preds = %120
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %7, align 4, !tbaa !5
  br label %37, !llvm.loop !16

124:                                              ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %125 = call i64 @clock() #8
  store i64 %125, ptr %18, align 8, !tbaa !13
  %126 = load i64, ptr %18, align 8, !tbaa !13
  %127 = load i64, ptr %6, align 8, !tbaa !13
  %128 = sub nsw i64 %126, %127
  %129 = sitofp i64 %128 to double
  %130 = fdiv double %129, 1.000000e+06
  %131 = call i32 (ptr, ...) @printf(ptr noundef @.str, double noundef %130)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %146, %124
  %133 = load i32, ptr %19, align 4, !tbaa !5
  %134 = icmp sle i32 %133, 100000
  br i1 %134, label %136, label %135

135:                                              ; preds = %132
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %149

136:                                              ; preds = %132
  %137 = load i32, ptr %19, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !9
  %141 = load i32, ptr %19, align 4, !tbaa !5
  %142 = call noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %141)
  %143 = icmp ne i64 %140, %142
  br i1 %143, label %144, label %145

144:                                              ; preds = %136
  call void @abort() #9
  unreachable

145:                                              ; preds = %136
  br label %146

146:                                              ; preds = %145
  %147 = load i32, ptr %19, align 4, !tbaa !5
  %148 = add nsw i32 %147, 1
  store i32 %148, ptr %19, align 4, !tbaa !5
  br label %132, !llvm.loop !17

149:                                              ; preds = %135
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %150 = load i32, ptr %1, align 4
  ret i32 %150
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: nounwind
declare i64 @clock() #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_05buildEi"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef) #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_06updateEiii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZN3$_05queryEii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) #5

; Function Attrs: noreturn nounwind
declare void @abort() #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_06updateEii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef) #4 align 2

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

attributes #0 = { mustprogress norecurse 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 = { 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 #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

%struct.anon = type { i32, i32, [440000 x i64], [440000 x i64] }
%"class.std::linear_congruential_engine" = type { i64 }
%"class.std::uniform_int_distribution" = type { %"struct.std::uniform_int_distribution<>::param_type" }
%"struct.std::uniform_int_distribution<>::param_type" = type { i32, i32 }

@A = external dso_local global [110000 x i64], align 16
@tree = external hidden global %struct.anon, align 8
@.str = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"class.std::linear_congruential_engine", align 8
  %2 = alloca %"class.std::uniform_int_distribution", align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @_ZNSt24uniform_int_distributionIiEC2Eii(ptr noundef nonnull align 4 dereferenceable(8) %2, i32 noundef 1, i32 noundef 100000)
  call void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EE4seedEm(ptr noundef nonnull align 8 dereferenceable(8) %1, i64 noundef 35345)
  br label %7

5:                                                ; preds = %7
  %6 = call i64 @clock() #8
  call void @"_ZN3$_05buildEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef 100000)
  br label %17

7:                                                ; preds = %0, %7
  %indvars.iv = phi i64 [ 1, %0 ], [ %indvars.iv.next, %7 ]
  %8 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %indvars.iv
  store i64 %9, ptr %10, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100001
  br i1 %exitcond.not, label %5, label %7, !llvm.loop !9

11:                                               ; preds = %.loopexit
  %12 = call i64 @clock() #8
  %13 = sub nsw i64 %12, %6
  %14 = sitofp i64 %13 to double
  %15 = fdiv double %14, 1.000000e+06
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, double noundef %15)
  br label %65

17:                                               ; preds = %5, %.loopexit
  %.03847 = phi i32 [ 0, %5 ], [ %62, %.loopexit ]
  %18 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %19 = srem i32 %18, 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %20 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %21 = srem i32 %20, 100000
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %23 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %24 = srem i32 %23, 100000
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %4, align 4, !tbaa !11
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %27 = load i32, ptr %26, align 4, !tbaa !11
  %28 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %29 = load i32, ptr %28, align 4, !tbaa !11
  switch i32 %19, label %56 [
    i32 0, label %30
    i32 1, label %44
    i32 2, label %51
  ]

30:                                               ; preds = %17
  call void @"_ZN3$_06updateEiii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %27, i32 noundef %29, i32 noundef 1)
  %.not4345 = icmp sgt i32 %27, %29
  br i1 %.not4345, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %30
  %31 = sext i32 %27 to i64
  %32 = add i32 %29, 1
  %33 = sub i32 %29, %27
  %34 = zext i32 %33 to i64
  %35 = add nuw nsw i64 %34, 1
  %min.iters.check = icmp ult i32 %33, 3
  br i1 %min.iters.check, label %.lr.ph.preheader60, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %35, 8589934588
  %ind.end = add nsw i64 %n.vec, %31
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %31
  %36 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %offset.idx
  %37 = getelementptr inbounds i8, ptr %36, i64 16
  %wide.load = load <2 x i64>, ptr %36, align 8, !tbaa !5
  %wide.load59 = load <2 x i64>, ptr %37, align 8, !tbaa !5
  %38 = add nsw <2 x i64> %wide.load, <i64 1, i64 1>
  %39 = add nsw <2 x i64> %wide.load59, <i64 1, i64 1>
  store <2 x i64> %38, ptr %36, align 8, !tbaa !5
  store <2 x i64> %39, ptr %37, align 8, !tbaa !5
  %index.next = add nuw i64 %index, 4
  %40 = icmp eq i64 %index.next, %n.vec
  br i1 %40, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %35, %n.vec
  br i1 %cmp.n, label %.loopexit, label %.lr.ph.preheader60

.lr.ph.preheader60:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv50.ph = phi i64 [ %31, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader60, %.lr.ph
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %.lr.ph ], [ %indvars.iv50.ph, %.lr.ph.preheader60 ]
  %41 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %indvars.iv50
  %42 = load i64, ptr %41, align 8, !tbaa !5
  %43 = add nsw i64 %42, 1
  store i64 %43, ptr %41, align 8, !tbaa !5
  %indvars.iv.next51 = add nsw i64 %indvars.iv50, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next51 to i32
  %exitcond53.not = icmp eq i32 %32, %lftr.wideiv
  br i1 %exitcond53.not, label %.loopexit, label %.lr.ph, !llvm.loop !16

44:                                               ; preds = %17
  %45 = call noundef i64 @"_ZN3$_05queryEii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %27, i32 noundef %29)
  %46 = sext i32 %27 to i64
  %47 = getelementptr inbounds i64, ptr @A, i64 %46
  %48 = sext i32 %29 to i64
  %gep = getelementptr i64, ptr getelementptr inbounds (i8, ptr @A, i64 8), i64 %48
  %49 = call noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef nonnull %47, ptr noundef nonnull %gep, i64 noundef 0)
  %.not42 = icmp eq i64 %45, %49
  br i1 %.not42, label %.loopexit, label %50

50:                                               ; preds = %44
  call void @abort() #9
  unreachable

51:                                               ; preds = %17
  call void @"_ZN3$_06updateEii"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %27, i32 noundef 7)
  %52 = sext i32 %27 to i64
  %53 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = add nsw i64 %54, 7
  store i64 %55, ptr %53, align 8, !tbaa !5
  br label %.loopexit

56:                                               ; preds = %17
  %57 = call noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %27)
  %58 = sext i32 %27 to i64
  %59 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !5
  %.not41 = icmp eq i64 %57, %60
  br i1 %.not41, label %.loopexit, label %61

61:                                               ; preds = %56
  call void @abort() #9
  unreachable

.loopexit:                                        ; preds = %.lr.ph, %middle.block, %30, %56, %44, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %62 = add nuw nsw i32 %.03847, 1
  %exitcond54.not = icmp eq i32 %62, 1000000
  br i1 %exitcond54.not, label %11, label %17, !llvm.loop !17

63:                                               ; preds = %65
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond58.not = icmp eq i64 %indvars.iv.next56, 100001
  br i1 %exitcond58.not, label %64, label %65, !llvm.loop !18

64:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

65:                                               ; preds = %11, %63
  %indvars.iv55 = phi i64 [ 1, %11 ], [ %indvars.iv.next56, %63 ]
  %66 = getelementptr inbounds [110000 x i64], ptr @A, i64 0, i64 %indvars.iv55
  %67 = load i64, ptr %66, align 8, !tbaa !5
  %68 = trunc nuw nsw i64 %indvars.iv55 to i32
  %69 = call noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008) @tree, i32 noundef %68)
  %.not = icmp eq i64 %67, %69
  br i1 %.not, label %63, label %70

70:                                               ; preds = %65
  call void @abort() #9
  unreachable
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 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: nounwind
declare i64 @clock() local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_05buildEi"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef) local_unnamed_addr #4 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_06updateEiii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZN3$_05queryEii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt10accumulateIPxxET0_T_S2_S1_(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZN3$_06updateEii"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef, i32 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i64 @"_ZN3$_05queryEi"(ptr noundef nonnull align 8 dereferenceable(7040008), i32 noundef) local_unnamed_addr #4 align 2

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

attributes #0 = { mustprogress norecurse 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 = { 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 #3 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10, !15, !14}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; Effective O3 passes: GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass