; LLVM IR from AdarshGaur/Competitive-Programming :: Codeforces/Codeforces Round #810 (Div. 2)/C. Color the Picture.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
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %18 = 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)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %21 = load i64, ptr %3, align 8, !tbaa !5
  %22 = call ptr @llvm.stacksave.p0()
  store ptr %22, ptr %4, align 8
  %23 = alloca i64, i64 %21, align 16
  store i64 %21, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr %23, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %24 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %24, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %25 = load ptr, ptr %6, align 8, !tbaa !9
  %26 = mul nuw i64 8, %21
  %27 = udiv i64 %26, 8
  %28 = getelementptr inbounds i64, ptr %25, i64 %27
  store ptr %28, ptr %8, align 8, !tbaa !9
  br label %29

29:                                               ; preds = %38, %0
  %30 = load ptr, ptr %7, align 8, !tbaa !9
  %31 = load ptr, ptr %8, align 8, !tbaa !9
  %32 = icmp ne ptr %30, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %35 = load ptr, ptr %7, align 8, !tbaa !9
  store ptr %35, ptr %9, align 8, !tbaa !9
  %36 = load ptr, ptr %9, align 8, !tbaa !9
  %37 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %36)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  br label %38

38:                                               ; preds = %34
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = getelementptr inbounds i64, ptr %39, i32 1
  store ptr %40, ptr %7, align 8, !tbaa !9
  br label %29

41:                                               ; preds = %33
  %42 = load i64, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds i64, ptr %23, i64 %42
  call void @_ZSt4sortIPlEvT_S1_(ptr noundef %23, ptr noundef %43)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %44 = load i64, ptr %1, align 8, !tbaa !5
  store i64 %44, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %45 = load i64, ptr %2, align 8, !tbaa !5
  store i64 %45, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  store i64 0, ptr %12, align 8, !tbaa !5
  br label %46

46:                                               ; preds = %131, %41
  %47 = load i64, ptr %12, align 8, !tbaa !5
  %48 = load i64, ptr %3, align 8, !tbaa !5
  %49 = icmp slt i64 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 4, ptr %13, align 4
  br label %134

51:                                               ; preds = %46
  %52 = load i64, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds i64, ptr %23, i64 %52
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = load i64, ptr %2, align 8, !tbaa !5
  %56 = mul nsw i64 %55, 2
  %57 = icmp sge i64 %54, %56
  br i1 %57, label %58, label %87

58:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  %59 = load i64, ptr %12, align 8, !tbaa !5
  %60 = getelementptr inbounds i64, ptr %23, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !5
  %62 = load i64, ptr %2, align 8, !tbaa !5
  %63 = sdiv i64 %61, %62
  store i64 %63, ptr %14, align 8, !tbaa !5
  %64 = load i64, ptr %14, align 8, !tbaa !5
  %65 = load i64, ptr %10, align 8, !tbaa !5
  %66 = icmp sge i64 %64, %65
  br i1 %66, label %67, label %69

67:                                               ; preds = %58
  %68 = load i64, ptr %10, align 8, !tbaa !5
  store i64 %68, ptr %14, align 8, !tbaa !5
  br label %79

69:                                               ; preds = %58
  %70 = load i64, ptr %14, align 8, !tbaa !5
  %71 = load i64, ptr %10, align 8, !tbaa !5
  %72 = icmp slt i64 %70, %71
  br i1 %72, label %73, label %78

73:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %74 = load i64, ptr %10, align 8, !tbaa !5
  %75 = sub nsw i64 %74, 2
  store i64 %75, ptr %15, align 8, !tbaa !5
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %14, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %77 = load i64, ptr %76, align 8, !tbaa !5
  store i64 %77, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  br label %78

78:                                               ; preds = %73, %69
  br label %79

79:                                               ; preds = %78, %67
  %80 = load i64, ptr %14, align 8, !tbaa !5
  %81 = icmp ne i64 %80, 1
  br i1 %81, label %82, label %86

82:                                               ; preds = %79
  %83 = load i64, ptr %14, align 8, !tbaa !5
  %84 = load i64, ptr %10, align 8, !tbaa !5
  %85 = sub nsw i64 %84, %83
  store i64 %85, ptr %10, align 8, !tbaa !5
  br label %86

86:                                               ; preds = %82, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  br label %87

87:                                               ; preds = %86, %51
  %88 = load i64, ptr %12, align 8, !tbaa !5
  %89 = getelementptr inbounds i64, ptr %23, i64 %88
  %90 = load i64, ptr %89, align 8, !tbaa !5
  %91 = load i64, ptr %1, align 8, !tbaa !5
  %92 = mul nsw i64 %91, 2
  %93 = icmp sge i64 %90, %92
  br i1 %93, label %94, label %123

94:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %95 = load i64, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds i64, ptr %23, i64 %95
  %97 = load i64, ptr %96, align 8, !tbaa !5
  %98 = load i64, ptr %1, align 8, !tbaa !5
  %99 = sdiv i64 %97, %98
  store i64 %99, ptr %16, align 8, !tbaa !5
  %100 = load i64, ptr %16, align 8, !tbaa !5
  %101 = load i64, ptr %11, align 8, !tbaa !5
  %102 = icmp sge i64 %100, %101
  br i1 %102, label %103, label %105

103:                                              ; preds = %94
  %104 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %104, ptr %16, align 8, !tbaa !5
  br label %115

105:                                              ; preds = %94
  %106 = load i64, ptr %16, align 8, !tbaa !5
  %107 = load i64, ptr %11, align 8, !tbaa !5
  %108 = icmp slt i64 %106, %107
  br i1 %108, label %109, label %114

109:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %110 = load i64, ptr %11, align 8, !tbaa !5
  %111 = sub nsw i64 %110, 2
  store i64 %111, ptr %17, align 8, !tbaa !5
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(8) %17)
  %113 = load i64, ptr %112, align 8, !tbaa !5
  store i64 %113, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %114

114:                                              ; preds = %109, %105
  br label %115

115:                                              ; preds = %114, %103
  %116 = load i64, ptr %16, align 8, !tbaa !5
  %117 = icmp ne i64 %116, 1
  br i1 %117, label %118, label %122

118:                                              ; preds = %115
  %119 = load i64, ptr %16, align 8, !tbaa !5
  %120 = load i64, ptr %11, align 8, !tbaa !5
  %121 = sub nsw i64 %120, %119
  store i64 %121, ptr %11, align 8, !tbaa !5
  br label %122

122:                                              ; preds = %118, %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  br label %123

123:                                              ; preds = %122, %87
  %124 = load i64, ptr %11, align 8, !tbaa !5
  %125 = icmp eq i64 %124, 0
  br i1 %125, label %129, label %126

126:                                              ; preds = %123
  %127 = load i64, ptr %10, align 8, !tbaa !5
  %128 = icmp eq i64 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %126, %123
  store i32 4, ptr %13, align 4
  br label %134

130:                                              ; preds = %126
  br label %131

131:                                              ; preds = %130
  %132 = load i64, ptr %12, align 8, !tbaa !5
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %12, align 8, !tbaa !5
  br label %46, !llvm.loop !11

134:                                              ; preds = %129, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %135

135:                                              ; preds = %134
  %136 = load i64, ptr %11, align 8, !tbaa !5
  %137 = icmp eq i64 %136, 0
  br i1 %137, label %141, label %138

138:                                              ; preds = %135
  %139 = load i64, ptr %10, align 8, !tbaa !5
  %140 = icmp eq i64 %139, 0
  br label %141

141:                                              ; preds = %138, %135
  %142 = phi i1 [ true, %135 ], [ %140, %138 ]
  %143 = zext i1 %142 to i64
  %144 = select i1 %142, ptr @.str.1, ptr @.str.2
  %145 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef %144)
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %145, ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %147 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %147)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPlEvT_S1_(ptr noundef, ptr noundef) #3

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

; 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 = { 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 = { 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = 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
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %8 = 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)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %11 = load i64, ptr %3, align 8, !tbaa !5
  %12 = call ptr @llvm.stacksave.p0()
  %13 = alloca i64, i64 %11, align 16
  %14 = getelementptr inbounds i64, ptr %13, i64 %11
  %.not43 = icmp eq i64 %11, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %15 = load i64, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds i64, ptr %13, i64 %15
  call void @_ZSt4sortIPlEvT_S1_(ptr noundef nonnull %13, ptr noundef nonnull %16)
  %17 = load i64, ptr %1, align 8, !tbaa !5
  %18 = load i64, ptr %2, align 8, !tbaa !5
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %20 = icmp sgt i64 %19, 0
  br i1 %20, label %.lr.ph49, label %._crit_edge50

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03344 = phi ptr [ %22, %.lr.ph ], [ %13, %0 ]
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERl(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %.03344)
  %22 = getelementptr inbounds i8, ptr %.03344, i64 8
  %.not = icmp eq ptr %22, %14
  br i1 %.not, label %._crit_edge, label %.lr.ph

23:                                               ; preds = %51
  %24 = add nuw nsw i64 %.047, 1
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = icmp slt i64 %24, %25
  br i1 %26, label %.lr.ph49, label %._crit_edge50, !llvm.loop !9

.lr.ph49:                                         ; preds = %._crit_edge, %23
  %.047 = phi i64 [ %24, %23 ], [ 0, %._crit_edge ]
  %.02846 = phi i64 [ %.2, %23 ], [ %18, %._crit_edge ]
  %.02945 = phi i64 [ %.231, %23 ], [ %17, %._crit_edge ]
  %27 = getelementptr inbounds i64, ptr %13, i64 %.047
  %28 = load i64, ptr %27, align 8, !tbaa !5
  %29 = load i64, ptr %2, align 8, !tbaa !5
  %30 = shl nsw i64 %29, 1
  %.not36 = icmp slt i64 %28, %30
  br i1 %.not36, label %39, label %31

31:                                               ; preds = %.lr.ph49
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %32 = sdiv i64 %28, %29
  store i64 %32, ptr %4, align 8, !tbaa !5
  %.not37 = icmp slt i64 %32, %.02945
  br i1 %.not37, label %33, label %37

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %34 = add nsw i64 %.02945, -2
  store i64 %34, ptr %5, align 8, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %36 = load i64, ptr %35, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  %.pre.pre = load i64, ptr %27, align 8, !tbaa !5
  br label %37

37:                                               ; preds = %31, %33
  %.pre = phi i64 [ %.pre.pre, %33 ], [ %28, %31 ]
  %.02945.sink = phi i64 [ %36, %33 ], [ %.02945, %31 ]
  %.not38 = icmp eq i64 %.02945.sink, 1
  %38 = select i1 %.not38, i64 0, i64 %.02945.sink
  %spec.select = sub nsw i64 %.02945, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %39

39:                                               ; preds = %37, %.lr.ph49
  %40 = phi i64 [ %.pre, %37 ], [ %28, %.lr.ph49 ]
  %.231 = phi i64 [ %spec.select, %37 ], [ %.02945, %.lr.ph49 ]
  %41 = load i64, ptr %1, align 8, !tbaa !5
  %42 = shl nsw i64 %41, 1
  %.not39 = icmp slt i64 %40, %42
  br i1 %.not39, label %51, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %44 = sdiv i64 %40, %41
  store i64 %44, ptr %6, align 8, !tbaa !5
  %.not40 = icmp slt i64 %44, %.02846
  br i1 %.not40, label %45, label %49

45:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  %46 = add nsw i64 %.02846, -2
  store i64 %46, ptr %7, align 8, !tbaa !5
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIlERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %48 = load i64, ptr %47, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  br label %49

49:                                               ; preds = %43, %45
  %.02846.sink = phi i64 [ %48, %45 ], [ %.02846, %43 ]
  %.not41 = icmp eq i64 %.02846.sink, 1
  %50 = select i1 %.not41, i64 0, i64 %.02846.sink
  %spec.select42 = sub nsw i64 %.02846, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %51

51:                                               ; preds = %49, %39
  %.2 = phi i64 [ %spec.select42, %49 ], [ %.02846, %39 ]
  %52 = icmp eq i64 %.2, 0
  %53 = icmp eq i64 %.231, 0
  %or.cond = select i1 %52, i1 true, i1 %53
  br i1 %or.cond, label %._crit_edge50, label %23

._crit_edge50:                                    ; preds = %23, %51, %._crit_edge
  %.332 = phi i64 [ %17, %._crit_edge ], [ %.231, %51 ], [ %.231, %23 ]
  %.3 = phi i64 [ %18, %._crit_edge ], [ %.2, %51 ], [ %.2, %23 ]
  %54 = icmp eq i64 %.3, 0
  %55 = icmp eq i64 %.332, 0
  %56 = select i1 %54, i1 true, i1 %55
  %57 = select i1 %56, ptr @.str.1, ptr @.str.2
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %57)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @.str.3)
  call void @llvm.stackrestore.p0(ptr %12)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPlEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

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


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,SROAPass,SimplifyCFGPass