; LLVM IR from eyangch/competitive-programming :: Codeforces/1341 (b)

; 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 [2 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 i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %15 = 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 %16

16:                                               ; preds = %157, %0
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr %2, align 4, !tbaa !5
  %19 = icmp ne i32 %17, 0
  br i1 %19, label %20, label %166

20:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %21 = 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)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = zext i32 %23 to i64
  %25 = call ptr @llvm.stacksave.p0()
  store ptr %25, ptr %5, align 8
  %26 = alloca i32, i64 %24, align 16
  store i64 %24, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %37, %20
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

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

32:                                               ; preds = %27
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds i32, ptr %26, i64 %34
  %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)
  br label %37

37:                                               ; preds = %32
  %38 = load i32, ptr %7, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %7, align 4, !tbaa !5
  br label %27, !llvm.loop !9

40:                                               ; preds = %31
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = zext i32 %41 to i64
  %43 = alloca i8, i64 %42, align 16
  store i64 %42, ptr %8, align 8
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i8, ptr %43, i64 %46
  store i8 0, ptr %47, align 1, !tbaa !11
  %48 = getelementptr inbounds i8, ptr %43, i64 0
  store i8 0, ptr %48, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %86, %40
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sub nsw i32 %51, 1
  %53 = icmp slt i32 %50, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %89

55:                                               ; preds = %49
  %56 = load i32, ptr %9, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %26, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds i32, ptr %26, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp sgt i32 %59, %64
  br i1 %65, label %66, label %81

66:                                               ; preds = %55
  %67 = load i32, ptr %9, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i32, ptr %26, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds i32, ptr %26, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = icmp sgt i32 %70, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %66
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds i8, ptr %43, i64 %79
  store i8 1, ptr %80, align 1, !tbaa !11
  br label %85

81:                                               ; preds = %66, %55
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds i8, ptr %43, i64 %83
  store i8 0, ptr %84, align 1, !tbaa !11
  br label %85

85:                                               ; preds = %81, %77
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %9, align 4, !tbaa !5
  br label %49, !llvm.loop !13

89:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %105, %89
  %91 = load i32, ptr %13, align 4, !tbaa !5
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = icmp slt i32 %91, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %108

96:                                               ; preds = %90
  %97 = load i32, ptr %13, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds i8, ptr %43, i64 %98
  %100 = load i8, ptr %99, align 1, !tbaa !11, !range !14, !noundef !15
  %101 = trunc i8 %100 to i1
  %102 = zext i1 %101 to i32
  %103 = load i32, ptr %12, align 4, !tbaa !5
  %104 = add nsw i32 %103, %102
  store i32 %104, ptr %12, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %96
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %13, align 4, !tbaa !5
  br label %90, !llvm.loop !16

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

109:                                              ; preds = %144, %108
  %110 = load i32, ptr %14, align 4, !tbaa !5
  %111 = load i32, ptr %4, align 4, !tbaa !5
  %112 = add nsw i32 %110, %111
  %113 = sub nsw i32 %112, 1
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = icmp sle i32 %113, %114
  br i1 %115, label %117, label %116

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

117:                                              ; preds = %109
  %118 = load i32, ptr %12, align 4, !tbaa !5
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = icmp sgt i32 %118, %119
  br i1 %120, label %121, label %124

121:                                              ; preds = %117
  %122 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %122, ptr %10, align 4, !tbaa !5
  %123 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %123, ptr %11, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %121, %117
  %125 = load i32, ptr %14, align 4, !tbaa !5
  %126 = load i32, ptr %4, align 4, !tbaa !5
  %127 = add nsw i32 %125, %126
  %128 = sub nsw i32 %127, 2
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i8, ptr %43, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !11, !range !14, !noundef !15
  %132 = trunc i8 %131 to i1
  %133 = zext i1 %132 to i32
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = add nsw i32 %134, %133
  store i32 %135, ptr %12, align 4, !tbaa !5
  %136 = load i32, ptr %14, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i8, ptr %43, i64 %137
  %139 = load i8, ptr %138, align 1, !tbaa !11, !range !14, !noundef !15
  %140 = trunc i8 %139 to i1
  %141 = zext i1 %140 to i32
  %142 = load i32, ptr %12, align 4, !tbaa !5
  %143 = sub nsw i32 %142, %141
  store i32 %143, ptr %12, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %124
  %145 = load i32, ptr %14, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %14, align 4, !tbaa !5
  br label %109, !llvm.loop !17

147:                                              ; preds = %116
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = load i32, ptr %10, align 4, !tbaa !5
  %150 = icmp sgt i32 %148, %149
  br i1 %150, label %151, label %157

151:                                              ; preds = %147
  %152 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %152, ptr %10, align 4, !tbaa !5
  %153 = load i32, ptr %3, align 4, !tbaa !5
  %154 = load i32, ptr %4, align 4, !tbaa !5
  %155 = sub nsw i32 %154, 2
  %156 = sub nsw i32 %153, %155
  store i32 %156, ptr %11, align 4, !tbaa !5
  br label %157

157:                                              ; preds = %151, %147
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %159)
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %160, ptr noundef @.str)
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %161, i32 noundef %162)
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %163, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %165 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %165)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %16, !llvm.loop !18

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

; 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: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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) #5 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 willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { 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 = { nocallback nofree nosync nounwind willreturn }
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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; 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 [2 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 = alloca i32, align 4
  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
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr %1, align 4, !tbaa !5
  %.not67 = icmp eq i32 %5, 0
  br i1 %.not67, label %._crit_edge70, label %.lr.ph69

.lr.ph69:                                         ; preds = %0, %._crit_edge63
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %7 = 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)
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = call ptr @llvm.stacksave.p0()
  %12 = alloca i32, i64 %10, align 16
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph69
  %.pre = sext i32 %13 to i64
  %15 = zext i32 %13 to i64
  %16 = alloca i8, i64 %15, align 16
  %17 = getelementptr i8, ptr %16, i64 %.pre
  %18 = getelementptr i8, ptr %17, i64 -1
  store i8 0, ptr %18, align 1, !tbaa !9
  store i8 0, ptr %16, align 16, !tbaa !9
  br label %.preheader46

._crit_edge:                                      ; preds = %.lr.ph
  %19 = zext i32 %29 to i64
  %20 = alloca i8, i64 %19, align 16
  %21 = getelementptr i8, ptr %20, i64 %30
  %22 = getelementptr i8, ptr %21, i64 -1
  store i8 0, ptr %22, align 1, !tbaa !9
  store i8 0, ptr %20, align 16, !tbaa !9
  %23 = icmp sgt i32 %29, 2
  br i1 %23, label %.lr.ph51.preheader, label %.preheader46

.lr.ph51.preheader:                               ; preds = %._crit_edge
  %24 = add nsw i32 %29, -1
  %wide.trip.count = zext i32 %24 to i64
  %25 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %25, 1
  %26 = icmp eq i32 %24, 2
  br i1 %26, label %.preheader46.loopexit.unr-lcssa, label %.lr.ph51.preheader.new

.lr.ph51.preheader.new:                           ; preds = %.lr.ph51.preheader
  %unroll_iter = and i64 %25, -2
  br label %.lr.ph51

.lr.ph:                                           ; preds = %.lr.ph69, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph69 ]
  %27 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %27)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader46.loopexit.unr-lcssa:                  ; preds = %75, %.lr.ph51.preheader
  %indvars.iv75.unr = phi i64 [ 1, %.lr.ph51.preheader ], [ %indvars.iv.next76.1, %75 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader46, label %.lr.ph51.epil

.lr.ph51.epil:                                    ; preds = %.preheader46.loopexit.unr-lcssa
  %32 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv75.unr
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr i8, ptr %32, i64 -4
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp sgt i32 %33, %35
  br i1 %36, label %37, label %41

37:                                               ; preds = %.lr.ph51.epil
  %38 = getelementptr inbounds i8, ptr %32, i64 4
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp sgt i32 %33, %39
  br i1 %40, label %.preheader46.loopexit.epilog-lcssa, label %41

41:                                               ; preds = %37, %.lr.ph51.epil
  br label %.preheader46.loopexit.epilog-lcssa

.preheader46.loopexit.epilog-lcssa:               ; preds = %41, %37
  %.sink.epil = phi i8 [ 0, %41 ], [ 1, %37 ]
  %42 = getelementptr inbounds i8, ptr %20, i64 %indvars.iv75.unr
  store i8 %.sink.epil, ptr %42, align 1, !tbaa !9
  br label %.preheader46

.preheader46:                                     ; preds = %.preheader46.loopexit.epilog-lcssa, %.preheader46.loopexit.unr-lcssa, %._crit_edge.thread, %._crit_edge
  %43 = phi ptr [ %16, %._crit_edge.thread ], [ %20, %._crit_edge ], [ %20, %.preheader46.loopexit.unr-lcssa ], [ %20, %.preheader46.loopexit.epilog-lcssa ]
  %.lcssa88 = phi i32 [ %13, %._crit_edge.thread ], [ %29, %._crit_edge ], [ %29, %.preheader46.loopexit.unr-lcssa ], [ %29, %.preheader46.loopexit.epilog-lcssa ]
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = icmp sgt i32 %44, 2
  br i1 %45, label %.lr.ph54.preheader, label %.preheader

.lr.ph54.preheader:                               ; preds = %.preheader46
  %46 = add nsw i32 %44, -1
  %wide.trip.count81 = zext nneg i32 %46 to i64
  %47 = add nsw i64 %wide.trip.count81, -1
  %min.iters.check = icmp ult i64 %47, 8
  br i1 %min.iters.check, label %.lr.ph54.preheader98, label %vector.ph

.lr.ph54.preheader98:                             ; preds = %middle.block, %.lr.ph54.preheader
  %indvars.iv78.ph = phi i64 [ 1, %.lr.ph54.preheader ], [ %ind.end, %middle.block ]
  %.03152.ph = phi i32 [ 0, %.lr.ph54.preheader ], [ %55, %middle.block ]
  br label %.lr.ph54

vector.ph:                                        ; preds = %.lr.ph54.preheader
  %n.vec = and i64 %47, -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 i32> [ zeroinitializer, %vector.ph ], [ %52, %vector.body ]
  %vec.phi96 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %53, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %48 = getelementptr inbounds i8, ptr %43, i64 %offset.idx
  %49 = getelementptr inbounds i8, ptr %48, i64 4
  %wide.load = load <4 x i8>, ptr %48, align 1, !tbaa !9
  %wide.load97 = load <4 x i8>, ptr %49, align 1, !tbaa !9
  %50 = zext <4 x i8> %wide.load to <4 x i32>
  %51 = zext <4 x i8> %wide.load97 to <4 x i32>
  %52 = add <4 x i32> %vec.phi, %50
  %53 = add <4 x i32> %vec.phi96, %51
  %index.next = add nuw i64 %index, 8
  %54 = icmp eq i64 %index.next, %n.vec
  br i1 %54, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %53, %52
  %55 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %47, %n.vec
  br i1 %cmp.n, label %.preheader, label %.lr.ph54.preheader98

.lr.ph51:                                         ; preds = %75, %.lr.ph51.preheader.new
  %indvars.iv75 = phi i64 [ 1, %.lr.ph51.preheader.new ], [ %indvars.iv.next76.1, %75 ]
  %niter = phi i64 [ 0, %.lr.ph51.preheader.new ], [ %niter.next.1, %75 ]
  %56 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv75
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = getelementptr i8, ptr %56, i64 -4
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp sgt i32 %57, %59
  br i1 %60, label %61, label %65

61:                                               ; preds = %.lr.ph51
  %62 = getelementptr inbounds i8, ptr %56, i64 4
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp sgt i32 %57, %63
  br i1 %64, label %.lr.ph51.1, label %65

65:                                               ; preds = %61, %.lr.ph51
  br label %.lr.ph51.1

.lr.ph51.1:                                       ; preds = %61, %65
  %.sink = phi i8 [ 0, %65 ], [ 1, %61 ]
  %66 = getelementptr inbounds i8, ptr %20, i64 %indvars.iv75
  store i8 %.sink, ptr %66, align 1, !tbaa !9
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %67 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv.next76
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp sgt i32 %68, %57
  br i1 %69, label %70, label %74

70:                                               ; preds = %.lr.ph51.1
  %71 = getelementptr inbounds i8, ptr %67, i64 4
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp sgt i32 %68, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70, %.lr.ph51.1
  br label %75

75:                                               ; preds = %74, %70
  %.sink.1 = phi i8 [ 0, %74 ], [ 1, %70 ]
  %76 = getelementptr inbounds i8, ptr %20, i64 %indvars.iv.next76
  store i8 %.sink.1, ptr %76, align 1, !tbaa !9
  %indvars.iv.next76.1 = add nuw nsw i64 %indvars.iv75, 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 %.preheader46.loopexit.unr-lcssa, label %.lr.ph51, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph54, %middle.block, %.preheader46
  %.031.lcssa = phi i32 [ 0, %.preheader46 ], [ %55, %middle.block ], [ %81, %.lr.ph54 ]
  %invariant.gep = getelementptr i8, ptr %43, i64 -2
  %.not4257 = icmp sgt i32 %44, %.lcssa88
  br i1 %.not4257, label %._crit_edge63, label %.lr.ph62.preheader

.lr.ph62.preheader:                               ; preds = %.preheader
  %77 = add nsw i32 %44, 1
  br label %.lr.ph62

.lr.ph54:                                         ; preds = %.lr.ph54.preheader98, %.lr.ph54
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %.lr.ph54 ], [ %indvars.iv78.ph, %.lr.ph54.preheader98 ]
  %.03152 = phi i32 [ %81, %.lr.ph54 ], [ %.03152.ph, %.lr.ph54.preheader98 ]
  %78 = getelementptr inbounds i8, ptr %43, i64 %indvars.iv78
  %79 = load i8, ptr %78, align 1, !tbaa !9, !range !17, !noundef !18
  %80 = zext nneg i8 %79 to i32
  %81 = add nuw nsw i32 %.03152, %80
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %exitcond82.not = icmp eq i64 %indvars.iv.next79, %wide.trip.count81
  br i1 %exitcond82.not, label %.preheader, label %.lr.ph54, !llvm.loop !19

._crit_edge63:                                    ; preds = %.lr.ph62, %.preheader
  %.034.lcssa = phi i32 [ 0, %.preheader ], [ %spec.select, %.lr.ph62 ]
  %.032.lcssa = phi i32 [ 1, %.preheader ], [ %spec.select43, %.lr.ph62 ]
  %.1.lcssa = phi i32 [ %.031.lcssa, %.preheader ], [ %100, %.lr.ph62 ]
  %82 = icmp sgt i32 %.1.lcssa, %.034.lcssa
  %.neg45 = add i32 %.lcssa88, 2
  %83 = sub i32 %.neg45, %44
  %.236 = call i32 @llvm.smax.i32(i32 %.1.lcssa, i32 %.034.lcssa)
  %.2 = select i1 %82, i32 %83, i32 %.032.lcssa
  %84 = add nuw nsw i32 %.236, 1
  %85 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %84)
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef nonnull @.str)
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %86, i32 noundef %.2)
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.stackrestore.p0(ptr %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %89 = load i32, ptr %1, align 4, !tbaa !5
  %90 = add nsw i32 %89, -1
  store i32 %90, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %89, 0
  br i1 %.not, label %._crit_edge70, label %.lr.ph69, !llvm.loop !20

.lr.ph62:                                         ; preds = %.lr.ph62.preheader, %.lr.ph62
  %indvars.iv83 = phi i64 [ 1, %.lr.ph62.preheader ], [ %indvars.iv.next84, %.lr.ph62 ]
  %91 = phi i32 [ %77, %.lr.ph62.preheader ], [ %103, %.lr.ph62 ]
  %.160 = phi i32 [ %.031.lcssa, %.lr.ph62.preheader ], [ %100, %.lr.ph62 ]
  %.03259 = phi i32 [ 1, %.lr.ph62.preheader ], [ %spec.select43, %.lr.ph62 ]
  %.03458 = phi i32 [ 0, %.lr.ph62.preheader ], [ %spec.select, %.lr.ph62 ]
  %indvars85 = trunc i64 %indvars.iv83 to i32
  %92 = icmp sgt i32 %.160, %.03458
  %spec.select = call i32 @llvm.smax.i32(i32 %.160, i32 %.03458)
  %spec.select43 = select i1 %92, i32 %indvars85, i32 %.03259
  %93 = sext i32 %91 to i64
  %gep = getelementptr i8, ptr %invariant.gep, i64 %93
  %94 = load i8, ptr %gep, align 1, !tbaa !9, !range !17, !noundef !18
  %95 = zext nneg i8 %94 to i32
  %96 = add nsw i32 %.160, %95
  %97 = getelementptr inbounds i8, ptr %43, i64 %indvars.iv83
  %98 = load i8, ptr %97, align 1, !tbaa !9, !range !17, !noundef !18
  %99 = zext nneg i8 %98 to i32
  %100 = sub i32 %96, %99
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %101 = add i32 %44, %indvars85
  %.not42 = icmp sgt i32 %101, %.lcssa88
  %102 = trunc i64 %indvars.iv.next84 to i32
  %103 = add i32 %44, %102
  br i1 %.not42, label %._crit_edge63, label %.lr.ph62, !llvm.loop !21

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

; 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 nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

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

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

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

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 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = { 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 }

!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 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !12, !15, !14}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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