; LLVM IR from kazunetakahashi/atcoder :: 2018/0602_codeFlyer (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" }

@H = external dso_local global i64, align 8
@W = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@_Z1AB5cxx11 = external dso_local global [1010 x %"class.std::__cxx11::basic_string"], align 16
@S = external dso_local global [1010 x [1010 x i8]], align 16
@F = external dso_local global [1010 x [1010 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8

; 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 i8, align 1
  %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
  store i32 0, ptr %1, align 4
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @H)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 8 dereferenceable(8) @W)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %28, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = load i64, ptr @N, align 8, !tbaa !9
  %21 = icmp slt i64 %19, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %31

23:                                               ; preds = %17
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [1010 x %"class.std::__cxx11::basic_string"], ptr @_Z1AB5cxx11, i64 0, i64 %25
  %27 = 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) %26)
  br label %28

28:                                               ; preds = %23
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %17, !llvm.loop !11

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

32:                                               ; preds = %66, %31
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = load i64, ptr @N, align 8, !tbaa !9
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %32
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %69

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %62, %38
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = load i64, ptr @M, align 8, !tbaa !9
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %39
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %65

45:                                               ; preds = %39
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [1010 x %"class.std::__cxx11::basic_string"], ptr @_Z1AB5cxx11, i64 0, i64 %47
  %49 = load i32, ptr %5, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %48, i64 noundef %50)
  %52 = load i8, ptr %51, align 1, !tbaa !13
  %53 = sext i8 %52 to i32
  %54 = icmp eq i32 %53, 35
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %56
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1010 x i8], ptr %57, i64 0, i64 %59
  %61 = zext i1 %54 to i8
  store i8 %61, ptr %60, align 1, !tbaa !14
  br label %62

62:                                               ; preds = %45
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %5, align 4, !tbaa !5
  br label %39, !llvm.loop !16

65:                                               ; preds = %44
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !17

69:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  store i8 0, ptr %6, align 1, !tbaa !14
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef @F, ptr noundef getelementptr inbounds (i8, ptr @F, i64 1020100), ptr noundef nonnull align 1 dereferenceable(1) %6)
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %144, %69
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = load i64, ptr @H, align 8, !tbaa !9
  %74 = load i64, ptr @N, align 8, !tbaa !9
  %75 = sub nsw i64 %73, %74
  %76 = icmp sle i64 %72, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %70
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %147

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

79:                                               ; preds = %140, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = load i64, ptr @W, align 8, !tbaa !9
  %83 = load i64, ptr @M, align 8, !tbaa !9
  %84 = sub nsw i64 %82, %83
  %85 = icmp sle i64 %81, %84
  br i1 %85, label %87, label %86

86:                                               ; preds = %79
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %143

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %136, %87
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = load i64, ptr @N, align 8, !tbaa !9
  %92 = icmp slt i64 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %88
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %139

94:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %132, %94
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = load i64, ptr @M, align 8, !tbaa !9
  %99 = icmp slt i64 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %95
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %135

101:                                              ; preds = %95
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %103
  %105 = load i32, ptr %10, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1010 x i8], ptr %104, i64 0, i64 %106
  %108 = load i8, ptr %107, align 1, !tbaa !14, !range !18, !noundef !19
  %109 = trunc i8 %108 to i1
  br i1 %109, label %110, label %123

110:                                              ; preds = %101
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = add nsw i32 %111, %112
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %114
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = add nsw i32 %116, %117
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [1010 x i8], ptr %115, i64 0, i64 %119
  %121 = load i8, ptr %120, align 1, !tbaa !14, !range !18, !noundef !19
  %122 = trunc i8 %121 to i1
  br label %123

123:                                              ; preds = %110, %101
  %124 = phi i1 [ false, %101 ], [ %122, %110 ]
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %126
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [1010 x i8], ptr %127, i64 0, i64 %129
  %131 = zext i1 %124 to i8
  store i8 %131, ptr %130, align 1, !tbaa !14
  br label %132

132:                                              ; preds = %123
  %133 = load i32, ptr %10, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %10, align 4, !tbaa !5
  br label %95, !llvm.loop !20

135:                                              ; preds = %100
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %9, align 4, !tbaa !5
  br label %88, !llvm.loop !21

139:                                              ; preds = %93
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %8, align 4, !tbaa !5
  br label %79, !llvm.loop !22

143:                                              ; preds = %86
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %7, align 4, !tbaa !5
  br label %70, !llvm.loop !23

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

148:                                              ; preds = %178, %147
  %149 = load i32, ptr %11, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = load i64, ptr @H, align 8, !tbaa !9
  %152 = icmp slt i64 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %148
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %181

154:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %173, %154
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = load i64, ptr @W, align 8, !tbaa !9
  %159 = icmp slt i64 %157, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %155
  store i32 26, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %176

161:                                              ; preds = %155
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %163
  %165 = load i32, ptr %12, align 4, !tbaa !5
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [1010 x i8], ptr %164, i64 0, i64 %166
  %168 = load i8, ptr %167, align 1, !tbaa !14, !range !18, !noundef !19
  %169 = trunc i8 %168 to i1
  %170 = zext i1 %169 to i64
  %171 = select i1 %169, i8 35, i8 46
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %171)
  br label %173

173:                                              ; preds = %161
  %174 = load i32, ptr %12, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %12, align 4, !tbaa !5
  br label %155, !llvm.loop !24

176:                                              ; preds = %160
  %177 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %178

178:                                              ; preds = %176
  %179 = load i32, ptr %11, align 4, !tbaa !5
  %180 = add nsw i32 %179, 1
  store i32 %180, ptr %11, align 4, !tbaa !5
  br label %148, !llvm.loop !25

181:                                              ; preds = %153
  %182 = load i32, ptr %1, align 4
  ret i32 %182
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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)) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !7, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = distinct !{!25, !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" }

@H = external dso_local global i64, align 8
@W = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@_Z1AB5cxx11 = external dso_local global [1010 x %"class.std::__cxx11::basic_string"], align 16
@S = external dso_local local_unnamed_addr global [1010 x [1010 x i8]], align 16
@F = external dso_local global [1010 x [1010 x i8]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i8, align 1
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @H)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(8) @W)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %6 = load i64, ptr @N, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge60

.preheader55:                                     ; preds = %.lr.ph
  %8 = icmp sgt i64 %13, 0
  %9 = load i64, ptr @M, align 8
  %10 = icmp sgt i64 %9, 0
  %or.cond146 = select i1 %8, i1 %10, i1 false
  br i1 %or.cond146, label %.preheader54, label %._crit_edge60

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [1010 x %"class.std::__cxx11::basic_string"], ptr @_Z1AB5cxx11, i64 0, i64 %indvars.iv
  %12 = 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) %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i64, ptr @N, align 8, !tbaa !5
  %14 = icmp sgt i64 %13, %indvars.iv.next
  br i1 %14, label %.lr.ph, label %.preheader55, !llvm.loop !9

.preheader54:                                     ; preds = %.preheader55, %._crit_edge
  %15 = phi i64 [ %57, %._crit_edge ], [ %13, %.preheader55 ]
  %16 = phi i64 [ %58, %._crit_edge ], [ %9, %.preheader55 ]
  %indvars.iv102 = phi i64 [ %indvars.iv.next103, %._crit_edge ], [ 0, %.preheader55 ]
  %17 = icmp sgt i64 %16, 0
  br i1 %17, label %.lr.ph58, label %._crit_edge

.lr.ph58:                                         ; preds = %.preheader54
  %18 = getelementptr inbounds [1010 x %"class.std::__cxx11::basic_string"], ptr @_Z1AB5cxx11, i64 0, i64 %indvars.iv102
  br label %60

._crit_edge60:                                    ; preds = %._crit_edge, %0, %.preheader55
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #6
  store i8 0, ptr %1, align 1, !tbaa !11
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull @F, ptr noundef nonnull getelementptr inbounds (i8, ptr @F, i64 1020100), ptr noundef nonnull align 1 dereferenceable(1) %1)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #6
  %19 = load i64, ptr @H, align 8, !tbaa !5
  %20 = load i64, ptr @N, align 8, !tbaa !5
  %.not74 = icmp slt i64 %19, %20
  br i1 %.not74, label %.preheader50, label %.preheader53.lr.ph

.preheader53.lr.ph:                               ; preds = %._crit_edge60
  %21 = load i64, ptr @W, align 8, !tbaa !5
  %22 = load i64, ptr @M, align 8, !tbaa !5
  %.not4966 = icmp slt i64 %21, %22
  %23 = icmp slt i64 %22, 1
  %24 = icmp slt i64 %20, 1
  %or.cond.not148 = or i1 %.not4966, %24
  %brmerge = or i1 %or.cond.not148, %23
  br i1 %brmerge, label %.preheader50, label %.preheader53.us78.us.preheader

.preheader53.us78.us.preheader:                   ; preds = %.preheader53.lr.ph
  %25 = add i64 %21, 1
  %26 = sub i64 %25, %22
  %27 = add i64 %19, 1
  %28 = sub i64 %27, %20
  %xtraiter = and i64 %22, 1
  %29 = icmp eq i64 %22, 1
  %unroll_iter = and i64 %22, 9223372036854775806
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader53.us78.us

.preheader53.us78.us:                             ; preds = %.preheader53.us78.us.preheader, %._crit_edge69.split.us.split.us.us.us
  %indvars.iv131 = phi i64 [ 0, %.preheader53.us78.us.preheader ], [ %indvars.iv.next132, %._crit_edge69.split.us.split.us.us.us ]
  br label %.preheader52.us.us.us.us

.preheader52.us.us.us.us:                         ; preds = %._crit_edge65.split.us.us.us.us.us, %.preheader53.us78.us
  %indvars.iv127 = phi i64 [ %indvars.iv.next128, %._crit_edge65.split.us.us.us.us.us ], [ 0, %.preheader53.us78.us ]
  br label %.preheader51.us.us.us.us.us

.preheader51.us.us.us.us.us:                      ; preds = %._crit_edge63.us.us.us.us.us, %.preheader52.us.us.us.us
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %._crit_edge63.us.us.us.us.us ], [ 0, %.preheader52.us.us.us.us ]
  %30 = add nuw nsw i64 %indvars.iv123, %indvars.iv131
  br i1 %29, label %._crit_edge63.us.us.us.us.us.unr-lcssa, label %.preheader51.us.us.us.us.us.new

.preheader51.us.us.us.us.us.new:                  ; preds = %.preheader51.us.us.us.us.us, %47
  %indvars.iv120 = phi i64 [ %indvars.iv.next121.1, %47 ], [ 0, %.preheader51.us.us.us.us.us ]
  %niter = phi i64 [ %niter.next.1, %47 ], [ 0, %.preheader51.us.us.us.us.us ]
  %31 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %indvars.iv123, i64 %indvars.iv120
  %32 = load i8, ptr %31, align 2, !tbaa !11, !range !13, !noundef !14
  %33 = trunc nuw i8 %32 to i1
  br i1 %33, label %34, label %38

34:                                               ; preds = %.preheader51.us.us.us.us.us.new
  %35 = add nuw nsw i64 %indvars.iv120, %indvars.iv127
  %36 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %30, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !11, !range !13, !noundef !14
  br label %38

38:                                               ; preds = %34, %.preheader51.us.us.us.us.us.new
  %39 = phi i8 [ 0, %.preheader51.us.us.us.us.us.new ], [ %37, %34 ]
  store i8 %39, ptr %31, align 2, !tbaa !11
  %indvars.iv.next121 = or disjoint i64 %indvars.iv120, 1
  %40 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %indvars.iv123, i64 %indvars.iv.next121
  %41 = load i8, ptr %40, align 1, !tbaa !11, !range !13, !noundef !14
  %42 = trunc nuw i8 %41 to i1
  br i1 %42, label %43, label %47

43:                                               ; preds = %38
  %44 = add nuw nsw i64 %indvars.iv.next121, %indvars.iv127
  %45 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %30, i64 %44
  %46 = load i8, ptr %45, align 1, !tbaa !11, !range !13, !noundef !14
  br label %47

47:                                               ; preds = %43, %38
  %48 = phi i8 [ 0, %38 ], [ %46, %43 ]
  store i8 %48, ptr %40, align 1, !tbaa !11
  %indvars.iv.next121.1 = add nuw nsw i64 %indvars.iv120, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge63.us.us.us.us.us.unr-lcssa, label %.preheader51.us.us.us.us.us.new, !llvm.loop !15

._crit_edge63.us.us.us.us.us.unr-lcssa:           ; preds = %47, %.preheader51.us.us.us.us.us
  %indvars.iv120.unr = phi i64 [ 0, %.preheader51.us.us.us.us.us ], [ %indvars.iv.next121.1, %47 ]
  br i1 %lcmp.mod.not, label %._crit_edge63.us.us.us.us.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge63.us.us.us.us.us.unr-lcssa
  %49 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %indvars.iv123, i64 %indvars.iv120.unr
  %50 = load i8, ptr %49, align 1, !tbaa !11, !range !13, !noundef !14
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %52, label %._crit_edge63.us.us.us.us.us.epilog-lcssa

52:                                               ; preds = %.epil.preheader
  %53 = add nuw nsw i64 %indvars.iv120.unr, %indvars.iv127
  %54 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %30, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !11, !range !13, !noundef !14
  br label %._crit_edge63.us.us.us.us.us.epilog-lcssa

._crit_edge63.us.us.us.us.us.epilog-lcssa:        ; preds = %52, %.epil.preheader
  %56 = phi i8 [ 0, %.epil.preheader ], [ %55, %52 ]
  store i8 %56, ptr %49, align 1, !tbaa !11
  br label %._crit_edge63.us.us.us.us.us

._crit_edge63.us.us.us.us.us:                     ; preds = %._crit_edge63.us.us.us.us.us.unr-lcssa, %._crit_edge63.us.us.us.us.us.epilog-lcssa
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %exitcond126.not = icmp eq i64 %indvars.iv.next124, %20
  br i1 %exitcond126.not, label %._crit_edge65.split.us.us.us.us.us, label %.preheader51.us.us.us.us.us, !llvm.loop !16

._crit_edge65.split.us.us.us.us.us:               ; preds = %._crit_edge63.us.us.us.us.us
  %indvars.iv.next128 = add nuw nsw i64 %indvars.iv127, 1
  %exitcond130 = icmp eq i64 %indvars.iv.next128, %26
  br i1 %exitcond130, label %._crit_edge69.split.us.split.us.us.us, label %.preheader52.us.us.us.us, !llvm.loop !17

._crit_edge69.split.us.split.us.us.us:            ; preds = %._crit_edge65.split.us.us.us.us.us
  %indvars.iv.next132 = add nuw nsw i64 %indvars.iv131, 1
  %exitcond134 = icmp eq i64 %indvars.iv.next132, %28
  br i1 %exitcond134, label %.preheader50, label %.preheader53.us78.us, !llvm.loop !18

._crit_edge.loopexit:                             ; preds = %60
  %.pre = load i64, ptr @N, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader54
  %57 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %15, %.preheader54 ]
  %58 = phi i64 [ %66, %._crit_edge.loopexit ], [ %16, %.preheader54 ]
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %59 = icmp sgt i64 %57, %indvars.iv.next103
  br i1 %59, label %.preheader54, label %._crit_edge60, !llvm.loop !19

60:                                               ; preds = %.lr.ph58, %60
  %indvars.iv99 = phi i64 [ 0, %.lr.ph58 ], [ %indvars.iv.next100, %60 ]
  %61 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %18, i64 noundef %indvars.iv99)
  %62 = load i8, ptr %61, align 1, !tbaa !21
  %63 = icmp eq i8 %62, 35
  %64 = getelementptr inbounds [1010 x [1010 x i8]], ptr @S, i64 0, i64 %indvars.iv102, i64 %indvars.iv99
  %65 = zext i1 %63 to i8
  store i8 %65, ptr %64, align 1, !tbaa !11
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %66 = load i64, ptr @M, align 8, !tbaa !5
  %67 = icmp sgt i64 %66, %indvars.iv.next100
  br i1 %67, label %60, label %._crit_edge.loopexit, !llvm.loop !22

.preheader50:                                     ; preds = %._crit_edge69.split.us.split.us.us.us, %.preheader53.lr.ph, %._crit_edge60
  %68 = icmp sgt i64 %19, 0
  br i1 %68, label %.preheader, label %._crit_edge90

.preheader:                                       ; preds = %.preheader50, %._crit_edge88
  %indvars.iv141 = phi i64 [ %indvars.iv.next142, %._crit_edge88 ], [ 0, %.preheader50 ]
  %69 = load i64, ptr @W, align 8, !tbaa !5
  %70 = icmp sgt i64 %69, 0
  br i1 %70, label %.lr.ph87, label %._crit_edge88

._crit_edge90:                                    ; preds = %._crit_edge88, %.preheader50
  ret i32 0

._crit_edge88:                                    ; preds = %.lr.ph87, %.preheader
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %indvars.iv.next142 = add nuw nsw i64 %indvars.iv141, 1
  %72 = load i64, ptr @H, align 8, !tbaa !5
  %73 = icmp sgt i64 %72, %indvars.iv.next142
  br i1 %73, label %.preheader, label %._crit_edge90, !llvm.loop !23

.lr.ph87:                                         ; preds = %.preheader, %.lr.ph87
  %indvars.iv138 = phi i64 [ %indvars.iv.next139, %.lr.ph87 ], [ 0, %.preheader ]
  %74 = getelementptr inbounds [1010 x [1010 x i8]], ptr @F, i64 0, i64 %indvars.iv141, i64 %indvars.iv138
  %75 = load i8, ptr %74, align 1, !tbaa !11, !range !13, !noundef !14
  %76 = trunc nuw i8 %75 to i1
  %77 = select i1 %76, i8 35, i8 46
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %77)
  %indvars.iv.next139 = add nuw nsw i64 %indvars.iv138, 1
  %79 = load i64, ptr @W, align 8, !tbaa !5
  %80 = icmp sgt i64 %79, %indvars.iv.next139
  br i1 %80, label %.lr.ph87, label %._crit_edge88, !llvm.loop !24
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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 #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef, ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

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 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


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