; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (1004(字符串统计))

; 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::__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] }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca [1000 x %"class.std::__cxx11::basic_string"], align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca [1000 x i32], align 16
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 32000, ptr %2) #8
  %11 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i32 0, i32 0
  %12 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %11, i64 1000
  br label %13

13:                                               ; preds = %13, %0
  %14 = phi ptr [ %11, %0 ], [ %15, %13 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %14) #8
  %15 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 1
  %16 = icmp eq ptr %15, %12
  br i1 %16, label %17, label %13

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

18:                                               ; preds = %113, %17
  %19 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %20 unwind label %31

20:                                               ; preds = %18
  %21 = load ptr, ptr %19, align 8, !tbaa !9
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr %19, i64 %23
  %25 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %24)
          to label %26 unwind label %31

26:                                               ; preds = %20
  br i1 %25, label %27, label %119

27:                                               ; preds = %26
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  br label %119

31:                                               ; preds = %20, %18
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %7, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %8, align 4
  br label %122

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4000, ptr %9) #8
  call void @llvm.memset.p0.i64(ptr align 16 %9, i8 0, i64 4000, i1 false)
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %36

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

40:                                               ; preds = %36
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %42
  %44 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %43)
          to label %45 unwind label %49

45:                                               ; preds = %40
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %5, align 4, !tbaa !5
  br label %36, !llvm.loop !11

49:                                               ; preds = %40
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %7, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %8, align 4
  br label %118

53:                                               ; preds = %36
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %82, %53
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %58, label %85

58:                                               ; preds = %54
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %78, %58
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %63, label %81

63:                                               ; preds = %59
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %65
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %68
  %70 = call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %66, ptr noundef nonnull align 8 dereferenceable(32) %69) #8
  br i1 %70, label %71, label %77

71:                                               ; preds = %63
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1000 x i32], ptr %9, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %74, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %71, %63
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !13

81:                                               ; preds = %59
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %5, align 4, !tbaa !5
  br label %54, !llvm.loop !14

85:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %103, %85
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %90, label %106

90:                                               ; preds = %86
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1000 x i32], ptr %9, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = load i32, ptr %10, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [1000 x i32], ptr %9, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = icmp sgt i32 %94, %98
  br i1 %99, label %100, label %102

100:                                              ; preds = %90
  %101 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %101, ptr %10, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %100, %90
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %5, align 4, !tbaa !5
  br label %86, !llvm.loop !15

106:                                              ; preds = %86
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %108
  %110 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %109)
          to label %111 unwind label %114

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

113:                                              ; preds = %111
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 4000, ptr %9) #8
  br label %18, !llvm.loop !16

114:                                              ; preds = %111, %106
  %115 = landingpad { ptr, i32 }
          cleanup
  %116 = extractvalue { ptr, i32 } %115, 0
  store ptr %116, ptr %7, align 8
  %117 = extractvalue { ptr, i32 } %115, 1
  store i32 %117, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %118

118:                                              ; preds = %114, %49
  call void @llvm.lifetime.end.p0(i64 4000, ptr %9) #8
  br label %122

119:                                              ; preds = %30, %26
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  %120 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i32 0, i32 0
  %121 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %120, i64 1000
  br label %125

122:                                              ; preds = %118, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  %123 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %2, i32 0, i32 0
  %124 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %123, i64 1000
  br label %131

125:                                              ; preds = %125, %119
  %126 = phi ptr [ %121, %119 ], [ %127, %125 ]
  %127 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %126, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %127) #8
  %128 = icmp eq ptr %127, %120
  br i1 %128, label %129, label %125

129:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 32000, ptr %2) #8
  %130 = load i32, ptr %1, align 4
  ret i32 %130

131:                                              ; preds = %131, %122
  %132 = phi ptr [ %124, %122 ], [ %133, %131 ]
  %133 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %132, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %133) #8
  %134 = icmp eq ptr %133, %123
  br i1 %134, label %135, label %131

135:                                              ; preds = %131
  call void @llvm.lifetime.end.p0(i64 32000, ptr %2) #8
  br label %136

136:                                              ; preds = %135
  %137 = load ptr, ptr %7, align 8
  %138 = load i32, ptr %8, align 4
  %139 = insertvalue { ptr, i32 } poison, ptr %137, 0
  %140 = insertvalue { ptr, i32 } %139, i32 %138, 1
  resume { ptr, i32 } %140
}

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #7

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #7

; 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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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 = { 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 #3 = { "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: write) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !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::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::__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] }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca [1000 x %"class.std::__cxx11::basic_string"], align 16
  %2 = alloca i32, align 4
  %3 = alloca [1000 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 32000, ptr nonnull %1) #8
  br label %4

4:                                                ; preds = %4, %0
  %.idx = phi i64 [ 0, %0 ], [ %.add, %4 ]
  %.ptr = getelementptr inbounds i8, ptr %1, i64 %.idx
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.ptr) #8
  %.add = add nuw nsw i64 %.idx, 32
  %5 = icmp eq i64 %.add, 32000
  br i1 %5, label %6, label %4

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %1, i64 32000
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %84, %6
  %9 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %10 unwind label %19

