; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #790 (Div. 4)/C. Most Similar Words.ll (Z5solvev)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #8
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %19 = load i64, ptr %1, align 8, !tbaa !5
  %20 = call ptr @llvm.stacksave.p0()
  store ptr %20, ptr %3, align 8
  %21 = alloca %"class.std::__cxx11::basic_string", i64 %19, align 16
  store i64 %19, ptr %4, align 8
  %22 = icmp eq i64 %19, 0
  br i1 %22, label %29, label %23

23:                                               ; preds = %0
  %24 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %21, i64 %19
  br label %25

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

29:                                               ; preds = %25, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store ptr %21, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %30 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %30, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  %32 = mul nuw i64 32, %19
  %33 = udiv i64 %32, 32
  %34 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %31, i64 %33
  store ptr %34, ptr %7, align 8, !tbaa !9
  br label %35

35:                                               ; preds = %45, %29
  %36 = load ptr, ptr %6, align 8, !tbaa !9
  %37 = load ptr, ptr %7, align 8, !tbaa !9
  %38 = icmp ne ptr %36, %37
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %41 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %41, ptr %8, align 8, !tbaa !9
  %42 = load ptr, ptr %8, align 8, !tbaa !9
  %43 = 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) %42)
          to label %44 unwind label %48

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %45

45:                                               ; preds = %44
  %46 = load ptr, ptr %6, align 8, !tbaa !9
  %47 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %46, i32 1
  store ptr %47, ptr %6, align 8, !tbaa !9
  br label %35

48:                                               ; preds = %40
  %49 = landingpad { ptr, i32 }
          cleanup
  %50 = extractvalue { ptr, i32 } %49, 0
  store ptr %50, ptr %9, align 8
  %51 = extractvalue { ptr, i32 } %49, 1
  store i32 %51, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %136

52:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 2000000000000000000, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store i64 0, ptr %12, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %114, %52
  %54 = load i64, ptr %12, align 8, !tbaa !5
  %55 = load i64, ptr %1, align 8, !tbaa !5
  %56 = icmp slt i64 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 4, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %117

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %59 = load i64, ptr %12, align 8, !tbaa !5
  %60 = add nsw i64 %59, 1
  store i64 %60, ptr %14, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %105, %58
  %62 = load i64, ptr %14, align 8, !tbaa !5
  %63 = load i64, ptr %1, align 8, !tbaa !5
  %64 = icmp slt i64 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 7, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %113

66:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %94, %66
  %68 = load i64, ptr %16, align 8, !tbaa !5
  %69 = load i64, ptr %2, align 8, !tbaa !5
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 10, ptr %13, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %101

72:                                               ; preds = %67
  %73 = load i64, ptr %12, align 8, !tbaa !5
  %74 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %21, i64 %73
  %75 = load i64, ptr %16, align 8, !tbaa !5
  %76 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %74, i64 noundef %75)
          to label %77 unwind label %97

77:                                               ; preds = %72
  %78 = load i8, ptr %76, align 1, !tbaa !11
  %79 = sext i8 %78 to i32
  %80 = sub nsw i32 %79, 97
  %81 = load i64, ptr %14, align 8, !tbaa !5
  %82 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %21, i64 %81
  %83 = load i64, ptr %16, align 8, !tbaa !5
  %84 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %82, i64 noundef %83)
          to label %85 unwind label %97

85:                                               ; preds = %77
  %86 = load i8, ptr %84, align 1, !tbaa !11
  %87 = sext i8 %86 to i32
  %88 = sub nsw i32 %87, 97
  %89 = sub nsw i32 %80, %88
  %90 = call i32 @llvm.abs.i32(i32 %89, i1 true)
  %91 = sext i32 %90 to i64
  %92 = load i64, ptr %15, align 8, !tbaa !5
  %93 = add nsw i64 %92, %91
  store i64 %93, ptr %15, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %85
  %95 = load i64, ptr %16, align 8, !tbaa !5
  %96 = add nsw i64 %95, 1
  store i64 %96, ptr %16, align 8, !tbaa !5
  br label %67, !llvm.loop !12

97:                                               ; preds = %77, %72
  %98 = landingpad { ptr, i32 }
          cleanup
  %99 = extractvalue { ptr, i32 } %98, 0
  store ptr %99, ptr %9, align 8
  %100 = extractvalue { ptr, i32 } %98, 1
  store i32 %100, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %112

101:                                              ; preds = %71
  %102 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %103 unwind label %108

103:                                              ; preds = %101
  %104 = load i64, ptr %102, align 8, !tbaa !5
  store i64 %104, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %105

105:                                              ; preds = %103
  %106 = load i64, ptr %14, align 8, !tbaa !5
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %14, align 8, !tbaa !5
  br label %61, !llvm.loop !14

108:                                              ; preds = %101
  %109 = landingpad { ptr, i32 }
          cleanup
  %110 = extractvalue { ptr, i32 } %109, 0
  store ptr %110, ptr %9, align 8
  %111 = extractvalue { ptr, i32 } %109, 1
  store i32 %111, ptr %10, align 4
  br label %112

112:                                              ; preds = %108, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %135

113:                                              ; preds = %65
  br label %114

114:                                              ; preds = %113
  %115 = load i64, ptr %12, align 8, !tbaa !5
  %116 = add nsw i64 %115, 1
  store i64 %116, ptr %12, align 8, !tbaa !5
  br label %53, !llvm.loop !15

117:                                              ; preds = %57
  %118 = load i64, ptr %11, align 8, !tbaa !5
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %118)
          to label %120 unwind label %131

120:                                              ; preds = %117
  %121 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef @.str)
          to label %122 unwind label %131

122:                                              ; preds = %120
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %123 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %21, i64 %19
  %124 = icmp eq ptr %21, %123
  br i1 %124, label %129, label %125

125:                                              ; preds = %125, %122
  %126 = phi ptr [ %123, %122 ], [ %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, %21
  br i1 %128, label %129, label %125

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

131:                                              ; preds = %120, %117
  %132 = landingpad { ptr, i32 }
          cleanup
  %133 = extractvalue { ptr, i32 } %132, 0
  store ptr %133, ptr %9, align 8
  %134 = extractvalue { ptr, i32 } %132, 1
  store i32 %134, ptr %10, align 4
  br label %135

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

136:                                              ; preds = %135, %48
  %137 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %21, i64 %19
  %138 = icmp eq ptr %21, %137
  br i1 %138, label %143, label %139

139:                                              ; preds = %139, %136
  %140 = phi ptr [ %137, %136 ], [ %141, %139 ]
  %141 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %140, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %141) #8
  %142 = icmp eq ptr %141, %21
  br i1 %142, label %143, label %139

143:                                              ; preds = %139, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #8
  br label %144

144:                                              ; preds = %143
  %145 = load ptr, ptr %9, align 8
  %146 = load i32, ptr %10, align 4
  %147 = insertvalue { ptr, i32 } poison, ptr %145, 0
  %148 = insertvalue { ptr, i32 } %147, i32 %146, 1
  resume { ptr, i32 } %148
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

; 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: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

declare i32 @__gxx_personality_v0(...)

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %7 = load i64, ptr %1, align 8, !tbaa !5
  %8 = call ptr @llvm.stacksave.p0()
  %9 = alloca %"class.std::__cxx11::basic_string", i64 %7, align 16
  %10 = icmp eq i64 %7, 0
  %11 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %9, i64 %7
  br i1 %10, label %._crit_edge, label %.preheader47

.preheader47:                                     ; preds = %0, %.preheader47
  %12 = phi ptr [ %13, %.preheader47 ], [ %9, %0 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #8
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = icmp eq ptr %13, %11
  br i1 %14, label %.loopexit31, label %.preheader47

.loopexit31:                                      ; preds = %.preheader47
  %15 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %9, i64 %7
  br i1 %10, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %20, %0, %.loopexit31
  %16 = phi ptr [ %15, %.loopexit31 ], [ %11, %0 ], [ %15, %20 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i64 2000000000000000000, ptr %3, align 8, !tbaa !5
  %17 = load i64, ptr %1, align 8, !tbaa !5
  %18 = icmp sgt i64 %17, 0
  br i1 %18, label %.lr.ph43, label %._crit_edge44

.lr.ph:                                           ; preds = %.loopexit31, %20
  %.02433 = phi ptr [ %21, %20 ], [ %9, %.loopexit31 ]
  %19 = 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) %.02433)
          to label %20 unwind label %22

20:                                               ; preds = %.lr.ph
  %21 = getelementptr inbounds i8, ptr %.02433, i64 32
  %.not = icmp eq ptr %21, %15
  br i1 %.not, label %._crit_edge, label %.lr.ph

22:                                               ; preds = %.lr.ph
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %66

.loopexit30:                                      ; preds = %._crit_edge37, %.lr.ph43
  %24 = phi i64 [ %29, %.lr.ph43 ], [ %39, %._crit_edge37 ]
  %25 = phi i64 [ %30, %.lr.ph43 ], [ %41, %._crit_edge37 ]
  %26 = icmp slt i64 %31, %25
  br i1 %26, label %.lr.ph43, label %._crit_edge44, !llvm.loop !9

._crit_edge44:                                    ; preds = %.loopexit30, %._crit_edge
  %27 = phi i64 [ 2000000000000000000, %._crit_edge ], [ %24, %.loopexit30 ]
  %28 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %27)
          to label %58 unwind label %64

.lr.ph43:                                         ; preds = %._crit_edge, %.loopexit30
  %29 = phi i64 [ %24, %.loopexit30 ], [ 2000000000000000000, %._crit_edge ]
  %30 = phi i64 [ %25, %.loopexit30 ], [ %17, %._crit_edge ]
  %.02141 = phi i64 [ %31, %.loopexit30 ], [ 0, %._crit_edge ]
  %31 = add nuw nsw i64 %.02141, 1
  %32 = icmp slt i64 %31, %30
  br i1 %32, label %.lr.ph40, label %.loopexit30

.lr.ph40:                                         ; preds = %.lr.ph43
  %33 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %9, i64 %.02141
  br label %34

34:                                               ; preds = %.lr.ph40, %._crit_edge37
  %.02038 = phi i64 [ %31, %.lr.ph40 ], [ %40, %._crit_edge37 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 0, ptr %4, align 8, !tbaa !5
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %36 = icmp sgt i64 %35, 0
  br i1 %36, label %.lr.ph36, label %._crit_edge37

.lr.ph36:                                         ; preds = %34
  %37 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %9, i64 %.02038
  br label %43

._crit_edge37:                                    ; preds = %43, %34
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %39 = load i64, ptr %38, align 8, !tbaa !5
  store i64 %39, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %40 = add nuw nsw i64 %.02038, 1
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %34, label %.loopexit30, !llvm.loop !11

43:                                               ; preds = %.lr.ph36, %43
  %.034 = phi i64 [ 0, %.lr.ph36 ], [ %55, %43 ]
  %44 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %33, i64 noundef %.034)
  %45 = load i8, ptr %44, align 1, !tbaa !12
  %46 = sext i8 %45 to i32
  %47 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %37, i64 noundef %.034)
  %48 = load i8, ptr %47, align 1, !tbaa !12
  %49 = sext i8 %48 to i32
  %50 = sub nsw i32 %46, %49
  %51 = call i32 @llvm.abs.i32(i32 %50, i1 true)
  %52 = zext nneg i32 %51 to i64
  %53 = load i64, ptr %4, align 8, !tbaa !5
  %54 = add nsw i64 %53, %52
  store i64 %54, ptr %4, align 8, !tbaa !5
  %55 = add nuw nsw i64 %.034, 1
  %56 = load i64, ptr %2, align 8, !tbaa !5
  %57 = icmp slt i64 %55, %56
  br i1 %57, label %43, label %._crit_edge37, !llvm.loop !13

58:                                               ; preds = %._crit_edge44
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull @.str)
          to label %60 unwind label %64

60:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br i1 %10, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %60, %.preheader
  %61 = phi ptr [ %62, %.preheader ], [ %16, %60 ]
  %62 = getelementptr inbounds i8, ptr %61, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %62) #8
  %63 = icmp eq ptr %62, %9
  br i1 %63, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %60
  call void @llvm.stackrestore.p0(ptr %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret void

64:                                               ; preds = %58, %._crit_edge44
  %65 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  br label %66

66:                                               ; preds = %64, %22
  %67 = phi ptr [ %15, %22 ], [ %16, %64 ]
  %.pn = phi { ptr, i32 } [ %23, %22 ], [ %65, %64 ]
  br i1 %10, label %.loopexit29, label %.preheader28

.preheader28:                                     ; preds = %66, %.preheader28
  %68 = phi ptr [ %69, %.preheader28 ], [ %67, %66 ]
  %69 = getelementptr inbounds i8, ptr %68, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %69) #8
  %70 = icmp eq ptr %69, %9
  br i1 %70, label %.loopexit29, label %.preheader28

.loopexit29:                                      ; preds = %.preheader28, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; 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 #5

; 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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.abs.i32(i32, i1 immarg) #6

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass