; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/University CodeSprint 2016/Problem C (C)

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

@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@cnt = external dso_local global [100100 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5queryii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6updateii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %20

20:                                               ; preds = %30, %0
  %21 = load i32, ptr %2, align 4, !tbaa !8
  %22 = load i32, ptr @n, align 4, !tbaa !8
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !8
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %28)
  br label %30

30:                                               ; preds = %25
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !8
  br label %20, !llvm.loop !11

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

34:                                               ; preds = %47, %33
  %35 = load i32, ptr %3, align 4, !tbaa !8
  %36 = load i32, ptr @n, align 4, !tbaa !8
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %50

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !8
  %44 = add nsw i32 200100, %43
  %45 = load i32, ptr %3, align 4, !tbaa !8
  %46 = sub nsw i32 %44, %45
  call void @_Z6updateii(i32 noundef %46, i32 noundef 1)
  br label %47

47:                                               ; preds = %39
  %48 = load i32, ptr %3, align 4, !tbaa !8
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %3, align 4, !tbaa !8
  br label %34, !llvm.loop !13

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

51:                                               ; preds = %79, %50
  %52 = load i32, ptr %4, align 4, !tbaa !8
  %53 = load i32, ptr @n, align 4, !tbaa !8
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %82

56:                                               ; preds = %51
  %57 = load i32, ptr %4, align 4, !tbaa !8
  %58 = sub nsw i32 200100, %57
  %59 = call noundef i32 @_Z5queryii(i32 noundef %58, i32 noundef 0)
  %60 = load i32, ptr %4, align 4, !tbaa !8
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %61
  store i32 %59, ptr %62, align 4, !tbaa !8
  %63 = load i32, ptr %4, align 4, !tbaa !8
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !8
  %67 = add nsw i32 200100, %66
  %68 = load i32, ptr %4, align 4, !tbaa !8
  %69 = sub nsw i32 %67, %68
  call void @_Z6updateii(i32 noundef %69, i32 noundef -1)
  %70 = load i32, ptr %4, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = add nsw i32 200100, %73
  %75 = load i32, ptr %4, align 4, !tbaa !8
  %76 = sub nsw i32 %74, %75
  %77 = load i32, ptr @n, align 4, !tbaa !8
  %78 = sub nsw i32 %76, %77
  call void @_Z6updateii(i32 noundef %78, i32 noundef 1)
  br label %79

79:                                               ; preds = %56
  %80 = load i32, ptr %4, align 4, !tbaa !8
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %4, align 4, !tbaa !8
  br label %51, !llvm.loop !14

82:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %83 = load i32, ptr @cnt, align 16, !tbaa !8
  store i32 %83, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %84

84:                                               ; preds = %103, %82
  %85 = load i32, ptr %7, align 4, !tbaa !8
  %86 = load i32, ptr @n, align 4, !tbaa !8
  %87 = icmp slt i32 %85, %86
  br i1 %87, label %89, label %88

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

89:                                               ; preds = %84
  %90 = load i32, ptr %7, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !8
  %94 = load i32, ptr %6, align 4, !tbaa !8
  %95 = icmp sgt i32 %93, %94
  br i1 %95, label %96, label %102

96:                                               ; preds = %89
  %97 = load i32, ptr %7, align 4, !tbaa !8
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !8
  store i32 %100, ptr %6, align 4, !tbaa !8
  %101 = load i32, ptr %7, align 4, !tbaa !8
  store i32 %101, ptr %5, align 4, !tbaa !8
  br label %102

102:                                              ; preds = %96, %89
  br label %103

103:                                              ; preds = %102
  %104 = load i32, ptr %7, align 4, !tbaa !8
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %7, align 4, !tbaa !8
  br label %84, !llvm.loop !15

106:                                              ; preds = %88
  %107 = load i32, ptr %5, align 4, !tbaa !8
  %108 = add nsw i32 %107, 1
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %108)
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #2

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

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #3

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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 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 #1 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { 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 }

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !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" }

