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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

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

19:                                               ; preds = %110, %0
  %20 = load i32, ptr %2, align 4, !tbaa !8
  %21 = add nsw i32 %20, -1
  store i32 %21, ptr %2, align 4, !tbaa !8
  %22 = icmp ne i32 %20, 0
  br i1 %22, label %23, label %112

23:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %25 = load i32, ptr %3, align 4, !tbaa !8
  %26 = zext i32 %25 to i64
  %27 = call ptr @llvm.stacksave.p0()
  store ptr %27, ptr %4, align 8
  %28 = alloca i32, i64 %26, align 16
  store i64 %26, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !8
  br label %29

29:                                               ; preds = %39, %23
  %30 = load i32, ptr %6, align 4, !tbaa !8
  %31 = load i32, ptr %3, align 4, !tbaa !8
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %29
  %35 = load i32, ptr %6, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds i32, ptr %28, i64 %36
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %37)
  br label %39

39:                                               ; preds = %34
  %40 = load i32, ptr %6, align 4, !tbaa !8
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %6, align 4, !tbaa !8
  br label %29, !llvm.loop !11

42:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !8
  %43 = load i32, ptr %3, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr %28, i64 %44
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef %28, ptr noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %46

46:                                               ; preds = %65, %42
  %47 = load i32, ptr %9, align 4, !tbaa !8
  %48 = load i32, ptr %3, align 4, !tbaa !8
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %68

51:                                               ; preds = %46
  %52 = load i32, ptr %9, align 4, !tbaa !8
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds i32, ptr %28, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !8
  %56 = srem i32 %55, 2
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %61

58:                                               ; preds = %51
  %59 = load i32, ptr %8, align 4, !tbaa !8
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %8, align 4, !tbaa !8
  br label %64

61:                                               ; preds = %51
  %62 = load i32, ptr %7, align 4, !tbaa !8
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %7, align 4, !tbaa !8
  br label %64

64:                                               ; preds = %61, %58
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %9, align 4, !tbaa !8
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %9, align 4, !tbaa !8
  br label %46, !llvm.loop !13

68:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #7
  store i8 0, ptr %10, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !8
  br label %69

69:                                               ; preds = %88, %68
  %70 = load i32, ptr %11, align 4, !tbaa !8
  %71 = load i32, ptr %3, align 4, !tbaa !8
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %91

74:                                               ; preds = %69
  %75 = load i32, ptr %11, align 4, !tbaa !8
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds i32, ptr %28, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !8
  %79 = load i32, ptr %11, align 4, !tbaa !8
  %80 = sub nsw i32 %79, 1
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %28, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = sub nsw i32 %78, %83
  %85 = icmp eq i32 %84, 1
  br i1 %85, label %86, label %87

86:                                               ; preds = %74
  store i8 1, ptr %10, align 1, !tbaa !14
  br label %87

87:                                               ; preds = %86, %74
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %11, align 4, !tbaa !8
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %11, align 4, !tbaa !8
  br label %69, !llvm.loop !16

91:                                               ; preds = %73
  %92 = load i32, ptr %7, align 4, !tbaa !8
  %93 = srem i32 %92, 2
  %94 = load i32, ptr %8, align 4, !tbaa !8
  %95 = srem i32 %94, 2
  %96 = icmp ne i32 %93, %95
  br i1 %96, label %104, label %97

97:                                               ; preds = %91
  %98 = load i32, ptr %7, align 4, !tbaa !8
  %99 = srem i32 %98, 2
  %100 = icmp eq i32 %99, 1
  br i1 %100, label %101, label %107

101:                                              ; preds = %97
  %102 = load i8, ptr %10, align 1, !tbaa !14, !range !17, !noundef !18
  %103 = trunc i8 %102 to i1
  br i1 %103, label %107, label %104

104:                                              ; preds = %101, %91
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %106 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %105, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %110

107:                                              ; preds = %101, %97
  %108 = 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)
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %108, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %110

110:                                              ; preds = %107, %104
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  %111 = load ptr, ptr %4, align 8
  call void @llvm.stackrestore.p0(ptr %111)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %19, !llvm.loop !19

112:                                              ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6 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 willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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

!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 = !{!15, !15, i64 0}
!15 = !{!"bool", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !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" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 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 = alloca i32, align 4
  %3 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %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)
  %10 = load i32, ptr %1, align 4, !tbaa !8
  %11 = add nsw i32 %10, -1
  store i32 %11, ptr %1, align 4, !tbaa !8
  %.not42 = icmp eq i32 %10, 0
  br i1 %.not42, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %0, %._crit_edge40
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %13 = load i32, ptr %2, align 4, !tbaa !8
  %14 = zext i32 %13 to i64
  %15 = call ptr @llvm.stacksave.p0()
  %16 = alloca i32, i64 %14, align 16
  %17 = load i32, ptr %2, align 4, !tbaa !8
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %.lr.ph44.._crit_edge_crit_edge

.lr.ph44.._crit_edge_crit_edge:                   ; preds = %.lr.ph44
  %.pre = sext i32 %17 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph44.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph44.._crit_edge_crit_edge ], [ %38, %.lr.ph ]
  %19 = getelementptr inbounds i32, ptr %16, i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull %16, ptr noundef nonnull %19)
  %20 = load i32, ptr %2, align 4, !tbaa !8
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph33.preheader, label %._crit_edge40

.lr.ph33.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %20 to i64
  %min.iters.check66 = icmp ult i32 %20, 8
  br i1 %min.iters.check66, label %.lr.ph33.preheader86, label %vector.ph67

.lr.ph33.preheader86:                             ; preds = %middle.block64, %.lr.ph33.preheader
  %indvars.iv48.ph = phi i64 [ 0, %.lr.ph33.preheader ], [ %n.vec69, %middle.block64 ]
  %.01830.ph = phi i32 [ 0, %.lr.ph33.preheader ], [ %33, %middle.block64 ]
  %.02029.ph = phi i32 [ 0, %.lr.ph33.preheader ], [ %34, %middle.block64 ]
  br label %.lr.ph33

vector.ph67:                                      ; preds = %.lr.ph33.preheader
  %n.vec69 = and i64 %wide.trip.count, 2147483640
  br label %vector.body71

vector.body71:                                    ; preds = %vector.body71, %vector.ph67
  %index72 = phi i64 [ 0, %vector.ph67 ], [ %index.next79, %vector.body71 ]
  %vec.phi73 = phi <4 x i32> [ zeroinitializer, %vector.ph67 ], [ %30, %vector.body71 ]
  %vec.phi74 = phi <4 x i32> [ zeroinitializer, %vector.ph67 ], [ %31, %vector.body71 ]
  %vec.phi75 = phi <4 x i32> [ zeroinitializer, %vector.ph67 ], [ %26, %vector.body71 ]
  %vec.phi76 = phi <4 x i32> [ zeroinitializer, %vector.ph67 ], [ %27, %vector.body71 ]
  %22 = getelementptr inbounds i32, ptr %16, i64 %index72
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  %wide.load77 = load <4 x i32>, ptr %22, align 16, !tbaa !8
  %wide.load78 = load <4 x i32>, ptr %23, align 16, !tbaa !8
  %24 = and <4 x i32> %wide.load77, <i32 1, i32 1, i32 1, i32 1>
  %25 = and <4 x i32> %wide.load78, <i32 1, i32 1, i32 1, i32 1>
  %26 = add <4 x i32> %24, %vec.phi75
  %27 = add <4 x i32> %25, %vec.phi76
  %28 = xor <4 x i32> %24, <i32 1, i32 1, i32 1, i32 1>
  %29 = xor <4 x i32> %25, <i32 1, i32 1, i32 1, i32 1>
  %30 = add <4 x i32> %28, %vec.phi73
  %31 = add <4 x i32> %29, %vec.phi74
  %index.next79 = add nuw i64 %index72, 8
  %32 = icmp eq i64 %index.next79, %n.vec69
  br i1 %32, label %middle.block64, label %vector.body71, !llvm.loop !11

middle.block64:                                   ; preds = %vector.body71
  %bin.rdx80 = add <4 x i32> %31, %30
  %33 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx80)
  %bin.rdx81 = add <4 x i32> %27, %26
  %34 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx81)
  %cmp.n82 = icmp eq i64 %n.vec69, %wide.trip.count
  br i1 %cmp.n82, label %.preheader, label %.lr.ph33.preheader86

.lr.ph:                                           ; preds = %.lr.ph44, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph44 ]
  %35 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = icmp slt i64 %indvars.iv.next, %38
  br i1 %39, label %.lr.ph, label %._crit_edge, !llvm.loop !15

.preheader:                                       ; preds = %.lr.ph33, %middle.block64
  %.121.lcssa = phi i32 [ %34, %middle.block64 ], [ %.121, %.lr.ph33 ]
  %.119.lcssa = phi i32 [ %33, %middle.block64 ], [ %.119, %.lr.ph33 ]
  %.not59 = icmp eq i32 %20, 1
  br i1 %.not59, label %._crit_edge40, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %.preheader
  %wide.trip.count53 = zext nneg i32 %20 to i64
  %40 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %20, 9
  br i1 %min.iters.check, label %.lr.ph39.preheader85, label %vector.ph

.lr.ph39.preheader85:                             ; preds = %middle.block, %.lr.ph39.preheader
  %indvars.iv51.ph = phi i64 [ 1, %.lr.ph39.preheader ], [ %ind.end, %middle.block ]
  %.01637.ph = phi i1 [ false, %.lr.ph39.preheader ], [ %53, %middle.block ]
  br label %.lr.ph39

vector.ph:                                        ; preds = %.lr.ph39.preheader
  %n.vec = and i64 %40, -8
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %49, %vector.body ]
  %vec.phi60 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %50, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %41 = getelementptr inbounds i32, ptr %16, i64 %offset.idx
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <4 x i32>, ptr %41, align 4, !tbaa !8
  %wide.load61 = load <4 x i32>, ptr %42, align 4, !tbaa !8
  %43 = getelementptr i8, ptr %41, i64 -4
  %44 = getelementptr i8, ptr %41, i64 12
  %wide.load62 = load <4 x i32>, ptr %43, align 16, !tbaa !8
  %wide.load63 = load <4 x i32>, ptr %44, align 16, !tbaa !8
  %45 = sub nsw <4 x i32> %wide.load, %wide.load62
  %46 = sub nsw <4 x i32> %wide.load61, %wide.load63
  %47 = icmp eq <4 x i32> %45, <i32 1, i32 1, i32 1, i32 1>
  %48 = icmp eq <4 x i32> %46, <i32 1, i32 1, i32 1, i32 1>
  %49 = or <4 x i1> %vec.phi, %47
  %50 = or <4 x i1> %vec.phi60, %48
  %index.next = add nuw i64 %index, 8
  %51 = icmp eq i64 %index.next, %n.vec
  br i1 %51, label %middle.block, label %vector.body, !llvm.loop !16

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %50, %49
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %52 = bitcast <4 x i1> %bin.rdx.fr to i4
  %53 = icmp ne i4 %52, 0
  %cmp.n = icmp eq i64 %40, %n.vec
  br i1 %cmp.n, label %._crit_edge40, label %.lr.ph39.preheader85

.lr.ph33:                                         ; preds = %.lr.ph33.preheader86, %.lr.ph33
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %.lr.ph33 ], [ %indvars.iv48.ph, %.lr.ph33.preheader86 ]
  %.01830 = phi i32 [ %.119, %.lr.ph33 ], [ %.01830.ph, %.lr.ph33.preheader86 ]
  %.02029 = phi i32 [ %.121, %.lr.ph33 ], [ %.02029.ph, %.lr.ph33.preheader86 ]
  %54 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv48
  %55 = load i32, ptr %54, align 4, !tbaa !8
  %56 = and i32 %55, 1
  %.121 = add i32 %56, %.02029
  %57 = xor i32 %56, 1
  %.119 = add i32 %57, %.01830
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next49, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph33, !llvm.loop !17

._crit_edge40:                                    ; preds = %.lr.ph39, %middle.block, %._crit_edge, %.preheader
  %.018.lcssa58 = phi i32 [ %.119.lcssa, %.preheader ], [ 0, %._crit_edge ], [ %.119.lcssa, %middle.block ], [ %.119.lcssa, %.lr.ph39 ]
  %.020.lcssa57 = phi i32 [ %.121.lcssa, %.preheader ], [ 0, %._crit_edge ], [ %.121.lcssa, %middle.block ], [ %.121.lcssa, %.lr.ph39 ]
  %.016.lcssa = phi i1 [ false, %.preheader ], [ false, %._crit_edge ], [ %53, %middle.block ], [ %spec.select, %.lr.ph39 ]
  %58 = srem i32 %.020.lcssa57, 2
  %59 = srem i32 %.018.lcssa58, 2
  %.not25 = icmp eq i32 %58, %59
  %60 = icmp ne i32 %58, 1
  %brmerge = select i1 %60, i1 true, i1 %.016.lcssa
  %or.cond = select i1 %.not25, i1 %brmerge, i1 false
  %.str.1..str = select i1 %or.cond, ptr @.str.1, ptr @.str
  %61 = 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..str)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %15)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %63 = load i32, ptr %1, align 4, !tbaa !8
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr %1, align 4, !tbaa !8
  %.not = icmp eq i32 %63, 0
  br i1 %.not, label %._crit_edge45, label %.lr.ph44, !llvm.loop !18

.lr.ph39:                                         ; preds = %.lr.ph39.preheader85, %.lr.ph39
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %.lr.ph39 ], [ %indvars.iv51.ph, %.lr.ph39.preheader85 ]
  %.01637 = phi i1 [ %spec.select, %.lr.ph39 ], [ %.01637.ph, %.lr.ph39.preheader85 ]
  %65 = getelementptr inbounds i32, ptr %16, i64 %indvars.iv51
  %66 = load i32, ptr %65, align 4, !tbaa !8
  %67 = getelementptr i8, ptr %65, i64 -4
  %68 = load i32, ptr %67, align 4, !tbaa !8
  %69 = sub nsw i32 %66, %68
  %70 = icmp eq i32 %69, 1
  %spec.select = select i1 %70, i1 true, i1 %.01637
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond54.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count53
  br i1 %exitcond54.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !19

._crit_edge45:                                    ; preds = %._crit_edge40, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

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

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

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

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 #1

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) 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

; 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 #6 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: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #7

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


; 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,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass