; LLVM IR from AdarshGaur/Competitive-Programming :: Codechef/Starters 61/Red Blue Flowers.ll (Z5solvev)

; 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
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i64, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #7
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %15 = load i64, ptr %1, align 8, !tbaa !5
  %16 = call ptr @llvm.stacksave.p0()
  store ptr %16, ptr %2, align 8
  %17 = alloca i64, i64 %15, align 16
  store i64 %15, ptr %3, align 8
  %18 = load i64, ptr %1, align 8, !tbaa !5
  %19 = alloca i64, i64 %18, align 16
  store i64 %18, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %20

20:                                               ; preds = %29, %0
  %21 = load i64, ptr %5, align 8, !tbaa !5
  %22 = load i64, ptr %1, align 8, !tbaa !5
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %32

25:                                               ; preds = %20
  %26 = load i64, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds i64, ptr %17, i64 %26
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %27)
  br label %29

29:                                               ; preds = %25
  %30 = load i64, ptr %5, align 8, !tbaa !5
  %31 = add nsw i64 %30, 1
  store i64 %31, ptr %5, align 8, !tbaa !5
  br label %20, !llvm.loop !9

32:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %42, %32
  %34 = load i64, ptr %6, align 8, !tbaa !5
  %35 = load i64, ptr %1, align 8, !tbaa !5
  %36 = icmp slt i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %45

38:                                               ; preds = %33
  %39 = load i64, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds i64, ptr %19, i64 %39
  %41 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %40)
  br label %42

42:                                               ; preds = %38
  %43 = load i64, ptr %6, align 8, !tbaa !5
  %44 = add nsw i64 %43, 1
  store i64 %44, ptr %6, align 8, !tbaa !5
  br label %33, !llvm.loop !11

45:                                               ; preds = %37
  %46 = load i64, ptr %1, align 8, !tbaa !5
  %47 = alloca [20007 x i64], i64 %46, align 16
  store i64 %46, ptr %7, align 8
  %48 = mul nuw i64 160056, %46
  call void @llvm.memset.p0.i64(ptr align 16 %47, i8 -1, i64 %48, i1 false)
  %49 = getelementptr inbounds i64, ptr %19, i64 0
  %50 = load i64, ptr %49, align 16, !tbaa !5
  %51 = getelementptr inbounds [20007 x i64], ptr %47, i64 0
  %52 = getelementptr inbounds [20007 x i64], ptr %51, i64 0, i64 0
  store i64 %50, ptr %52, align 16, !tbaa !5
  %53 = getelementptr inbounds [20007 x i64], ptr %47, i64 0
  %54 = getelementptr inbounds i64, ptr %17, i64 0
  %55 = load i64, ptr %54, align 16, !tbaa !5
  %56 = getelementptr inbounds [20007 x i64], ptr %53, i64 0, i64 %55
  store i64 0, ptr %56, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %140, %45
  %58 = load i64, ptr %8, align 8, !tbaa !5
  %59 = load i64, ptr %1, align 8, !tbaa !5
  %60 = sub nsw i64 %59, 1
  %61 = icmp slt i64 %58, %60
  br i1 %61, label %63, label %62

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

63:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %136, %63
  %65 = load i64, ptr %10, align 8, !tbaa !5
  %66 = icmp slt i64 %65, 20007
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %64
  %69 = load i64, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds [20007 x i64], ptr %47, i64 %69
  %71 = load i64, ptr %10, align 8, !tbaa !5
  %72 = getelementptr inbounds [20007 x i64], ptr %70, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !5
  %74 = icmp ne i64 %73, -1
  br i1 %74, label %75, label %135

75:                                               ; preds = %68
  %76 = load i64, ptr %8, align 8, !tbaa !5
  %77 = add nsw i64 %76, 1
  %78 = getelementptr inbounds [20007 x i64], ptr %47, i64 %77
  %79 = load i64, ptr %10, align 8, !tbaa !5
  %80 = getelementptr inbounds [20007 x i64], ptr %78, i64 0, i64 %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %81 = load i64, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds [20007 x i64], ptr %47, i64 %81
  %83 = load i64, ptr %10, align 8, !tbaa !5
  %84 = getelementptr inbounds [20007 x i64], ptr %82, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !5
  %86 = load i64, ptr %8, align 8, !tbaa !5
  %87 = add nsw i64 %86, 1
  %88 = getelementptr inbounds i64, ptr %19, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !5
  %90 = add nsw i64 %85, %89
  store i64 %90, ptr %11, align 8, !tbaa !5
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %92 = load i64, ptr %91, align 8, !tbaa !5
  %93 = load i64, ptr %8, align 8, !tbaa !5
  %94 = add nsw i64 %93, 1
  %95 = getelementptr inbounds [20007 x i64], ptr %47, i64 %94
  %96 = load i64, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds [20007 x i64], ptr %95, i64 0, i64 %96
  store i64 %92, ptr %97, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  %98 = load i64, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %8, align 8, !tbaa !5
  %100 = add nsw i64 %99, 1
  %101 = getelementptr inbounds i64, ptr %17, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !5
  %103 = add nsw i64 %98, %102
  %104 = icmp slt i64 %103, 20007
  br i1 %104, label %105, label %106

105:                                              ; preds = %75
  br label %108

106:                                              ; preds = %75
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 39, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #8
  unreachable

107:                                              ; No predecessors!
  br label %108

108:                                              ; preds = %107, %105
  %109 = load i64, ptr %8, align 8, !tbaa !5
  %110 = add nsw i64 %109, 1
  %111 = getelementptr inbounds [20007 x i64], ptr %47, i64 %110
  %112 = load i64, ptr %10, align 8, !tbaa !5
  %113 = load i64, ptr %8, align 8, !tbaa !5
  %114 = add nsw i64 %113, 1
  %115 = getelementptr inbounds i64, ptr %17, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !5
  %117 = add nsw i64 %112, %116
  %118 = getelementptr inbounds [20007 x i64], ptr %111, i64 0, i64 %117
  %119 = load i64, ptr %8, align 8, !tbaa !5
  %120 = getelementptr inbounds [20007 x i64], ptr %47, i64 %119
  %121 = load i64, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds [20007 x i64], ptr %120, i64 0, i64 %121
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %118, ptr noundef nonnull align 8 dereferenceable(8) %122)
  %124 = load i64, ptr %123, align 8, !tbaa !5
  %125 = load i64, ptr %8, align 8, !tbaa !5
  %126 = add nsw i64 %125, 1
  %127 = getelementptr inbounds [20007 x i64], ptr %47, i64 %126
  %128 = load i64, ptr %10, align 8, !tbaa !5
  %129 = load i64, ptr %8, align 8, !tbaa !5
  %130 = add nsw i64 %129, 1
  %131 = getelementptr inbounds i64, ptr %17, i64 %130
  %132 = load i64, ptr %131, align 8, !tbaa !5
  %133 = add nsw i64 %128, %132
  %134 = getelementptr inbounds [20007 x i64], ptr %127, i64 0, i64 %133
  store i64 %124, ptr %134, align 8, !tbaa !5
  br label %135

135:                                              ; preds = %108, %68
  br label %136

136:                                              ; preds = %135
  %137 = load i64, ptr %10, align 8, !tbaa !5
  %138 = add nsw i64 %137, 1
  store i64 %138, ptr %10, align 8, !tbaa !5
  br label %64, !llvm.loop !12

139:                                              ; preds = %67
  br label %140

140:                                              ; preds = %139
  %141 = load i64, ptr %8, align 8, !tbaa !5
  %142 = add nsw i64 %141, 1
  store i64 %142, ptr %8, align 8, !tbaa !5
  br label %57, !llvm.loop !13

143:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store i64 0, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %144

144:                                              ; preds = %166, %143
  %145 = load i64, ptr %13, align 8, !tbaa !5
  %146 = icmp slt i64 %145, 20007
  br i1 %146, label %148, label %147

147:                                              ; preds = %144
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %169

