; LLVM IR from Shah-Shishir/Codeforces-Solutions :: 219A. k-String (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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_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_iterator" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"struct.std::pair" = type { i8, i32 }

@str = external dso_local global [1005 x i8], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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::map", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::__cxx11::basic_string", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator", 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
  br label %13

13:                                               ; preds = %98, %0
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef @str)
  %15 = icmp ne i32 %14, -1
  br i1 %15, label %16, label %100

16:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 48, ptr %5) #6
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  call void @_ZNSt17_Rb_tree_iteratorISt4pairIKciEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %31, %16
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1005 x i8], ptr @str, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !9
  %22 = icmp ne i8 %21, 0
  br i1 %22, label %23, label %38

23:                                               ; preds = %17
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [1005 x i8], ptr @str, i64 0, i64 %25
  %27 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %5, ptr noundef nonnull align 1 dereferenceable(1) %26)
          to label %28 unwind label %34

28:                                               ; preds = %23
  %29 = load i32, ptr %27, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %27, align 4, !tbaa !5
  br label %31

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

34:                                               ; preds = %23
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %7, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %8, align 4
  br label %99

38:                                               ; preds = %17
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %39 = call ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %40 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %10, i32 0, i32 0
  store ptr %39, ptr %40, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %10, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %41

41:                                               ; preds = %77, %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %42 = call ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  %43 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %11, i32 0, i32 0
  store ptr %42, ptr %43, align 8
  %44 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKciEES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br i1 %44, label %45, label %80

45:                                               ; preds = %41
  %46 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %47 = getelementptr inbounds %"struct.std::pair", ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !15
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = srem i32 %48, %49
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %59

52:                                               ; preds = %45
  store i32 0, ptr %4, align 4, !tbaa !5
  %53 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.1)
          to label %54 unwind label %55

54:                                               ; preds = %52
  br label %80

55:                                               ; preds = %96, %88, %68, %52
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %7, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %8, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  br label %99

59:                                               ; preds = %45
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %73, %59
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !15
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = sdiv i32 %64, %65
  %67 = icmp sle i32 %61, %66
  br i1 %67, label %68, label %76

68:                                               ; preds = %60
  %69 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  %70 = getelementptr inbounds %"struct.std::pair", ptr %69, i32 0, i32 0
  %71 = load i8, ptr %70, align 4, !tbaa !17
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32) %9, i8 noundef signext %71)
          to label %72 unwind label %55

72:                                               ; preds = %68
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %3, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %3, align 4, !tbaa !5
  br label %60, !llvm.loop !18

76:                                               ; preds = %60
  br label %77

77:                                               ; preds = %76
  %78 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKciEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %6, i32 noundef 0) #6
  %79 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %12, i32 0, i32 0
  store ptr %78, ptr %79, align 8
  br label %41, !llvm.loop !19

80:                                               ; preds = %54, %41
  %81 = load i32, ptr %4, align 4, !tbaa !5
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %96

83:                                               ; preds = %80
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %92, %83
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %88, label %95

88:                                               ; preds = %84
  %89 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  %90 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, ptr noundef %89)
          to label %91 unwind label %55

91:                                               ; preds = %88
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %3, align 4, !tbaa !5
  br label %84, !llvm.loop !20

95:                                               ; preds = %84
  br label %96

96:                                               ; preds = %95, %80
  %97 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3)
          to label %98 unwind label %55

98:                                               ; preds = %96
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %5) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %5) #6
  br label %13, !llvm.loop !21

99:                                               ; preds = %55, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(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 %101

100:                                              ; preds = %13
  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
  ret i32 0

101:                                              ; preds = %99
  %102 = load ptr, ptr %7, align 8
  %103 = load i32, ptr %8, align 4
  %104 = insertvalue { ptr, i32 } poison, ptr %102, 0
  %105 = insertvalue { ptr, i32 } %104, i32 %103, 1
  resume { ptr, i32 } %105
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #3 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: 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 zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKciEES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #4 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5clearEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{i64 0, i64 8, !13}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !6, i64 4}
!16 = !{!"_ZTSSt4pairIKciE", !7, i64 0, !6, i64 4}
!17 = !{!16, !7, i64 0}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !11}


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<char, std::pair<const char, int>, std::_Select1st<std::pair<const char, int>>, std::less<char>>::_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_iterator" = type { ptr }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@str = external dso_local global [1005 x i8], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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 %"class.std::map", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull @str)
  %.not30 = icmp eq i32 %6, -1
  br i1 %.not30, label %._crit_edge33, label %.lr.ph32

.lr.ph32:                                         ; preds = %0, %.loopexit
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #5
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @_ZNSt17_Rb_tree_iteratorISt4pairIKciEEC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %7 = load i8, ptr @str, align 16, !tbaa !5
  %.not1319 = icmp eq i8 %7, 0
  br i1 %.not1319, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph32, %10
  %indvars.iv = phi i64 [ %indvars.iv.next, %10 ], [ 0, %.lr.ph32 ]
  %8 = phi ptr [ %13, %10 ], [ @str, %.lr.ph32 ]
  %9 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 1 dereferenceable(1) %8)
          to label %10 unwind label %15

10:                                               ; preds = %.lr.ph
  %11 = load i32, ptr %9, align 4, !tbaa !8
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %9, align 4, !tbaa !8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = getelementptr inbounds [1005 x i8], ptr @str, i64 0, i64 %indvars.iv.next
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %.not13 = icmp eq i8 %14, 0
  br i1 %.not13, label %._crit_edge, label %.lr.ph, !llvm.loop !10

15:                                               ; preds = %.lr.ph
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %53

._crit_edge:                                      ; preds = %10, %.lr.ph32
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  %17 = call ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  store ptr %17, ptr %3, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %18 = call ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  store ptr %18, ptr %5, align 8
  %19 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKciEES5_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %19, label %.lr.ph26, label %.critedge.preheader

.critedge.preheader:                              ; preds = %._crit_edge24, %._crit_edge
  %20 = load i32, ptr %1, align 4, !tbaa !8
  %.not1727 = icmp slt i32 %20, 1
  br i1 %.not1727, label %.loopexit, label %.critedge

.lr.ph26:                                         ; preds = %._crit_edge, %._crit_edge24
  %21 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  %23 = load i32, ptr %22, align 4, !tbaa !14
  %24 = load i32, ptr %1, align 4, !tbaa !8
  %25 = srem i32 %23, %24
  %.not14 = icmp eq i32 %25, 0
  br i1 %.not14, label %.preheader, label %31

.preheader:                                       ; preds = %.lr.ph26
  %26 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %27 = getelementptr inbounds i8, ptr %26, i64 4
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = load i32, ptr %1, align 4, !tbaa !8
  %30 = sdiv i32 %28, %29
  %.not1521 = icmp slt i32 %30, 1
  br i1 %.not1521, label %._crit_edge24, label %.lr.ph23

31:                                               ; preds = %.lr.ph26
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.loopexit

33:                                               ; preds = %.lr.ph23
  %34 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %53

.lr.ph23:                                         ; preds = %.preheader, %37
  %.122 = phi i32 [ %38, %37 ], [ 1, %.preheader ]
  %35 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %36 = load i8, ptr %35, align 4, !tbaa !16
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext %36)
          to label %37 unwind label %33

37:                                               ; preds = %.lr.ph23
  %38 = add nuw nsw i32 %.122, 1
  %39 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKciEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  %40 = getelementptr inbounds i8, ptr %39, i64 4
  %41 = load i32, ptr %40, align 4, !tbaa !14
  %42 = load i32, ptr %1, align 4, !tbaa !8
  %43 = sdiv i32 %41, %42
  %.not15.not = icmp slt i32 %.122, %43
  br i1 %.not15.not, label %.lr.ph23, label %._crit_edge24, !llvm.loop !17

._crit_edge24:                                    ; preds = %37, %.preheader
  %44 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKciEEppEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %45 = call ptr @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  store ptr %45, ptr %5, align 8
  %46 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKciEES5_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  br i1 %46, label %.lr.ph26, label %.critedge.preheader, !llvm.loop !18

.critedge:                                        ; preds = %.critedge.preheader, %.critedge
  %.228 = phi i32 [ %49, %.critedge ], [ 1, %.critedge.preheader ]
  %47 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, ptr noundef %47)
  %49 = add nuw nsw i32 %.228, 1
  %50 = load i32, ptr %1, align 4, !tbaa !8
  %.not17.not = icmp slt i32 %.228, %50
  br i1 %.not17.not, label %.critedge, label %.loopexit, !llvm.loop !19

.loopexit:                                        ; preds = %.critedge, %.critedge.preheader, %31
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5clearEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  %52 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull @str)
  %.not = icmp eq i32 %52, -1
  br i1 %.not, label %._crit_edge33, label %.lr.ph32, !llvm.loop !20

53:                                               ; preds = %33, %15
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %34, %33 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn

._crit_edge33:                                    ; preds = %.loopexit, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE9push_backEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #4 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5clearEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIciSt4lessIcESaISt4pairIKciEEED2Ev(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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = !{!15, !9, i64 4}
!15 = !{!"_ZTSSt4pairIKciE", !6, i64 0, !9, i64 4}
!16 = !{!15, !6, i64 0}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}


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