; LLVM IR from eyangch/competitive-programming :: Codeforces/1770 (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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@A = external dso_local global [100 x i64], align 16
@occ = external dso_local global [105 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

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

18:                                               ; preds = %121, %0
  %19 = load i64, ptr @T, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr @T, align 8, !tbaa !8
  %21 = icmp ne i64 %19, 0
  br i1 %21, label %22, label %122

22:                                               ; preds = %18
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %24

24:                                               ; preds = %33, %22
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = load i64, ptr @N, align 8, !tbaa !8
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

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

29:                                               ; preds = %24
  %30 = load i64, ptr %2, align 8, !tbaa !8
  %31 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %31)
  br label %33

33:                                               ; preds = %29
  %34 = load i64, ptr %2, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %2, align 8, !tbaa !8
  br label %24, !llvm.loop !11

36:                                               ; preds = %28
  %37 = load i64, ptr @N, align 8, !tbaa !8
  %38 = getelementptr inbounds i64, ptr @A, i64 %37
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @A, ptr noundef %38)
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #6
  store i8 1, ptr %3, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %39

39:                                               ; preds = %55, %36
  %40 = load i64, ptr %4, align 8, !tbaa !8
  %41 = load i64, ptr @N, align 8, !tbaa !8
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %44, label %43

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

44:                                               ; preds = %39
  %45 = load i64, ptr %4, align 8, !tbaa !8
  %46 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = load i64, ptr %4, align 8, !tbaa !8
  %49 = sub nsw i64 %48, 1
  %50 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = icmp eq i64 %47, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %44
  store i8 0, ptr %3, align 1, !tbaa !13
  br label %54

54:                                               ; preds = %53, %44
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = add nsw i64 %56, 1
  store i64 %57, ptr %4, align 8, !tbaa !8
  br label %39, !llvm.loop !15

58:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 2, ptr %5, align 8, !tbaa !8
  br label %59

59:                                               ; preds = %108, %58
  %60 = load i64, ptr %5, align 8, !tbaa !8
  %61 = load i64, ptr @N, align 8, !tbaa !8
  %62 = icmp sle i64 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 10, ptr %6, align 4
  br label %111

64:                                               ; preds = %59
  %65 = load i64, ptr %5, align 8, !tbaa !8
  %66 = getelementptr inbounds i64, ptr @occ, i64 %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !16
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @occ, ptr noundef %66, ptr noundef nonnull align 4 dereferenceable(4) %7)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %67

67:                                               ; preds = %81, %64
  %68 = load i64, ptr %8, align 8, !tbaa !8
  %69 = load i64, ptr @N, align 8, !tbaa !8
  %70 = icmp slt i64 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %84

72:                                               ; preds = %67
  %73 = load i64, ptr %8, align 8, !tbaa !8
  %74 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = load i64, ptr %5, align 8, !tbaa !8
  %77 = srem i64 %75, %76
  %78 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = add nsw i64 %79, 1
  store i64 %80, ptr %78, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %72
  %82 = load i64, ptr %8, align 8, !tbaa !8
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %8, align 8, !tbaa !8
  br label %67, !llvm.loop !18

84:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  store i8 0, ptr %9, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %85

85:                                               ; preds = %97, %84
  %86 = load i64, ptr %10, align 8, !tbaa !8
  %87 = load i64, ptr %5, align 8, !tbaa !8
  %88 = icmp slt i64 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %100

90:                                               ; preds = %85
  %91 = load i64, ptr %10, align 8, !tbaa !8
  %92 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !8
  %94 = icmp slt i64 %93, 2
  br i1 %94, label %95, label %96

95:                                               ; preds = %90
  store i8 1, ptr %9, align 1, !tbaa !13
  br label %96

96:                                               ; preds = %95, %90
  br label %97

97:                                               ; preds = %96
  %98 = load i64, ptr %10, align 8, !tbaa !8
  %99 = add nsw i64 %98, 1
  store i64 %99, ptr %10, align 8, !tbaa !8
  br label %85, !llvm.loop !19

100:                                              ; preds = %89
  %101 = load i8, ptr %9, align 1, !tbaa !13, !range !20, !noundef !21
  %102 = trunc i8 %101 to i1
  br i1 %102, label %104, label %103

103:                                              ; preds = %100
  store i8 0, ptr %3, align 1, !tbaa !13
  store i32 10, ptr %6, align 4
  br label %105

104:                                              ; preds = %100
  store i32 0, ptr %6, align 4
  br label %105

105:                                              ; preds = %104, %103
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  %106 = load i32, ptr %6, align 4
  switch i32 %106, label %111 [
    i32 0, label %107
  ]

107:                                              ; preds = %105
  br label %108

108:                                              ; preds = %107
  %109 = load i64, ptr %5, align 8, !tbaa !8
  %110 = add nsw i64 %109, 1
  store i64 %110, ptr %5, align 8, !tbaa !8
  br label %59, !llvm.loop !22

111:                                              ; preds = %105, %63
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %112

112:                                              ; preds = %111
  %113 = load i8, ptr %3, align 1, !tbaa !13, !range !20, !noundef !21
  %114 = trunc i8 %113 to i1
  br i1 %114, label %115, label %118

115:                                              ; preds = %112
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %116, i8 noundef signext 10)
  br label %121

118:                                              ; preds = %112
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %119, i8 noundef signext 10)
  br label %121

121:                                              ; preds = %118, %115
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #6
  br label %18, !llvm.loop !23

122:                                              ; preds = %18
  %123 = load i32, ptr %1, align 4
  ret i32 %123
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #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)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

attributes #0 = { 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !10, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@A = external dso_local global [100 x i64], align 16
@occ = external dso_local global [105 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @T)
  %9 = load i64, ptr @T, align 8, !tbaa !8
  %10 = add nsw i64 %9, -1
  store i64 %10, ptr @T, align 8, !tbaa !8
  %.not49 = icmp eq i64 %9, 0
  br i1 %.not49, label %._crit_edge52, label %.lr.ph51

.lr.ph51:                                         ; preds = %0, %._crit_edge48.thread
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %12 = load i64, ptr @N, align 8, !tbaa !8
  %13 = icmp sgt i64 %12, 0
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph51
  %.lcssa = phi i64 [ %12, %.lr.ph51 ], [ %23, %.lr.ph ]
  %14 = getelementptr inbounds i64, ptr @A, i64 %.lcssa
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %14)
  %15 = load i64, ptr @N, align 8, !tbaa !8
  %16 = icmp sgt i64 %15, 1
  br i1 %16, label %.lr.ph38.preheader, label %._crit_edge48.thread

.lr.ph38.preheader:                               ; preds = %._crit_edge
  %.pre = load i64, ptr @A, align 16, !tbaa !8
  %17 = add nsw i64 %15, -1
  %18 = add nsw i64 %15, -2
  %xtraiter = and i64 %17, 3
  %19 = icmp ult i64 %18, 3
  br i1 %19, label %.lr.ph47.preheader.unr-lcssa, label %.lr.ph38.preheader.new

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

.lr.ph:                                           ; preds = %.lr.ph51, %.lr.ph
  %.02934 = phi i64 [ %22, %.lr.ph ], [ 0, %.lr.ph51 ]
  %20 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %.02934
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %20)
  %22 = add nuw nsw i64 %.02934, 1
  %23 = load i64, ptr @N, align 8, !tbaa !8
  %24 = icmp slt i64 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph38:                                         ; preds = %.lr.ph38, %.lr.ph38.preheader.new
  %25 = phi i64 [ %.pre, %.lr.ph38.preheader.new ], [ %39, %.lr.ph38 ]
  %.02636 = phi i64 [ 1, %.lr.ph38.preheader.new ], [ %44, %.lr.ph38 ]
  %.02735 = phi i1 [ true, %.lr.ph38.preheader.new ], [ %spec.select.3, %.lr.ph38 ]
  %niter = phi i64 [ 0, %.lr.ph38.preheader.new ], [ %niter.next.3, %.lr.ph38 ]
  %26 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %.02636
  %27 = load i64, ptr %26, align 8, !tbaa !8
  %28 = icmp ne i64 %27, %25
  %29 = add nuw nsw i64 %.02636, 1
  %30 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %29
  %31 = load i64, ptr %30, align 8, !tbaa !8
  %32 = icmp ne i64 %31, %27
  %33 = add nuw nsw i64 %.02636, 2
  %34 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !8
  %36 = icmp ne i64 %35, %31
  %37 = add nuw nsw i64 %.02636, 3
  %38 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = icmp ne i64 %39, %35
  %41 = select i1 %40, i1 %36, i1 false
  %42 = select i1 %41, i1 %32, i1 false
  %43 = select i1 %42, i1 %28, i1 false
  %spec.select.3 = select i1 %43, i1 %.02735, i1 false
  %44 = add nuw nsw i64 %.02636, 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 %.lr.ph47.preheader.unr-lcssa, label %.lr.ph38, !llvm.loop !13

.lr.ph47.preheader.unr-lcssa:                     ; preds = %.lr.ph38, %.lr.ph38.preheader
  %spec.select.lcssa.ph = phi i1 [ poison, %.lr.ph38.preheader ], [ %spec.select.3, %.lr.ph38 ]
  %.unr = phi i64 [ %.pre, %.lr.ph38.preheader ], [ %39, %.lr.ph38 ]
  %.02636.unr = phi i64 [ 1, %.lr.ph38.preheader ], [ %44, %.lr.ph38 ]
  %.02735.unr = phi i1 [ true, %.lr.ph38.preheader ], [ %spec.select.3, %.lr.ph38 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph47.preheader, label %.lr.ph38.epil

.lr.ph38.epil:                                    ; preds = %.lr.ph47.preheader.unr-lcssa, %.lr.ph38.epil
  %45 = phi i64 [ %47, %.lr.ph38.epil ], [ %.unr, %.lr.ph47.preheader.unr-lcssa ]
  %.02636.epil = phi i64 [ %49, %.lr.ph38.epil ], [ %.02636.unr, %.lr.ph47.preheader.unr-lcssa ]
  %.02735.epil = phi i1 [ %spec.select.epil, %.lr.ph38.epil ], [ %.02735.unr, %.lr.ph47.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph38.epil ], [ 0, %.lr.ph47.preheader.unr-lcssa ]
  %46 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %.02636.epil
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = icmp ne i64 %47, %45
  %spec.select.epil = select i1 %48, i1 %.02735.epil, i1 false
  %49 = add nuw nsw i64 %.02636.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 %.lr.ph47.preheader, label %.lr.ph38.epil, !llvm.loop !14

.lr.ph47.preheader:                               ; preds = %.lr.ph38.epil, %.lr.ph47.preheader.unr-lcssa
  %spec.select.lcssa = phi i1 [ %spec.select.lcssa.ph, %.lr.ph47.preheader.unr-lcssa ], [ %spec.select.epil, %.lr.ph38.epil ]
  br label %.lr.ph47

50:                                               ; preds = %.loopexit
  %51 = add nuw nsw i64 %.02546, 1
  %.not31.not = icmp slt i64 %.02546, %53
  br i1 %.not31.not, label %.lr.ph47, label %._crit_edge48, !llvm.loop !16

.lr.ph47:                                         ; preds = %.lr.ph47.preheader, %50
  %.02546 = phi i64 [ %51, %50 ], [ 2, %.lr.ph47.preheader ]
  %52 = getelementptr inbounds i64, ptr @occ, i64 %.02546
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !17
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @occ, ptr noundef nonnull %52, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %53 = load i64, ptr @N, align 8, !tbaa !8
  %54 = icmp sgt i64 %53, 0
  br i1 %54, label %.lr.ph42.preheader, label %.preheader

.lr.ph42.preheader:                               ; preds = %.lr.ph47
  %xtraiter69 = and i64 %53, 1
  %55 = icmp eq i64 %53, 1
  br i1 %55, label %.preheader.loopexit.unr-lcssa, label %.lr.ph42.preheader.new

.lr.ph42.preheader.new:                           ; preds = %.lr.ph42.preheader
  %unroll_iter72 = and i64 %53, 9223372036854775806
  br label %.lr.ph42

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph42, %.lr.ph42.preheader
  %.02340.unr = phi i64 [ 0, %.lr.ph42.preheader ], [ %84, %.lr.ph42 ]
  %lcmp.mod71.not = icmp eq i64 %xtraiter69, 0
  br i1 %lcmp.mod71.not, label %.preheader, label %.lr.ph42.epil

.lr.ph42.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %56 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %.02340.unr
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = srem i64 %57, %.02546
  %59 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = add nsw i64 %60, 1
  store i64 %61, ptr %59, align 8, !tbaa !8
  br label %.preheader

.preheader:                                       ; preds = %.lr.ph42.epil, %.preheader.loopexit.unr-lcssa, %.lr.ph47
  %min.iters.check = icmp ult i64 %.02546, 4
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader
  %.044.ph = phi i64 [ 0, %.preheader ], [ %n.vec, %middle.block ]
  %.02243.ph = phi i1 [ false, %.preheader ], [ %70, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.preheader
  %n.vec = and i64 %.02546, 9223372036854775804
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i1> [ zeroinitializer, %vector.ph ], [ %66, %vector.body ]
  %vec.phi62 = phi <2 x i1> [ zeroinitializer, %vector.ph ], [ %67, %vector.body ]
  %62 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %index
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %wide.load = load <2 x i64>, ptr %62, align 16, !tbaa !8
  %wide.load63 = load <2 x i64>, ptr %63, align 16, !tbaa !8
  %64 = icmp slt <2 x i64> %wide.load, <i64 2, i64 2>
  %65 = icmp slt <2 x i64> %wide.load63, <i64 2, i64 2>
  %66 = or <2 x i1> %vec.phi, %64
  %67 = or <2 x i1> %vec.phi62, %65
  %index.next = add nuw i64 %index, 4
  %68 = icmp eq i64 %index.next, %n.vec
  br i1 %68, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <2 x i1> %67, %66
  %bin.rdx.fr = freeze <2 x i1> %bin.rdx
  %69 = bitcast <2 x i1> %bin.rdx.fr to i2
  %70 = icmp ne i2 %69, 0
  %cmp.n = icmp eq i64 %.02546, %n.vec
  br i1 %cmp.n, label %.loopexit, label %scalar.ph.preheader

.lr.ph42:                                         ; preds = %.lr.ph42, %.lr.ph42.preheader.new
  %.02340 = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %84, %.lr.ph42 ]
  %niter73 = phi i64 [ 0, %.lr.ph42.preheader.new ], [ %niter73.next.1, %.lr.ph42 ]
  %71 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %.02340
  %72 = load i64, ptr %71, align 16, !tbaa !8
  %73 = srem i64 %72, %.02546
  %74 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = add nsw i64 %75, 1
  store i64 %76, ptr %74, align 8, !tbaa !8
  %77 = or disjoint i64 %.02340, 1
  %78 = getelementptr inbounds [100 x i64], ptr @A, i64 0, i64 %77
  %79 = load i64, ptr %78, align 8, !tbaa !8
  %80 = srem i64 %79, %.02546
  %81 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %80
  %82 = load i64, ptr %81, align 8, !tbaa !8
  %83 = add nsw i64 %82, 1
  store i64 %83, ptr %81, align 8, !tbaa !8
  %84 = add nuw nsw i64 %.02340, 2
  %niter73.next.1 = add i64 %niter73, 2
  %niter73.ncmp.1 = icmp eq i64 %niter73.next.1, %unroll_iter72
  br i1 %niter73.ncmp.1, label %.preheader.loopexit.unr-lcssa, label %.lr.ph42, !llvm.loop !22

.loopexit:                                        ; preds = %scalar.ph, %middle.block
  %spec.select32.lcssa = phi i1 [ %70, %middle.block ], [ %spec.select32, %scalar.ph ]
  br i1 %spec.select32.lcssa, label %50, label %.critedge

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.044 = phi i64 [ %88, %scalar.ph ], [ %.044.ph, %scalar.ph.preheader ]
  %.02243 = phi i1 [ %spec.select32, %scalar.ph ], [ %.02243.ph, %scalar.ph.preheader ]
  %85 = getelementptr inbounds [105 x i64], ptr @occ, i64 0, i64 %.044
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = icmp slt i64 %86, 2
  %spec.select32 = select i1 %87, i1 true, i1 %.02243
  %88 = add nuw nsw i64 %.044, 1
  %exitcond55.not = icmp eq i64 %88, %.02546
  br i1 %exitcond55.not, label %.loopexit, label %scalar.ph, !llvm.loop !23

._crit_edge48:                                    ; preds = %50
  br i1 %spec.select.lcssa, label %._crit_edge48.thread, label %.critedge

.critedge:                                        ; preds = %.loopexit, %._crit_edge48
  br label %._crit_edge48.thread

._crit_edge48.thread:                             ; preds = %._crit_edge48, %._crit_edge, %.critedge
  %.str.1.sink = phi ptr [ @.str.1, %.critedge ], [ @.str, %._crit_edge ], [ @.str, %._crit_edge48 ]
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.1.sink)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %89, i8 noundef signext 10)
  %91 = load i64, ptr @T, align 8, !tbaa !8
  %92 = add nsw i64 %91, -1
  store i64 %92, ptr @T, align 8, !tbaa !8
  %.not = icmp eq i64 %91, 0
  br i1 %.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !24

._crit_edge52:                                    ; preds = %._crit_edge48.thread, %0
  ret i32 0
}

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

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) 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 #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

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

attributes #0 = { 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 #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !12}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !10, i64 0}
!19 = distinct !{!19, !12, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12, !21, !20}
!24 = distinct !{!24, !12}


; Effective O3 passes: AggressiveInstCombinePass,BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SROAPass,SimplifyCFGPass,TailCallElimPass