10:                                               ; preds = %8
  %11 = load ptr, ptr %9, align 8, !tbaa !9
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr %9, i64 %13
  %15 = invoke noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %14)
          to label %16 unwind label %19

16:                                               ; preds = %10
  %17 = load i32, ptr %2, align 4
  %18 = icmp ne i32 %17, 0
  %or.cond.not = select i1 %15, i1 %18, i1 false
  br i1 %or.cond.not, label %21, label %88

19:                                               ; preds = %10, %8
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %89

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4000, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(4000) %3, i8 0, i64 4000, i1 false)
  %.not38 = icmp slt i32 %17, 1
  br i1 %.not38, label %._crit_edge49, label %.lr.ph

.preheader37:                                     ; preds = %24
  %.not3143 = icmp slt i32 %25, 1
  br i1 %.not3143, label %._crit_edge49, label %.preheader

.lr.ph:                                           ; preds = %21, %24
  %indvars.iv = phi i64 [ %indvars.iv.next, %24 ], [ 1, %21 ]
  %22 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %1, i64 0, i64 %indvars.iv
  %23 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %22)
          to label %24 unwind label %27

24:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %.not.not = icmp slt i64 %indvars.iv, %26
  br i1 %.not.not, label %.lr.ph, label %.preheader37, !llvm.loop !11

27:                                               ; preds = %.lr.ph
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %87

.preheader36:                                     ; preds = %._crit_edge
  %.not3245 = icmp slt i32 %43, 1
  br i1 %.not3245, label %._crit_edge49, label %.lr.ph48.preheader

.lr.ph48.preheader:                               ; preds = %.preheader36
  %29 = zext nneg i32 %43 to i64
  %xtraiter = and i64 %29, 3
  %30 = icmp ult i32 %43, 4
  br i1 %30, label %._crit_edge49.loopexit.unr-lcssa, label %.lr.ph48.preheader.new

.lr.ph48.preheader.new:                           ; preds = %.lr.ph48.preheader
  %unroll_iter = and i64 %29, 2147483644
  br label %.lr.ph48

.preheader:                                       ; preds = %.preheader37, %._crit_edge
  %31 = phi i32 [ %43, %._crit_edge ], [ %25, %.preheader37 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge ], [ 1, %.preheader37 ]
  %.not3340 = icmp slt i32 %31, 1
  br i1 %.not3340, label %.preheader.._crit_edge_crit_edge, label %.lr.ph42

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre = sext i32 %31 to i64
  br label %._crit_edge

.lr.ph42:                                         ; preds = %.preheader
  %32 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %1, i64 0, i64 %indvars.iv57
  %33 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv57
  br label %34

34:                                               ; preds = %.lr.ph42, %40
  %indvars.iv54 = phi i64 [ 1, %.lr.ph42 ], [ %indvars.iv.next55, %40 ]
  %35 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %1, i64 0, i64 %indvars.iv54
  %36 = call noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32) %32, ptr noundef nonnull align 8 dereferenceable(32) %35) #8
  br i1 %36, label %37, label %40

37:                                               ; preds = %34
  %38 = load i32, ptr %33, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %33, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %34, %37
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %.not33.not = icmp slt i64 %indvars.iv54, %42
  br i1 %.not33.not, label %34, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %40, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %42, %40 ]
  %43 = phi i32 [ %31, %.preheader.._crit_edge_crit_edge ], [ %41, %40 ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %.not31.not = icmp slt i64 %indvars.iv57, %.pre-phi
  br i1 %.not31.not, label %.preheader, label %.preheader36, !llvm.loop !14

.lr.ph48:                                         ; preds = %.lr.ph48, %.lr.ph48.preheader.new
  %indvars.iv60 = phi i64 [ 1, %.lr.ph48.preheader.new ], [ %indvars.iv.next61.3, %.lr.ph48 ]
  %.047 = phi i32 [ 0, %.lr.ph48.preheader.new ], [ %spec.select.3, %.lr.ph48 ]
  %niter = phi i64 [ 0, %.lr.ph48.preheader.new ], [ %niter.next.3, %.lr.ph48 ]
  %44 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv60
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %.047 to i64
  %47 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = icmp sgt i32 %45, %48
  %50 = trunc nuw nsw i64 %indvars.iv60 to i32
  %spec.select = select i1 %49, i32 %50, i32 %.047
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %51 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv.next61
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %spec.select to i64
  %54 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = icmp sgt i32 %52, %55
  %57 = trunc nuw nsw i64 %indvars.iv.next61 to i32
  %spec.select.1 = select i1 %56, i32 %57, i32 %spec.select
  %indvars.iv.next61.1 = add nuw nsw i64 %indvars.iv60, 2
  %58 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv.next61.1
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %spec.select.1 to i64
  %61 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp sgt i32 %59, %62
  %64 = trunc nuw nsw i64 %indvars.iv.next61.1 to i32
  %spec.select.2 = select i1 %63, i32 %64, i32 %spec.select.1
  %indvars.iv.next61.2 = add nuw nsw i64 %indvars.iv60, 3
  %65 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv.next61.2
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sext i32 %spec.select.2 to i64
  %68 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp sgt i32 %66, %69
  %71 = trunc nuw nsw i64 %indvars.iv.next61.2 to i32
  %spec.select.3 = select i1 %70, i32 %71, i32 %spec.select.2
  %indvars.iv.next61.3 = add nuw nsw i64 %indvars.iv60, 4
  %niter.next.3 = add nuw i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge49.loopexit.unr-lcssa, label %.lr.ph48, !llvm.loop !16

._crit_edge49.loopexit.unr-lcssa:                 ; preds = %.lr.ph48, %.lr.ph48.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph48.preheader ], [ %spec.select.3, %.lr.ph48 ]
  %indvars.iv60.unr = phi i64 [ 1, %.lr.ph48.preheader ], [ %indvars.iv.next61.3, %.lr.ph48 ]
  %.047.unr = phi i32 [ 0, %.lr.ph48.preheader ], [ %spec.select.3, %.lr.ph48 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge49, label %.lr.ph48.epil

.lr.ph48.epil:                                    ; preds = %._crit_edge49.loopexit.unr-lcssa, %.lr.ph48.epil
  %indvars.iv60.epil = phi i64 [ %indvars.iv.next61.epil, %.lr.ph48.epil ], [ %indvars.iv60.unr, %._crit_edge49.loopexit.unr-lcssa ]
  %.047.epil = phi i32 [ %spec.select.epil, %.lr.ph48.epil ], [ %.047.unr, %._crit_edge49.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph48.epil ], [ 0, %._crit_edge49.loopexit.unr-lcssa ]
  %72 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %indvars.iv60.epil
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = sext i32 %.047.epil to i64
  %75 = getelementptr inbounds [1000 x i32], ptr %3, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp sgt i32 %73, %76
  %78 = trunc nuw nsw i64 %indvars.iv60.epil to i32
  %spec.select.epil = select i1 %77, i32 %78, i32 %.047.epil
  %indvars.iv.next61.epil = add nuw nsw i64 %indvars.iv60.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge49, label %.lr.ph48.epil, !llvm.loop !17

._crit_edge49:                                    ; preds = %._crit_edge49.loopexit.unr-lcssa, %.lr.ph48.epil, %21, %.preheader37, %.preheader36
  %.0.lcssa = phi i32 [ 0, %.preheader36 ], [ 0, %.preheader37 ], [ 0, %21 ], [ %spec.select.lcssa.ph, %._crit_edge49.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph48.epil ]
  %79 = sext i32 %.0.lcssa to i64
  %80 = getelementptr inbounds [1000 x %"class.std::__cxx11::basic_string"], ptr %1, i64 0, i64 %79
  %81 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) %80)
          to label %82 unwind label %85

82:                                               ; preds = %._crit_edge49
  %83 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %81, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %84 unwind label %85

84:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %3) #8
  br label %8, !llvm.loop !19

85:                                               ; preds = %82, %._crit_edge49
  %86 = landingpad { ptr, i32 }
          cleanup
  br label %87

87:                                               ; preds = %85, %27
  %.pn = phi { ptr, i32 } [ %28, %27 ], [ %86, %85 ]
  call void @llvm.lifetime.end.p0(i64 4000, ptr nonnull %3) #8
  br label %89

88:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  br label %90

89:                                               ; preds = %87, %19
  %.pn.pn = phi { ptr, i32 } [ %.pn, %87 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  br label %95

90:                                               ; preds = %90, %88
  %91 = phi ptr [ %7, %88 ], [ %92, %90 ]
  %92 = getelementptr inbounds i8, ptr %91, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %92) #8
  %93 = icmp eq ptr %92, %1
  br i1 %93, label %94, label %90

94:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 32000, ptr nonnull %1) #8
  ret i32 0

95:                                               ; preds = %95, %89
  %96 = phi ptr [ %7, %89 ], [ %97, %95 ]
  %97 = getelementptr inbounds i8, ptr %96, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %97) #8
  %98 = icmp eq ptr %97, %1
  br i1 %98, label %99, label %95

99:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 32000, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn.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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZSteqIcEN9__gnu_cxx11__enable_ifIXsr9__is_charIT_EE7__valueEbE6__typeERKNSt7__cxx1112basic_stringIS2_St11char_traitsIS2_ESaIS2_EEESC_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #6

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

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

; 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 void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 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 = { 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 #3 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { 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, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.unswitch.partial.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass