; LLVM IR from ahr9n/psolving-paradigms :: 2.greedy (UVa 11520 - Fill the Square)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@arr = external dso_local global [15 x [15 x i8]], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @_Z7quickenv()
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @t)
  br label %10

10:                                               ; preds = %109, %0
  %11 = load i32, ptr @t, align 4, !tbaa !5
  %12 = add nsw i32 %11, -1
  store i32 %12, ptr @t, align 4, !tbaa !5
  %13 = icmp ne i32 %11, 0
  br i1 %13, label %14, label %110

14:                                               ; preds = %10
  %15 = 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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %40, %14
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = add nsw i32 %18, 2
  %20 = icmp slt i32 %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %43

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

23:                                               ; preds = %36, %22
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = add nsw i32 %25, 2
  %27 = icmp slt i32 %24, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %23
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [15 x [15 x i8]], ptr @arr, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [15 x i8], ptr %32, i64 0, i64 %34
  store i8 46, ptr %35, align 1, !tbaa !9
  br label %36

36:                                               ; preds = %29
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %4, align 4, !tbaa !5
  br label %23, !llvm.loop !10

39:                                               ; preds = %28
  br label %40

40:                                               ; preds = %39
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !12

43:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %69, %43
  %45 = load i32, ptr %5, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  %48 = icmp slt i32 %45, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %65, %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  %55 = icmp slt i32 %52, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %51
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [15 x [15 x i8]], ptr @arr, i64 0, i64 %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [15 x i8], ptr %60, i64 0, i64 %62
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %63)
  br label %65

65:                                               ; preds = %57
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %6, align 4, !tbaa !5
  br label %51, !llvm.loop !13

68:                                               ; preds = %56
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %5, align 4, !tbaa !5
  br label %44, !llvm.loop !14

72:                                               ; preds = %49
  call void @_Z8fillGridv()
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %74 = load i32, ptr @k, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr @k, align 4, !tbaa !5
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %73, i32 noundef %75)
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %76, i8 noundef signext 58)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %77, i8 noundef signext 10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %106, %72
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = load i32, ptr @n, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %85, label %84

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

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

86:                                               ; preds = %101, %85
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  %90 = icmp slt i32 %87, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %86
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %104

92:                                               ; preds = %86
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [15 x [15 x i8]], ptr @arr, i64 0, i64 %94
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [15 x i8], ptr %95, i64 0, i64 %97
  %99 = load i8, ptr %98, align 1, !tbaa !9
  %100 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %99)
  br label %101

101:                                              ; preds = %92
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %86, !llvm.loop !15

104:                                              ; preds = %91
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  br label %106

106:                                              ; preds = %104
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %7, align 4, !tbaa !5
  br label %79, !llvm.loop !16

109:                                              ; preds = %84
  br label %10, !llvm.loop !17

110:                                              ; preds = %10
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #3

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

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

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

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

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

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


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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@k = external dso_local local_unnamed_addr global i32, align 4
@arr = external dso_local global [15 x [15 x i8]], align 16
@.str = external hidden unnamed_addr constant [6 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  tail call void @_Z7quickenv()
  %1 = 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) @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not43 = icmp eq i32 %2, 0
  br i1 %.not43, label %._crit_edge46, label %.lr.ph45

.loopexit:                                        ; preds = %._crit_edge40, %._crit_edge36
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge46, label %.lr.ph45, !llvm.loop !9

.lr.ph45:                                         ; preds = %0, %.loopexit
  %6 = 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)
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, -2
  br i1 %8, label %.preheader28.us.preheader, label %._crit_edge36

.preheader28.us.preheader:                        ; preds = %.lr.ph45
  %9 = add i32 %7, 2
  %smax = tail call i32 @llvm.smax.i32(i32 %9, i32 1)
  %10 = zext nneg i32 %smax to i64
  %xtraiter = and i64 %10, 7
  %11 = icmp slt i32 %9, 8
  br i1 %11, label %.preheader29.unr-lcssa, label %.preheader28.us.preheader.new

.preheader28.us.preheader.new:                    ; preds = %.preheader28.us.preheader
  %unroll_iter = and i64 %10, 2147483640
  br label %.preheader28.us

.preheader28.us:                                  ; preds = %.preheader28.us, %.preheader28.us.preheader.new
  %indvar = phi i64 [ 0, %.preheader28.us.preheader.new ], [ %indvar.next.7, %.preheader28.us ]
  %niter = phi i64 [ 0, %.preheader28.us.preheader.new ], [ %niter.next.7, %.preheader28.us ]
  %12 = mul nuw nsw i64 %indvar, 15
  %scevgep = getelementptr i8, ptr @arr, i64 %12
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(1) %scevgep, i8 46, i64 %10, i1 false), !tbaa !11
  %13 = mul nuw i64 %indvar, 15
  %gep = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 15), i64 %13
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %gep, i8 46, i64 %10, i1 false), !tbaa !11
  %14 = mul nuw i64 %indvar, 15
  %gep65 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 30), i64 %14
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(1) %gep65, i8 46, i64 %10, i1 false), !tbaa !11
  %15 = mul nuw i64 %indvar, 15
  %gep66 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 45), i64 %15
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %gep66, i8 46, i64 %10, i1 false), !tbaa !11
  %16 = mul nuw i64 %indvar, 15
  %gep67 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 60), i64 %16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %gep67, i8 46, i64 %10, i1 false), !tbaa !11
  %17 = mul nuw i64 %indvar, 15
  %gep68 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 75), i64 %17
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %gep68, i8 46, i64 %10, i1 false), !tbaa !11
  %18 = mul nuw i64 %indvar, 15
  %gep69 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 90), i64 %18
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(1) %gep69, i8 46, i64 %10, i1 false), !tbaa !11
  %19 = mul nuw i64 %indvar, 15
  %gep70 = getelementptr i8, ptr getelementptr (i8, ptr @arr, i64 105), i64 %19
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %gep70, i8 46, i64 %10, i1 false), !tbaa !11
  %indvar.next.7 = add nuw nsw i64 %indvar, 8
  %niter.next.7 = add i64 %niter, 8
  %niter.ncmp.7 = icmp eq i64 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %.preheader29.unr-lcssa, label %.preheader28.us, !llvm.loop !12