148:                                              ; preds = %144
  %149 = load i64, ptr %1, align 8, !tbaa !5
  %150 = sub nsw i64 %149, 1
  %151 = getelementptr inbounds [20007 x i64], ptr %47, i64 %150
  %152 = load i64, ptr %13, align 8, !tbaa !5
  %153 = getelementptr inbounds [20007 x i64], ptr %151, i64 0, i64 %152
  %154 = load i64, ptr %153, align 8, !tbaa !5
  %155 = icmp ne i64 %154, -1
  br i1 %155, label %156, label %165

156:                                              ; preds = %148
  %157 = load i64, ptr %1, align 8, !tbaa !5
  %158 = sub nsw i64 %157, 1
  %159 = getelementptr inbounds [20007 x i64], ptr %47, i64 %158
  %160 = load i64, ptr %13, align 8, !tbaa !5
  %161 = getelementptr inbounds [20007 x i64], ptr %159, i64 0, i64 %160
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %161, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %162)
  %164 = load i64, ptr %163, align 8, !tbaa !5
  store i64 %164, ptr %12, align 8, !tbaa !5
  br label %165

165:                                              ; preds = %156, %148
  br label %166

166:                                              ; preds = %165
  %167 = load i64, ptr %13, align 8, !tbaa !5
  %168 = add nsw i64 %167, 1
  store i64 %168, ptr %13, align 8, !tbaa !5
  br label %144, !llvm.loop !14

169:                                              ; preds = %147
  %170 = load i64, ptr %12, align 8, !tbaa !5
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %170)
  %172 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %171, ptr noundef @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %173 = load ptr, ptr %2, align 8
  call void @llvm.stackrestore.p0(ptr %173)
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #7
  ret void
}

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #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) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind willreturn }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  %5 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %6 = load i64, ptr %1, align 8, !tbaa !5
  %7 = call ptr @llvm.stacksave.p0()
  %8 = alloca i64, i64 %6, align 16
  %9 = load i64, ptr %1, align 8, !tbaa !5
  %10 = alloca i64, i64 %9, align 16
  %11 = icmp sgt i64 %9, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.preheader36:                                     ; preds = %.lr.ph
  %12 = icmp sgt i64 %16, 0
  br i1 %12, label %.lr.ph39, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03037 = phi i64 [ %15, %.lr.ph ], [ 0, %0 ]
  %13 = getelementptr inbounds i64, ptr %8, i64 %.03037
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %15 = add nuw nsw i64 %.03037, 1
  %16 = load i64, ptr %1, align 8, !tbaa !5
  %17 = icmp slt i64 %15, %16
  br i1 %17, label %.lr.ph, label %.preheader36, !llvm.loop !9

._crit_edge.loopexit:                             ; preds = %.lr.ph39
  %.pre = load i64, ptr %10, align 16, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %0, %._crit_edge.loopexit, %.preheader36
  %18 = phi i64 [ undef, %.preheader36 ], [ %.pre, %._crit_edge.loopexit ], [ undef, %0 ]
  %19 = phi i64 [ %16, %.preheader36 ], [ %28, %._crit_edge.loopexit ], [ %9, %0 ]
  %20 = alloca [20007 x i64], i64 %19, align 16
  %21 = mul nuw i64 %19, 160056
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %20, i8 -1, i64 %21, i1 false)
  store i64 %18, ptr %20, align 16, !tbaa !5
  %22 = load i64, ptr %8, align 16, !tbaa !5
  %23 = getelementptr inbounds [20007 x i64], ptr %20, i64 0, i64 %22
  store i64 0, ptr %23, align 8, !tbaa !5
  %24 = icmp sgt i64 %19, 1
  br i1 %24, label %.preheader, label %._crit_edge42

