; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/SNACKDOWN/17/Pre-Elimination A/A/A.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" }

@h = external dso_local global [100100 x i64], align 16
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@sum = external dso_local global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [117 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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  %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) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %39, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = icmp sle i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %42

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %18)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sub nsw i32 %20, 1
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %22
  %24 = load i64, ptr %23, align 8, !tbaa !9
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !9
  %29 = add nsw i64 %24, %28
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %31
  store i64 %29, ptr %32, align 8, !tbaa !9
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %34
  store i64 1, ptr %35, align 8, !tbaa !9
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %37
  store i64 1, ptr %38, align 8, !tbaa !9
  br label %39

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

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

43:                                               ; preds = %75, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr %1, align 4, !tbaa !5
  %46 = icmp sle i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %78

48:                                               ; preds = %43
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = icmp sge i64 %52, %54
  br i1 %55, label %56, label %63

56:                                               ; preds = %48
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %57 to i64
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %61
  store i64 %59, ptr %62, align 8, !tbaa !9
  br label %74

63:                                               ; preds = %48
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !9
  %68 = load i32, ptr %4, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %69
  store i64 %67, ptr %70, align 8, !tbaa !9
  %71 = trunc i64 %67 to i32
  store i32 %71, ptr %3, align 4, !tbaa !5
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %63, %56
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %4, align 4, !tbaa !5
  br label %43, !llvm.loop !13

78:                                               ; preds = %47
  store i32 1, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %79 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %79, ptr %5, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %111, %78
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = icmp sgt i32 %81, 0
  br i1 %82, label %84, label %83

83:                                               ; preds = %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %114

84:                                               ; preds = %80
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %89 = load i32, ptr %3, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = icmp sge i64 %88, %90
  br i1 %91, label %92, label %99

92:                                               ; preds = %84
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %93 to i64
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %97
  store i64 %95, ptr %98, align 8, !tbaa !9
  br label %110

99:                                               ; preds = %84
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !9
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %105
  store i64 %103, ptr %106, align 8, !tbaa !9
  %107 = trunc i64 %103 to i32
  store i32 %107, ptr %3, align 4, !tbaa !5
  %108 = load i32, ptr %3, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %3, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %99, %92
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %5, align 4, !tbaa !5
  %113 = add nsw i32 %112, -1
  store i32 %113, ptr %5, align 4, !tbaa !5
  br label %80, !llvm.loop !14

114:                                              ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %131, %114
  %116 = load i32, ptr %7, align 4, !tbaa !5
  %117 = load i32, ptr %1, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %134

120:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %121 = load i32, ptr %7, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %122
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %125
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %123, ptr noundef nonnull align 8 dereferenceable(8) %126)
  %128 = load i64, ptr %127, align 8, !tbaa !9
  store i64 %128, ptr %8, align 8, !tbaa !9
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %130 = load i64, ptr %129, align 8, !tbaa !9
  store i64 %130, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %131

131:                                              ; preds = %120
  %132 = load i32, ptr %7, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %7, align 4, !tbaa !5
  br label %115, !llvm.loop !15

134:                                              ; preds = %119
  %135 = load i32, ptr %1, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !9
  %139 = load i64, ptr %6, align 8, !tbaa !9
  %140 = sub nsw i64 %139, 1
  %141 = load i64, ptr %6, align 8, !tbaa !9
  %142 = mul nsw i64 %140, %141
  %143 = load i64, ptr %6, align 8, !tbaa !9
  %144 = add nsw i64 %142, %143
  %145 = sub nsw i64 %138, %144
  store i64 %145, ptr %6, align 8, !tbaa !9
  %146 = load i64, ptr %6, align 8, !tbaa !9
  %147 = icmp sge i64 %146, 0
  br i1 %147, label %148, label %149

148:                                              ; preds = %134
  br label %151

149:                                              ; preds = %134
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 85, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

150:                                              ; No predecessors!
  br label %151

151:                                              ; preds = %150, %148
  %152 = load i64, ptr %6, align 8, !tbaa !9
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %152)
  %154 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %153, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 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 nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn nounwind }

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

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


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

@h = external dso_local global [100100 x i64], align 16
@a = external dso_local global [100100 x i64], align 16
@b = external dso_local global [100100 x i64], align 16
@sum = external dso_local local_unnamed_addr global [100100 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [117 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

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

.preheader45:                                     ; preds = %.lr.ph
  %.not4149 = icmp slt i32 %18, 1
  br i1 %.not4149, label %._crit_edge.thread, label %.lr.ph52.preheader

.lr.ph52.preheader:                               ; preds = %.preheader45
  %6 = zext nneg i32 %18 to i64
  %xtraiter = and i64 %6, 1
  %7 = icmp eq i32 %18, 1
  br i1 %7, label %.lr.ph55.preheader.unr-lcssa, label %.lr.ph52.preheader.new

.lr.ph52.preheader.new:                           ; preds = %.lr.ph52.preheader
  %unroll_iter = and i64 %6, 2147483646
  br label %.lr.ph52

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %8 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %indvars.iv
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %10 = add nsw i64 %indvars.iv, -1
  %11 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %10
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = load i64, ptr %8, align 8, !tbaa !9
  %14 = add nsw i64 %13, %12
  %15 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %indvars.iv
  store i64 %14, ptr %15, align 8, !tbaa !9
  %16 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv
  store i64 1, ptr %16, align 8, !tbaa !9
  %17 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv
  store i64 1, ptr %17, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not.not = icmp slt i64 %indvars.iv, %19
  br i1 %.not.not, label %.lr.ph, label %.preheader45, !llvm.loop !11

._crit_edge.thread:                               ; preds = %0, %.preheader45
  %.ph = phi i32 [ %18, %.preheader45 ], [ %5, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  br label %._crit_edge.._crit_edge60_crit_edge

.lr.ph55.preheader.unr-lcssa.loopexit:            ; preds = %.lr.ph52
  %20 = sext i32 %.1.1 to i64
  br label %.lr.ph55.preheader.unr-lcssa

.lr.ph55.preheader.unr-lcssa:                     ; preds = %.lr.ph55.preheader.unr-lcssa.loopexit, %.lr.ph52.preheader
  %indvars.iv65.unr = phi i64 [ 1, %.lr.ph52.preheader ], [ %indvars.iv.next66.1, %.lr.ph55.preheader.unr-lcssa.loopexit ]
  %.03250.unr = phi i64 [ 1, %.lr.ph52.preheader ], [ %20, %.lr.ph55.preheader.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph55.preheader, label %.lr.ph52.epil

.lr.ph52.epil:                                    ; preds = %.lr.ph55.preheader.unr-lcssa
  %21 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %indvars.iv65.unr
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %spec.select.epil = call i64 @llvm.smin.i64(i64 %22, i64 %.03250.unr)
  %23 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv65.unr
  store i64 %spec.select.epil, ptr %23, align 8
  br label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %.lr.ph55.preheader.unr-lcssa, %.lr.ph52.epil
  %24 = zext nneg i32 %18 to i64
  br label %.lr.ph55

.lr.ph52:                                         ; preds = %.lr.ph52, %.lr.ph52.preheader.new
  %indvars.iv65 = phi i64 [ 1, %.lr.ph52.preheader.new ], [ %indvars.iv.next66.1, %.lr.ph52 ]
  %.03250 = phi i32 [ 1, %.lr.ph52.preheader.new ], [ %.1.1, %.lr.ph52 ]
  %niter = phi i64 [ 0, %.lr.ph52.preheader.new ], [ %niter.next.1, %.lr.ph52 ]
  %25 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %indvars.iv65
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = sext i32 %.03250 to i64
  %.not44 = icmp slt i64 %26, %27
  %28 = trunc i64 %26 to i32
  %spec.select = call i64 @llvm.smin.i64(i64 %26, i64 %27)
  %spec.select82 = select i1 %.not44, i32 %28, i32 %.03250
  %29 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv65
  store i64 %spec.select, ptr %29, align 8
  %.1 = add nsw i32 %spec.select82, 1
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %30 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %indvars.iv.next66
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = sext i32 %.1 to i64
  %.not44.1 = icmp slt i64 %31, %32
  %33 = trunc i64 %31 to i32
  %spec.select.1 = call i64 @llvm.smin.i64(i64 %31, i64 %32)
  %spec.select82.1 = select i1 %.not44.1, i32 %33, i32 %.1
  %34 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv.next66
  store i64 %spec.select.1, ptr %34, align 8
  %.1.1 = add nsw i32 %spec.select82.1, 1
  %indvars.iv.next66.1 = add nuw nsw i64 %indvars.iv65, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %.lr.ph55.preheader.unr-lcssa.loopexit, label %.lr.ph52, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph55
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  store i64 0, ptr %2, align 8, !tbaa !9
  br i1 %.not4149, label %._crit_edge.._crit_edge60_crit_edge, label %.lr.ph59

._crit_edge.._crit_edge60_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %35 = phi i32 [ %.ph, %._crit_edge.thread ], [ %18, %._crit_edge ]
  %.pre = sext i32 %35 to i64
  br label %._crit_edge60

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.lr.ph55
  %indvars.iv68 = phi i64 [ %24, %.lr.ph55.preheader ], [ %indvars.iv.next69, %.lr.ph55 ]
  %.253 = phi i32 [ 1, %.lr.ph55.preheader ], [ %.3, %.lr.ph55 ]
  %36 = getelementptr inbounds [100100 x i64], ptr @h, i64 0, i64 %indvars.iv68
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = sext i32 %.253 to i64
  %.not43 = icmp slt i64 %37, %38
  %39 = trunc i64 %37 to i32
  %spec.select83 = call i64 @llvm.smin.i64(i64 %37, i64 %38)
  %spec.select84 = select i1 %.not43, i32 %39, i32 %.253
  %40 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv68
  store i64 %spec.select83, ptr %40, align 8
  %.3 = add nsw i32 %spec.select84, 1
  %indvars.iv.next69 = add nsw i64 %indvars.iv68, -1
  %41 = icmp sgt i64 %indvars.iv68, 1
  br i1 %41, label %.lr.ph55, label %._crit_edge, !llvm.loop !14

._crit_edge60:                                    ; preds = %.lr.ph59, %._crit_edge.._crit_edge60_crit_edge
  %.pre-phi = phi i64 [ %.pre, %._crit_edge.._crit_edge60_crit_edge ], [ %55, %.lr.ph59 ]
  %42 = phi i64 [ 0, %._crit_edge.._crit_edge60_crit_edge ], [ %53, %.lr.ph59 ]
  %43 = getelementptr inbounds [100100 x i64], ptr @sum, i64 0, i64 %.pre-phi
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = mul i64 %42, %42
  %46 = sub nsw i64 %44, %45
  store i64 %46, ptr %2, align 8, !tbaa !9
  %47 = icmp sgt i64 %46, -1
  br i1 %47, label %57, label %56

.lr.ph59:                                         ; preds = %._crit_edge, %.lr.ph59
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph59 ], [ 1, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %48 = getelementptr inbounds [100100 x i64], ptr @a, i64 0, i64 %indvars.iv71
  %49 = getelementptr inbounds [100100 x i64], ptr @b, i64 0, i64 %indvars.iv71
  %50 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull align 8 dereferenceable(8) %49)
  %51 = load i64, ptr %50, align 8, !tbaa !9
  store i64 %51, ptr %3, align 8, !tbaa !9
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %53 = load i64, ptr %52, align 8, !tbaa !9
  store i64 %53, ptr %2, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %54 = load i32, ptr %1, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %.not42.not = icmp slt i64 %indvars.iv71, %55
  br i1 %.not42.not, label %.lr.ph59, label %._crit_edge60, !llvm.loop !15

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

57:                                               ; preds = %._crit_edge60
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %46)
  %59 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #6

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 = { "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 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 #4 = { 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }

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

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


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