.preheader29.unr-lcssa:                           ; preds = %.preheader28.us, %.preheader28.us.preheader
  %indvar.unr = phi i64 [ 0, %.preheader28.us.preheader ], [ %indvar.next.7, %.preheader28.us ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader29, label %.preheader28.us.epil

.preheader28.us.epil:                             ; preds = %.preheader29.unr-lcssa, %.preheader28.us.epil
  %indvar.epil = phi i64 [ %indvar.next.epil, %.preheader28.us.epil ], [ %indvar.unr, %.preheader29.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader28.us.epil ], [ 0, %.preheader29.unr-lcssa ]
  %20 = mul nuw nsw i64 %indvar.epil, 15
  %scevgep.epil = getelementptr i8, ptr @arr, i64 %20
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(1) %scevgep.epil, i8 46, i64 %10, i1 false), !tbaa !11
  %indvar.next.epil = add nuw nsw i64 %indvar.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader29, label %.preheader28.us.epil, !llvm.loop !13

.preheader29:                                     ; preds = %.preheader28.us.epil, %.preheader29.unr-lcssa
  %.not2334 = icmp slt i32 %7, 1
  br i1 %.not2334, label %._crit_edge36, label %.preheader27

.preheader27:                                     ; preds = %.preheader29, %._crit_edge
  %21 = phi i32 [ %29, %._crit_edge ], [ %7, %.preheader29 ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %._crit_edge ], [ 1, %.preheader29 ]
  %.not2632 = icmp slt i32 %21, 1
  br i1 %.not2632, label %.preheader27.._crit_edge_crit_edge, label %.lr.ph

.preheader27.._crit_edge_crit_edge:               ; preds = %.preheader27
  %.pre = sext i32 %21 to i64
  br label %._crit_edge

._crit_edge36:                                    ; preds = %._crit_edge, %.lr.ph45, %.preheader29
  tail call void @_Z8fillGridv()
  %22 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %23 = load i32, ptr @k, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @k, align 4, !tbaa !5
  %25 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %22, i32 noundef %24)
  %26 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %25, i8 noundef signext 58)
  %27 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %26, i8 noundef signext 10)
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %.not2441 = icmp slt i32 %28, 1
  br i1 %.not2441, label %.loopexit, label %.preheader

._crit_edge:                                      ; preds = %.lr.ph, %.preheader27.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader27.._crit_edge_crit_edge ], [ %33, %.lr.ph ]
  %29 = phi i32 [ %21, %.preheader27.._crit_edge_crit_edge ], [ %32, %.lr.ph ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %.not23.not = icmp slt i64 %indvars.iv51, %.pre-phi
  br i1 %.not23.not, label %.preheader27, label %._crit_edge36, !llvm.loop !15

.lr.ph:                                           ; preds = %.preheader27, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader27 ]
  %30 = getelementptr inbounds [15 x [15 x i8]], ptr @arr, i64 0, i64 %indvars.iv51, i64 %indvars.iv
  %31 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 1 dereferenceable(1) %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %.not26.not = icmp slt i64 %indvars.iv, %33
  br i1 %.not26.not, label %.lr.ph, label %._crit_edge, !llvm.loop !17

.preheader:                                       ; preds = %._crit_edge36, %._crit_edge40
  %34 = phi i32 [ %36, %._crit_edge40 ], [ %28, %._crit_edge36 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge40 ], [ 1, %._crit_edge36 ]
  %.not2537 = icmp slt i32 %34, 1
  br i1 %.not2537, label %._crit_edge40, label %.lr.ph39

._crit_edge40:                                    ; preds = %.lr.ph39, %.preheader
  %35 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %.not24.not = icmp slt i64 %indvars.iv57, %37
  br i1 %.not24.not, label %.preheader, label %.loopexit, !llvm.loop !18

.lr.ph39:                                         ; preds = %.preheader, %.lr.ph39
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.lr.ph39 ], [ 1, %.preheader ]
  %38 = getelementptr inbounds [15 x [15 x i8]], ptr @arr, i64 0, i64 %indvars.iv57, i64 %indvars.iv54
  %39 = load i8, ptr %38, align 1, !tbaa !11
  %40 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %39)
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %.not25.not = icmp slt i64 %indvars.iv54, %42
  br i1 %.not25.not, label %.lr.ph39, label %._crit_edge40, !llvm.loop !19

._crit_edge46:                                    ; preds = %.loopexit, %0
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { 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 #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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !10, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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