.lr.ph39:                                         ; preds = %.preheader36, %.lr.ph39
  %.03138 = phi i64 [ %27, %.lr.ph39 ], [ 0, %.preheader36 ]
  %25 = getelementptr inbounds i64, ptr %10, i64 %.03138
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %27 = add nuw nsw i64 %.03138, 1
  %28 = load i64, ptr %1, align 8, !tbaa !5
  %29 = icmp slt i64 %27, %28
  br i1 %29, label %.lr.ph39, label %._crit_edge.loopexit, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %33
  %.02941 = phi i64 [ %30, %33 ], [ 0, %._crit_edge ]
  %30 = add nuw nsw i64 %.02941, 1
  %31 = getelementptr inbounds i64, ptr %10, i64 %30
  %32 = getelementptr inbounds i64, ptr %8, i64 %30
  br label %37

._crit_edge42:                                    ; preds = %33, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  store i64 0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %invariant.gep = getelementptr i8, ptr %20, i64 -160056
  store i64 0, ptr %4, align 8, !tbaa !5
  br label %62

33:                                               ; preds = %57
  %34 = load i64, ptr %1, align 8, !tbaa !5
  %35 = add nsw i64 %34, -1
  %36 = icmp slt i64 %30, %35
  br i1 %36, label %.preheader, label %._crit_edge42, !llvm.loop !12

37:                                               ; preds = %.preheader, %57
  %.040 = phi i64 [ 0, %.preheader ], [ %58, %57 ]
  %38 = getelementptr inbounds [20007 x i64], ptr %20, i64 %.02941, i64 %.040
  %39 = load i64, ptr %38, align 8, !tbaa !5
  %.not35 = icmp eq i64 %39, -1
  br i1 %.not35, label %57, label %40

40:                                               ; preds = %37
  %41 = getelementptr inbounds [20007 x i64], ptr %20, i64 %30, i64 %.040
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %42 = load i64, ptr %31, align 8, !tbaa !5
  %43 = add nsw i64 %42, %39
  store i64 %43, ptr %2, align 8, !tbaa !5
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %41, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %45 = load i64, ptr %44, align 8, !tbaa !5
  store i64 %45, ptr %41, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  %46 = load i64, ptr %32, align 8, !tbaa !5
  %47 = add nsw i64 %46, %.040
  %48 = icmp slt i64 %47, 20007
  br i1 %48, label %50, label %49

49:                                               ; preds = %40
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 39, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #8
  unreachable

50:                                               ; preds = %40
  %51 = getelementptr inbounds [20007 x i64], ptr %20, i64 %30, i64 %47
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %51, ptr noundef nonnull align 8 dereferenceable(8) %38)
  %53 = load i64, ptr %52, align 8, !tbaa !5
  %54 = load i64, ptr %32, align 8, !tbaa !5
  %55 = add nsw i64 %54, %.040
  %56 = getelementptr inbounds [20007 x i64], ptr %20, i64 %30, i64 %55
  store i64 %53, ptr %56, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %37, %50
  %58 = add nuw nsw i64 %.040, 1
  %exitcond.not = icmp eq i64 %58, 20007
  br i1 %exitcond.not, label %33, label %37, !llvm.loop !13

59:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEl(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %72)
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @.str.2)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.stackrestore.p0(ptr %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  ret void

62:                                               ; preds = %._crit_edge42, %71
  %63 = phi i64 [ 0, %._crit_edge42 ], [ %72, %71 ]
  %storemerge43 = phi i64 [ 0, %._crit_edge42 ], [ %74, %71 ]
  %64 = load i64, ptr %1, align 8, !tbaa !5
  %65 = getelementptr nusw [20007 x i64], ptr %invariant.gep, i64 %64, i64 %storemerge43
  %66 = load i64, ptr %65, align 8, !tbaa !5
  %.not = icmp eq i64 %66, -1
  br i1 %.not, label %71, label %67

67:                                               ; preds = %62
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %68)
  %70 = load i64, ptr %69, align 8, !tbaa !5
  store i64 %70, ptr %3, align 8, !tbaa !5
  %.pre45 = load i64, ptr %4, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %62, %67
  %72 = phi i64 [ %63, %62 ], [ %70, %67 ]
  %73 = phi i64 [ %storemerge43, %62 ], [ %.pre45, %67 ]
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %4, align 8, !tbaa !5
  %75 = icmp slt i64 %73, 20006
  br i1 %75, label %62, label %59, !llvm.loop !14
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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 #6

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


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