; LLVM IR from kazunetakahashi/atcoder :: 2019/0504_AGC033 (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::basic_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"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] }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@dp1 = external dso_local global [17 x [186 x [186 x [186 x i16]]]], align 16
@dp2 = external dso_local global [17 x [186 x [186 x [186 x i16]]]], align 16
@H = external dso_local global i16, align 2
@W = external dso_local global i16, align 2
@A = external dso_local global [186 x [186 x i16]], align 16
@.str.3 = external hidden unnamed_addr constant [80 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.10 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEs(ptr noundef nonnull align 8 dereferenceable(8), i16 noundef signext) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10zero_setupv() #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8fill_dp1i(i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8fill_dp2i(i32 noundef) #5

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #6 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  store i32 0, ptr %1, align 4
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 2 dereferenceable(2) @H)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 2 dereferenceable(2) @W)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %64, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i16, ptr @H, align 2, !tbaa !9
  %17 = sext i16 %16 to i32
  %18 = icmp slt i32 %15, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %68

20:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  %21 = 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) %4)
          to label %22 unwind label %29

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

23:                                               ; preds = %60, %22
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = load i16, ptr @W, align 2, !tbaa !9
  %26 = sext i16 %25 to i32
  %27 = icmp slt i32 %24, %26
  br i1 %27, label %33, label %28

28:                                               ; preds = %23
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %63

29:                                               ; preds = %20
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %5, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %6, align 4
  br label %67

33:                                               ; preds = %23
  %34 = load i32, ptr %7, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %35)
          to label %37 unwind label %48

37:                                               ; preds = %33
  %38 = load i8, ptr %36, align 1, !tbaa !11
  %39 = sext i8 %38 to i32
  %40 = icmp eq i32 %39, 46
  br i1 %40, label %41, label %52

41:                                               ; preds = %37
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [186 x [186 x i16]], ptr @A, i64 0, i64 %43
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [186 x i16], ptr %44, i64 0, i64 %46
  store i16 2, ptr %47, align 2, !tbaa !12
  br label %59

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

52:                                               ; preds = %37
  %53 = load i32, ptr %2, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [186 x [186 x i16]], ptr @A, i64 0, i64 %54
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [186 x i16], ptr %55, i64 0, i64 %57
  store i16 1, ptr %58, align 2, !tbaa !12
  br label %59

59:                                               ; preds = %52, %41
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %23, !llvm.loop !14

63:                                               ; preds = %28
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !16

67:                                               ; preds = %48, %29
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %149

68:                                               ; preds = %19
  call void @_Z10zero_setupv()
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %76, %68
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = icmp sle i32 %70, 16
  br i1 %71, label %73, label %72

72:                                               ; preds = %69
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %79

73:                                               ; preds = %69
  %74 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z8fill_dp1i(i32 noundef %74)
  %75 = load i32, ptr %8, align 4, !tbaa !5
  call void @_Z8fill_dp2i(i32 noundef %75)
  br label %76

76:                                               ; preds = %73
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %8, align 4, !tbaa !5
  br label %69, !llvm.loop !17

79:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 2, ptr %9) #7
  store i16 17, ptr %9, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #7
  store i16 17, ptr %10, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 2, ptr %11) #7
  store i16 0, ptr %11, align 2, !tbaa !9
  br label %80

80:                                               ; preds = %118, %79
  %81 = load i16, ptr %11, align 2, !tbaa !9
  %82 = sext i16 %81 to i32
  %83 = icmp sle i32 %82, 16
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %11) #7
  br label %121

85:                                               ; preds = %80
  %86 = load i16, ptr %11, align 2, !tbaa !9
  %87 = sext i16 %86 to i64
  %88 = getelementptr inbounds [17 x [186 x [186 x [186 x i16]]]], ptr @dp1, i64 0, i64 %87
  %89 = getelementptr inbounds [186 x [186 x [186 x i16]]], ptr %88, i64 0, i64 0
  %90 = load i16, ptr @H, align 2, !tbaa !9
  %91 = sext i16 %90 to i64
  %92 = getelementptr inbounds [186 x [186 x i16]], ptr %89, i64 0, i64 %91
  %93 = getelementptr inbounds [186 x i16], ptr %92, i64 0, i64 0
  %94 = load i16, ptr %93, align 4, !tbaa !9
  %95 = sext i16 %94 to i32
  %96 = load i16, ptr @W, align 2, !tbaa !9
  %97 = sext i16 %96 to i32
  %98 = icmp sge i32 %95, %97
  br i1 %98, label %99, label %101

99:                                               ; preds = %85
  %100 = load i16, ptr %11, align 2, !tbaa !9
  call void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2) %9, i16 noundef signext %100)
  br label %101

101:                                              ; preds = %99, %85
  %102 = load i16, ptr %11, align 2, !tbaa !9
  %103 = sext i16 %102 to i64
  %104 = getelementptr inbounds [17 x [186 x [186 x [186 x i16]]]], ptr @dp2, i64 0, i64 %103
  %105 = getelementptr inbounds [186 x [186 x [186 x i16]]], ptr %104, i64 0, i64 0
  %106 = load i16, ptr @W, align 2, !tbaa !9
  %107 = sext i16 %106 to i64
  %108 = getelementptr inbounds [186 x [186 x i16]], ptr %105, i64 0, i64 %107
  %109 = getelementptr inbounds [186 x i16], ptr %108, i64 0, i64 0
  %110 = load i16, ptr %109, align 4, !tbaa !9
  %111 = sext i16 %110 to i32
  %112 = load i16, ptr @H, align 2, !tbaa !9
  %113 = sext i16 %112 to i32
  %114 = icmp sge i32 %111, %113
  br i1 %114, label %115, label %117

115:                                              ; preds = %101
  %116 = load i16, ptr %11, align 2, !tbaa !9
  call void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2) %10, i16 noundef signext %116)
  br label %117

117:                                              ; preds = %115, %101
  br label %118

118:                                              ; preds = %117
  %119 = load i16, ptr %11, align 2, !tbaa !9
  %120 = add i16 %119, 1
  store i16 %120, ptr %11, align 2, !tbaa !9
  br label %80, !llvm.loop !18

121:                                              ; preds = %84
  %122 = load i16, ptr %9, align 2, !tbaa !9
  %123 = sext i16 %122 to i32
  %124 = icmp slt i32 %123, 17
  br i1 %124, label %125, label %126

125:                                              ; preds = %121
  br label %128

126:                                              ; preds = %121
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.3, i32 noundef 431, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

127:                                              ; No predecessors!
  br label %128

128:                                              ; preds = %127, %125
  %129 = load i16, ptr %10, align 2, !tbaa !9
  %130 = sext i16 %129 to i32
  %131 = icmp slt i32 %130, 17
  br i1 %131, label %132, label %133

132:                                              ; preds = %128
  br label %135

133:                                              ; preds = %128
  call void @__assert_fail(ptr noundef @.str.11, ptr noundef @.str.3, i32 noundef 432, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

134:                                              ; No predecessors!
  br label %135

135:                                              ; preds = %134, %132
  %136 = load i16, ptr %9, align 2, !tbaa !9
  %137 = sext i16 %136 to i32
  %138 = load i16, ptr %10, align 2, !tbaa !9
  %139 = sext i16 %138 to i32
  %140 = icmp eq i32 %137, %139
  br i1 %140, label %141, label %142

141:                                              ; preds = %135
  br label %144

142:                                              ; preds = %135
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.3, i32 noundef 433, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

143:                                              ; No predecessors!
  br label %144

144:                                              ; preds = %143, %141
  %145 = load i16, ptr %9, align 2, !tbaa !9
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEs(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i16 noundef signext %145)
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %146, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 2, ptr %9) #7
  %148 = load i32, ptr %1, align 4
  ret i32 %148

149:                                              ; preds = %67
  %150 = load ptr, ptr %5, align 8
  %151 = load i32, ptr %6, align 4
  %152 = insertvalue { ptr, i32 } poison, ptr %150, 0
  %153 = insertvalue { ptr, i32 } %152, i32 %151, 1
  resume { ptr, i32 } %153
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 2 dereferenceable(2)) #2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2), i16 noundef signext) #5

attributes #0 = { 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 #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "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 memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn 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 = !{!"short", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"_ZTS5Color", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"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] }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@dp1 = external dso_local local_unnamed_addr global [17 x [186 x [186 x [186 x i16]]]], align 16
@dp2 = external dso_local local_unnamed_addr global [17 x [186 x [186 x [186 x i16]]]], align 16
@H = external dso_local global i16, align 2
@W = external dso_local global i16, align 2
@A = external dso_local local_unnamed_addr global [186 x [186 x i16]], align 16
@.str.3 = external hidden unnamed_addr constant [80 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.10 = external hidden unnamed_addr constant [10 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [15 x i8], align 1

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEs(ptr noundef nonnull align 8 dereferenceable(8), i16 noundef signext) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10zero_setupv() local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8fill_dp1i(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z8fill_dp2i(i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #6 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca i16, align 2
  %3 = alloca i16, align 2
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 2 dereferenceable(2) @H)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 2 dereferenceable(2) @W)
  %6 = load i16, ptr @H, align 2, !tbaa !5
  %7 = icmp sgt i16 %6, 0
  br i1 %7, label %.lr.ph30, label %._crit_edge31

._crit_edge31:                                    ; preds = %._crit_edge, %0
  call void @_Z10zero_setupv()
  call void @_Z8fill_dp1i(i32 noundef 1)
  call void @_Z8fill_dp2i(i32 noundef 1)
  call void @_Z8fill_dp1i(i32 noundef 2)
  call void @_Z8fill_dp2i(i32 noundef 2)
  call void @_Z8fill_dp1i(i32 noundef 3)
  call void @_Z8fill_dp2i(i32 noundef 3)
  call void @_Z8fill_dp1i(i32 noundef 4)
  call void @_Z8fill_dp2i(i32 noundef 4)
  call void @_Z8fill_dp1i(i32 noundef 5)
  call void @_Z8fill_dp2i(i32 noundef 5)
  call void @_Z8fill_dp1i(i32 noundef 6)
  call void @_Z8fill_dp2i(i32 noundef 6)
  call void @_Z8fill_dp1i(i32 noundef 7)
  call void @_Z8fill_dp2i(i32 noundef 7)
  call void @_Z8fill_dp1i(i32 noundef 8)
  call void @_Z8fill_dp2i(i32 noundef 8)
  call void @_Z8fill_dp1i(i32 noundef 9)
  call void @_Z8fill_dp2i(i32 noundef 9)
  call void @_Z8fill_dp1i(i32 noundef 10)
  call void @_Z8fill_dp2i(i32 noundef 10)
  call void @_Z8fill_dp1i(i32 noundef 11)
  call void @_Z8fill_dp2i(i32 noundef 11)
  call void @_Z8fill_dp1i(i32 noundef 12)
  call void @_Z8fill_dp2i(i32 noundef 12)
  call void @_Z8fill_dp1i(i32 noundef 13)
  call void @_Z8fill_dp2i(i32 noundef 13)
  call void @_Z8fill_dp1i(i32 noundef 14)
  call void @_Z8fill_dp2i(i32 noundef 14)
  call void @_Z8fill_dp1i(i32 noundef 15)
  call void @_Z8fill_dp2i(i32 noundef 15)
  call void @_Z8fill_dp1i(i32 noundef 16)
  call void @_Z8fill_dp2i(i32 noundef 16)
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) #7
  store i16 17, ptr %2, align 2, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %3) #7
  store i16 17, ptr %3, align 2, !tbaa !5
  %.pre41 = load i16, ptr @H, align 2, !tbaa !5
  %.pre43 = load i16, ptr @W, align 2, !tbaa !5
  br label %26

.lr.ph30:                                         ; preds = %0, %._crit_edge
  %indvars.iv35 = phi i64 [ %indvars.iv.next36, %._crit_edge ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  %8 = 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) %1)
          to label %.preheader unwind label %14

.preheader:                                       ; preds = %.lr.ph30
  %9 = load i16, ptr @W, align 2, !tbaa !5
  %10 = icmp sgt i16 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  %indvars.iv.next36 = add nuw nsw i64 %indvars.iv35, 1
  %11 = load i16, ptr @H, align 2, !tbaa !5
  %12 = sext i16 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next36, %12
  br i1 %13, label %.lr.ph30, label %._crit_edge31, !llvm.loop !9

14:                                               ; preds = %.lr.ph30
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #7
  resume { ptr, i32 } %15

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %16 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv)
  %17 = load i8, ptr %16, align 1, !tbaa !11
  %18 = icmp eq i8 %17, 46
  %spec.select = select i1 %18, i16 2, i16 1
  %19 = getelementptr inbounds [186 x [186 x i16]], ptr @A, i64 0, i64 %indvars.iv35, i64 %indvars.iv
  store i16 %spec.select, ptr %19, align 2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i16, ptr @W, align 2, !tbaa !5
  %21 = sext i16 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !12

23:                                               ; preds = %44
  %24 = load i16, ptr %2, align 2, !tbaa !5
  %25 = icmp slt i16 %24, 17
  br i1 %25, label %48, label %47

26:                                               ; preds = %._crit_edge31, %44
  %27 = phi i16 [ %.pre41, %._crit_edge31 ], [ %45, %44 ]
  %28 = phi i16 [ %.pre43, %._crit_edge31 ], [ %46, %44 ]
  %indvars.iv38 = phi i64 [ 0, %._crit_edge31 ], [ %indvars.iv.next39, %44 ]
  %29 = getelementptr inbounds [17 x [186 x [186 x [186 x i16]]]], ptr @dp1, i64 0, i64 %indvars.iv38
  %30 = sext i16 %27 to i64
  %31 = getelementptr inbounds [186 x [186 x i16]], ptr %29, i64 0, i64 %30
  %32 = load i16, ptr %31, align 4, !tbaa !5
  %.not = icmp slt i16 %32, %28
  br i1 %.not, label %35, label %33

33:                                               ; preds = %26
  %34 = trunc nuw nsw i64 %indvars.iv38 to i16
  call void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2) %2, i16 noundef signext %34)
  %.pre44 = load i16, ptr @W, align 2, !tbaa !5
  %.pre45 = load i16, ptr @H, align 2, !tbaa !5
  br label %35

35:                                               ; preds = %33, %26
  %36 = phi i16 [ %.pre45, %33 ], [ %27, %26 ]
  %37 = phi i16 [ %.pre44, %33 ], [ %28, %26 ]
  %38 = getelementptr inbounds [17 x [186 x [186 x [186 x i16]]]], ptr @dp2, i64 0, i64 %indvars.iv38
  %39 = sext i16 %37 to i64
  %40 = getelementptr inbounds [186 x [186 x i16]], ptr %38, i64 0, i64 %39
  %41 = load i16, ptr %40, align 4, !tbaa !5
  %.not26 = icmp slt i16 %41, %36
  br i1 %.not26, label %44, label %42

42:                                               ; preds = %35
  %43 = trunc nuw nsw i64 %indvars.iv38 to i16
  call void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2) %3, i16 noundef signext %43)
  %.pre = load i16, ptr @H, align 2, !tbaa !5
  %.pre42 = load i16, ptr @W, align 2, !tbaa !5
  br label %44

44:                                               ; preds = %35, %42
  %45 = phi i16 [ %36, %35 ], [ %.pre, %42 ]
  %46 = phi i16 [ %37, %35 ], [ %.pre42, %42 ]
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next39, 17
  br i1 %exitcond.not, label %23, label %26, !llvm.loop !13

47:                                               ; preds = %23
  call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.3, i32 noundef 431, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

48:                                               ; preds = %23
  %49 = load i16, ptr %3, align 2, !tbaa !5
  %50 = icmp slt i16 %49, 17
  br i1 %50, label %52, label %51

51:                                               ; preds = %48
  call void @__assert_fail(ptr noundef nonnull @.str.11, ptr noundef nonnull @.str.3, i32 noundef 432, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

52:                                               ; preds = %48
  %53 = icmp eq i16 %24, %49
  br i1 %53, label %55, label %54

54:                                               ; preds = %52
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.3, i32 noundef 433, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

55:                                               ; preds = %52
  %56 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEs(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i16 noundef signext %24)
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %56, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) #7
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERs(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 2 dereferenceable(2)) local_unnamed_addr #2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6ch_minIsEvRT_S0_(ptr noundef nonnull align 2 dereferenceable(2), i16 noundef signext) local_unnamed_addr #5

attributes #0 = { 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 #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind "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 memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { 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 #7 = { nounwind }
attributes #8 = { noreturn 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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass,TailCallElimPass