; LLVM IR from upupming/algorithm :: acwing/算法竞赛进阶指南/0x52-背包/281. 硬币.ll (Z10main_naivev)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [110 x i32], align 16
@c = external dso_local global [110 x i32], align 16
@f = external dso_local global [100010 x i32], align 16
@v = external dso_local global [110 x i32], align 16
@w = external dso_local global [110 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z10main_naivev() #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
  br label %9

9:                                                ; preds = %132, %0
  %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) @n)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %17

14:                                               ; preds = %9
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp ne i32 %15, 0
  br label %17

17:                                               ; preds = %14, %9
  %18 = phi i1 [ false, %9 ], [ %16, %14 ]
  br i1 %18, label %19, label %136

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

20:                                               ; preds = %40, %19
  %21 = load i32, ptr %1, align 4, !tbaa !5
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %43

25:                                               ; preds = %20
  %26 = load i32, ptr %1, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [110 x i32], ptr @a, i64 0, i64 %27
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %28)
  %30 = load i32, ptr %1, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [110 x i32], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [110 x i32], ptr @w, i64 0, i64 %35
  store i32 %33, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %38
  store i32 %33, ptr %39, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %25
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %1, align 4, !tbaa !5
  br label %20, !llvm.loop !9

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

44:                                               ; preds = %54, %43
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp sle i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %57

49:                                               ; preds = %44
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %51
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %52)
  br label %54

54:                                               ; preds = %49
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %2, align 4, !tbaa !5
  br label %44, !llvm.loop !11

57:                                               ; preds = %48
  call void @llvm.memset.p0.i64(ptr align 16 @f, i8 0, i64 400040, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %113, %57
  %59 = load i32, ptr %3, align 4, !tbaa !5
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = icmp sle i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %116

63:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %109, %63
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp sle i32 %65, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %64
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %112

72:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %73 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %73, ptr %6, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %105, %72
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp sge i32 %75, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %74
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %108

82:                                               ; preds = %74
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %99, label %88

88:                                               ; preds = %82
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sub nsw i32 %89, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp ne i32 %97, 0
  br label %99

99:                                               ; preds = %88, %82
  %100 = phi i1 [ true, %82 ], [ %98, %88 ]
  %101 = zext i1 %100 to i32
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %103
  store i32 %101, ptr %104, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %99
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %6, align 4, !tbaa !5
  br label %74, !llvm.loop !12

108:                                              ; preds = %81
  br label %109

109:                                              ; preds = %108
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %5, align 4, !tbaa !5
  br label %64, !llvm.loop !13

112:                                              ; preds = %71
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %3, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %3, align 4, !tbaa !5
  br label %58, !llvm.loop !14

116:                                              ; preds = %62
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %129, %116
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = icmp sle i32 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %132

122:                                              ; preds = %117
  %123 = load i32, ptr %8, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = add nsw i32 %127, %126
  store i32 %128, ptr %7, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %122
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %8, align 4, !tbaa !5
  br label %117, !llvm.loop !15

132:                                              ; preds = %121
  %133 = load i32, ptr %7, align 4, !tbaa !5
  %134 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %133)
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %134, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %9, !llvm.loop !16

136:                                              ; preds = %17
  ret i32 0
}

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #2

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 nounwind willreturn memory(argmem: write) }
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 = !{!"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}


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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [110 x i32], align 16
@c = external dso_local global [110 x i32], align 16
@f = external dso_local local_unnamed_addr global [100010 x i32], align 16
@v = external dso_local local_unnamed_addr global [110 x i32], align 16
@w = external dso_local local_unnamed_addr global [110 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z10main_naivev() local_unnamed_addr #0 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp ne i32 %3, 0
  %5 = load i32, ptr @m, align 4
  %6 = icmp ne i32 %5, 0
  %7 = select i1 %4, i1 %6, i1 false
  br i1 %7, label %.preheader41, label %._crit_edge64

.preheader41:                                     ; preds = %0, %._crit_edge62
  %8 = phi i32 [ %72, %._crit_edge62 ], [ %3, %0 ]
  %.not42 = icmp slt i32 %8, 1
  br i1 %.not42, label %._crit_edge.thread, label %.lr.ph

.preheader40:                                     ; preds = %.lr.ph
  %.not3344 = icmp slt i32 %14, 1
  br i1 %.not3344, label %._crit_edge.thread, label %.lr.ph46

.lr.ph:                                           ; preds = %.preheader41, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader41 ]
  %9 = getelementptr inbounds [110 x i32], ptr @a, i64 0, i64 %indvars.iv
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %11 = load i32, ptr %9, align 4, !tbaa !5
  %12 = getelementptr inbounds [110 x i32], ptr @w, i64 0, i64 %indvars.iv
  store i32 %11, ptr %12, align 4, !tbaa !5
  %13 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %indvars.iv
  store i32 %11, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %.not.not = icmp slt i64 %indvars.iv, %15
  br i1 %.not.not, label %.lr.ph, label %.preheader40, !llvm.loop !9

._crit_edge.thread:                               ; preds = %.preheader40, %.preheader41
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @f, i8 0, i64 400040, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  %.pre87 = load i32, ptr @m, align 4
  br label %.preheader39

._crit_edge:                                      ; preds = %.lr.ph46
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(400040) @f, i8 0, i64 400040, i1 false)
  store i32 1, ptr @f, align 16, !tbaa !5
  %.not3456 = icmp slt i32 %21, 1
  %.pre = load i32, ptr @m, align 4
  br i1 %.not3456, label %.preheader39, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %16 = sext i32 %.pre to i64
  %17 = add nuw i32 %21, 1
  %wide.trip.count = zext i32 %17 to i64
  %18 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %16
  %indvars.iv.next73.prol = add nsw i64 %16, -1
  br label %.preheader

.lr.ph46:                                         ; preds = %.preheader40, %.lr.ph46
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.lr.ph46 ], [ 1, %.preheader40 ]
  %19 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %indvars.iv69
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %19)
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %.not33.not = icmp slt i64 %indvars.iv69, %22
  br i1 %.not33.not, label %.lr.ph46, label %._crit_edge, !llvm.loop !11

.preheader39:                                     ; preds = %._crit_edge55, %._crit_edge.thread, %._crit_edge
  %.pre88 = phi i32 [ %.pre87, %._crit_edge.thread ], [ %.pre, %._crit_edge ], [ %.pre, %._crit_edge55 ]
  %.not3558 = icmp slt i32 %.pre88, 1
  br i1 %.not3558, label %._crit_edge62, label %.lr.ph61.preheader

.lr.ph61.preheader:                               ; preds = %.preheader39
  %23 = add nuw i32 %.pre88, 1
  %wide.trip.count82 = zext i32 %23 to i64
  %24 = zext nneg i32 %.pre88 to i64
  %min.iters.check = icmp ult i32 %.pre88, 8
  br i1 %min.iters.check, label %.lr.ph61.preheader95, label %vector.ph

.lr.ph61.preheader95:                             ; preds = %middle.block, %.lr.ph61.preheader
  %indvars.iv79.ph = phi i64 [ 1, %.lr.ph61.preheader ], [ %ind.end, %middle.block ]
  %.02659.ph = phi i32 [ 0, %.lr.ph61.preheader ], [ %30, %middle.block ]
  br label %.lr.ph61

vector.ph:                                        ; preds = %.lr.ph61.preheader
  %n.vec = and i64 %24, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %27, %vector.body ]
  %vec.phi93 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %28, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %25 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %offset.idx
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  %wide.load = load <4 x i32>, ptr %25, align 4, !tbaa !5
  %wide.load94 = load <4 x i32>, ptr %26, align 4, !tbaa !5
  %27 = add <4 x i32> %wide.load, %vec.phi
  %28 = add <4 x i32> %wide.load94, %vec.phi93
  %index.next = add nuw i64 %index, 8
  %29 = icmp eq i64 %index.next, %n.vec
  br i1 %29, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %28, %27
  %30 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %24
  br i1 %cmp.n, label %._crit_edge62, label %.lr.ph61.preheader95

.preheader:                                       ; preds = %.preheader.lr.ph, %._crit_edge55
  %indvars.iv75 = phi i64 [ 1, %.preheader.lr.ph ], [ %indvars.iv.next76, %._crit_edge55 ]
  %31 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %indvars.iv75
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %.not3652 = icmp slt i32 %32, 1
  br i1 %.not3652, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %.preheader
  %33 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %indvars.iv75
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %.not3747 = icmp slt i32 %.pre, %34
  br i1 %.not3747, label %._crit_edge55, label %.lr.ph50.preheader

.lr.ph50.preheader:                               ; preds = %.lr.ph54
  %35 = sext i32 %34 to i64
  %36 = add nsw i64 %16, %35
  %37 = and i64 %36, 1
  %lcmp.mod.not.not = icmp eq i64 %37, 0
  %38 = sub nsw i64 %16, %35
  %39 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %38
  %40 = icmp eq i32 %.pre, %34
  br label %.lr.ph50

._crit_edge55:                                    ; preds = %._crit_edge51, %.lr.ph54, %.preheader
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond78.not = icmp eq i64 %indvars.iv.next76, %wide.trip.count
  br i1 %exitcond78.not, label %.preheader39, label %.preheader, !llvm.loop !15

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %._crit_edge51
  %.02853 = phi i32 [ %47, %._crit_edge51 ], [ 1, %.lr.ph50.preheader ]
  br i1 %lcmp.mod.not.not, label %.prol.preheader, label %.prol.loopexit

.prol.preheader:                                  ; preds = %.lr.ph50
  %41 = load i32, ptr %18, align 4, !tbaa !5
  %.not38.prol = icmp eq i32 %41, 0
  br i1 %.not38.prol, label %42, label %.prol.loopexit.unr-lcssa

42:                                               ; preds = %.prol.preheader
  %43 = load i32, ptr %39, align 4, !tbaa !5
  %44 = icmp ne i32 %43, 0
  br label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %42, %.prol.preheader
  %45 = phi i1 [ true, %.prol.preheader ], [ %44, %42 ]
  %46 = zext i1 %45 to i32
  store i32 %46, ptr %18, align 4, !tbaa !5
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph50
  %indvars.iv72.unr = phi i64 [ %16, %.lr.ph50 ], [ %indvars.iv.next73.prol, %.prol.loopexit.unr-lcssa ]
  br i1 %40, label %._crit_edge51, label %.lr.ph50.new

._crit_edge51:                                    ; preds = %65, %.prol.loopexit
  %47 = add nuw i32 %.02853, 1
  %exitcond.not = icmp eq i32 %.02853, %32
  br i1 %exitcond.not, label %._crit_edge55, label %.lr.ph50, !llvm.loop !16

.lr.ph50.new:                                     ; preds = %.prol.loopexit, %65
  %indvars.iv72 = phi i64 [ %indvars.iv.next73.1, %65 ], [ %indvars.iv72.unr, %.prol.loopexit ]
  %48 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv72
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not38 = icmp eq i32 %49, 0
  br i1 %.not38, label %50, label %55

50:                                               ; preds = %.lr.ph50.new
  %51 = sub nsw i64 %indvars.iv72, %35
  %52 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 0
  br label %55

55:                                               ; preds = %50, %.lr.ph50.new
  %56 = phi i1 [ true, %.lr.ph50.new ], [ %54, %50 ]
  %57 = zext i1 %56 to i32
  store i32 %57, ptr %48, align 4, !tbaa !5
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1
  %58 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv.next73
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %.not38.1 = icmp eq i32 %59, 0
  br i1 %.not38.1, label %60, label %65

60:                                               ; preds = %55
  %61 = sub nsw i64 %indvars.iv.next73, %35
  %62 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br label %65

65:                                               ; preds = %60, %55
  %66 = phi i1 [ true, %55 ], [ %64, %60 ]
  %67 = zext i1 %66 to i32
  store i32 %67, ptr %58, align 4, !tbaa !5
  %indvars.iv.next73.1 = add nsw i64 %indvars.iv72, -2
  %.not37.not.1 = icmp sgt i64 %indvars.iv.next73, %35
  br i1 %.not37.not.1, label %.lr.ph50.new, label %._crit_edge51, !llvm.loop !17

._crit_edge62:                                    ; preds = %.lr.ph61, %middle.block, %.preheader39
  %.026.lcssa = phi i32 [ 0, %.preheader39 ], [ %30, %middle.block ], [ %79, %.lr.ph61 ]
  %68 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.026.lcssa)
  %69 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %70 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %71 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %70, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = icmp ne i32 %72, 0
  %74 = load i32, ptr @m, align 4
  %75 = icmp ne i32 %74, 0
  %76 = select i1 %73, i1 %75, i1 false
  br i1 %76, label %.preheader41, label %._crit_edge64, !llvm.loop !18

.lr.ph61:                                         ; preds = %.lr.ph61.preheader95, %.lr.ph61
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %.lr.ph61 ], [ %indvars.iv79.ph, %.lr.ph61.preheader95 ]
  %.02659 = phi i32 [ %79, %.lr.ph61 ], [ %.02659.ph, %.lr.ph61.preheader95 ]
  %77 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv79
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, %.02659
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count82
  br i1 %exitcond83.not, label %._crit_edge62, label %.lr.ph61, !llvm.loop !19

._crit_edge64:                                    ; preds = %._crit_edge62, %0
  ret i32 0
}

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 #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #3

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

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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !14, !13}


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