; LLVM IR from kazunetakahashi/atcoder :: 2019/0831_chokudai004/A.ll (Z10calc_pointv)

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

@N = external dso_local global i32, align 4
@B = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global %"class.std::vector.0", align 8

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

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

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

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

15:                                               ; preds = %83, %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
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #2
  br label %86

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %79, %20
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = load i32, ptr @N, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  br label %82

26:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %27 = load i32, ptr %4, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %5, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %75, %26
  %30 = load i32, ptr %5, align 4, !tbaa !5
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  br label %78

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #2
  %35 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %35, ptr %7, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %51, %34
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #2
  br label %54

41:                                               ; preds = %36
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %43) #2
  %45 = load i32, ptr %7, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %44, i64 noundef %46) #2
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr %6, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %41
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %7, align 4, !tbaa !5
  br label %36, !llvm.loop !9

54:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #2
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %71, %54
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = icmp slt i32 %56, 3
  br i1 %57, label %59, label %58

58:                                               ; preds = %55
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  br label %74

59:                                               ; preds = %55
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef %62) #2
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %70

66:                                               ; preds = %59
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = load i32, ptr %1, align 4, !tbaa !5
  %69 = add nsw i32 %68, %67
  store i32 %69, ptr %1, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %66, %59
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %8, align 4, !tbaa !5
  br label %55, !llvm.loop !11

74:                                               ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %5, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %5, align 4, !tbaa !5
  br label %29, !llvm.loop !12

78:                                               ; preds = %33
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %4, align 4, !tbaa !5
  br label %21, !llvm.loop !13

82:                                               ; preds = %25
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !14

86:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #2
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %87

87:                                               ; preds = %155, %86
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr @N, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #2
  br label %158

92:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #2
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %151, %92
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = load i32, ptr @N, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #2
  br label %154

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #2
  %99 = load i32, ptr %10, align 4, !tbaa !5
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr %11, align 4, !tbaa !5
  br label %101

101:                                              ; preds = %147, %98
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = load i32, ptr @N, align 4, !tbaa !5
  %104 = icmp slt i32 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %101
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #2
  br label %150

106:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #2
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #2
  %107 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %107, ptr %13, align 4, !tbaa !5
  br label %108

108:                                              ; preds = %123, %106
  %109 = load i32, ptr %13, align 4, !tbaa !5
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #2
  br label %126

113:                                              ; preds = %108
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %115) #2
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %116, i64 noundef %118) #2
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = load i32, ptr %12, align 4, !tbaa !5
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %12, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %113
  %124 = load i32, ptr %13, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %13, align 4, !tbaa !5
  br label %108, !llvm.loop !15

126:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #2
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %143, %126
  %128 = load i32, ptr %14, align 4, !tbaa !5
  %129 = icmp slt i32 %128, 3
  br i1 %129, label %131, label %130

130:                                              ; preds = %127
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #2
  br label %146

131:                                              ; preds = %127
  %132 = load i32, ptr %12, align 4, !tbaa !5
  %133 = load i32, ptr %14, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef %134) #2
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = icmp eq i32 %132, %136
  br i1 %137, label %138, label %142

138:                                              ; preds = %131
  %139 = load i32, ptr %12, align 4, !tbaa !5
  %140 = load i32, ptr %1, align 4, !tbaa !5
  %141 = add nsw i32 %140, %139
  store i32 %141, ptr %1, align 4, !tbaa !5
  br label %142

142:                                              ; preds = %138, %131
  br label %143

143:                                              ; preds = %142
  %144 = load i32, ptr %14, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %14, align 4, !tbaa !5
  br label %127, !llvm.loop !16

146:                                              ; preds = %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #2
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %11, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %11, align 4, !tbaa !5
  br label %101, !llvm.loop !17

150:                                              ; preds = %105
  br label %151

151:                                              ; preds = %150
  %152 = load i32, ptr %10, align 4, !tbaa !5
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %10, align 4, !tbaa !5
  br label %93, !llvm.loop !18

154:                                              ; preds = %97
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %9, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %9, align 4, !tbaa !5
  br label %87, !llvm.loop !19

158:                                              ; preds = %91
  %159 = load i32, ptr %1, align 4, !tbaa !5
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #2
  ret i32 %159
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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::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 }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<int>, std::allocator<std::vector<int>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@N = external dso_local local_unnamed_addr global i32, align 4
@B = external dso_local global %"class.std::vector", align 8
@ans = external dso_local global %"class.std::vector.0", align 8

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z10calc_pointv() local_unnamed_addr #0 {
  %1 = load i32, ptr @N, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  br i1 %2, label %.preheader60, label %._crit_edge91

.preheader60:                                     ; preds = %0, %._crit_edge
  %3 = phi i32 [ %9, %._crit_edge ], [ %1, %0 ]
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %._crit_edge ], [ 0, %0 ]
  %.05272 = phi i32 [ %.1.lcssa, %._crit_edge ], [ 0, %0 ]
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph70, label %._crit_edge

.preheader56:                                     ; preds = %._crit_edge
  %5 = icmp sgt i32 %9, 0
  br i1 %5, label %.preheader55, label %._crit_edge91

.loopexit59.loopexit:                             ; preds = %.preheader57
  %.pre = sext i32 %29 to i64
  br label %.loopexit59

.loopexit59:                                      ; preds = %.loopexit59.loopexit, %.lr.ph70
  %.pre-phi = phi i64 [ %.pre, %.loopexit59.loopexit ], [ %14, %.lr.ph70 ]
  %6 = phi i32 [ %29, %.loopexit59.loopexit ], [ %12, %.lr.ph70 ]
  %7 = phi i32 [ %29, %.loopexit59.loopexit ], [ %13, %.lr.ph70 ]
  %.2.lcssa = phi i32 [ %spec.select.2, %.loopexit59.loopexit ], [ %.168, %.lr.ph70 ]
  %8 = icmp slt i64 %indvars.iv.next, %.pre-phi
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  br i1 %8, label %.lr.ph70, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.loopexit59, %.preheader60
  %9 = phi i32 [ %3, %.preheader60 ], [ %6, %.loopexit59 ]
  %.1.lcssa = phi i32 [ %.05272, %.preheader60 ], [ %.2.lcssa, %.loopexit59 ]
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %10 = sext i32 %9 to i64
  %11 = icmp slt i64 %indvars.iv.next111, %10
  br i1 %11, label %.preheader60, label %.preheader56, !llvm.loop !11

.lr.ph70:                                         ; preds = %.preheader60, %.loopexit59
  %12 = phi i32 [ %6, %.loopexit59 ], [ %3, %.preheader60 ]
  %13 = phi i32 [ %7, %.loopexit59 ], [ %3, %.preheader60 ]
  %indvars.iv104 = phi i64 [ %indvars.iv.next105, %.loopexit59 ], [ 1, %.preheader60 ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %.loopexit59 ], [ 0, %.preheader60 ]
  %.168 = phi i32 [ %.2.lcssa, %.loopexit59 ], [ %.05272, %.preheader60 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.preheader58, label %.loopexit59

.preheader58:                                     ; preds = %.lr.ph70, %.preheader57
  %indvars.iv106 = phi i64 [ %indvars.iv.next107, %.preheader57 ], [ %indvars.iv104, %.lr.ph70 ]
  %.265 = phi i32 [ %spec.select.2, %.preheader57 ], [ %.168, %.lr.ph70 ]
  %16 = icmp ult i64 %indvars.iv, %indvars.iv106
  br i1 %16, label %.lr.ph, label %.preheader57

.preheader57:                                     ; preds = %.lr.ph, %.preheader58
  %.048.lcssa = phi i32 [ 0, %.preheader58 ], [ %35, %.lr.ph ]
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 0) #1
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp eq i32 %.048.lcssa, %18
  %20 = select i1 %19, i32 %.048.lcssa, i32 0
  %spec.select = add nsw i32 %20, %.265
  %21 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 1) #1
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = icmp eq i32 %.048.lcssa, %22
  %24 = select i1 %23, i32 %.048.lcssa, i32 0
  %spec.select.1 = add nsw i32 %24, %spec.select
  %25 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 2) #1
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp eq i32 %.048.lcssa, %26
  %28 = select i1 %27, i32 %.048.lcssa, i32 0
  %spec.select.2 = add nsw i32 %28, %spec.select.1
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %29 = load i32, ptr @N, align 4, !tbaa !5
  %30 = trunc nuw i64 %indvars.iv.next107 to i32
  %31 = icmp sgt i32 %29, %30
  br i1 %31, label %.preheader58, label %.loopexit59.loopexit, !llvm.loop !13

.lr.ph:                                           ; preds = %.preheader58, %.lr.ph
  %indvars.iv97 = phi i64 [ %indvars.iv.next98, %.lr.ph ], [ %indvars.iv, %.preheader58 ]
  %.04861 = phi i32 [ %35, %.lr.ph ], [ 0, %.preheader58 ]
  %32 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %indvars.iv110) #1
  %33 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %indvars.iv97) #1
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = add nsw i32 %34, %.04861
  %indvars.iv.next98 = add nuw nsw i64 %indvars.iv97, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next98, %indvars.iv106
  br i1 %exitcond.not, label %.preheader57, label %.lr.ph, !llvm.loop !14

.preheader55:                                     ; preds = %.preheader56, %._crit_edge87
  %36 = phi i32 [ %41, %._crit_edge87 ], [ %9, %.preheader56 ]
  %indvars.iv129 = phi i64 [ %indvars.iv.next130, %._crit_edge87 ], [ 0, %.preheader56 ]
  %.589 = phi i32 [ %.6.lcssa, %._crit_edge87 ], [ %.1.lcssa, %.preheader56 ]
  %37 = icmp sgt i32 %36, 0
  br i1 %37, label %.lr.ph86, label %._crit_edge87

._crit_edge91:                                    ; preds = %._crit_edge87, %0, %.preheader56
  %.5.lcssa = phi i32 [ %.1.lcssa, %.preheader56 ], [ 0, %0 ], [ %.6.lcssa, %._crit_edge87 ]
  ret i32 %.5.lcssa

.loopexit.loopexit:                               ; preds = %.preheader
  %.pre132 = sext i32 %61 to i64
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.lr.ph86
  %.pre-phi133 = phi i64 [ %.pre132, %.loopexit.loopexit ], [ %46, %.lr.ph86 ]
  %38 = phi i32 [ %61, %.loopexit.loopexit ], [ %44, %.lr.ph86 ]
  %39 = phi i32 [ %61, %.loopexit.loopexit ], [ %45, %.lr.ph86 ]
  %.7.lcssa = phi i32 [ %spec.select53.2, %.loopexit.loopexit ], [ %.684, %.lr.ph86 ]
  %40 = icmp slt i64 %indvars.iv.next114, %.pre-phi133
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  br i1 %40, label %.lr.ph86, label %._crit_edge87, !llvm.loop !15

._crit_edge87:                                    ; preds = %.loopexit, %.preheader55
  %41 = phi i32 [ %36, %.preheader55 ], [ %38, %.loopexit ]
  %.6.lcssa = phi i32 [ %.589, %.preheader55 ], [ %.7.lcssa, %.loopexit ]
  %indvars.iv.next130 = add nuw nsw i64 %indvars.iv129, 1
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next130, %42
  br i1 %43, label %.preheader55, label %._crit_edge91, !llvm.loop !16

.lr.ph86:                                         ; preds = %.preheader55, %.loopexit
  %44 = phi i32 [ %38, %.loopexit ], [ %36, %.preheader55 ]
  %45 = phi i32 [ %39, %.loopexit ], [ %36, %.preheader55 ]
  %indvars.iv123 = phi i64 [ %indvars.iv.next124, %.loopexit ], [ 1, %.preheader55 ]
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %.loopexit ], [ 0, %.preheader55 ]
  %.684 = phi i32 [ %.7.lcssa, %.loopexit ], [ %.589, %.preheader55 ]
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next114, %46
  br i1 %47, label %.preheader54, label %.loopexit

.preheader54:                                     ; preds = %.lr.ph86, %.preheader
  %indvars.iv125 = phi i64 [ %indvars.iv.next126, %.preheader ], [ %indvars.iv123, %.lr.ph86 ]
  %.781 = phi i32 [ %spec.select53.2, %.preheader ], [ %.684, %.lr.ph86 ]
  %48 = icmp ult i64 %indvars.iv113, %indvars.iv125
  br i1 %48, label %.lr.ph77, label %.preheader

.preheader:                                       ; preds = %.lr.ph77, %.preheader54
  %.042.lcssa = phi i32 [ 0, %.preheader54 ], [ %67, %.lr.ph77 ]
  %49 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 0) #1
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp eq i32 %.042.lcssa, %50
  %52 = select i1 %51, i32 %.042.lcssa, i32 0
  %spec.select53 = add nsw i32 %52, %.781
  %53 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 1) #1
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = icmp eq i32 %.042.lcssa, %54
  %56 = select i1 %55, i32 %.042.lcssa, i32 0
  %spec.select53.1 = add nsw i32 %56, %spec.select53
  %57 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @B, i64 noundef 2) #1
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp eq i32 %.042.lcssa, %58
  %60 = select i1 %59, i32 %.042.lcssa, i32 0
  %spec.select53.2 = add nsw i32 %60, %spec.select53.1
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %61 = load i32, ptr @N, align 4, !tbaa !5
  %62 = trunc nuw i64 %indvars.iv.next126 to i32
  %63 = icmp sgt i32 %61, %62
  br i1 %63, label %.preheader54, label %.loopexit.loopexit, !llvm.loop !17

.lr.ph77:                                         ; preds = %.preheader54, %.lr.ph77
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %.lr.ph77 ], [ %indvars.iv113, %.preheader54 ]
  %.04275 = phi i32 [ %67, %.lr.ph77 ], [ 0, %.preheader54 ]
  %64 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IiSaIiEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @ans, i64 noundef %indvars.iv115) #1
  %65 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %64, i64 noundef %indvars.iv129) #1
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, %.04275
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %exitcond118.not = icmp eq i64 %indvars.iv.next116, %indvars.iv125
  br i1 %exitcond118.not, label %.preheader, label %.lr.ph77, !llvm.loop !18
}

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 = { 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 = distinct !{!11, !10, !12}
!12 = !{!"llvm.loop.unswitch.partial.disable"}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !12}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass