; LLVM IR from kazunetakahashi/atcoder :: 2017/0318_ARC070 (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_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
@K = external dso_local global i32, align 4
@a = external dso_local global [410 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = 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 [410 x i8], align 16
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = 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)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %26, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @N, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %23
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %24)
  br label %26

26:                                               ; preds = %21
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !9

29:                                               ; preds = %20
  %30 = load i32, ptr @N, align 4, !tbaa !5
  %31 = icmp sle i32 %30, 400
  br i1 %31, label %32, label %35

32:                                               ; preds = %29
  %33 = load i32, ptr @K, align 4, !tbaa !5
  %34 = icmp sle i32 %33, 400
  br label %35

35:                                               ; preds = %32, %29
  %36 = phi i1 [ false, %29 ], [ %34, %32 ]
  br i1 %36, label %37, label %38

37:                                               ; preds = %35
  br label %40

38:                                               ; preds = %35
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 42, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

39:                                               ; No predecessors!
  br label %40

40:                                               ; preds = %39, %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %133, %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = load i32, ptr @N, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %46, label %45

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

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #7
  store i8 0, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 410, ptr %7) #7
  %47 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 0
  %48 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 0
  %49 = getelementptr inbounds i8, ptr %48, i64 410
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 0, ptr %8, align 1, !tbaa !11
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef %47, ptr noundef %49, ptr noundef nonnull align 1 dereferenceable(1) %8)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  %50 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 0
  store i8 1, ptr %50, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %97, %46
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = load i32, ptr @N, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %51
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = icmp eq i32 %57, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  br label %97

61:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %62 = load i32, ptr @K, align 4, !tbaa !5
  %63 = sub nsw i32 %62, 1
  store i32 %63, ptr %10, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %93, %61
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = icmp sge i32 %65, 0
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %64
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !11, !range !13, !noundef !14
  %73 = trunc i8 %72 to i1
  br i1 %73, label %74, label %92

74:                                               ; preds = %68
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %75, %79
  %81 = load i32, ptr @K, align 4, !tbaa !5
  %82 = icmp slt i32 %80, %81
  br i1 %82, label %83, label %92

83:                                               ; preds = %74
  %84 = load i32, ptr %10, align 4, !tbaa !5
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i32 %84, %88
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 %90
  store i8 1, ptr %91, align 1, !tbaa !11
  br label %92

92:                                               ; preds = %83, %74, %68
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %10, align 4, !tbaa !5
  br label %64, !llvm.loop !15

96:                                               ; preds = %67
  br label %97

97:                                               ; preds = %96, %60
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %9, align 4, !tbaa !5
  br label %51, !llvm.loop !16

100:                                              ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %101 = load i32, ptr @K, align 4, !tbaa !5
  %102 = load i32, ptr %4, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %101, %105
  store i32 %106, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %108 = load i32, ptr %107, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  store i32 %108, ptr %11, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %122, %100
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = load i32, ptr @K, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %114, label %113

113:                                              ; preds = %109
  store i32 14, ptr %5, align 4
  br label %125

114:                                              ; preds = %109
  %115 = load i32, ptr %11, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [410 x i8], ptr %7, i64 0, i64 %116
  %118 = load i8, ptr %117, align 1, !tbaa !11, !range !13, !noundef !14
  %119 = trunc i8 %118 to i1
  br i1 %119, label %120, label %121

120:                                              ; preds = %114
  store i8 1, ptr %6, align 1, !tbaa !11
  store i32 14, ptr %5, align 4
  br label %125

121:                                              ; preds = %114
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %11, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %11, align 4, !tbaa !5
  br label %109, !llvm.loop !17

125:                                              ; preds = %120, %113
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %126

126:                                              ; preds = %125
  %127 = load i8, ptr %6, align 1, !tbaa !11, !range !13, !noundef !14
  %128 = trunc i8 %127 to i1
  br i1 %128, label %129, label %132

129:                                              ; preds = %126
  %130 = load i32, ptr %3, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %3, align 4, !tbaa !5
  br label %132

132:                                              ; preds = %129, %126
  call void @llvm.lifetime.end.p0(i64 410, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #7
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %4, align 4, !tbaa !5
  br label %41, !llvm.loop !18

136:                                              ; preds = %45
  %137 = load i32, ptr @N, align 4, !tbaa !5
  %138 = load i32, ptr %3, align 4, !tbaa !5
  %139 = sub nsw i32 %137, %138
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %139)
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %140, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  %142 = load i32, ptr %1, align 4
  ret i32 %142
}

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 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)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = 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}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@a = external dso_local global [410 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [21 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [80 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = 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 [410 x i8], align 16
  %2 = alloca i8, align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = 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)
  %6 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) @K)
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %9 = phi i32 [ %7, %0 ], [ %18, %.lr.ph ]
  %10 = icmp slt i32 %9, 401
  %11 = load i32, ptr @K, align 4
  %12 = icmp slt i32 %11, 401
  %13 = select i1 %10, i1 %12, i1 false
  br i1 %13, label %.preheader, label %21

.preheader:                                       ; preds = %._crit_edge
  %14 = icmp sgt i32 %9, 0
  br i1 %14, label %.lr.ph55, label %._crit_edge56

.lr.ph55:                                         ; preds = %.preheader
  %15 = getelementptr inbounds i8, ptr %1, i64 410
  br label %25

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %16 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %indvars.iv
  %17 = 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) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @N, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !9

21:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 42, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #7
  unreachable

._crit_edge56:                                    ; preds = %._crit_edge48, %.preheader
  %.028.lcssa = phi i32 [ 0, %.preheader ], [ %spec.select, %._crit_edge48 ]
  %.lcssa33 = phi i32 [ %9, %.preheader ], [ %81, %._crit_edge48 ]
  %22 = sub nsw i32 %.lcssa33, %.028.lcssa
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %22)
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

25:                                               ; preds = %.lr.ph55, %._crit_edge48
  %indvars.iv73 = phi i64 [ 0, %.lr.ph55 ], [ %indvars.iv.next74, %._crit_edge48 ]
  %.02852 = phi i32 [ 0, %.lr.ph55 ], [ %spec.select, %._crit_edge48 ]
  call void @llvm.lifetime.start.p0(i64 410, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #8
  store i8 0, ptr %2, align 1, !tbaa !11
  call void @_ZSt4fillIPbbEvT_S1_RKT0_(ptr noundef nonnull %1, ptr noundef nonnull %15, ptr noundef nonnull align 1 dereferenceable(1) %2)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #8
  store i8 1, ptr %1, align 16, !tbaa !11
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = icmp sgt i32 %26, 0
  %.pre = load i32, ptr @K, align 4
  %.fr59 = freeze i32 %.pre
  %28 = icmp sgt i32 %.fr59, 0
  %or.cond = and i1 %27, %28
  br i1 %or.cond, label %.lr.ph43.split.us.preheader, label %._crit_edge44

.lr.ph43.split.us.preheader:                      ; preds = %25
  %29 = zext nneg i32 %.fr59 to i64
  %wide.trip.count = zext nneg i32 %26 to i64
  %30 = zext nneg i32 %.fr59 to i64
  %xtraiter = and i64 %29, 1
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  %indvars.iv.next65.prol = add nsw i64 %29, -1
  %31 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %indvars.iv.next65.prol
  %32 = icmp eq i32 %.fr59, 1
  br label %.lr.ph43.split.us

.lr.ph43.split.us:                                ; preds = %.lr.ph43.split.us.preheader, %..loopexit_crit_edge.us
  %indvars.iv67 = phi i64 [ 0, %.lr.ph43.split.us.preheader ], [ %indvars.iv.next68, %..loopexit_crit_edge.us ]
  %33 = icmp eq i64 %indvars.iv73, %indvars.iv67
  br i1 %33, label %..loopexit_crit_edge.us, label %.lr.ph39.us

.lr.ph39.us:                                      ; preds = %.lr.ph43.split.us
  %34 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %indvars.iv67
  br i1 %lcmp.mod.not, label %.prol.loopexit, label %.prol.preheader

.prol.preheader:                                  ; preds = %.lr.ph39.us
  %35 = load i8, ptr %31, align 1, !tbaa !11, !range !13, !noundef !14
  %36 = trunc nuw i8 %35 to i1
  br i1 %36, label %37, label %.prol.loopexit

37:                                               ; preds = %.prol.preheader
  %38 = load i32, ptr %34, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = add nsw i64 %indvars.iv.next65.prol, %39
  %.wide.prol = icmp slt i64 %40, %30
  br i1 %.wide.prol, label %41, label %.prol.loopexit

41:                                               ; preds = %37
  %42 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %40
  store i8 1, ptr %42, align 1, !tbaa !11
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.preheader, %37, %41, %.lr.ph39.us
  %indvars.iv64.unr = phi i64 [ %29, %.lr.ph39.us ], [ %indvars.iv.next65.prol, %41 ], [ %indvars.iv.next65.prol, %37 ], [ %indvars.iv.next65.prol, %.prol.preheader ]
  br i1 %32, label %..loopexit_crit_edge.us, label %.lr.ph39.us.new

.lr.ph39.us.new:                                  ; preds = %.prol.loopexit, %62
  %indvars.iv64 = phi i64 [ %indvars.iv.next65.1, %62 ], [ %indvars.iv64.unr, %.prol.loopexit ]
  %indvars.iv.next65 = add nsw i64 %indvars.iv64, -1
  %43 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %indvars.iv.next65
  %44 = load i8, ptr %43, align 1, !tbaa !11, !range !13, !noundef !14
  %45 = trunc nuw i8 %44 to i1
  br i1 %45, label %46, label %52

46:                                               ; preds = %.lr.ph39.us.new
  %47 = load i32, ptr %34, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = add nsw i64 %indvars.iv.next65, %48
  %.wide = icmp slt i64 %49, %30
  br i1 %.wide, label %50, label %52

50:                                               ; preds = %46
  %51 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %49
  store i8 1, ptr %51, align 1, !tbaa !11
  br label %52

52:                                               ; preds = %50, %46, %.lr.ph39.us.new
  %indvars.iv.next65.1 = add nsw i64 %indvars.iv64, -2
  %53 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %indvars.iv.next65.1
  %54 = load i8, ptr %53, align 1, !tbaa !11, !range !13, !noundef !14
  %55 = trunc nuw i8 %54 to i1
  br i1 %55, label %56, label %62

56:                                               ; preds = %52
  %57 = load i32, ptr %34, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = add nsw i64 %indvars.iv.next65.1, %58
  %.wide.1 = icmp slt i64 %59, %30
  br i1 %.wide.1, label %60, label %62

60:                                               ; preds = %56
  %61 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %59
  store i8 1, ptr %61, align 1, !tbaa !11
  br label %62

62:                                               ; preds = %60, %56, %52
  %63 = icmp sgt i64 %indvars.iv64, 2
  br i1 %63, label %.lr.ph39.us.new, label %..loopexit_crit_edge.us, !llvm.loop !15

..loopexit_crit_edge.us:                          ; preds = %.prol.loopexit, %62, %.lr.ph43.split.us
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge44, label %.lr.ph43.split.us, !llvm.loop !16

._crit_edge44:                                    ; preds = %..loopexit_crit_edge.us, %25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %64 = getelementptr inbounds [410 x i32], ptr @a, i64 0, i64 %indvars.iv73
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub nsw i32 %.fr59, %65
  store i32 %66, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %68 = load i32, ptr %67, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %69 = load i32, ptr @K, align 4, !tbaa !5
  %70 = icmp slt i32 %68, %69
  br i1 %70, label %.lr.ph47.preheader, label %._crit_edge48

.lr.ph47.preheader:                               ; preds = %._crit_edge44
  %71 = sext i32 %68 to i64
  %72 = sext i32 %69 to i64
  %73 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %71
  %74 = load i8, ptr %73, align 1, !tbaa !11, !range !13, !noundef !14
  %75 = trunc nuw i8 %74 to i1
  br i1 %75, label %._crit_edge48, label %.lr.ph81

.lr.ph81:                                         ; preds = %.lr.ph47.preheader, %.lr.ph47
  %indvars.iv7080 = phi i64 [ %indvars.iv.next71, %.lr.ph47 ], [ %71, %.lr.ph47.preheader ]
  %indvars.iv.next71 = add nsw i64 %indvars.iv7080, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next71 to i32
  %exitcond72.not = icmp eq i32 %69, %lftr.wideiv
  br i1 %exitcond72.not, label %._crit_edge48.loopexit, label %.lr.ph47, !llvm.loop !17

.lr.ph47:                                         ; preds = %.lr.ph81
  %76 = getelementptr inbounds [410 x i8], ptr %1, i64 0, i64 %indvars.iv.next71
  %77 = load i8, ptr %76, align 1, !tbaa !11, !range !13, !noundef !14
  %78 = trunc nuw i8 %77 to i1
  br i1 %78, label %._crit_edge48.loopexit, label %.lr.ph81, !llvm.loop !17

._crit_edge48.loopexit:                           ; preds = %.lr.ph81, %.lr.ph47
  %79 = icmp slt i64 %indvars.iv.next71, %72
  br label %._crit_edge48

._crit_edge48:                                    ; preds = %._crit_edge48.loopexit, %.lr.ph47.preheader, %._crit_edge44
  %.lcssa = phi i1 [ false, %._crit_edge44 ], [ true, %.lr.ph47.preheader ], [ %79, %._crit_edge48.loopexit ]
  %80 = zext i1 %.lcssa to i32
  %spec.select = add nuw nsw i32 %.02852, %80
  call void @llvm.lifetime.end.p0(i64 410, ptr nonnull %1) #8
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %81 = load i32, ptr @N, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = icmp slt i64 %indvars.iv.next74, %82
  br i1 %83, label %25, label %._crit_edge56, !llvm.loop !18
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 #6 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)) #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { noreturn nounwind }
attributes #8 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !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}


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