; LLVM IR from upupming/algorithm :: AdvancedLevel_C++/1129. Recommendation System (25)  (main)

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

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<node, node, std::_Identity<node>, std::less<node>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<node, node, std::_Identity<node>, std::less<node>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%struct.node = type { i32, i32 }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>

@book = external dso_local global [50001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"class.std::set", align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca %struct.node, align 4
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %19 = alloca %struct.node, align 4
  %20 = alloca %"struct.std::pair", align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #6
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %123, %0
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %132

27:                                               ; preds = %22
  %28 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
          to label %29 unwind label %49

29:                                               ; preds = %27
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %76

32:                                               ; preds = %29
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %33)
          to label %35 unwind label %49

35:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %36 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %37 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %36, ptr %37, align 8
  br label %38

38:                                               ; preds = %61, %35
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  br i1 %41, label %42, label %46

42:                                               ; preds = %38
  %43 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %44 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %43, ptr %44, align 8
  %45 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  br label %46

46:                                               ; preds = %42, %38
  %47 = phi i1 [ false, %38 ], [ %45, %42 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br i1 %47, label %53, label %48

48:                                               ; preds = %46
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %68

49:                                               ; preds = %32, %27
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %8, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %9, align 4
  br label %131

53:                                               ; preds = %46
  %54 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4nodeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  %55 = getelementptr inbounds %struct.node, ptr %54, i32 0, i32 0
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %56)
          to label %58 unwind label %64

58:                                               ; preds = %53
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %10, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %58
  %62 = call ptr @_ZNSt23_Rb_tree_const_iteratorI4nodeEppEi(ptr noundef nonnull align 8 dereferenceable(8) %11, i32 noundef 0) #6
  %63 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %13, i32 0, i32 0
  store ptr %62, ptr %63, align 8
  br label %38, !llvm.loop !11

64:                                               ; preds = %53
  %65 = landingpad { ptr, i32 }
          cleanup
  %66 = extractvalue { ptr, i32 } %65, 0
  store ptr %66, ptr %8, align 8
  %67 = extractvalue { ptr, i32 } %65, 1
  store i32 %67, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %75

68:                                               ; preds = %48
  %69 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.4)
          to label %70 unwind label %71

70:                                               ; preds = %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %76

71:                                               ; preds = %68
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %8, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %9, align 4
  br label %75

75:                                               ; preds = %71, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %131

76:                                               ; preds = %70, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %77 = getelementptr inbounds %struct.node, ptr %15, i32 0, i32 0
  %78 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %78, ptr %77, align 4, !tbaa !9
  %79 = getelementptr inbounds %struct.node, ptr %15, i32 0, i32 1
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [50001 x i32], ptr @book, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  store i32 %83, ptr %79, align 4, !tbaa !13
  %84 = invoke ptr @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE4findERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(8) %15)
          to label %85 unwind label %96

85:                                               ; preds = %76
  %86 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %84, ptr %86, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %87 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %88 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %87, ptr %88, align 8
  %89 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br i1 %89, label %90, label %104

90:                                               ; preds = %85
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %14, i64 8, i1 false), !tbaa.struct !14
  %91 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8
  %93 = invoke ptr @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr %92)
          to label %94 unwind label %100

94:                                               ; preds = %90
  %95 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %18, i32 0, i32 0
  store ptr %93, ptr %95, align 8
  br label %104

96:                                               ; preds = %76
  %97 = landingpad { ptr, i32 }
          cleanup
  %98 = extractvalue { ptr, i32 } %97, 0
  store ptr %98, ptr %8, align 8
  %99 = extractvalue { ptr, i32 } %97, 1
  store i32 %99, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %130

100:                                              ; preds = %90
  %101 = landingpad { ptr, i32 }
          cleanup
  %102 = extractvalue { ptr, i32 } %101, 0
  store ptr %102, ptr %8, align 8
  %103 = extractvalue { ptr, i32 } %101, 1
  store i32 %103, ptr %9, align 4
  br label %130

104:                                              ; preds = %94, %85
  %105 = load i32, ptr %4, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [50001 x i32], ptr @book, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %107, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #6
  %110 = getelementptr inbounds %struct.node, ptr %19, i32 0, i32 0
  %111 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %111, ptr %110, align 4, !tbaa !9
  %112 = getelementptr inbounds %struct.node, ptr %19, i32 0, i32 1
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [50001 x i32], ptr @book, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  store i32 %116, ptr %112, align 4, !tbaa !13
  %117 = invoke { ptr, i8 } @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 4 dereferenceable(8) %19)
          to label %118 unwind label %126

118:                                              ; preds = %104
  %119 = getelementptr inbounds { ptr, i8 }, ptr %20, i32 0, i32 0
  %120 = extractvalue { ptr, i8 } %117, 0
  store ptr %120, ptr %119, align 8
  %121 = getelementptr inbounds { ptr, i8 }, ptr %20, i32 0, i32 1
  %122 = extractvalue { ptr, i8 } %117, 1
  store i8 %122, ptr %121, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %123

123:                                              ; preds = %118
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %22, !llvm.loop !17

126:                                              ; preds = %104
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %8, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #6
  br label %130

130:                                              ; preds = %126, %100, %96
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %131

131:                                              ; preds = %130, %75, %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %134

132:                                              ; preds = %26
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %133 = load i32, ptr %1, align 4
  ret i32 %133

134:                                              ; preds = %131
  %135 = load ptr, ptr %8, align 8
  %136 = load i32, ptr %9, align 4
  %137 = insertvalue { ptr, i32 } poison, ptr %135, 0
  %138 = insertvalue { ptr, i32 } %137, i32 %136, 1
  resume { ptr, i32 } %138
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4nodeEptEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) #4 align 2

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

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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, !6, i64 0}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 4}
!14 = !{i64 0, i64 8, !15}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!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"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<node, node, std::_Identity<node>, std::less<node>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<node, node, std::_Identity<node>, std::less<node>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%struct.node = type { i32, i32 }

@book = external dso_local local_unnamed_addr global [50001 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::set", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %struct.node, align 4
  %9 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %10 = alloca %struct.node, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #5
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.lr.ph16, label %._crit_edge

.lr.ph16:                                         ; preds = %0
  %14 = getelementptr inbounds i8, ptr %8, i64 4
  %15 = getelementptr inbounds i8, ptr %10, i64 4
  br label %16

._crit_edge:                                      ; preds = %57, %0
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

16:                                               ; preds = %.lr.ph16, %57
  %.015 = phi i32 [ 0, %.lr.ph16 ], [ %58, %57 ]
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3)
  %.not = icmp eq i32 %.015, 0
  br i1 %.not, label %35, label %18

18:                                               ; preds = %16
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %19)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %21 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  store ptr %21, ptr %5, align 8
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  br i1 %23, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %18, %27
  %.01214 = phi i32 [ %31, %27 ], [ 0, %18 ]
  %24 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  store ptr %24, ptr %6, align 8
  %25 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br i1 %25, label %27, label %.loopexit

.critedge:                                        ; preds = %27, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %.critedge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %26 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %35

27:                                               ; preds = %.lr.ph
  %28 = call noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4nodeEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %29)
  %31 = add nuw nsw i32 %.01214, 1
  %32 = call ptr @_ZNSt23_Rb_tree_const_iteratorI4nodeEppEi(ptr noundef nonnull align 8 dereferenceable(8) %5, i32 noundef 0) #5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = icmp slt i32 %31, %33
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  br i1 %34, label %.lr.ph, label %.critedge, !llvm.loop !11

35:                                               ; preds = %.loopexit, %16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #5
  %36 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %36, ptr %8, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [50001 x i32], ptr @book, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr %14, align 4, !tbaa !13
  %40 = invoke ptr @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE4findERKS0_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(8) %8)
          to label %41 unwind label %46

41:                                               ; preds = %35
  store ptr %40, ptr %7, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #5
  %42 = call ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  store ptr %42, ptr %9, align 8
  %43 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #5
  br i1 %43, label %44, label %50

44:                                               ; preds = %41
  %.sroa.02.0.copyload = load ptr, ptr %7, align 8, !tbaa !14
  %45 = invoke ptr @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIS0_E(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr %.sroa.02.0.copyload)
          to label %50 unwind label %48

46:                                               ; preds = %35
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #5
  br label %63

48:                                               ; preds = %44
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %63

50:                                               ; preds = %44, %41
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [50001 x i32], ptr @book, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %53, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #5
  store i32 %51, ptr %10, align 4, !tbaa !9
  store i32 %55, ptr %15, align 4, !tbaa !13
  %56 = invoke { ptr, i8 } @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 4 dereferenceable(8) %10)
          to label %57 unwind label %61

57:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  %58 = add nuw nsw i32 %.015, 1
  %59 = load i32, ptr %1, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %16, label %._crit_edge, !llvm.loop !16

61:                                               ; preds = %50
  %62 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #5
  br label %63

63:                                               ; preds = %61, %48, %46
  %.pn = phi { ptr, i32 } [ %62, %61 ], [ %49, %48 ], [ %47, %46 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorI4nodeES3_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setI4nodeSt4lessIS0_ESaIS0_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #3 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNKSt23_Rb_tree_const_iteratorI4nodeEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorI4nodeEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setI4nodeSt4lessIS0_ESaIS0_EE6insertEOS0_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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 = { 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 #3 = { 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 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 }

!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, !6, i64 0}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 4}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 4}
!14 = !{!15, !15, i64 0}
!15 = !{!"any pointer", !7, i64 0}
!16 = distinct !{!16, !12}


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