; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2018-19/Dec 2018/Silver (mooyomooyo)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@gr = external dso_local global [10 x [100 x i8]], align 16
@done = external dso_local global i8, align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef) #0

declare i32 @__gxx_personality_v0(...)

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

; 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: mustprogress uwtable
declare dso_local void @_Z3simv() #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::__cxx11::basic_string", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %2, ptr noundef @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %13 unwind label %19

13:                                               ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef %2)
          to label %14 unwind label %23

14:                                               ; preds = %13
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @K)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %44, %14
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 10
  br i1 %17, label %28, label %18

18:                                               ; preds = %15
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %47

19:                                               ; preds = %0
  %20 = landingpad { ptr, i32 }
          cleanup
  %21 = extractvalue { ptr, i32 } %20, 0
  store ptr %21, ptr %4, align 8
  %22 = extractvalue { ptr, i32 } %20, 1
  store i32 %22, ptr %5, align 4
  br label %27

23:                                               ; preds = %13
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %4, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %5, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %2) #5
  br label %27

27:                                               ; preds = %23, %19
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  br label %110

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

29:                                               ; preds = %40, %28
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = icmp slt i32 %30, 100
  br i1 %31, label %33, label %32

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

33:                                               ; preds = %29
  %34 = load i32, ptr %6, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 %35
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100 x i8], ptr %36, i64 0, i64 %38
  store i8 48, ptr %39, align 1, !tbaa !9
  br label %40

40:                                               ; preds = %33
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %8, align 4, !tbaa !5
  br label %29, !llvm.loop !10

43:                                               ; preds = %32
  br label %44

44:                                               ; preds = %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %6, align 4, !tbaa !5
  br label %15, !llvm.loop !12

47:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %48 = load i32, ptr @N, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 1
  store i32 %49, ptr %9, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %70, %47
  %51 = load i32, ptr %9, align 4, !tbaa !5
  %52 = icmp sge i32 %51, 0
  br i1 %52, label %54, label %53

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

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

55:                                               ; preds = %66, %54
  %56 = load i32, ptr %10, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 10
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %55
  %60 = load i32, ptr %10, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 %61
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100 x i8], ptr %62, i64 0, i64 %64
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %65)
  br label %66

66:                                               ; preds = %59
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %10, align 4, !tbaa !5
  br label %55, !llvm.loop !13

69:                                               ; preds = %58
  br label %70

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

73:                                               ; preds = %53
  br label %74

74:                                               ; preds = %78, %73
  %75 = load i8, ptr @done, align 1, !tbaa !15, !range !17, !noundef !18
  %76 = trunc i8 %75 to i1
  %77 = xor i1 %76, true
  br i1 %77, label %78, label %79

78:                                               ; preds = %74
  call void @_Z3simv()
  br label %74, !llvm.loop !19

79:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %80 = load i32, ptr @N, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  store i32 %81, ptr %11, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %105, %79
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = icmp sge i32 %83, 0
  br i1 %84, label %86, label %85

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

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

87:                                               ; preds = %100, %86
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = icmp slt i32 %88, 10
  br i1 %89, label %91, label %90

90:                                               ; preds = %87
  store i32 19, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %103

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

100:                                              ; preds = %91
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %12, align 4, !tbaa !5
  br label %87, !llvm.loop !20

103:                                              ; preds = %90
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.6)
  br label %105

105:                                              ; preds = %103
  %106 = load i32, ptr %11, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %11, align 4, !tbaa !5
  br label %82, !llvm.loop !21

108:                                              ; preds = %85
  %109 = load i32, ptr %1, align 4
  ret i32 %109

110:                                              ; preds = %27
  %111 = load ptr, ptr %4, align 8
  %112 = load i32, ptr %5, align 4
  %113 = insertvalue { ptr, i32 } poison, ptr %111, 0
  %114 = insertvalue { ptr, i32 } %113, i32 %112, 1
  resume { ptr, i32 } %114
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1)) #0

; 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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}
!21 = distinct !{!21, !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_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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@N = external dso_local global i32, align 4
@K = external dso_local global i32, align 4
@gr = external dso_local global [10 x [100 x i8]], align 16
@done = external dso_local local_unnamed_addr global i8, align 1
@.str.5 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::__cxx11::basic_string", align 8
  %2 = alloca %"class.std::allocator", align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %1, ptr noundef nonnull @.str.5, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %3 unwind label %8

3:                                                ; preds = %0
  invoke void @_ZN2io5setIOENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull %1)
          to label %4 unwind label %10

