; LLVM IR from abeaumont/competitive-programming :: kattis (almostsorted2)

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

@a = external dso_local global [300000 x i32], 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 [5 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 i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca [2 x i32], align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %19

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

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %50

24:                                               ; preds = %19
  %25 = 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)
  %26 = load i32, ptr %4, align 4, !tbaa !8
  %27 = icmp sgt i32 %26, 0
  br i1 %27, label %28, label %41

28:                                               ; preds = %24
  %29 = load i32, ptr %3, align 4, !tbaa !8
  %30 = load i32, ptr %4, align 4, !tbaa !8
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %35 = icmp eq i32 %29, %34
  br i1 %35, label %36, label %41

36:                                               ; preds = %28
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr %2, align 4, !tbaa !8
  %39 = load i32, ptr %4, align 4, !tbaa !8
  %40 = add nsw i32 %39, -1
  store i32 %40, ptr %4, align 4, !tbaa !8
  br label %46

41:                                               ; preds = %28, %24
  %42 = load i32, ptr %3, align 4, !tbaa !8
  %43 = load i32, ptr %4, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %44
  store i32 %42, ptr %45, align 4, !tbaa !8
  br label %46

46:                                               ; preds = %41, %36
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %4, align 4, !tbaa !8
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %4, align 4, !tbaa !8
  br label %19, !llvm.loop !11

50:                                               ; preds = %23
  %51 = load i32, ptr %2, align 4, !tbaa !8
  %52 = icmp eq i32 %51, 102
  br i1 %52, label %59, label %53

53:                                               ; preds = %50
  %54 = load i32, ptr %2, align 4, !tbaa !8
  %55 = icmp eq i32 %54, 100
  br i1 %55, label %56, label %61

56:                                               ; preds = %53
  %57 = load i32, ptr @a, align 16, !tbaa !8
  %58 = icmp sge i32 %57, 100
  br i1 %58, label %59, label %61

59:                                               ; preds = %56, %50
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %166

61:                                               ; preds = %56, %53
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #5
  store i8 1, ptr %6, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 1, ptr %7, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !8
  %62 = getelementptr inbounds i32, ptr %9, i64 1
  %63 = load i32, ptr %2, align 4, !tbaa !8
  %64 = sub nsw i32 %63, 1
  store i32 %64, ptr %62, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %65

65:                                               ; preds = %116, %61
  %66 = load i32, ptr %10, align 4, !tbaa !8
  %67 = load i32, ptr %2, align 4, !tbaa !8
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %119

70:                                               ; preds = %65
  %71 = load i8, ptr %6, align 1, !tbaa !13, !range !15, !noundef !16
  %72 = trunc i8 %71 to i1
  br i1 %72, label %73, label %94

73:                                               ; preds = %70
  %74 = load i32, ptr %10, align 4, !tbaa !8
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !8
  %78 = load i32, ptr %10, align 4, !tbaa !8
  %79 = sub nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = icmp slt i32 %77, %82
  br i1 %83, label %84, label %93

84:                                               ; preds = %73
  %85 = load i32, ptr %10, align 4, !tbaa !8
  %86 = sub nsw i32 %85, 1
  %87 = load i32, ptr %8, align 4, !tbaa !8
  %88 = srem i32 %87, 2
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 %89
  store i32 %86, ptr %90, align 4, !tbaa !8
  store i8 0, ptr %6, align 1, !tbaa !13
  %91 = load i32, ptr %8, align 4, !tbaa !8
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %8, align 4, !tbaa !8
  br label %93

93:                                               ; preds = %84, %73
  br label %115

94:                                               ; preds = %70
  %95 = load i32, ptr %10, align 4, !tbaa !8
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !8
  %99 = load i32, ptr %10, align 4, !tbaa !8
  %100 = sub nsw i32 %99, 1
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !8
  %104 = icmp sgt i32 %98, %103
  br i1 %104, label %105, label %114

105:                                              ; preds = %94
  %106 = load i32, ptr %10, align 4, !tbaa !8
  %107 = sub nsw i32 %106, 1
  %108 = load i32, ptr %8, align 4, !tbaa !8
  %109 = srem i32 %108, 2
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 %110
  store i32 %107, ptr %111, align 4, !tbaa !8
  store i8 1, ptr %6, align 1, !tbaa !13
  %112 = load i32, ptr %8, align 4, !tbaa !8
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %8, align 4, !tbaa !8
  br label %114

114:                                              ; preds = %105, %94
  br label %115

115:                                              ; preds = %114, %93
  br label %116

116:                                              ; preds = %115
  %117 = load i32, ptr %10, align 4, !tbaa !8
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %10, align 4, !tbaa !8
  br label %65, !llvm.loop !17

119:                                              ; preds = %69
  %120 = load i32, ptr %8, align 4, !tbaa !8
  %121 = icmp sgt i32 %120, 2
  br i1 %121, label %122, label %124

122:                                              ; preds = %119
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  br label %165

124:                                              ; preds = %119
  %125 = load i32, ptr %8, align 4, !tbaa !8
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %137

127:                                              ; preds = %124
  %128 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 0
  %129 = load i32, ptr %128, align 4, !tbaa !8
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i32, ptr @a, i64 %130
  %132 = getelementptr inbounds [2 x i32], ptr %9, i64 0, i64 1
  %133 = load i32, ptr %132, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds i32, ptr @a, i64 %134
  %136 = getelementptr inbounds i32, ptr %135, i64 1
  call void @_ZSt7reverseIPiEvT_S1_(ptr noundef %131, ptr noundef %136)
  br label %137

137:                                              ; preds = %127, %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 1, ptr %11, align 4, !tbaa !8
  br label %138

138:                                              ; preds = %156, %137
  %139 = load i32, ptr %11, align 4, !tbaa !8
  %140 = load i32, ptr %2, align 4, !tbaa !8
  %141 = icmp slt i32 %139, %140
  br i1 %141, label %143, label %142

142:                                              ; preds = %138
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %159

143:                                              ; preds = %138
  %144 = load i32, ptr %11, align 4, !tbaa !8
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !8
  %148 = load i32, ptr %11, align 4, !tbaa !8
  %149 = sub nsw i32 %148, 1
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !8
  %153 = icmp slt i32 %147, %152
  br i1 %153, label %154, label %155

154:                                              ; preds = %143
  store i8 0, ptr %7, align 1, !tbaa !13
  br label %155

155:                                              ; preds = %154, %143
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %11, align 4, !tbaa !8
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %11, align 4, !tbaa !8
  br label %138, !llvm.loop !18

159:                                              ; preds = %142
  %160 = load i8, ptr %7, align 1, !tbaa !13, !range !15, !noundef !16
  %161 = trunc i8 %160 to i1
  %162 = zext i1 %161 to i64
  %163 = select i1 %161, ptr @.str.1, ptr @.str
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef %163)
  store i32 0, ptr %5, align 4
  br label %165

165:                                              ; preds = %159, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #5
  br label %166

166:                                              ; preds = %165, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %167 = load i32, ptr %5, align 4
  switch i32 %167, label %170 [
    i32 0, label %168
    i32 1, label %168
  ]

168:                                              ; preds = %166, %166
  %169 = load i32, ptr %1, align 4
  ret i32 %169

170:                                              ; preds = %166
  unreachable
}

; 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: 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)) #2

; 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPiEvT_S1_(ptr noundef, ptr noundef) #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !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" }

@a = external dso_local global [300000 x i32], 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 [5 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 [2 x i32], align 4
  %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)
  %9 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %10 = 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)
  %11 = load i32, ptr %1, align 4, !tbaa !8
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph, label %.thread66

.thread66:                                        ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  br label %._crit_edge51

._crit_edge:                                      ; preds = %28
  %13 = icmp eq i32 %29, 102
  br i1 %13, label %36, label %32

.lr.ph:                                           ; preds = %0, %28
  %.03439 = phi i32 [ %30, %28 ], [ 0, %0 ]
  %14 = 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)
  %15 = icmp sgt i32 %.03439, 0
  %.pre = load i32, ptr %2, align 4, !tbaa !8
  br i1 %15, label %16, label %25

16:                                               ; preds = %.lr.ph
  %17 = add nsw i32 %.03439, -1
  %18 = zext nneg i32 %17 to i64
  %19 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !8
  %21 = icmp eq i32 %.pre, %20
  br i1 %21, label %22, label %25

22:                                               ; preds = %16
  %23 = load i32, ptr %1, align 4, !tbaa !8
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %1, align 4, !tbaa !8
  br label %28

25:                                               ; preds = %16, %.lr.ph
  %26 = sext i32 %.03439 to i64
  %27 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %26
  store i32 %.pre, ptr %27, align 4, !tbaa !8
  %.pre58 = load i32, ptr %1, align 4, !tbaa !8
  br label %28

28:                                               ; preds = %22, %25
  %29 = phi i32 [ %24, %22 ], [ %.pre58, %25 ]
  %.135 = phi i32 [ %17, %22 ], [ %.03439, %25 ]
  %30 = add nsw i32 %.135, 1
  %31 = icmp slt i32 %30, %29
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !11

32:                                               ; preds = %._crit_edge
  %33 = icmp eq i32 %29, 100
  %34 = load i32, ptr @a, align 16
  %35 = icmp sgt i32 %34, 99
  %or.cond = select i1 %33, i1 %35, i1 false
  br i1 %or.cond, label %36, label %38

36:                                               ; preds = %32, %._crit_edge
  %37 = 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)
  br label %85

38:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i32 0, ptr %3, align 4, !tbaa !8
  %39 = getelementptr inbounds i8, ptr %3, i64 4
  %40 = add nsw i32 %29, -1
  store i32 %40, ptr %39, align 4, !tbaa !8
  %41 = icmp sgt i32 %29, 1
  br i1 %41, label %.lr.ph44.preheader, label %._crit_edge51

.lr.ph44.preheader:                               ; preds = %38
  %wide.trip.count = zext nneg i32 %29 to i64
  br label %.lr.ph44

._crit_edge45:                                    ; preds = %57
  %42 = icmp sgt i32 %.1, 2
  br i1 %42, label %._crit_edge51, label %58

.lr.ph44:                                         ; preds = %.lr.ph44.preheader, %57
  %indvars.iv = phi i64 [ 1, %.lr.ph44.preheader ], [ %indvars.iv.next, %57 ]
  %.02941 = phi i32 [ 0, %.lr.ph44.preheader ], [ %.1, %57 ]
  %.03240 = phi i1 [ true, %.lr.ph44.preheader ], [ %.133, %57 ]
  %43 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %indvars.iv
  %44 = load i32, ptr %43, align 4, !tbaa !8
  %45 = add nsw i64 %indvars.iv, -1
  %46 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !8
  br i1 %.03240, label %48, label %50

48:                                               ; preds = %.lr.ph44
  %49 = icmp slt i32 %44, %47
  br i1 %49, label %.sink.split, label %57

50:                                               ; preds = %.lr.ph44
  %51 = icmp sgt i32 %44, %47
  br i1 %51, label %.sink.split, label %57

.sink.split:                                      ; preds = %50, %48
  %.133.ph = xor i1 %.03240, true
  %52 = srem i32 %.02941, 2
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [2 x i32], ptr %3, i64 0, i64 %53
  %55 = trunc nuw nsw i64 %45 to i32
  store i32 %55, ptr %54, align 4, !tbaa !8
  %56 = add nsw i32 %.02941, 1
  br label %57

57:                                               ; preds = %.sink.split, %48, %50
  %.133 = phi i1 [ true, %48 ], [ false, %50 ], [ %.133.ph, %.sink.split ]
  %.1 = phi i32 [ %.02941, %48 ], [ %.02941, %50 ], [ %56, %.sink.split ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge45, label %.lr.ph44, !llvm.loop !13

58:                                               ; preds = %._crit_edge45
  %.not = icmp eq i32 %.1, 0
  br i1 %.not, label %67, label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %3, align 4, !tbaa !8
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr @a, i64 %61
  %63 = load i32, ptr %39, align 4, !tbaa !8
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr @a, i64 %64
  %66 = getelementptr inbounds i8, ptr %65, i64 4
  call void @_ZSt7reverseIPiEvT_S1_(ptr noundef nonnull %62, ptr noundef nonnull %66)
  %.pre59 = load i32, ptr %1, align 4, !tbaa !8
  br label %67

67:                                               ; preds = %59, %58
  %68 = phi i32 [ %.pre59, %59 ], [ %29, %58 ]
  %69 = icmp sgt i32 %68, 1
  br i1 %69, label %.lr.ph50.preheader, label %._crit_edge51

.lr.ph50.preheader:                               ; preds = %67
  %wide.trip.count56 = zext nneg i32 %68 to i64
  %.pre60 = load i32, ptr @a, align 16, !tbaa !8
  %70 = add nsw i64 %wide.trip.count56, -1
  %min.iters.check = icmp ult i32 %68, 9
  br i1 %min.iters.check, label %.lr.ph50.preheader85, label %vector.ph

.lr.ph50.preheader85:                             ; preds = %middle.block, %.lr.ph50.preheader
  %.ph = phi i32 [ %.pre60, %.lr.ph50.preheader ], [ %vector.recur.extract, %middle.block ]
  %indvars.iv54.ph = phi i64 [ 1, %.lr.ph50.preheader ], [ %ind.end, %middle.block ]
  %.03047.ph = phi i1 [ true, %.lr.ph50.preheader ], [ %.not84, %middle.block ]
  br label %.lr.ph50

vector.ph:                                        ; preds = %.lr.ph50.preheader
  %n.vec = and i64 %70, -8
  %ind.end = or disjoint i64 %n.vec, 1
  %vector.recur.init = insertelement <4 x i32> poison, i32 %.pre60, i64 3
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vector.recur = phi <4 x i32> [ %vector.recur.init, %vector.ph ], [ %wide.load81, %vector.body ]
  %vec.phi = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %75, %vector.body ]
  %vec.phi80 = phi <4 x i1> [ zeroinitializer, %vector.ph ], [ %76, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %71 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %offset.idx
  %72 = getelementptr inbounds i8, ptr %71, i64 16
  %wide.load = load <4 x i32>, ptr %71, align 4, !tbaa !8
  %wide.load81 = load <4 x i32>, ptr %72, align 4, !tbaa !8
  %73 = shufflevector <4 x i32> %vector.recur, <4 x i32> %wide.load, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %74 = shufflevector <4 x i32> %wide.load, <4 x i32> %wide.load81, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
  %.not82 = icmp slt <4 x i32> %wide.load, %73
  %.not83 = icmp slt <4 x i32> %wide.load81, %74
  %75 = or <4 x i1> %vec.phi, %.not82
  %76 = or <4 x i1> %vec.phi80, %.not83
  %index.next = add nuw i64 %index, 8
  %77 = icmp eq i64 %index.next, %n.vec
  br i1 %77, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %bin.rdx = or <4 x i1> %76, %75
  %bin.rdx.fr = freeze <4 x i1> %bin.rdx
  %78 = bitcast <4 x i1> %bin.rdx.fr to i4
  %.not84 = icmp eq i4 %78, 0
  %vector.recur.extract = extractelement <4 x i32> %wide.load81, i64 3
  %cmp.n = icmp eq i64 %70, %n.vec
  br i1 %cmp.n, label %._crit_edge51.loopexit, label %.lr.ph50.preheader85

._crit_edge51.loopexit:                           ; preds = %.lr.ph50, %middle.block
  %spec.select.lcssa = phi i1 [ %.not84, %middle.block ], [ %spec.select, %.lr.ph50 ]
  %79 = select i1 %spec.select.lcssa, ptr @.str.1, ptr @.str
  br label %._crit_edge51

.lr.ph50:                                         ; preds = %.lr.ph50.preheader85, %.lr.ph50
  %80 = phi i32 [ %82, %.lr.ph50 ], [ %.ph, %.lr.ph50.preheader85 ]
  %indvars.iv54 = phi i64 [ %indvars.iv.next55, %.lr.ph50 ], [ %indvars.iv54.ph, %.lr.ph50.preheader85 ]
  %.03047 = phi i1 [ %spec.select, %.lr.ph50 ], [ %.03047.ph, %.lr.ph50.preheader85 ]
  %81 = getelementptr inbounds [300000 x i32], ptr @a, i64 0, i64 %indvars.iv54
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = icmp sge i32 %82, %80
  %spec.select = select i1 %83, i1 %.03047, i1 false
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %exitcond57.not = icmp eq i64 %indvars.iv.next55, %wide.trip.count56
  br i1 %exitcond57.not, label %._crit_edge51.loopexit, label %.lr.ph50, !llvm.loop !17

._crit_edge51:                                    ; preds = %67, %._crit_edge51.loopexit, %38, %.thread66, %._crit_edge45
  %.030.lcssa.sink = phi ptr [ @.str, %._crit_edge45 ], [ @.str.1, %67 ], [ %79, %._crit_edge51.loopexit ], [ @.str.1, %38 ], [ @.str.1, %.thread66 ]
  %84 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.030.lcssa.sink)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %85

85:                                               ; preds = %._crit_edge51, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  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 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 #2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt7reverseIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #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 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }

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

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


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