; LLVM IR from Izaron/ACM-ICPC :: Russian Council of School Olympiads (R.S.O.Sh.)/IOIP/IOIP 2015/parties.ll (Z3kekv)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@sum = external dso_local global i32, align 4
@vec = external dso_local global %"class.std::vector", align 8
@can = external dso_local global i8, align 1
@n = external dso_local global i32, align 4
@ms = external dso_local global [100005 x i32], align 16

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

10:                                               ; preds = %32, %0
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  store i32 2, ptr %3, align 4
  br label %37

15:                                               ; preds = %10
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = load i32, ptr @sum, align 4, !tbaa !5
  %21 = add nsw i32 %20, %19
  store i32 %21, ptr @sum, align 4, !tbaa !5
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %23
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr @sum, align 4, !tbaa !5
  %27 = add nsw i32 %25, %26
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp eq i32 %27, %28
  br i1 %29, label %30, label %31

30:                                               ; preds = %15
  store i8 1, ptr @can, align 1, !tbaa !9
  store i32 2, ptr %3, align 4
  br label %37

31:                                               ; preds = %15
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = add nsw i32 %33, 2
  store i32 %34, ptr %1, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

37:                                               ; preds = %30, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  br label %38

38:                                               ; preds = %37
  %39 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %40 = trunc i8 %39 to i1
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  br label %144

42:                                               ; preds = %38
  store i32 0, ptr @sum, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %65, %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 %3, align 4
  br label %70

48:                                               ; preds = %43
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr @sum, align 4, !tbaa !5
  %54 = add nsw i32 %53, %52
  store i32 %54, ptr @sum, align 4, !tbaa !5
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %56
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %57)
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = load i32, ptr @sum, align 4, !tbaa !5
  %60 = add nsw i32 %58, %59
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %48
  store i8 1, ptr @can, align 1, !tbaa !9
  store i32 5, ptr %3, align 4
  br label %70

64:                                               ; preds = %48
  br label %65

65:                                               ; preds = %64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, 2
  store i32 %67, ptr %4, align 4, !tbaa !5
  %68 = load i32, ptr %5, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %5, align 4, !tbaa !5
  br label %43, !llvm.loop !15

70:                                               ; preds = %63, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %71

71:                                               ; preds = %70
  %72 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %73 = trunc i8 %72 to i1
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  br label %144

75:                                               ; preds = %71
  store i32 0, ptr @sum, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %76 = load i32, ptr @n, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %78

78:                                               ; preds = %99, %75
  %79 = load i32, ptr %6, align 4, !tbaa !5
  %80 = icmp sge i32 %79, 0
  br i1 %80, label %82, label %81

81:                                               ; preds = %78
  store i32 8, ptr %3, align 4
  br label %104

82:                                               ; preds = %78
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr @sum, align 4, !tbaa !5
  %88 = add nsw i32 %87, %86
  store i32 %88, ptr @sum, align 4, !tbaa !5
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %90
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %91)
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = load i32, ptr @sum, align 4, !tbaa !5
  %94 = add nsw i32 %92, %93
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = icmp eq i32 %94, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %82
  store i8 1, ptr @can, align 1, !tbaa !9
  store i32 8, ptr %3, align 4
  br label %104

98:                                               ; preds = %82
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sub nsw i32 %100, 2
  store i32 %101, ptr %6, align 4, !tbaa !5
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %7, align 4, !tbaa !5
  br label %78, !llvm.loop !16

104:                                              ; preds = %97, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %105

105:                                              ; preds = %104
  %106 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %107 = trunc i8 %106 to i1
  br i1 %107, label %108, label %109

108:                                              ; preds = %105
  br label %144

109:                                              ; preds = %105
  store i32 0, ptr @sum, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 2
  store i32 %111, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %133, %109
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = icmp sge i32 %113, 0
  br i1 %114, label %116, label %115

115:                                              ; preds = %112
  store i32 11, ptr %3, align 4
  br label %138

116:                                              ; preds = %112
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr @sum, align 4, !tbaa !5
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr @sum, align 4, !tbaa !5
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %124
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %125)
  %126 = load i32, ptr %9, align 4, !tbaa !5
  %127 = load i32, ptr @sum, align 4, !tbaa !5
  %128 = add nsw i32 %126, %127
  %129 = load i32, ptr @n, align 4, !tbaa !5
  %130 = icmp eq i32 %128, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %116
  store i8 1, ptr @can, align 1, !tbaa !9
  store i32 11, ptr %3, align 4
  br label %138

132:                                              ; preds = %116
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %8, align 4, !tbaa !5
  %135 = sub nsw i32 %134, 2
  store i32 %135, ptr %8, align 4, !tbaa !5
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %9, align 4, !tbaa !5
  br label %112, !llvm.loop !17

138:                                              ; preds = %131, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %139

139:                                              ; preds = %138
  %140 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %141 = trunc i8 %140 to i1
  br i1 %141, label %142, label %143

142:                                              ; preds = %139
  br label %144

143:                                              ; preds = %139
  store i32 0, ptr @sum, align 4, !tbaa !5
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #3
  br label %144

144:                                              ; preds = %143, %142, %108, %74, %41
  ret void
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; 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 dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

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 = { 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 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@sum = external dso_local local_unnamed_addr global i32, align 4
@vec = external dso_local global %"class.std::vector", align 8
@can = external dso_local local_unnamed_addr global i8, align 1
@n = external dso_local local_unnamed_addr global i32, align 4
@ms = external dso_local global [100005 x i32], align 16

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

.lr.ph.preheader:                                 ; preds = %0
  %.pre = load i32, ptr @sum, align 4, !tbaa !5
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %12
  %3 = phi i32 [ %.pre, %.lr.ph.preheader ], [ %7, %12 ]
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %12 ]
  %.02935 = phi i32 [ 1, %.lr.ph.preheader ], [ %13, %12 ]
  %4 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %indvars.iv
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = add nsw i32 %3, %5
  store i32 %6, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %7 = load i32, ptr @sum, align 4, !tbaa !5
  %8 = add nsw i32 %7, %.02935
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp eq i32 %8, %9
  br i1 %10, label %11, label %12

11:                                               ; preds = %.lr.ph
  store i8 1, ptr @can, align 1, !tbaa !9
  br label %.loopexit33

12:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %13 = add nuw nsw i32 %.02935, 1
  %14 = trunc nuw i64 %indvars.iv.next to i32
  %15 = icmp sgt i32 %9, %14
  br i1 %15, label %.lr.ph, label %.loopexit33, !llvm.loop !11

.loopexit33:                                      ; preds = %12, %0, %11
  %16 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %17 = trunc nuw i8 %16 to i1
  br i1 %17, label %74, label %18

18:                                               ; preds = %.loopexit33
  store i32 0, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #2
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %.lr.ph38.preheader, label %.loopexit32

.lr.ph38.preheader:                               ; preds = %18
  %.pre56 = load i32, ptr @sum, align 4, !tbaa !5
  br label %.lr.ph38

.lr.ph38:                                         ; preds = %.lr.ph38.preheader, %30
  %21 = phi i32 [ %.pre56, %.lr.ph38.preheader ], [ %25, %30 ]
  %indvars.iv47 = phi i64 [ 1, %.lr.ph38.preheader ], [ %indvars.iv.next48, %30 ]
  %.02737 = phi i32 [ 1, %.lr.ph38.preheader ], [ %31, %30 ]
  %22 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %indvars.iv47
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add nsw i32 %21, %23
  store i32 %24, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %22)
  %25 = load i32, ptr @sum, align 4, !tbaa !5
  %26 = add nsw i32 %25, %.02737
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp eq i32 %26, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %.lr.ph38
  store i8 1, ptr @can, align 1, !tbaa !9
  br label %.loopexit32

30:                                               ; preds = %.lr.ph38
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 2
  %31 = add nuw nsw i32 %.02737, 1
  %32 = trunc nuw i64 %indvars.iv.next48 to i32
  %33 = icmp sgt i32 %27, %32
  br i1 %33, label %.lr.ph38, label %.loopexit32, !llvm.loop !15

.loopexit32:                                      ; preds = %30, %18, %29
  %34 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %35 = trunc nuw i8 %34 to i1
  br i1 %35, label %74, label %36

36:                                               ; preds = %.loopexit32
  store i32 0, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #2
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = icmp sgt i32 %37, 0
  br i1 %38, label %.lr.ph41.preheader, label %.loopexit31

.lr.ph41.preheader:                               ; preds = %36
  %39 = add nsw i32 %37, -1
  %40 = zext nneg i32 %39 to i64
  %.pre57 = load i32, ptr @sum, align 4, !tbaa !5
  br label %.lr.ph41

.lr.ph41:                                         ; preds = %.lr.ph41.preheader, %50
  %41 = phi i32 [ %.pre57, %.lr.ph41.preheader ], [ %45, %50 ]
  %indvars.iv50 = phi i64 [ %40, %.lr.ph41.preheader ], [ %indvars.iv.next51, %50 ]
  %.02540 = phi i32 [ 1, %.lr.ph41.preheader ], [ %51, %50 ]
  %42 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %indvars.iv50
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %41, %43
  store i32 %44, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %45 = load i32, ptr @sum, align 4, !tbaa !5
  %46 = add nsw i32 %45, %.02540
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = icmp eq i32 %46, %47
  br i1 %48, label %49, label %50

49:                                               ; preds = %.lr.ph41
  store i8 1, ptr @can, align 1, !tbaa !9
  br label %.loopexit31

50:                                               ; preds = %.lr.ph41
  %indvars.iv.next51 = add nsw i64 %indvars.iv50, -2
  %51 = add nuw nsw i32 %.02540, 1
  %52 = icmp sgt i64 %indvars.iv50, 1
  br i1 %52, label %.lr.ph41, label %.loopexit31, !llvm.loop !16

.loopexit31:                                      ; preds = %50, %36, %49
  %53 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %54 = trunc nuw i8 %53 to i1
  br i1 %54, label %74, label %55

55:                                               ; preds = %.loopexit31
  store i32 0, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #2
  %56 = load i32, ptr @n, align 4, !tbaa !5
  %57 = icmp sgt i32 %56, 1
  br i1 %57, label %.lr.ph45.preheader, label %.loopexit

.lr.ph45.preheader:                               ; preds = %55
  %58 = zext nneg i32 %56 to i64
  %.pre58 = load i32, ptr @sum, align 4, !tbaa !5
  br label %.lr.ph45

59:                                               ; preds = %.lr.ph45
  %60 = add nuw nsw i32 %.043, 1
  %61 = icmp ugt i64 %indvars.iv53, 3
  br i1 %61, label %.lr.ph45, label %.loopexit, !llvm.loop !17

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %59
  %62 = phi i32 [ %.pre58, %.lr.ph45.preheader ], [ %66, %59 ]
  %indvars.iv53 = phi i64 [ %58, %.lr.ph45.preheader ], [ %indvars.iv.next54, %59 ]
  %.043 = phi i32 [ 1, %.lr.ph45.preheader ], [ %60, %59 ]
  %indvars.iv.next54 = add nsw i64 %indvars.iv53, -2
  %63 = getelementptr inbounds [100005 x i32], ptr @ms, i64 0, i64 %indvars.iv.next54
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %62, %64
  store i32 %65, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) @vec, ptr noundef nonnull align 4 dereferenceable(4) %63)
  %66 = load i32, ptr @sum, align 4, !tbaa !5
  %67 = add nsw i32 %66, %.043
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp eq i32 %67, %68
  br i1 %69, label %70, label %59

70:                                               ; preds = %.lr.ph45
  store i8 1, ptr @can, align 1, !tbaa !9
  br label %.loopexit

.loopexit:                                        ; preds = %59, %55, %70
  %71 = load i8, ptr @can, align 1, !tbaa !9, !range !13, !noundef !14
  %72 = trunc nuw i8 %71 to i1
  br i1 %72, label %74, label %73

73:                                               ; preds = %.loopexit
  store i32 0, ptr @sum, align 4, !tbaa !5
  tail call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @vec) #2
  br label %74

74:                                               ; preds = %.loopexit, %.loopexit31, %.loopexit32, %.loopexit33, %73
  ret void
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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 = { 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 = { 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 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass