; 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 noundef i32 @_Z5buildii(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: 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: 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 @_Z6updateiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiii(i32 noundef, i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5queryiii(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 = %32, %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 %35

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

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

35:                                               ; preds = %27
  call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = sub nsw i32 0, %36
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = call noundef i32 @_Z5buildii(i32 noundef %37, i32 noundef %38)
  store i32 %39, 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 %40

40:                                               ; preds = %159, %35
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  %46 = call i32 @rand() #8
  %47 = srem i32 %46, 4
  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) %5, ptr noundef nonnull align 8 dereferenceable(8) %2)
  store i32 %48, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  %49 = 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 %49, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %50 = call i32 @rand() #8
  store i32 %50, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  %51 = 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)
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %53 = 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)
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr %15, align 4, !tbaa !5
  %55 = load i32, ptr %10, align 4, !tbaa !5
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %79

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

59:                                               ; preds = %70, %57
  %60 = load i32, ptr %16, align 4, !tbaa !5
  %61 = load i32, ptr %15, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %64, label %63

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

64:                                               ; preds = %59
  %65 = load i32, ptr %13, align 4, !tbaa !5
  %66 = load i32, ptr %16, align 4, !tbaa !5
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %66)
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %65
  store i32 %69, ptr %67, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %64
  %71 = load i32, ptr %16, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %16, align 4, !tbaa !5
  br label %59, !llvm.loop !11

73:                                               ; preds = %63
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr %14, align 4, !tbaa !5
  %76 = load i32, ptr %15, align 4, !tbaa !5
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %74, i32 noundef %75, i32 noundef %76, i32 noundef %77, i32 noundef %78)
  br label %158

79:                                               ; preds = %45
  %80 = load i32, ptr %10, align 4, !tbaa !5
  %81 = icmp eq i32 %80, 1
  br i1 %81, label %82, label %102

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

84:                                               ; preds = %93, %82
  %85 = load i32, ptr %17, align 4, !tbaa !5
  %86 = load i32, ptr %15, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %84
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = load i32, ptr %17, align 4, !tbaa !5
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %91)
  store i32 %90, ptr %92, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %89
  %94 = load i32, ptr %17, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %17, align 4, !tbaa !5
  br label %84, !llvm.loop !12

96:                                               ; preds = %88
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = load i32, ptr %14, align 4, !tbaa !5
  %99 = load i32, ptr %15, align 4, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !5
  %101 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %97, i32 noundef %98, i32 noundef %99, i32 noundef %100, i32 noundef %101)
  br label %157

102:                                              ; preds = %79
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = icmp eq i32 %103, 2
  br i1 %104, label %105, label %147

105:                                              ; preds = %102
  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
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = load i32, ptr %14, align 4, !tbaa !5
  %108 = load i32, ptr %15, align 4, !tbaa !5
  call void @_Z5queryiii(i32 noundef %106, i32 noundef %107, i32 noundef %108)
  %109 = load i32, ptr @mn, align 4, !tbaa !5
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %111
  %113 = load i32, ptr %15, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @A, i64 210000), i64 %114
  %116 = getelementptr inbounds i32, ptr %115, i64 1
  %117 = call noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef %112, ptr noundef %116)
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = icmp ne i32 %109, %118
  br i1 %119, label %120, label %121

120:                                              ; preds = %105
  call void @abort() #9
  unreachable

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

133:                                              ; preds = %121
  call void @abort() #9
  unreachable

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

145:                                              ; preds = %134
  call void @abort() #9
  unreachable

146:                                              ; preds = %134
  br label %156

147:                                              ; preds = %102
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = load i32, ptr %14, align 4, !tbaa !5
  %150 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %149)
  %151 = load i32, ptr %150, align 4, !tbaa !5
  %152 = add nsw i32 %151, %148
  store i32 %152, ptr %150, align 4, !tbaa !5
  %153 = load i32, ptr %7, align 4, !tbaa !5
  %154 = load i32, ptr %14, align 4, !tbaa !5
  %155 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z6updateiii(i32 noundef %153, i32 noundef %154, i32 noundef %155)
  br label %156

156:                                              ; preds = %147, %146
  br label %157

157:                                              ; preds = %156, %96
  br label %158

158:                                              ; preds = %157, %73
  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 %159

159:                                              ; preds = %158
  %160 = load i32, ptr %8, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %8, align 4, !tbaa !5
  br label %40, !llvm.loop !13

162:                                              ; preds = %44
  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
  %163 = load i32, ptr %1, align 4
  ret i32 %163
}

; 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 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: nounwind
declare i32 @rand() #5

; 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 noundef i32 @_Z5buildii(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 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: 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 @_Z6updateiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6updateiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5queryiii(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
  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

5:                                                ; preds = %7
  call void @_Z4initv()
  %6 = call noundef i32 @_Z5buildii(i32 noundef -100000, i32 noundef 100000)
  br label %12

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

11:                                               ; preds = %49
  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

12:                                               ; preds = %5, %49
  %.05470 = phi i32 [ 1, %5 ], [ %50, %49 ]
  %13 = call i32 @rand() #8
  %14 = srem i32 %13, 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #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 %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %16 = 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 %16, ptr %4, align 4, !tbaa !5
  %17 = call i32 @rand() #8
  %18 = 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)
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = 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)
  %21 = load i32, ptr %20, align 4, !tbaa !5
  switch i32 %14, label %45 [
    i32 0, label %.preheader
    i32 1, label %.preheader62
    i32 2, label %28
  ]

.preheader62:                                     ; preds = %12
  %.not6064 = icmp sgt i32 %19, %21
  br i1 %.not6064, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %12
  %.not6166 = icmp sgt i32 %19, %21
  br i1 %.not6166, label %._crit_edge69, label %.lr.ph68

._crit_edge69:                                    ; preds = %.lr.ph68, %.preheader
  call void @_Z6updateiiiii(i32 noundef %6, i32 noundef %19, i32 noundef %21, i32 noundef 0, i32 noundef %17)
  br label %49

.lr.ph68:                                         ; preds = %.preheader, %.lr.ph68
  %.05267 = phi i32 [ %25, %.lr.ph68 ], [ %19, %.preheader ]
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %.05267)
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %23, %17
  store i32 %24, ptr %22, align 4, !tbaa !5
  %25 = add i32 %.05267, 1
  %exitcond72.not = icmp eq i32 %.05267, %21
  br i1 %exitcond72.not, label %._crit_edge69, label %.lr.ph68, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph, %.preheader62
  call void @_Z6updateiiiii(i32 noundef %6, i32 noundef %19, i32 noundef %21, i32 noundef 1, i32 noundef %17)
  br label %49

.lr.ph:                                           ; preds = %.preheader62, %.lr.ph
  %.065 = phi i32 [ %27, %.lr.ph ], [ %19, %.preheader62 ]
  %26 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %.065)
  store i32 %17, ptr %26, align 4, !tbaa !5
  %27 = add i32 %.065, 1
  %exitcond71.not = icmp eq i32 %.065, %21
  br i1 %exitcond71.not, label %._crit_edge, label %.lr.ph, !llvm.loop !12

28:                                               ; preds = %12
  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 @_Z5queryiii(i32 noundef %6, i32 noundef %19, i32 noundef %21)
  %29 = load i32, ptr @mn, align 4, !tbaa !5
  %30 = sext i32 %19 to i64
  %31 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @A, i64 840000), i64 %30
  %32 = sext i32 %21 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @A, i64 840004), i64 %32
  %33 = call noundef ptr @_ZSt11min_elementIPiET_S1_S1_(ptr noundef nonnull %31, ptr noundef nonnull %gep)
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %.not = icmp eq i32 %29, %34
  br i1 %.not, label %36, label %35

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

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

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

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

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

45:                                               ; preds = %12
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN3tmpixEi(ptr noundef nonnull align 4 dereferenceable(4200000) @A, i32 noundef %19)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %17
  store i32 %48, ptr %46, align 4, !tbaa !5
  call void @_Z6updateiii(i32 noundef %6, i32 noundef %19, i32 noundef %17)
  br label %49

49:                                               ; preds = %._crit_edge, %41, %45, %._crit_edge69
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %50 = add nuw nsw i32 %.05470, 1
  %exitcond73.not = icmp eq i32 %50, 100001
  br i1 %exitcond73.not, label %11, label %12, !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 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: nounwind
declare i32 @rand() local_unnamed_addr #5

; 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