4:                                                ; preds = %3
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  call void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4) @N, ptr noundef nonnull align 4 dereferenceable(4) @K)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) @gr, i8 48, i64 1000, i1 false), !tbaa !5
  %5 = load i32, ptr @N, align 4, !tbaa !8
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.preheader29.preheader, label %.preheader28

.preheader29.preheader:                           ; preds = %4
  %7 = zext nneg i32 %5 to i64
  br label %.preheader29

8:                                                ; preds = %0
  %9 = landingpad { ptr, i32 }
          cleanup
  br label %12

10:                                               ; preds = %3
  %11 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %1) #6
  br label %12

12:                                               ; preds = %10, %8
  %.pn = phi { ptr, i32 } [ %11, %10 ], [ %9, %8 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #6
  resume { ptr, i32 } %.pn

.preheader29:                                     ; preds = %.preheader29.preheader, %.preheader29
  %indvars.iv = phi i64 [ %7, %.preheader29.preheader ], [ %indvars.iv.next, %.preheader29 ]
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %13 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 0, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %13)
  %14 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 1, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %14)
  %15 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 2, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %15)
  %16 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 3, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %16)
  %17 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 4, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %17)
  %18 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 5, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %18)
  %19 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 6, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %19)
  %20 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 7, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %20)
  %21 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 8, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %21)
  %22 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 9, i64 %indvars.iv.next
  call void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %22)
  %23 = icmp ugt i64 %indvars.iv, 1
  br i1 %23, label %.preheader29, label %.preheader28, !llvm.loop !10

.preheader28:                                     ; preds = %.preheader29, %4
  %24 = load i8, ptr @done, align 1, !tbaa !12, !range !14, !noundef !15
  %25 = trunc nuw i8 %24 to i1
  br i1 %25, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader28, %.lr.ph
  call void @_Z3simv()
  %26 = load i8, ptr @done, align 1, !tbaa !12, !range !14, !noundef !15
  %27 = trunc nuw i8 %26 to i1
  br i1 %27, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph, %.preheader28
  %28 = load i32, ptr @N, align 4, !tbaa !8
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.preheader.preheader, label %._crit_edge39

.preheader.preheader:                             ; preds = %._crit_edge
  %30 = zext nneg i32 %28 to i64
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv47 = phi i64 [ %30, %.preheader.preheader ], [ %indvars.iv.next48, %.preheader ]
  %indvars.iv.next48 = add nsw i64 %indvars.iv47, -1
  %31 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 0, i64 %indvars.iv.next48
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %33 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %32)
  %34 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 1, i64 %indvars.iv.next48
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %35)
  %37 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 2, i64 %indvars.iv.next48
  %38 = load i8, ptr %37, align 1, !tbaa !5
  %39 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %38)
  %40 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 3, i64 %indvars.iv.next48
  %41 = load i8, ptr %40, align 1, !tbaa !5
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %41)
  %43 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 4, i64 %indvars.iv.next48
  %44 = load i8, ptr %43, align 1, !tbaa !5
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %44)
  %46 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 5, i64 %indvars.iv.next48
  %47 = load i8, ptr %46, align 1, !tbaa !5
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %47)
  %49 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 6, i64 %indvars.iv.next48
  %50 = load i8, ptr %49, align 1, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %50)
  %52 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 7, i64 %indvars.iv.next48
  %53 = load i8, ptr %52, align 1, !tbaa !5
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %53)
  %55 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 8, i64 %indvars.iv.next48
  %56 = load i8, ptr %55, align 1, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %56)
  %58 = getelementptr inbounds [10 x [100 x i8]], ptr @gr, i64 0, i64 9, i64 %indvars.iv.next48
  %59 = load i8, ptr %58, align 1, !tbaa !5
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext %59)
  %61 = 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.6)
  %62 = icmp ugt i64 %indvars.iv47, 1
  br i1 %62, label %.preheader, label %._crit_edge39, !llvm.loop !17

._crit_edge39:                                    ; preds = %.preheader, %._crit_edge
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIiJiEEEvRT_DpRT0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN2io2reIcEEvRT_(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; 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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass