; LLVM IR from sunkafei/xcpc-algorithm-templates :: 算法/数据结构 (动态开点线段树)

; 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.tmp = type { [1050000 x i32] }
%"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 %struct.tmp, align 4
@tot = external dso_local global i32, align 4
@mn = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateRiiiiiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 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
declare dso_local void @_Z5queryRiiiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

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

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

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

23:                                               ; preds = %31, %0
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !5
  %30 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %29)
  store i32 0, ptr %30, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %28
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %6, align 4, !tbaa !5
  br label %23, !llvm.loop !9

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

35:                                               ; preds = %147, %34
  %36 = load i32, ptr %8, align 4, !tbaa !5
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = icmp sle i32 %36, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %150

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %41 = call i32 @rand() #8
  %42 = srem i32 %41, 3
  store i32 %42, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  %43 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %2)
  store i32 %43, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %44 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %2)
  store i32 %44, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %45 = call i32 @rand() #8
  store i32 %45, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  store i32 %47, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %48 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %11, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %49 = load i32, ptr %48, align 4, !tbaa !5
  store i32 %49, ptr %15, align 4, !tbaa !5
  %50 = load i32, ptr %10, align 4, !tbaa !5
  %51 = icmp eq i32 %50, 0
  br i1 %51, label %52, label %76

52:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  %53 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %53, ptr %16, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %65, %52
  %55 = load i32, ptr %16, align 4, !tbaa !5
  %56 = load i32, ptr %15, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %68

59:                                               ; preds = %54
  %60 = load i32, ptr %13, align 4, !tbaa !5
  %61 = load i32, ptr %16, align 4, !tbaa !5
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %61)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, %60
  store i32 %64, ptr %62, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %59
  %66 = load i32, ptr %16, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %16, align 4, !tbaa !5
  br label %54, !llvm.loop !11

68:                                               ; preds = %58
  %69 = load i32, ptr %14, align 4, !tbaa !5
  %70 = load i32, ptr %15, align 4, !tbaa !5
  %71 = load i32, ptr %10, align 4, !tbaa !5
  %72 = load i32, ptr %13, align 4, !tbaa !5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sub nsw i32 0, %73
  %75 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z6updateRiiiiiii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %69, i32 noundef %70, i32 noundef %71, i32 noundef %72, i32 noundef %74, i32 noundef %75)
  br label %146

76:                                               ; preds = %40
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %101

79:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  %80 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %80, ptr %17, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %90, %79
  %82 = load i32, ptr %17, align 4, !tbaa !5
  %83 = load i32, ptr %15, align 4, !tbaa !5
  %84 = icmp sle i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %93

86:                                               ; preds = %81
  %87 = load i32, ptr %13, align 4, !tbaa !5
  %88 = load i32, ptr %17, align 4, !tbaa !5
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %88)
  store i32 %87, ptr %89, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %86
  %91 = load i32, ptr %17, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %17, align 4, !tbaa !5
  br label %81, !llvm.loop !12

93:                                               ; preds = %85
  %94 = load i32, ptr %14, align 4, !tbaa !5
  %95 = load i32, ptr %15, align 4, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = load i32, ptr %13, align 4, !tbaa !5
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = sub nsw i32 0, %98
  %100 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z6updateRiiiiiii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %94, i32 noundef %95, i32 noundef %96, i32 noundef %97, i32 noundef %99, i32 noundef %100)
  br label %145

101:                                              ; preds = %76
  store i32 1073741824, ptr @mn, align 4, !tbaa !5
  store i32 -1073741824, ptr @mx, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  %102 = load i32, ptr %14, align 4, !tbaa !5
  %103 = load i32, ptr %15, align 4, !tbaa !5
  %104 = load i32, ptr %3, align 4, !tbaa !5
  %105 = sub nsw i32 0, %104
  %106 = load i32, ptr %3, align 4, !tbaa !5
  call void @_Z5queryRiiiii(ptr noundef nonnull align 4 dereferenceable(4) %7, i32 noundef %102, i32 noundef %103, i32 noundef %105, i32 noundef %106)
  %107 = load i32, ptr @mn, align 4, !tbaa !5
  %108 = load i32, ptr %14, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %109
  %111 = load i32, ptr %15, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %112
  %114 = getelementptr inbounds i32, ptr %113, i64 1
  %115 = call noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef %110, ptr noundef %114)
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp ne i32 %107, %116
  br i1 %117, label %118, label %119

118:                                              ; preds = %101
  call void @abort() #9
  unreachable

119:                                              ; preds = %101
  %120 = load i32, ptr @mx, align 4, !tbaa !5
  %121 = load i32, ptr %14, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %122
  %124 = load i32, ptr %15, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %125
  %127 = getelementptr inbounds i32, ptr %126, i64 1
  %128 = call noundef ptr @_ZSt11max_elementIPiET_S1_S1_(ptr noundef %123, ptr noundef %127)
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = icmp ne i32 %120, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %119
  call void @abort() #9
  unreachable

132:                                              ; preds = %119
  %133 = load i32, ptr @tot, align 4, !tbaa !5
  %134 = load i32, ptr %14, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %135
  %137 = load i32, ptr %15, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %138
  %140 = getelementptr inbounds i32, ptr %139, i64 1
  %141 = call noundef i32 @_ZSt10accumulateIPiiET0_T_S2_S1_(ptr noundef %136, ptr noundef %140, i32 noundef 0)
  %142 = icmp ne i32 %133, %141
  br i1 %142, label %143, label %144

143:                                              ; preds = %132
  call void @abort() #9
  unreachable

144:                                              ; preds = %132
  br label %145

145:                                              ; preds = %144, %93
  br label %146

146:                                              ; preds = %145, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  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
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %8, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %8, align 4, !tbaa !5
  br label %35, !llvm.loop !13

150:                                              ; preds = %39
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %151 = load i32, ptr %1, align 4
  ret i32 %151
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 #1 align 2

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

; Function Attrs: nounwind
declare i32 @rand() #5

; 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)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef, ptr noundef) #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11max_elementIPiET_S1_S1_(ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt10accumulateIPiiET0_T_S2_S1_(ptr noundef, ptr noundef, i32 noundef) #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 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 = { 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 = { 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 #5 = { 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 #6 = { inlinehint 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 #7 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.tmp = type { [1050000 x i32] }
%"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 %struct.tmp, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@mn = external dso_local local_unnamed_addr global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateRiiiiiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 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
declare dso_local void @_Z5queryRiiiii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %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
  %5 = 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 -100000, i32 noundef 100000)
  br label %7

6:                                                ; preds = %7
  call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %11

7:                                                ; preds = %0, %7
  %.04858 = phi i32 [ -100000, %0 ], [ %9, %7 ]
  %8 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %.04858)
  store i32 0, ptr %8, align 4, !tbaa !5
  %9 = add nsw i32 %.04858, 1
  %exitcond.not = icmp eq i32 %9, 100001
  br i1 %exitcond.not, label %6, label %7, !llvm.loop !9

10:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  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

11:                                               ; preds = %6, %44
  %.04965 = phi i32 [ 1, %6 ], [ %45, %44 ]
  %12 = call i32 @rand() #8
  %13 = srem i32 %12, 3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %14 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  store i32 %14, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #8
  %15 = call noundef i32 @_ZNSt24uniform_int_distributionIiEclISt26linear_congruential_engineImLm16807ELm0ELm2147483647EEEEiRT_(ptr noundef nonnull align 4 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1)
  store i32 %15, ptr %5, align 4, !tbaa !5
  %16 = call i32 @rand() #8
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %20 = load i32, ptr %19, align 4, !tbaa !5
  switch i32 %13, label %27 [
    i32 0, label %.preheader
    i32 1, label %.preheader57
  ]

.preheader57:                                     ; preds = %11
  %.not5559 = icmp sgt i32 %18, %20
  br i1 %.not5559, label %.sink.split, label %.lr.ph

.preheader:                                       ; preds = %11
  %.not5661 = icmp sgt i32 %18, %20
  br i1 %.not5661, label %.sink.split, label %.lr.ph63

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %.04762 = phi i32 [ %24, %.lr.ph63 ], [ %18, %.preheader ]
  %21 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %.04762)
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = add nsw i32 %22, %16
  store i32 %23, ptr %21, align 4, !tbaa !5
  %24 = add i32 %.04762, 1
  %exitcond67.not = icmp eq i32 %.04762, %20
  br i1 %exitcond67.not, label %.sink.split, label %.lr.ph63, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader57, %.lr.ph
  %.060 = phi i32 [ %26, %.lr.ph ], [ %18, %.preheader57 ]
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %.060)
  store i32 %16, ptr %25, align 4, !tbaa !5
  %26 = add i32 %.060, 1
  %exitcond66.not = icmp eq i32 %.060, %20
  br i1 %exitcond66.not, label %.sink.split, label %.lr.ph, !llvm.loop !12

27:                                               ; preds = %11
  store i32 1073741824, ptr @mn, align 4, !tbaa !5
  store i32 -1073741824, ptr @mx, align 4, !tbaa !5
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @_Z5queryRiiiii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %18, i32 noundef %20, i32 noundef -100000, i32 noundef 100000)
  %28 = load i32, ptr @mn, align 4, !tbaa !5
  %29 = sext i32 %18 to i64
  %30 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @A, i64 840000), i64 %29
  %31 = sext i32 %20 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @A, i64 840004), i64 %31
  %32 = call noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef nonnull %30, ptr noundef nonnull %gep)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %.not = icmp eq i32 %28, %33
  br i1 %.not, label %35, label %34

34:                                               ; preds = %27
  call void @abort() #9
  unreachable

35:                                               ; preds = %27
  %36 = load i32, ptr @mx, align 4, !tbaa !5
  %37 = call noundef ptr @_ZSt11max_elementIPiET_S1_S1_(ptr noundef nonnull %30, ptr noundef nonnull %gep)
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %.not53 = icmp eq i32 %36, %38
  br i1 %.not53, label %40, label %39

39:                                               ; preds = %35
  call void @abort() #9
  unreachable

40:                                               ; preds = %35
  %41 = load i32, ptr @tot, align 4, !tbaa !5
  %42 = call noundef i32 @_ZSt10accumulateIPiiET0_T_S2_S1_(ptr noundef nonnull %30, ptr noundef nonnull %gep, i32 noundef 0)
  %.not54 = icmp eq i32 %41, %42
  br i1 %.not54, label %44, label %43

43:                                               ; preds = %40
  call void @abort() #9
  unreachable

.sink.split:                                      ; preds = %.lr.ph, %.lr.ph63, %.preheader57, %.preheader
  call void @_Z6updateRiiiiiii(ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %18, i32 noundef %20, i32 noundef %13, i32 noundef %16, i32 noundef -100000, i32 noundef 100000)
  br label %44

44:                                               ; preds = %.sink.split, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  %45 = add nuw nsw i32 %.04965, 1
  %exitcond68.not = icmp eq i32 %45, 100001
  br i1 %exitcond68.not, label %10, label %11, !llvm.loop !13
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt26linear_congruential_engineImLm16807ELm0ELm2147483647EEC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 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 #1 align 2

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

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #5

; 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 #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt11max_elementIPiET_S1_S1_(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt10accumulateIPiiET0_T_S2_S1_(ptr noundef, ptr noundef, i32 noundef) 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 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 = { 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 = { 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 #5 = { 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 #6 = { inlinehint 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 #7 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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