@n = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@cnt = external dso_local local_unnamed_addr global [100100 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5queryii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6updateii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %13 = load i32, ptr @n, align 4, !tbaa !8
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge43

.preheader31:                                     ; preds = %.lr.ph
  %15 = icmp sgt i32 %18, 0
  br i1 %15, label %.lr.ph34, label %._crit_edge43

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %16 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @n, align 4, !tbaa !8
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %.preheader31, !llvm.loop !11

.preheader:                                       ; preds = %.lr.ph34
  %21 = icmp sgt i32 %26, 0
  br i1 %21, label %.lr.ph37, label %._crit_edge43

.lr.ph34:                                         ; preds = %.preheader31, %.lr.ph34
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph34 ], [ 0, %.preheader31 ]
  %22 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv47
  %23 = load i32, ptr %22, align 4, !tbaa !8
  %24 = trunc nuw nsw i64 %indvars.iv47 to i32
  %reass.sub = sub i32 %23, %24
  %25 = add i32 %reass.sub, 200100
  tail call void @_Z6updateii(i32 noundef %25, i32 noundef 1)
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %26 = load i32, ptr @n, align 4, !tbaa !8
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next48, %27
  br i1 %28, label %.lr.ph34, label %.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph37
  %29 = icmp sgt i32 %47, 1
  br i1 %29, label %.lr.ph42.preheader, label %._crit_edge43

.lr.ph42.preheader:                               ; preds = %._crit_edge
  %30 = load i32, ptr @cnt, align 16, !tbaa !8
  %wide.trip.count = zext nneg i32 %47 to i64
  %31 = add nsw i64 %wide.trip.count, -1
  %32 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %31, 3
  %33 = icmp ult i64 %32, 3
  br i1 %33, label %._crit_edge43.loopexit.unr-lcssa, label %.lr.ph42.preheader.new

.lr.ph42.preheader.new:                           ; preds = %.lr.ph42.preheader
  %unroll_iter = and i64 %31, -4
  br label %.lr.ph42

.lr.ph37:                                         ; preds = %.preheader, %.lr.ph37
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %.lr.ph37 ], [ 0, %.preheader ]
  %.025.neg36 = phi i32 [ %.025.neg, %.lr.ph37 ], [ 0, %.preheader ]
  %34 = trunc i64 %indvars.iv50 to i32
  %35 = sub i32 200100, %34
  %36 = tail call noundef i32 @_Z5queryii(i32 noundef %35, i32 noundef 0)
  %37 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv50
  store i32 %36, ptr %37, align 4, !tbaa !8
  %38 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv50
  %39 = load i32, ptr %38, align 4, !tbaa !8
  %40 = add nsw i32 %.025.neg36, 200100
  %41 = add i32 %40, %39
  tail call void @_Z6updateii(i32 noundef %41, i32 noundef -1)
  %42 = load i32, ptr %38, align 4, !tbaa !8
  %43 = load i32, ptr @n, align 4, !tbaa !8
  %44 = add i32 %40, %42
  %45 = sub i32 %44, %43
  tail call void @_Z6updateii(i32 noundef %45, i32 noundef 1)
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %46 = trunc nuw nsw i64 %indvars.iv50 to i32
  %.025.neg = xor i32 %46, -1
  %47 = load i32, ptr @n, align 4, !tbaa !8
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next51, %48
  br i1 %49, label %.lr.ph37, label %._crit_edge, !llvm.loop !14

._crit_edge43.loopexit.unr-lcssa:                 ; preds = %.lr.ph42, %.lr.ph42.preheader
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph42.preheader ], [ %spec.select.3, %.lr.ph42 ]
  %indvars.iv54.unr = phi i64 [ 1, %.lr.ph42.preheader ], [ %indvars.iv.next55.3, %.lr.ph42 ]
  %.02239.unr = phi i32 [ %30, %.lr.ph42.preheader ], [ %spec.select29.3, %.lr.ph42 ]
  %.02338.unr = phi i32 [ 0, %.lr.ph42.preheader ], [ %spec.select.3, %.lr.ph42 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge43.loopexit, label %.lr.ph42.epil

.lr.ph42.epil:                                    ; preds = %._crit_edge43.loopexit.unr-lcssa, %.lr.ph42.epil
  %indvars.iv54.epil = phi i64 [ %indvars.iv.next55.epil, %.lr.ph42.epil ], [ %indvars.iv54.unr, %._crit_edge43.loopexit.unr-lcssa ]
  %.02239.epil = phi i32 [ %spec.select29.epil, %.lr.ph42.epil ], [ %.02239.unr, %._crit_edge43.loopexit.unr-lcssa ]
  %.02338.epil = phi i32 [ %spec.select.epil, %.lr.ph42.epil ], [ %.02338.unr, %._crit_edge43.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph42.epil ], [ 0, %._crit_edge43.loopexit.unr-lcssa ]
  %50 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv54.epil
  %51 = load i32, ptr %50, align 4, !tbaa !8
  %52 = icmp sgt i32 %51, %.02239.epil
  %53 = trunc nuw nsw i64 %indvars.iv54.epil to i32
  %spec.select.epil = select i1 %52, i32 %53, i32 %.02338.epil
  %spec.select29.epil = tail call i32 @llvm.smax.i32(i32 %51, i32 %.02239.epil)
  %indvars.iv.next55.epil = add nuw nsw i64 %indvars.iv54.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge43.loopexit, label %.lr.ph42.epil, !llvm.loop !15

._crit_edge43.loopexit:                           ; preds = %.lr.ph42.epil, %._crit_edge43.loopexit.unr-lcssa
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge43.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph42.epil ]
  %54 = add nsw i32 %spec.select.lcssa, 1
  br label %._crit_edge43

._crit_edge43:                                    ; preds = %0, %.preheader31, %.preheader, %._crit_edge43.loopexit, %._crit_edge
  %.023.lcssa = phi i32 [ 1, %._crit_edge ], [ %54, %._crit_edge43.loopexit ], [ 1, %.preheader ], [ 1, %.preheader31 ], [ 1, %0 ]
  %55 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.023.lcssa)
  %56 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %55, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph42:                                         ; preds = %.lr.ph42, %.lr.ph42.preheader.new
  %indvars.iv54 = phi i64 [ 1, %.lr.ph42.preheader.new ], [ %indvars.iv.next55.3, %.lr.ph42 ]
  %.02239 = phi i32 [ %30, %.lr.ph42.preheader.new ], [ %spec.select29.3, %.lr.ph42 ]
  %.02338 = phi i32 [ 0, %.lr.ph42.preheader.new ], [ %spec.select.3, %.lr.ph42 ]
  %niter = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %niter.next.3, %.lr.ph42 ]
  %57 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv54
  %58 = load i32, ptr %57, align 4, !tbaa !8
  %59 = icmp sgt i32 %58, %.02239
  %60 = trunc nuw nsw i64 %indvars.iv54 to i32
  %spec.select = select i1 %59, i32 %60, i32 %.02338
  %spec.select29 = tail call i32 @llvm.smax.i32(i32 %58, i32 %.02239)
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %61 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next55
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = icmp sgt i32 %62, %spec.select29
  %64 = trunc nuw nsw i64 %indvars.iv.next55 to i32
  %spec.select.1 = select i1 %63, i32 %64, i32 %spec.select
  %spec.select29.1 = tail call i32 @llvm.smax.i32(i32 %62, i32 %spec.select29)
  %indvars.iv.next55.1 = add nuw nsw i64 %indvars.iv54, 2
  %65 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next55.1
  %66 = load i32, ptr %65, align 4, !tbaa !8
  %67 = icmp sgt i32 %66, %spec.select29.1
  %68 = trunc nuw nsw i64 %indvars.iv.next55.1 to i32
  %spec.select.2 = select i1 %67, i32 %68, i32 %spec.select.1
  %spec.select29.2 = tail call i32 @llvm.smax.i32(i32 %66, i32 %spec.select29.1)
  %indvars.iv.next55.2 = add nuw nsw i64 %indvars.iv54, 3
  %69 = getelementptr inbounds [100100 x i32], ptr @cnt, i64 0, i64 %indvars.iv.next55.2
  %70 = load i32, ptr %69, align 4, !tbaa !8
  %71 = icmp sgt i32 %70, %spec.select29.2
  %72 = trunc nuw nsw i64 %indvars.iv.next55.2 to i32
  %spec.select.3 = select i1 %71, i32 %72, i32 %spec.select.2
  %spec.select29.3 = tail call i32 @llvm.smax.i32(i32 %70, i32 %spec.select29.2)
  %indvars.iv.next55.3 = add nuw nsw i64 %indvars.iv54, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge43.loopexit.unr-lcssa, label %.lr.ph42, !llvm.loop !17
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #2

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 #3 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)) #4

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

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

!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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12}


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