; LLVM IR from eyangch/competitive-programming :: Codeforces/230 (b)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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 [1000001 x i8], align 16
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca %"class.std::set", align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca i32, align 4
  %15 = alloca i64, align 8
  %16 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %17 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 1000001, ptr %3) #6
  %19 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 0
  %20 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 0
  %21 = getelementptr inbounds i8, ptr %20, i64 1000001
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #6
  store i8 1, ptr %4, align 1, !tbaa !5
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %19, ptr noundef %21, ptr noundef nonnull align 1 dereferenceable(1) %4)
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 2, ptr %5, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %49, %0
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = icmp slt i32 %23, 1000001
  br i1 %24, label %26, label %25

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

26:                                               ; preds = %22
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !5, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  br i1 %31, label %32, label %48

32:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = mul nsw i32 2, %33
  store i32 %34, ptr %7, align 4, !tbaa !9
  br label %35

35:                                               ; preds = %43, %32
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = icmp slt i32 %36, 1000001
  br i1 %37, label %39, label %38

38:                                               ; preds = %35
  store i32 5, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %47

39:                                               ; preds = %35
  %40 = load i32, ptr %7, align 4, !tbaa !9
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 %41
  store i8 0, ptr %42, align 1, !tbaa !5
  br label %43

43:                                               ; preds = %39
  %44 = load i32, ptr %5, align 4, !tbaa !9
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = add nsw i32 %45, %44
  store i32 %46, ptr %7, align 4, !tbaa !9
  br label %35, !llvm.loop !13

47:                                               ; preds = %38
  br label %48

48:                                               ; preds = %47, %26
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %5, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !9
  br label %22, !llvm.loop !15

52:                                               ; preds = %25
  %53 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 1
  store i8 0, ptr %53, align 1, !tbaa !5
  %54 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 0
  store i8 0, ptr %54, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %8) #6
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !16
  br label %55

55:                                               ; preds = %79, %52
  %56 = load i64, ptr %9, align 8, !tbaa !16
  %57 = icmp slt i64 %56, 1000001
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %55
  %60 = load i64, ptr %9, align 8, !tbaa !16
  %61 = getelementptr inbounds [1000001 x i8], ptr %3, i64 0, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !5, !range !11, !noundef !12
  %63 = trunc i8 %62 to i1
  br i1 %63, label %64, label %78

64:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %65 = load i64, ptr %9, align 8, !tbaa !16
  %66 = load i64, ptr %9, align 8, !tbaa !16
  %67 = mul nsw i64 %65, %66
  store i64 %67, ptr %10, align 8, !tbaa !16
  %68 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %69 unwind label %74

69:                                               ; preds = %64
  %70 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 0
  %71 = extractvalue { ptr, i8 } %68, 0
  store ptr %71, ptr %70, align 8
  %72 = getelementptr inbounds { ptr, i8 }, ptr %13, i32 0, i32 1
  %73 = extractvalue { ptr, i8 } %68, 1
  store i8 %73, ptr %72, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %78

74:                                               ; preds = %64
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %11, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %122

78:                                               ; preds = %69, %59
  br label %79

79:                                               ; preds = %78
  %80 = load i64, ptr %9, align 8, !tbaa !16
  %81 = add nsw i64 %80, 1
  store i64 %81, ptr %9, align 8, !tbaa !16
  br label %55, !llvm.loop !18

82:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %116, %82
  %84 = load i32, ptr %14, align 4, !tbaa !9
  %85 = load i32, ptr %2, align 4, !tbaa !9
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %120

88:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %89 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %90 unwind label %102

90:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %91 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %15)
          to label %92 unwind label %106

92:                                               ; preds = %90
  %93 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %16, i32 0, i32 0
  store ptr %91, ptr %93, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %94 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  %95 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %17, i32 0, i32 0
  store ptr %94, ptr %95, align 8
  %96 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br i1 %96, label %97, label %110

97:                                               ; preds = %92
  %98 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %99 unwind label %102

99:                                               ; preds = %97
  %100 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %101 unwind label %102

101:                                              ; preds = %99
  br label %115

102:                                              ; preds = %112, %110, %99, %97, %88
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %11, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %12, align 4
  br label %119

106:                                              ; preds = %90
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %11, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %119

110:                                              ; preds = %92
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
          to label %112 unwind label %102

112:                                              ; preds = %110
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %114 unwind label %102

114:                                              ; preds = %112
  br label %115

115:                                              ; preds = %114, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %14, align 4, !tbaa !9
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %14, align 4, !tbaa !9
  br label %83, !llvm.loop !19

119:                                              ; preds = %106, %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %122

120:                                              ; preds = %87
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 1000001, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %121 = load i32, ptr %1, align 4
  ret i32 %121

122:                                              ; preds = %119, %74
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 1000001, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %11, align 8
  %125 = load i32, ptr %12, align 4
  %126 = insertvalue { ptr, i32 } poison, ptr %124, 0
  %127 = insertvalue { ptr, i32 } %126, i32 %125, 1
  resume { ptr, i32 } %127
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #3

; 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 void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #5 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 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 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 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 [1000001 x i8], align 16
  %3 = alloca i8, align 1
  %4 = alloca %"class.std::set", align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 1000001, ptr nonnull %2) #6
  %10 = getelementptr inbounds i8, ptr %2, i64 1000001
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #6
  store i8 1, ptr %3, align 1, !tbaa !5
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull %2, ptr noundef nonnull %10, ptr noundef nonnull align 1 dereferenceable(1) %3)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #6
  br label %13

11:                                               ; preds = %.loopexit
  %12 = getelementptr inbounds i8, ptr %2, i64 1
  store i8 0, ptr %12, align 1, !tbaa !5
  store i8 0, ptr %2, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #6
  call void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  br label %29

13:                                               ; preds = %.loopexit.1, %0
  %indvars.iv33 = phi i64 [ 2, %0 ], [ %indvars.iv.next34.1, %.loopexit.1 ]
  %indvars.iv = phi i64 [ 4, %0 ], [ %indvars.iv.next.1, %.loopexit.1 ]
  %14 = getelementptr inbounds [1000001 x i8], ptr %2, i64 0, i64 %indvars.iv33
  %15 = load i8, ptr %14, align 2, !tbaa !5, !range !9, !noundef !10
  %16 = trunc nuw i8 %15 to i1
  %17 = icmp ult i64 %indvars.iv33, 500001
  %or.cond = and i1 %17, %16
  br i1 %or.cond, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %13, %.lr.ph
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %.lr.ph ], [ %indvars.iv, %13 ]
  %18 = getelementptr inbounds [1000001 x i8], ptr %2, i64 0, i64 %indvars.iv35
  store i8 0, ptr %18, align 2, !tbaa !5
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, %indvars.iv33
  %19 = icmp ult i64 %indvars.iv.next36, 1000001
  br i1 %19, label %.lr.ph, label %.loopexit, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph, %13
  %indvars.iv.next34 = or disjoint i64 %indvars.iv33, 1
  %indvars.iv.next = or disjoint i64 %indvars.iv, 2
  %exitcond.not = icmp eq i64 %indvars.iv33, 1000000
  br i1 %exitcond.not, label %11, label %20, !llvm.loop !13

20:                                               ; preds = %.loopexit
  %21 = getelementptr inbounds [1000001 x i8], ptr %2, i64 0, i64 %indvars.iv.next34
  %22 = load i8, ptr %21, align 1, !tbaa !5, !range !9, !noundef !10
  %23 = trunc nuw i8 %22 to i1
  %24 = icmp ult i64 %indvars.iv.next34, 500001
  %or.cond.1 = and i1 %24, %23
  br i1 %or.cond.1, label %.lr.ph.1, label %.loopexit.1

.lr.ph.1:                                         ; preds = %20, %.lr.ph.1
  %indvars.iv35.1 = phi i64 [ %indvars.iv.next36.1, %.lr.ph.1 ], [ %indvars.iv.next, %20 ]
  %25 = getelementptr inbounds [1000001 x i8], ptr %2, i64 0, i64 %indvars.iv35.1
  store i8 0, ptr %25, align 1, !tbaa !5
  %indvars.iv.next36.1 = add nuw nsw i64 %indvars.iv35.1, %indvars.iv.next34
  %26 = icmp ult i64 %indvars.iv.next36.1, 1000001
  br i1 %26, label %.lr.ph.1, label %.loopexit.1, !llvm.loop !11

.loopexit.1:                                      ; preds = %.lr.ph.1, %20
  %indvars.iv.next34.1 = add nuw nsw i64 %indvars.iv33, 2
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 4
  br label %13

.preheader:                                       ; preds = %39
  %27 = load i32, ptr %1, align 4, !tbaa !14
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.lr.ph31, label %._crit_edge

29:                                               ; preds = %11, %39
  %.02129 = phi i64 [ 0, %11 ], [ %40, %39 ]
  %30 = getelementptr inbounds [1000001 x i8], ptr %2, i64 0, i64 %.02129
  %31 = load i8, ptr %30, align 1, !tbaa !5, !range !9, !noundef !10
  %32 = trunc nuw i8 %31 to i1
  br i1 %32, label %33, label %39

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %34 = mul nuw nsw i64 %.02129, %.02129
  store i64 %34, ptr %5, align 8, !tbaa !16
  %35 = invoke { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertEOx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %36 unwind label %37

36:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %39

37:                                               ; preds = %33
  %38 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %58

39:                                               ; preds = %29, %36
  %40 = add nuw nsw i64 %.02129, 1
  %exitcond39.not = icmp eq i64 %40, 1000001
  br i1 %exitcond39.not, label %.preheader, label %29, !llvm.loop !18

._crit_edge:                                      ; preds = %53, %.preheader
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph31:                                         ; preds = %.preheader, %53
  %.030 = phi i32 [ %54, %53 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %41 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %42 unwind label %48

42:                                               ; preds = %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %43 = invoke ptr @_ZNSt3setIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %4, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %.invoke40 unwind label %50

.invoke40:                                        ; preds = %42
  store ptr %43, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %44 = call ptr @_ZNKSt3setIxSt4lessIxESaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  store ptr %44, ptr %8, align 8
  %45 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIxES2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  %46 = select i1 %45, ptr @.str, ptr @.str.1
  %47 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %46)
          to label %.invoke unwind label %48

48:                                               ; preds = %.invoke40, %.invoke, %.lr.ph31
  %49 = landingpad { ptr, i32 }
          cleanup
  br label %57

50:                                               ; preds = %42
  %51 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br label %57

.invoke:                                          ; preds = %.invoke40
  %52 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %53 unwind label %48

53:                                               ; preds = %.invoke
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %54 = add nuw nsw i32 %.030, 1
  %55 = load i32, ptr %1, align 4, !tbaa !14
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %.lr.ph31, label %._crit_edge, !llvm.loop !19

57:                                               ; preds = %50, %48
  %.pn = phi { ptr, i32 } [ %49, %48 ], [ %51, %50 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br label %58

58:                                               ; preds = %57, %37
  %.pn24 = phi { ptr, i32 } [ %38, %37 ], [ %.pn, %57 ]
  call void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %4) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 1000001, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn24
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #3

; 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 void @_ZNSt3setIxSt4lessIxESaIxEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3setIxSt4lessIxESaIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #4 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 = { "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 = { 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 #4 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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