; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/345 Division 1/Problem B/B.ll (Z5solvev)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@n = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@T = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@t = external dso_local global [500100 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z5solvev() #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %24, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %27

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %22
  store i32 1000000000, ptr %23, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %20
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

27:                                               ; preds = %19
  %28 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %29 = load i8, ptr %28, align 1, !tbaa !11
  %30 = sext i8 %29 to i32
  %31 = icmp eq i32 %30, 119
  br i1 %31, label %32, label %34

32:                                               ; preds = %27
  %33 = load i32, ptr @b, align 4, !tbaa !5
  br label %35

34:                                               ; preds = %27
  br label %35

35:                                               ; preds = %34, %32
  %36 = phi i32 [ %33, %32 ], [ 0, %34 ]
  %37 = add nsw i32 1, %36
  store i32 %37, ptr @t, align 16, !tbaa !5
  %38 = load i32, ptr @t, align 16, !tbaa !5
  %39 = load i32, ptr @T, align 4, !tbaa !5
  %40 = icmp sgt i32 %38, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %35
  store i32 0, ptr %1, align 4
  br label %168

42:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %81, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 5, ptr %5, align 4
  br label %84

48:                                               ; preds = %43
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr @a, align 4, !tbaa !5
  %55 = add nsw i32 %53, %54
  %56 = add nsw i32 %55, 1
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %58)
  %60 = load i8, ptr %59, align 1, !tbaa !11
  %61 = sext i8 %60 to i32
  %62 = icmp eq i32 %61, 119
  br i1 %62, label %63, label %65

63:                                               ; preds = %48
  %64 = load i32, ptr @b, align 4, !tbaa !5
  br label %66

65:                                               ; preds = %48
  br label %66

66:                                               ; preds = %65, %63
  %67 = phi i32 [ %64, %63 ], [ 0, %65 ]
  %68 = add nsw i32 %56, %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %70
  store i32 %68, ptr %71, align 4, !tbaa !5
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = load i32, ptr @T, align 4, !tbaa !5
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %66
  store i32 5, ptr %5, align 4
  br label %84

79:                                               ; preds = %66
  %80 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %80, ptr %3, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %79
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %4, align 4, !tbaa !5
  br label %43, !llvm.loop !12

84:                                               ; preds = %78, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %85

85:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = add nsw i32 1, %86
  store i32 %87, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = sub nsw i32 %88, 1
  store i32 %89, ptr %8, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %162, %85
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = icmp sgt i32 %91, 0
  br i1 %92, label %94, label %93

93:                                               ; preds = %90
  store i32 8, ptr %5, align 4
  br label %165

94:                                               ; preds = %90
  %95 = load i32, ptr %8, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %96)
  %98 = load i8, ptr %97, align 1, !tbaa !11
  %99 = sext i8 %98 to i32
  %100 = icmp eq i32 %99, 119
  br i1 %100, label %101, label %108

101:                                              ; preds = %94
  %102 = load i32, ptr @a, align 4, !tbaa !5
  %103 = load i32, ptr @b, align 4, !tbaa !5
  %104 = add nsw i32 %102, %103
  %105 = add nsw i32 %104, 1
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = add nsw i32 %106, %105
  store i32 %107, ptr %7, align 4, !tbaa !5
  br label %113

108:                                              ; preds = %94
  %109 = load i32, ptr @a, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = add nsw i32 %111, %110
  store i32 %112, ptr %7, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %108, %101
  %114 = load i32, ptr %7, align 4, !tbaa !5
  %115 = load i32, ptr @t, align 16, !tbaa !5
  %116 = add nsw i32 %114, %115
  %117 = load i32, ptr @T, align 4, !tbaa !5
  %118 = icmp sgt i32 %116, %117
  br i1 %118, label %119, label %120

119:                                              ; preds = %113
  store i32 8, ptr %5, align 4
  br label %165

120:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %121 = load i32, ptr @n, align 4, !tbaa !5
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sub nsw i32 %121, %122
  %124 = add nsw i32 1, %123
  store i32 %124, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %125 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %125, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  br label %126

126:                                              ; preds = %155, %120
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  %129 = load i32, ptr %11, align 4, !tbaa !5
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %131, label %156

131:                                              ; preds = %126
  %132 = load i32, ptr %10, align 4, !tbaa !5
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = add nsw i32 %132, %133
  %135 = ashr i32 %134, 1
  store i32 %135, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = load i32, ptr @a, align 4, !tbaa !5
  %138 = load i32, ptr @n, align 4, !tbaa !5
  %139 = load i32, ptr %8, align 4, !tbaa !5
  %140 = sub nsw i32 %138, %139
  %141 = mul nsw i32 %137, %140
  %142 = add nsw i32 %136, %141
  %143 = load i32, ptr %12, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = add nsw i32 %142, %146
  store i32 %147, ptr %13, align 4, !tbaa !5
  %148 = load i32, ptr %13, align 4, !tbaa !5
  %149 = load i32, ptr @T, align 4, !tbaa !5
  %150 = icmp sle i32 %148, %149
  br i1 %150, label %151, label %153

151:                                              ; preds = %131
  %152 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %152, ptr %10, align 4, !tbaa !5
  br label %155

153:                                              ; preds = %131
  %154 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %154, ptr %11, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %153, %151
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %126, !llvm.loop !13

156:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %157 = load i32, ptr %9, align 4, !tbaa !5
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = add nsw i32 %157, %158
  store i32 %159, ptr %14, align 4, !tbaa !5
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %161 = load i32, ptr %160, align 4, !tbaa !5
  store i32 %161, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %162

162:                                              ; preds = %156
  %163 = load i32, ptr %8, align 4, !tbaa !5
  %164 = add nsw i32 %163, -1
  store i32 %164, ptr %8, align 4, !tbaa !5
  br label %90, !llvm.loop !14

165:                                              ; preds = %119, %93
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %167, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %168

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 #4 = { 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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@n = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global i32, align 4
@b = external dso_local local_unnamed_addr global i32, align 4
@T = external dso_local local_unnamed_addr global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@t = external dso_local local_unnamed_addr global [500100 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 1
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %wide.trip.count = zext nneg i32 %3 to i64
  %5 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %3, 9
  br i1 %min.iters.check, label %.lr.ph.preheader71, label %vector.ph

.lr.ph.preheader71:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 1, %.lr.ph.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %5, -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 ]
  %offset.idx = or disjoint i64 %index, 1
  %6 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %offset.idx
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %6, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %7, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %8 = icmp eq i64 %index.next, %n.vec
  br i1 %8, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %5, %n.vec
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph.preheader71

._crit_edge:                                      ; preds = %.lr.ph, %middle.block, %0
  %9 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef 0)
  %10 = load i8, ptr %9, align 1, !tbaa !13
  %11 = icmp eq i8 %10, 119
  %12 = load i32, ptr @b, align 4
  %13 = add nsw i32 %12, 1
  %14 = select i1 %11, i32 %13, i32 1
  store i32 %14, ptr @t, align 16, !tbaa !5
  %15 = load i32, ptr @T, align 4, !tbaa !5
  %16 = icmp sgt i32 %14, %15
  br i1 %16, label %71, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %.lr.ph44, label %._crit_edge45.thread

._crit_edge45.thread:                             ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  br label %._crit_edge59

.lr.ph:                                           ; preds = %.lr.ph.preheader71, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader71 ]
  %19 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %indvars.iv
  store i32 1000000000, ptr %19, align 4, !tbaa !5
  %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_edge, label %.lr.ph, !llvm.loop !14

20:                                               ; preds = %.lr.ph44
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %21 = sext i32 %.pre.pre to i64
  %22 = icmp slt i64 %indvars.iv.next63, %21
  %23 = trunc nuw nsw i64 %indvars.iv62 to i32
  br i1 %22, label %.lr.ph44, label %._crit_edge45, !llvm.loop !15

.lr.ph44:                                         ; preds = %.preheader, %20
  %24 = phi i32 [ %33, %20 ], [ %14, %.preheader ]
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %20 ], [ 1, %.preheader ]
  %.03643 = phi i32 [ %23, %20 ], [ 0, %.preheader ]
  %25 = load i32, ptr @a, align 4, !tbaa !5
  %26 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv62)
  %27 = load i8, ptr %26, align 1, !tbaa !13
  %28 = icmp eq i8 %27, 119
  %29 = load i32, ptr @b, align 4
  %30 = select i1 %28, i32 %29, i32 0
  %31 = add i32 %24, 1
  %32 = add i32 %31, %25
  %33 = add nsw i32 %32, %30
  %34 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %indvars.iv62
  store i32 %33, ptr %34, align 4, !tbaa !5
  %35 = load i32, ptr @T, align 4, !tbaa !5
  %36 = icmp sgt i32 %33, %35
  %.pre.pre = load i32, ptr @n, align 4, !tbaa !5
  br i1 %36, label %._crit_edge45, label %20

._crit_edge45:                                    ; preds = %20, %.lr.ph44
  %.036.lcssa.ph = phi i32 [ %23, %20 ], [ %.03643, %.lr.ph44 ]
  %37 = add nuw nsw i32 %.036.lcssa.ph, 1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  store i32 %37, ptr %1, align 4, !tbaa !5
  %38 = icmp sgt i32 %.pre.pre, 1
  br i1 %38, label %.lr.ph58.preheader, label %._crit_edge59

.lr.ph58.preheader:                               ; preds = %._crit_edge45
  %39 = zext nneg i32 %.pre.pre to i64
  br label %.lr.ph58

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %._crit_edge52
  %indvars.iv65 = phi i64 [ %39, %.lr.ph58.preheader ], [ %indvars.iv.next66, %._crit_edge52 ]
  %.03855 = phi i32 [ 0, %.lr.ph58.preheader ], [ %.139, %._crit_edge52 ]
  %indvars.iv.next66 = add nsw i64 %indvars.iv65, -1
  %40 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv.next66)
  %41 = load i8, ptr %40, align 1, !tbaa !13
  %42 = icmp eq i8 %41, 119
  %43 = load i32, ptr @a, align 4
  %44 = load i32, ptr @b, align 4
  %45 = select i1 %42, i32 %44, i32 0
  %.pn.in = add i32 %.03855, 1
  %.pn = add i32 %.pn.in, %43
  %.139 = add i32 %.pn, %45
  %46 = load i32, ptr @t, align 16, !tbaa !5
  %47 = add nsw i32 %.139, %46
  %48 = load i32, ptr @T, align 4, !tbaa !5
  %49 = icmp sgt i32 %47, %48
  br i1 %49, label %.lr.ph58.._crit_edge59.loopexit_crit_edge, label %50

.lr.ph58.._crit_edge59.loopexit_crit_edge:        ; preds = %.lr.ph58
  %.pre68.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge59

50:                                               ; preds = %.lr.ph58
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = trunc nuw nsw i64 %indvars.iv.next66 to i32
  %53 = sub nsw i32 %51, %52
  %54 = add nsw i32 %53, 1
  %55 = icmp ugt i64 %indvars.iv65, 2
  br i1 %55, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %50
  %56 = mul nsw i32 %53, %43
  %57 = add nsw i32 %56, %.139
  br label %58

58:                                               ; preds = %.lr.ph51, %58
  %.03349 = phi i32 [ %52, %.lr.ph51 ], [ %..033, %58 ]
  %.03448 = phi i32 [ 0, %.lr.ph51 ], [ %.034., %58 ]
  %59 = add nuw nsw i32 %.03349, %.03448
  %60 = lshr i32 %59, 1
  %61 = zext nneg i32 %60 to i64
  %62 = getelementptr inbounds [500100 x i32], ptr @t, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %57, %63
  %.not = icmp sgt i32 %64, %48
  %.034. = select i1 %.not, i32 %.03448, i32 %60
  %..033 = select i1 %.not, i32 %60, i32 %.03349
  %65 = add nuw nsw i32 %.034., 1
  %66 = icmp slt i32 %65, %..033
  br i1 %66, label %58, label %._crit_edge52, !llvm.loop !16

._crit_edge52:                                    ; preds = %58, %50
  %.034.lcssa = phi i32 [ 0, %50 ], [ %.034., %58 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #3
  %67 = add nsw i32 %54, %.034.lcssa
  store i32 %67, ptr %2, align 4, !tbaa !5
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %69 = load i32, ptr %68, align 4, !tbaa !5
  store i32 %69, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #3
  br i1 %55, label %.lr.ph58, label %._crit_edge59, !llvm.loop !17

._crit_edge59:                                    ; preds = %._crit_edge52, %.lr.ph58.._crit_edge59.loopexit_crit_edge, %._crit_edge45.thread, %._crit_edge45
  %70 = phi i32 [ %37, %._crit_edge45 ], [ 1, %._crit_edge45.thread ], [ %.pre68.pre, %.lr.ph58.._crit_edge59.loopexit_crit_edge ], [ %69, %._crit_edge52 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  br label %71

71:                                               ; preds = %._crit_edge, %._crit_edge59
  %.0 = phi i32 [ %70, %._crit_edge59 ], [ 0, %._crit_edge ]
  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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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


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