; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Looksery 2015/Problem D (D)

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

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

25:                                               ; preds = %35, %0
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = load i32, ptr @n, align 4, !tbaa !8
  %28 = icmp slt i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %38

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %32
  %34 = call 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) %33)
  br label %35

35:                                               ; preds = %30
  %36 = load i32, ptr %2, align 4, !tbaa !8
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %2, align 4, !tbaa !8
  br label %25, !llvm.loop !11

38:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %39 = load i32, ptr @n, align 4, !tbaa !8
  %40 = sub nsw i32 %39, 1
  store i32 %40, ptr %3, align 4, !tbaa !8
  br label %41

41:                                               ; preds = %176, %38
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = icmp sge i32 %42, 0
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %179

45:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %46 = load i32, ptr @m, align 4, !tbaa !8
  %47 = sub nsw i32 %46, 1
  store i32 %47, ptr %5, align 4, !tbaa !8
  br label %48

48:                                               ; preds = %172, %45
  %49 = load i32, ptr %5, align 4, !tbaa !8
  %50 = icmp sge i32 %49, 0
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %175

52:                                               ; preds = %48
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %54
  %56 = load i32, ptr %5, align 4, !tbaa !8
  %57 = sext i32 %56 to i64
  %58 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %55, i64 noundef %57)
  %59 = load i8, ptr %58, align 1, !tbaa !13
  %60 = sext i8 %59 to i32
  %61 = icmp eq i32 %60, 87
  br i1 %61, label %62, label %111

62:                                               ; preds = %52
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %5, align 4, !tbaa !8
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [100 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !8
  %70 = icmp ne i32 %69, 1
  br i1 %70, label %71, label %111

71:                                               ; preds = %62
  %72 = load i32, ptr @cnt, align 4, !tbaa !8
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr @cnt, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %74 = load i32, ptr %3, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %75
  %77 = load i32, ptr %5, align 4, !tbaa !8
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100 x i32], ptr %76, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !8
  %81 = sub nsw i32 1, %80
  store i32 %81, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %82 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %82, ptr %7, align 4, !tbaa !8
  br label %83

83:                                               ; preds = %107, %71
  %84 = load i32, ptr %7, align 4, !tbaa !8
  %85 = icmp sge i32 %84, 0
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %110

87:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %88 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %88, ptr %8, align 4, !tbaa !8
  br label %89

89:                                               ; preds = %103, %87
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = icmp sge i32 %90, 0
  br i1 %91, label %93, label %92

92:                                               ; preds = %89
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %106

93:                                               ; preds = %89
  %94 = load i32, ptr %6, align 4, !tbaa !8
  %95 = load i32, ptr %7, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %96
  %98 = load i32, ptr %8, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100 x i32], ptr %97, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !8
  %102 = add nsw i32 %101, %94
  store i32 %102, ptr %100, align 4, !tbaa !8
  br label %103

103:                                              ; preds = %93
  %104 = load i32, ptr %8, align 4, !tbaa !8
  %105 = add nsw i32 %104, -1
  store i32 %105, ptr %8, align 4, !tbaa !8
  br label %89, !llvm.loop !14

106:                                              ; preds = %92
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %7, align 4, !tbaa !8
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %7, align 4, !tbaa !8
  br label %83, !llvm.loop !15

110:                                              ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %171

111:                                              ; preds = %62, %52
  %112 = load i32, ptr %3, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %113
  %115 = load i32, ptr %5, align 4, !tbaa !8
  %116 = sext i32 %115 to i64
  %117 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %114, i64 noundef %116)
  %118 = load i8, ptr %117, align 1, !tbaa !13
  %119 = sext i8 %118 to i32
  %120 = icmp eq i32 %119, 66
  br i1 %120, label %121, label %170

121:                                              ; preds = %111
  %122 = load i32, ptr %3, align 4, !tbaa !8
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %123
  %125 = load i32, ptr %5, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !8
  %129 = icmp ne i32 %128, -1
  br i1 %129, label %130, label %170

130:                                              ; preds = %121
  %131 = load i32, ptr @cnt, align 4, !tbaa !8
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr @cnt, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %133 = load i32, ptr %3, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %134
  %136 = load i32, ptr %5, align 4, !tbaa !8
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [100 x i32], ptr %135, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !8
  %140 = sub nsw i32 -1, %139
  store i32 %140, ptr %9, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %141 = load i32, ptr %3, align 4, !tbaa !8
  store i32 %141, ptr %10, align 4, !tbaa !8
  br label %142

142:                                              ; preds = %166, %130
  %143 = load i32, ptr %10, align 4, !tbaa !8
  %144 = icmp sge i32 %143, 0
  br i1 %144, label %146, label %145

145:                                              ; preds = %142
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %169

146:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %147 = load i32, ptr %5, align 4, !tbaa !8
  store i32 %147, ptr %11, align 4, !tbaa !8
  br label %148

148:                                              ; preds = %162, %146
  %149 = load i32, ptr %11, align 4, !tbaa !8
  %150 = icmp sge i32 %149, 0
  br i1 %150, label %152, label %151

151:                                              ; preds = %148
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %165

152:                                              ; preds = %148
  %153 = load i32, ptr %9, align 4, !tbaa !8
  %154 = load i32, ptr %10, align 4, !tbaa !8
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %155
  %157 = load i32, ptr %11, align 4, !tbaa !8
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [100 x i32], ptr %156, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !8
  %161 = add nsw i32 %160, %153
  store i32 %161, ptr %159, align 4, !tbaa !8
  br label %162

162:                                              ; preds = %152
  %163 = load i32, ptr %11, align 4, !tbaa !8
  %164 = add nsw i32 %163, -1
  store i32 %164, ptr %11, align 4, !tbaa !8
  br label %148, !llvm.loop !16

165:                                              ; preds = %151
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %10, align 4, !tbaa !8
  %168 = add nsw i32 %167, -1
  store i32 %168, ptr %10, align 4, !tbaa !8
  br label %142, !llvm.loop !17

169:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %170

170:                                              ; preds = %169, %121, %111
  br label %171

171:                                              ; preds = %170, %110
  br label %172

172:                                              ; preds = %171
  %173 = load i32, ptr %5, align 4, !tbaa !8
  %174 = add nsw i32 %173, -1
  store i32 %174, ptr %5, align 4, !tbaa !8
  br label %48, !llvm.loop !18

175:                                              ; preds = %51
  br label %176

176:                                              ; preds = %175
  %177 = load i32, ptr %3, align 4, !tbaa !8
  %178 = add nsw i32 %177, -1
  store i32 %178, ptr %3, align 4, !tbaa !8
  br label %41, !llvm.loop !19

179:                                              ; preds = %44
  %180 = load i32, ptr @cnt, align 4, !tbaa !8
  %181 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %180)
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %181, ptr noundef @.str)
  ret i32 0
}

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

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

; 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 @_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)) #1

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

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 = { "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 = { 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 = { 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}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !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::__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] }
%"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" }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [100 x [100 x i32]], align 16
@cnt = external dso_local local_unnamed_addr global i32, align 4
@_Z1gB5cxx11 = external dso_local global [100 x %"class.std::__cxx11::basic_string"], align 16
@_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 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %14 = load i32, ptr @n, align 4, !tbaa !8
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

.preheader48:                                     ; preds = %.lr.ph
  %16 = icmp sgt i32 %22, 0
  br i1 %16, label %.lr.ph62, label %._crit_edge

.lr.ph62:                                         ; preds = %.preheader48
  %17 = load i32, ptr @m, align 4, !tbaa !8
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph62.split.preheader, label %._crit_edge

.lr.ph62.split.preheader:                         ; preds = %.lr.ph62
  %.04160 = add nsw i32 %22, -1
  %19 = zext nneg i32 %.04160 to i64
  br label %.lr.ph62.split

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %20 = getelementptr inbounds [100 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %indvars.iv
  %21 = tail call 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) %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr @n, align 4, !tbaa !8
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next, %23
  br i1 %24, label %.lr.ph, label %.preheader48, !llvm.loop !11

.loopexit47:                                      ; preds = %.loopexit, %.lr.ph62.split
  %25 = icmp sgt i64 %indvars.iv75, 0
  br i1 %25, label %.lr.ph62.splitthread-pre-split, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.loopexit47, %0, %.lr.ph62, %.preheader48
  %26 = load i32, ptr @cnt, align 4, !tbaa !8
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %26)
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %27, ptr noundef nonnull @.str)
  ret i32 0

.lr.ph62.splitthread-pre-split:                   ; preds = %.loopexit47
  %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
  %.pr = load i32, ptr @m, align 4, !tbaa !8
  br label %.lr.ph62.split

.lr.ph62.split:                                   ; preds = %.lr.ph62.splitthread-pre-split, %.lr.ph62.split.preheader
  %29 = phi i32 [ %.pr, %.lr.ph62.splitthread-pre-split ], [ %17, %.lr.ph62.split.preheader ]
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %.lr.ph62.splitthread-pre-split ], [ %19, %.lr.ph62.split.preheader ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph59, label %.loopexit47

.lr.ph59:                                         ; preds = %.lr.ph62.split
  %31 = getelementptr inbounds [100 x %"class.std::__cxx11::basic_string"], ptr @_Z1gB5cxx11, i64 0, i64 %indvars.iv75
  %32 = add nsw i32 %29, -1
  %33 = zext nneg i32 %32 to i64
  %34 = zext nneg i32 %29 to i64
  br label %35

35:                                               ; preds = %.lr.ph59, %.loopexit
  %indvar = phi i32 [ 0, %.lr.ph59 ], [ %indvar.next, %.loopexit ]
  %indvars.iv86 = phi i64 [ %34, %.lr.ph59 ], [ %indvars.iv.next87, %.loopexit ]
  %indvars.iv70 = phi i64 [ %33, %.lr.ph59 ], [ %indvars.iv.next71, %.loopexit ]
  %36 = sub i32 %32, %indvar
  %smin98 = tail call i32 @llvm.smin.i32(i32 %36, i32 0)
  %37 = sub i32 %36, %smin98
  %38 = zext i32 %37 to i64
  %39 = add nuw nsw i64 %38, 1
  %40 = sub i32 %32, %indvar
  %smin = tail call i32 @llvm.smin.i32(i32 %40, i32 0)
  %41 = sub i32 %40, %smin
  %42 = zext i32 %41 to i64
  %43 = add nuw nsw i64 %42, 1
  %indvars.iv.next87 = add nsw i64 %indvars.iv86, -1
  %44 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %31, i64 noundef %indvars.iv.next87)
  %45 = load i8, ptr %44, align 1, !tbaa !15
  %46 = icmp eq i8 %45, 87
  br i1 %46, label %47, label %67

47:                                               ; preds = %35
  %48 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv75, i64 %indvars.iv.next87
  %49 = load i32, ptr %48, align 4, !tbaa !8
  %.not = icmp eq i32 %49, 1
  br i1 %.not, label %67, label %.preheader45.us.preheader

.preheader45.us.preheader:                        ; preds = %47
  %50 = load i32, ptr @cnt, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr @cnt, align 4, !tbaa !8
  %min.iters.check101 = icmp ult i32 %37, 7
  %n.vec104 = and i64 %39, 8589934584
  %ind.end105 = sub i64 %indvars.iv70, %n.vec104
  %broadcast.splatinsert114 = insertelement <4 x i32> poison, i32 %49, i64 0
  %52 = shufflevector <4 x i32> %broadcast.splatinsert114, <4 x i32> poison, <4 x i32> zeroinitializer
  %53 = shufflevector <4 x i32> %broadcast.splatinsert114, <4 x i32> poison, <4 x i32> zeroinitializer
  %cmp.n119 = icmp eq i64 %39, %n.vec104
  br label %.preheader45.us

.preheader45.us:                                  ; preds = %.preheader45.us.preheader, %._crit_edge.us
  %indvars.iv77 = phi i64 [ %indvars.iv75, %.preheader45.us.preheader ], [ %indvars.iv.next78, %._crit_edge.us ]
  br i1 %min.iters.check101, label %scalar.ph100.preheader, label %vector.body107

vector.body107:                                   ; preds = %.preheader45.us, %vector.body107
  %index108 = phi i64 [ %index.next118, %vector.body107 ], [ 0, %.preheader45.us ]
  %offset.idx109 = sub i64 %indvars.iv70, %index108
  %54 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv77, i64 %offset.idx109
  %55 = getelementptr inbounds i8, ptr %54, i64 -12
  %56 = getelementptr inbounds i8, ptr %54, i64 -28
  %wide.load110 = load <4 x i32>, ptr %55, align 4, !tbaa !8
  %wide.load112 = load <4 x i32>, ptr %56, align 4, !tbaa !8
  %57 = sub <4 x i32> %wide.load110, %52
  %reverse116 = add <4 x i32> %57, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %reverse116, ptr %55, align 4, !tbaa !8
  %58 = sub <4 x i32> %wide.load112, %53
  %reverse117 = add <4 x i32> %58, <i32 1, i32 1, i32 1, i32 1>
  store <4 x i32> %reverse117, ptr %56, align 4, !tbaa !8
  %index.next118 = add nuw i64 %index108, 8
  %59 = icmp eq i64 %index.next118, %n.vec104
  br i1 %59, label %middle.block99, label %vector.body107, !llvm.loop !16

middle.block99:                                   ; preds = %vector.body107
  br i1 %cmp.n119, label %._crit_edge.us, label %scalar.ph100.preheader

scalar.ph100.preheader:                           ; preds = %middle.block99, %.preheader45.us
  %indvars.iv72.ph = phi i64 [ %indvars.iv70, %.preheader45.us ], [ %ind.end105, %middle.block99 ]
  br label %scalar.ph100

scalar.ph100:                                     ; preds = %scalar.ph100.preheader, %scalar.ph100
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %scalar.ph100 ], [ %indvars.iv72.ph, %scalar.ph100.preheader ]
  %60 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv77, i64 %indvars.iv72
  %61 = load i32, ptr %60, align 4, !tbaa !8
  %reass.sub63 = sub i32 %61, %49
  %62 = add i32 %reass.sub63, 1
  store i32 %62, ptr %60, align 4, !tbaa !8
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1
  %63 = trunc nuw i64 %indvars.iv72 to i32
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %scalar.ph100, label %._crit_edge.us, !llvm.loop !19

._crit_edge.us:                                   ; preds = %scalar.ph100, %middle.block99
  %indvars.iv.next78 = add nsw i64 %indvars.iv77, -1
  %65 = trunc nuw i64 %indvars.iv77 to i32
  %66 = icmp sgt i32 %65, 0
  br i1 %66, label %.preheader45.us, label %.loopexit, !llvm.loop !20

67:                                               ; preds = %47, %35
  %68 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %31, i64 noundef %indvars.iv.next87)
  %69 = load i8, ptr %68, align 1, !tbaa !15
  %70 = icmp eq i8 %69, 66
  br i1 %70, label %71, label %.loopexit

71:                                               ; preds = %67
  %72 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv75, i64 %indvars.iv.next87
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %.not44 = icmp eq i32 %73, -1
  br i1 %.not44, label %.loopexit, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %71
  %74 = load i32, ptr @cnt, align 4, !tbaa !8
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr @cnt, align 4, !tbaa !8
  %76 = xor i32 %73, -1
  %min.iters.check = icmp ult i32 %41, 7
  %n.vec = and i64 %43, 8589934584
  %ind.end = sub i64 %indvars.iv70, %n.vec
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %76, i64 0
  %77 = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %78 = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %43, %n.vec
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge.us56
  %indvars.iv83 = phi i64 [ %indvars.iv75, %.preheader.us.preheader ], [ %indvars.iv.next84, %._crit_edge.us56 ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %.preheader.us, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader.us ]
  %offset.idx = sub i64 %indvars.iv70, %index
  %79 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv83, i64 %offset.idx
  %80 = getelementptr inbounds i8, ptr %79, i64 -12
  %81 = getelementptr inbounds i8, ptr %79, i64 -28
  %wide.load = load <4 x i32>, ptr %80, align 4, !tbaa !8
  %wide.load94 = load <4 x i32>, ptr %81, align 4, !tbaa !8
  %reverse96 = add nsw <4 x i32> %wide.load, %77
  store <4 x i32> %reverse96, ptr %80, align 4, !tbaa !8
  %reverse97 = add nsw <4 x i32> %wide.load94, %78
  store <4 x i32> %reverse97, ptr %81, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %82 = icmp eq i64 %index.next, %n.vec
  br i1 %82, label %middle.block, label %vector.body, !llvm.loop !21

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge.us56, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader.us
  %indvars.iv80.ph = phi i64 [ %indvars.iv70, %.preheader.us ], [ %ind.end, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %scalar.ph ], [ %indvars.iv80.ph, %scalar.ph.preheader ]
  %83 = getelementptr inbounds [100 x [100 x i32]], ptr @a, i64 0, i64 %indvars.iv83, i64 %indvars.iv80
  %84 = load i32, ptr %83, align 4, !tbaa !8
  %85 = add nsw i32 %84, %76
  store i32 %85, ptr %83, align 4, !tbaa !8
  %indvars.iv.next81 = add nsw i64 %indvars.iv80, -1
  %86 = trunc nuw i64 %indvars.iv80 to i32
  %87 = icmp sgt i32 %86, 0
  br i1 %87, label %scalar.ph, label %._crit_edge.us56, !llvm.loop !22

._crit_edge.us56:                                 ; preds = %scalar.ph, %middle.block
  %indvars.iv.next84 = add nsw i64 %indvars.iv83, -1
  %88 = trunc nuw i64 %indvars.iv83 to i32
  %89 = icmp sgt i32 %88, 0
  br i1 %89, label %.preheader.us, label %.loopexit, !llvm.loop !23

.loopexit:                                        ; preds = %._crit_edge.us, %._crit_edge.us56, %71, %67
  %90 = icmp sgt i64 %indvars.iv86, 1
  %indvars.iv.next71 = add nsw i64 %indvars.iv70, -1
  %indvar.next = add i32 %indvar, 1
  br i1 %90, label %35, label %.loopexit47, !llvm.loop !24
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #4

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 = { "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 = { 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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}
!14 = !{!"llvm.loop.unswitch.partial.disable"}
!15 = !{!10, !10, i64 0}
!16 = distinct !{!16, !12, !17, !18}
!17 = !{!"llvm.loop.isvectorized", i32 1}
!18 = !{!"llvm.loop.unroll.runtime.disable"}
!19 = distinct !{!19, !12, !18, !17}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12, !17, !18}
!22 = distinct !{!22, !12, !18, !17}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


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