; LLVM IR from eyangch/competitive-programming :: Codeforces/1505 (e)

; 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
@.str = 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 [5 x %"class.std::__cxx11::basic_string"], align 16
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %22 = 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)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 160, ptr %4) #5
  %24 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i32 0, i32 0
  %25 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %24, i64 5
  br label %26

26:                                               ; preds = %26, %0
  %27 = phi ptr [ %24, %0 ], [ %28, %26 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %27) #5
  %28 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 1
  %29 = icmp eq ptr %28, %25
  br i1 %29, label %30, label %26

30:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !8
  br label %31

31:                                               ; preds = %42, %30
  %32 = load i32, ptr %5, align 4, !tbaa !8
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %49

36:                                               ; preds = %31
  %37 = load i32, ptr %5, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i64 0, i64 %38
  %40 = 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) %39)
          to label %41 unwind label %45

41:                                               ; preds = %36
  br label %42

42:                                               ; preds = %41
  %43 = load i32, ptr %5, align 4, !tbaa !8
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %5, align 4, !tbaa !8
  br label %31, !llvm.loop !11

45:                                               ; preds = %36
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %6, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %157

49:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !8
  br label %50

50:                                               ; preds = %139, %49
  %51 = load i32, ptr %8, align 4, !tbaa !8
  %52 = load i32, ptr %2, align 4, !tbaa !8
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %54, label %142

54:                                               ; preds = %50
  %55 = load i32, ptr %8, align 4, !tbaa !8
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i64 0, i64 %56
  %58 = load i32, ptr %9, align 4, !tbaa !8
  %59 = sext i32 %58 to i64
  %60 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %57, i64 noundef %59)
          to label %61 unwind label %76

61:                                               ; preds = %54
  %62 = load i8, ptr %60, align 1, !tbaa !13
  %63 = sext i8 %62 to i32
  %64 = icmp eq i32 %63, 42
  %65 = zext i1 %64 to i32
  %66 = load i32, ptr %10, align 4, !tbaa !8
  %67 = add nsw i32 %66, %65
  store i32 %67, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %68 = load i32, ptr %2, align 4, !tbaa !8
  store i32 %68, ptr %11, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %69 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %69, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %70 = load i32, ptr %8, align 4, !tbaa !8
  store i32 %70, ptr %13, align 4, !tbaa !8
  br label %71

71:                                               ; preds = %136, %61
  %72 = load i32, ptr %13, align 4, !tbaa !8
  %73 = load i32, ptr %2, align 4, !tbaa !8
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %80, label %75

75:                                               ; preds = %71
  store i32 7, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %139

76:                                               ; preds = %145, %142, %54
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %6, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %7, align 4
  br label %156

80:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %81 = load i32, ptr %9, align 4, !tbaa !8
  store i32 %81, ptr %15, align 4, !tbaa !8
  br label %82

82:                                               ; preds = %132, %80
  %83 = load i32, ptr %15, align 4, !tbaa !8
  %84 = load i32, ptr %3, align 4, !tbaa !8
  %85 = icmp slt i32 %83, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %82
  store i32 10, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %135

87:                                               ; preds = %82
  %88 = load i32, ptr %13, align 4, !tbaa !8
  %89 = load i32, ptr %8, align 4, !tbaa !8
  %90 = icmp eq i32 %88, %89
  br i1 %90, label %91, label %96

91:                                               ; preds = %87
  %92 = load i32, ptr %15, align 4, !tbaa !8
  %93 = load i32, ptr %9, align 4, !tbaa !8
  %94 = icmp eq i32 %92, %93
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  br label %132

96:                                               ; preds = %91, %87
  %97 = load i32, ptr %13, align 4, !tbaa !8
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i64 0, i64 %98
  %100 = load i32, ptr %15, align 4, !tbaa !8
  %101 = sext i32 %100 to i64
  %102 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %99, i64 noundef %101)
          to label %103 unwind label %126

103:                                              ; preds = %96
  %104 = load i8, ptr %102, align 1, !tbaa !13
  %105 = sext i8 %104 to i32
  %106 = icmp eq i32 %105, 42
  br i1 %106, label %107, label %131

107:                                              ; preds = %103
  %108 = load i32, ptr %13, align 4, !tbaa !8
  %109 = load i32, ptr %8, align 4, !tbaa !8
  %110 = sub nsw i32 %108, %109
  %111 = load i32, ptr %15, align 4, !tbaa !8
  %112 = add nsw i32 %110, %111
  %113 = load i32, ptr %9, align 4, !tbaa !8
  %114 = sub nsw i32 %112, %113
  %115 = load i32, ptr %11, align 4, !tbaa !8
  %116 = load i32, ptr %8, align 4, !tbaa !8
  %117 = sub nsw i32 %115, %116
  %118 = load i32, ptr %12, align 4, !tbaa !8
  %119 = add nsw i32 %117, %118
  %120 = load i32, ptr %9, align 4, !tbaa !8
  %121 = sub nsw i32 %119, %120
  %122 = icmp slt i32 %114, %121
  br i1 %122, label %123, label %130

123:                                              ; preds = %107
  %124 = load i32, ptr %13, align 4, !tbaa !8
  store i32 %124, ptr %11, align 4, !tbaa !8
  %125 = load i32, ptr %15, align 4, !tbaa !8
  store i32 %125, ptr %12, align 4, !tbaa !8
  br label %130

126:                                              ; preds = %96
  %127 = landingpad { ptr, i32 }
          cleanup
  %128 = extractvalue { ptr, i32 } %127, 0
  store ptr %128, ptr %6, align 8
  %129 = extractvalue { ptr, i32 } %127, 1
  store i32 %129, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %156

130:                                              ; preds = %123, %107
  br label %131

131:                                              ; preds = %130, %103
  br label %132

132:                                              ; preds = %131, %95
  %133 = load i32, ptr %15, align 4, !tbaa !8
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %15, align 4, !tbaa !8
  br label %82, !llvm.loop !14

135:                                              ; preds = %86
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %13, align 4, !tbaa !8
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %13, align 4, !tbaa !8
  br label %71, !llvm.loop !15

139:                                              ; preds = %75
  %140 = load i32, ptr %11, align 4, !tbaa !8
  store i32 %140, ptr %8, align 4, !tbaa !8
  %141 = load i32, ptr %12, align 4, !tbaa !8
  store i32 %141, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %50, !llvm.loop !16

142:                                              ; preds = %50
  %143 = load i32, ptr %10, align 4, !tbaa !8
  %144 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %143)
          to label %145 unwind label %76

145:                                              ; preds = %142
  %146 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %144, ptr noundef @.str)
          to label %147 unwind label %76

147:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %148 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i32 0, i32 0
  %149 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %148, i64 5
  br label %150

150:                                              ; preds = %150, %147
  %151 = phi ptr [ %149, %147 ], [ %152, %150 ]
  %152 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %151, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %152) #5
  %153 = icmp eq ptr %152, %148
  br i1 %153, label %154, label %150

154:                                              ; preds = %150
  call void @llvm.lifetime.end.p0(i64 160, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %155 = load i32, ptr %1, align 4
  ret i32 %155

156:                                              ; preds = %126, %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %157

157:                                              ; preds = %156, %45
  %158 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %4, i32 0, i32 0
  %159 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %158, i64 5
  br label %160

160:                                              ; preds = %160, %157
  %161 = phi ptr [ %159, %157 ], [ %162, %160 ]
  %162 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %161, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %162) #5
  %163 = icmp eq ptr %162, %158
  br i1 %163, label %164, label %160

164:                                              ; preds = %160
  call void @llvm.lifetime.end.p0(i64 160, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %165

165:                                              ; preds = %164
  %166 = load ptr, ptr %6, align 8
  %167 = load i32, ptr %7, align 4
  %168 = insertvalue { ptr, i32 } poison, ptr %166, 0
  %169 = insertvalue { ptr, i32 } %168, i32 %167, 1
  resume { ptr, i32 } %169
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

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

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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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)) #2

declare i32 @__gxx_personality_v0(...)

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 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 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !10, i64 0}
!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
@.str = 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 {
.preheader53:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = alloca [5 x %"class.std::__cxx11::basic_string"], align 16
  %3 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %4 = getelementptr i8, ptr %3, i64 -24
  %5 = load i64, ptr %4, align 8
  %6 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %5
  %7 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %6, ptr noundef null)
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %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) %0)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %2) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  %.ptr.1 = getelementptr inbounds i8, ptr %2, i64 32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.ptr.1) #5
  %.ptr.2 = getelementptr inbounds i8, ptr %2, i64 64
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.ptr.2) #5
  %.ptr.3 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.ptr.3) #5
  %.ptr.4 = getelementptr inbounds i8, ptr %2, i64 128
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %.ptr.4) #5
  %11 = load i32, ptr %0, align 4, !tbaa !8
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %._crit_edge73

.preheader52:                                     ; preds = %16
  %13 = icmp sgt i32 %17, 0
  br i1 %13, label %.lr.ph72, label %._crit_edge73

.lr.ph:                                           ; preds = %.preheader53, %16
  %indvars.iv = phi i64 [ %indvars.iv.next, %16 ], [ 0, %.preheader53 ]
  %14 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %indvars.iv
  %15 = 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) %14)
          to label %16 unwind label %20

16:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %17 = load i32, ptr %0, align 4, !tbaa !8
  %18 = sext i32 %17 to i64
  %19 = icmp slt i64 %indvars.iv.next, %18
  br i1 %19, label %.lr.ph, label %.preheader52, !llvm.loop !11

20:                                               ; preds = %.lr.ph
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %83

.loopexit:                                        ; preds = %._crit_edge
  %22 = icmp slt i32 %.137.lcssa, %61
  br i1 %22, label %.lr.ph72, label %._crit_edge73, !llvm.loop !13

.lr.ph72:                                         ; preds = %.preheader52, %.loopexit
  %.03971 = phi i32 [ %30, %.loopexit ], [ 0, %.preheader52 ]
  %.04070 = phi i32 [ %.1.lcssa, %.loopexit ], [ 0, %.preheader52 ]
  %.04169 = phi i32 [ %.137.lcssa, %.loopexit ], [ 0, %.preheader52 ]
  %23 = sext i32 %.04169 to i64
  %24 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %23
  %25 = sext i32 %.04070 to i64
  %26 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %24, i64 noundef %25)
  %27 = load i8, ptr %26, align 1, !tbaa !14
  %28 = icmp eq i8 %27, 42
  %29 = zext i1 %28 to i32
  %30 = add nuw nsw i32 %.03971, %29
  %31 = load i32, ptr %0, align 4, !tbaa !8
  %32 = load i32, ptr %1, align 4, !tbaa !8
  %33 = icmp slt i32 %.04169, %31
  br i1 %33, label %.preheader51.lr.ph, label %._crit_edge73

.preheader51.lr.ph:                               ; preds = %.lr.ph72
  %34 = add i32 %.04070, %.04169
  %35 = icmp slt i32 %.04070, %32
  br i1 %35, label %.preheader51.preheader, label %._crit_edge73

.preheader51.preheader:                           ; preds = %.preheader51.lr.ph
  %indvars.iv.next82.peel = add nsw i64 %25, 1
  br label %.preheader51

.preheader51:                                     ; preds = %.preheader51.preheader, %._crit_edge
  %36 = phi i32 [ %32, %.preheader51.preheader ], [ %59, %._crit_edge ]
  %37 = phi i32 [ %32, %.preheader51.preheader ], [ %60, %._crit_edge ]
  %indvars.iv85 = phi i64 [ %23, %.preheader51.preheader ], [ %indvars.iv.next86, %._crit_edge ]
  %.03562 = phi i32 [ %32, %.preheader51.preheader ], [ %.1.lcssa, %._crit_edge ]
  %.03661 = phi i32 [ %31, %.preheader51.preheader ], [ %.137.lcssa, %._crit_edge ]
  %38 = icmp slt i32 %.04070, %37
  br i1 %38, label %.lr.ph58, label %._crit_edge

.lr.ph58:                                         ; preds = %.preheader51
  %39 = icmp eq i64 %indvars.iv85, %23
  %40 = getelementptr inbounds [5 x %"class.std::__cxx11::basic_string"], ptr %2, i64 0, i64 %indvars.iv85
  %41 = trunc nsw i64 %indvars.iv85 to i32
  %42 = sub i32 %41, %34
  %.fr = freeze i1 %39
  br i1 %.fr, label %.lr.ph58.split.preheader, label %.lr.ph58.split.us

.lr.ph58.split.preheader:                         ; preds = %.lr.ph58
  %43 = sext i32 %36 to i64
  %44 = icmp slt i64 %indvars.iv.next82.peel, %43
  br i1 %44, label %.lr.ph58.split.peel.next, label %._crit_edge

.lr.ph58.split.us:                                ; preds = %.lr.ph58, %53
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %53 ], [ %25, %.lr.ph58 ]
  %.156.us = phi i32 [ %.2.us, %53 ], [ %.03562, %.lr.ph58 ]
  %.13755.us = phi i32 [ %.238.us, %53 ], [ %.03661, %.lr.ph58 ]
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %40, i64 noundef %indvars.iv78)
  %46 = load i8, ptr %45, align 1, !tbaa !14
  %47 = icmp eq i8 %46, 42
  br i1 %47, label %48, label %53

48:                                               ; preds = %.lr.ph58.split.us
  %indvars80 = trunc i64 %indvars.iv78 to i32
  %49 = add i32 %42, %indvars80
  %50 = sub i32 %.13755.us, %34
  %51 = add i32 %50, %.156.us
  %52 = icmp slt i32 %49, %51
  %spec.select.us = select i1 %52, i32 %41, i32 %.13755.us
  %spec.select50.us = select i1 %52, i32 %indvars80, i32 %.156.us
  br label %53

53:                                               ; preds = %48, %.lr.ph58.split.us
  %.238.us = phi i32 [ %.13755.us, %.lr.ph58.split.us ], [ %spec.select.us, %48 ]
  %.2.us = phi i32 [ %.156.us, %.lr.ph58.split.us ], [ %spec.select50.us, %48 ]
  %indvars.iv.next79 = add nsw i64 %indvars.iv78, 1
  %54 = load i32, ptr %1, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = icmp slt i64 %indvars.iv.next79, %55
  br i1 %56, label %.lr.ph58.split.us, label %._crit_edge, !llvm.loop !15

57:                                               ; preds = %77, %._crit_edge73
  %58 = landingpad { ptr, i32 }
          cleanup
  br label %83

._crit_edge:                                      ; preds = %53, %72, %.lr.ph58.split.preheader, %.preheader51
  %59 = phi i32 [ %36, %.preheader51 ], [ %36, %.lr.ph58.split.preheader ], [ %73, %72 ], [ %54, %53 ]
  %60 = phi i32 [ %37, %.preheader51 ], [ %36, %.lr.ph58.split.preheader ], [ %73, %72 ], [ %54, %53 ]
  %.137.lcssa = phi i32 [ %.03661, %.preheader51 ], [ %.03661, %.lr.ph58.split.preheader ], [ %.238, %72 ], [ %.238.us, %53 ]
  %.1.lcssa = phi i32 [ %.03562, %.preheader51 ], [ %.03562, %.lr.ph58.split.preheader ], [ %.2, %72 ], [ %.2.us, %53 ]
  %indvars.iv.next86 = add nsw i64 %indvars.iv85, 1
  %61 = load i32, ptr %0, align 4, !tbaa !8
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next86, %62
  br i1 %63, label %.preheader51, label %.loopexit, !llvm.loop !16

.lr.ph58.split.peel.next:                         ; preds = %.lr.ph58.split.preheader, %72
  %indvars.iv81 = phi i64 [ %indvars.iv.next82, %72 ], [ %indvars.iv.next82.peel, %.lr.ph58.split.preheader ]
  %.156 = phi i32 [ %.2, %72 ], [ %.03562, %.lr.ph58.split.preheader ]
  %.13755 = phi i32 [ %.238, %72 ], [ %.03661, %.lr.ph58.split.preheader ]
  %64 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %40, i64 noundef %indvars.iv81)
  %65 = load i8, ptr %64, align 1, !tbaa !14
  %66 = icmp eq i8 %65, 42
  br i1 %66, label %67, label %72

67:                                               ; preds = %.lr.ph58.split.peel.next
  %indvars83 = trunc i64 %indvars.iv81 to i32
  %68 = add i32 %42, %indvars83
  %69 = sub i32 %.13755, %34
  %70 = add i32 %69, %.156
  %71 = icmp slt i32 %68, %70
  %spec.select = select i1 %71, i32 %41, i32 %.13755
  %spec.select50 = select i1 %71, i32 %indvars83, i32 %.156
  br label %72

72:                                               ; preds = %67, %.lr.ph58.split.peel.next
  %.238 = phi i32 [ %.13755, %.lr.ph58.split.peel.next ], [ %spec.select, %67 ]
  %.2 = phi i32 [ %.156, %.lr.ph58.split.peel.next ], [ %spec.select50, %67 ]
  %indvars.iv.next82 = add nsw i64 %indvars.iv81, 1
  %73 = load i32, ptr %1, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next82, %74
  br i1 %75, label %.lr.ph58.split.peel.next, label %._crit_edge, !llvm.loop !18

._crit_edge73:                                    ; preds = %.preheader51.lr.ph, %.lr.ph72, %.loopexit, %.preheader53, %.preheader52
  %.039.lcssa = phi i32 [ 0, %.preheader52 ], [ 0, %.preheader53 ], [ %30, %.loopexit ], [ %30, %.lr.ph72 ], [ %30, %.preheader51.lr.ph ]
  %76 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.039.lcssa)
          to label %77 unwind label %57

77:                                               ; preds = %._crit_edge73
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef nonnull @.str)
          to label %.preheader.preheader unwind label %57

.preheader.preheader:                             ; preds = %77
  %79 = getelementptr inbounds i8, ptr %2, i64 128
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %79) #5
  %80 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %80) #5
  %81 = getelementptr inbounds i8, ptr %2, i64 64
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %81) #5
  %82 = getelementptr inbounds i8, ptr %2, i64 32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %82) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #5
  ret i32 0

83:                                               ; preds = %57, %20
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %58, %57 ]
  %84 = getelementptr inbounds i8, ptr %2, i64 128
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %84) #5
  %85 = getelementptr inbounds i8, ptr %2, i64 96
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %85) #5
  %86 = getelementptr inbounds i8, ptr %2, i64 64
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %86) #5
  %87 = getelementptr inbounds i8, ptr %2, i64 32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %87) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #1 align 2

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

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

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: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 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 #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #1 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 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!10, !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !12, !19}
!19 = !{!"llvm.loop.peeled.count", i32 1}


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