; LLVM IR from lzyrapx/Competitive-Programming :: ACdream (1110（dp+多重背包）)

; 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_ostream" = type { ptr, %"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 }

@n = external dso_local global i32, align 4
@cap = external dso_local global i32, align 4
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local global [100010 x i32], align 16
@dp = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca 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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %197, %0
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %20)
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @n, ptr noundef @cap)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %23

23:                                               ; preds = %33, %19
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = load i32, ptr @n, align 4, !tbaa !5
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %36

28:                                               ; preds = %23
  %29 = load i32, ptr %5, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %5, align 4, !tbaa !5
  br label %23, !llvm.loop !9

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

37:                                               ; preds = %47, %36
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %50

42:                                               ; preds = %37
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %44
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %6, align 4, !tbaa !5
  br label %37, !llvm.loop !11

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

51:                                               ; preds = %60, %50
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = load i32, ptr @cap, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %63

56:                                               ; preds = %51
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %58
  store i32 -1, ptr %59, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %56
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %51, !llvm.loop !12

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

64:                                               ; preds = %171, %63
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp sle i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %174

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

70:                                               ; preds = %86, %69
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = load i32, ptr @cap, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %89

75:                                               ; preds = %70
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = icmp ne i32 %79, -1
  br i1 %80, label %81, label %85

81:                                               ; preds = %75
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %83
  store i32 0, ptr %84, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %81, %75
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %9, align 4, !tbaa !5
  br label %70, !llvm.loop !13

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

90:                                               ; preds = %167, %89
  %91 = load i32, ptr %10, align 4, !tbaa !5
  %92 = load i32, ptr @cap, align 4, !tbaa !5
  %93 = icmp sle i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %170

95:                                               ; preds = %90
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp eq i32 %99, -1
  br i1 %100, label %101, label %102

101:                                              ; preds = %95
  br label %167

102:                                              ; preds = %95
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = icmp sgt i32 %106, %110
  br i1 %111, label %112, label %116

112:                                              ; preds = %102
  %113 = load i32, ptr %10, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %114
  store i32 -1, ptr %115, align 4, !tbaa !5
  br label %167

116:                                              ; preds = %102
  %117 = load i32, ptr %10, align 4, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = add nsw i32 %117, %121
  %123 = load i32, ptr @cap, align 4, !tbaa !5
  %124 = icmp sle i32 %122, %123
  br i1 %124, label %125, label %166

125:                                              ; preds = %116
  %126 = load i32, ptr %10, align 4, !tbaa !5
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = add nsw i32 %126, %130
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp eq i32 %134, -1
  br i1 %135, label %152, label %136

136:                                              ; preds = %125
  %137 = load i32, ptr %10, align 4, !tbaa !5
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = add nsw i32 %137, %141
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  %151 = icmp sge i32 %145, %150
  br i1 %151, label %152, label %166

152:                                              ; preds = %136, %125
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = load i32, ptr %8, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = add nsw i32 %158, %162
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %164
  store i32 %157, ptr %165, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %152, %136, %116
  br label %167

167:                                              ; preds = %166, %112, %101
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %10, align 4, !tbaa !5
  br label %90, !llvm.loop !14

170:                                              ; preds = %94
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %8, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %8, align 4, !tbaa !5
  br label %64, !llvm.loop !15

174:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %190, %174
  %176 = load i32, ptr %12, align 4, !tbaa !5
  %177 = load i32, ptr @cap, align 4, !tbaa !5
  %178 = icmp sle i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 23, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %193

180:                                              ; preds = %175
  %181 = load i32, ptr %12, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = icmp ne i32 %184, -1
  br i1 %185, label %186, label %189

186:                                              ; preds = %180
  %187 = load i32, ptr %11, align 4, !tbaa !5
  %188 = add nsw i32 %187, 1
  store i32 %188, ptr %11, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %186, %180
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %12, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %12, align 4, !tbaa !5
  br label %175, !llvm.loop !16

193:                                              ; preds = %179
  %194 = load i32, ptr %11, align 4, !tbaa !5
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %194)
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %195, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %197

197:                                              ; preds = %193
  %198 = load i32, ptr %3, align 4, !tbaa !5
  %199 = add nsw i32 %198, 1
  store i32 %199, ptr %3, align 4, !tbaa !5
  br label %14, !llvm.loop !17

200:                                              ; preds = %18
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %201 = load i32, ptr %1, align 4
  ret i32 %201
}

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

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

declare i32 @printf(ptr noundef, ...) #2

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

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) #3 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 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 = { 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}
!17 = distinct !{!17, !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_ostream" = type { ptr, %"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 }

@n = external dso_local global i32, align 4
@cap = external dso_local global i32, align 4
@a = external dso_local global [100010 x i32], align 16
@b = external dso_local global [100010 x i32], align 16
@dp = external dso_local local_unnamed_addr global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %2 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %.not92 = icmp slt i32 %3, 1
  br i1 %.not92, label %._crit_edge96, label %.lr.ph95

._crit_edge96:                                    ; preds = %._crit_edge90, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0

.lr.ph95:                                         ; preds = %0, %._crit_edge90
  %.04793 = phi i32 [ %89, %._crit_edge90 ], [ 1, %0 ]
  %4 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.04793)
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @n, ptr noundef nonnull @cap)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not5268 = icmp slt i32 %6, 1
  br i1 %.not5268, label %.preheader65, label %.lr.ph

.preheader66:                                     ; preds = %.lr.ph
  %.not5370 = icmp slt i32 %9, 1
  br i1 %.not5370, label %.preheader65, label %.lr.ph72

.lr.ph:                                           ; preds = %.lr.ph95, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.lr.ph95 ]
  %7 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %.not52.not = icmp slt i64 %indvars.iv, %10
  br i1 %.not52.not, label %.lr.ph, label %.preheader66, !llvm.loop !9

.preheader65:                                     ; preds = %.lr.ph72, %.lr.ph95, %.preheader66
  %.lcssa = phi i32 [ %9, %.preheader66 ], [ %6, %.lr.ph95 ], [ %16, %.lr.ph72 ]
  %11 = load i32, ptr @cap, align 4, !tbaa !5
  %.not5473 = icmp slt i32 %11, 1
  br i1 %.not5473, label %._crit_edge, label %.lr.ph75.preheader

.lr.ph75.preheader:                               ; preds = %.preheader65
  %12 = zext nneg i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @dp, i64 4), i8 -1, i64 %13, i1 false), !tbaa !5
  br label %._crit_edge

.lr.ph72:                                         ; preds = %.preheader66, %.lr.ph72
  %indvars.iv99 = phi i64 [ %indvars.iv.next100, %.lr.ph72 ], [ 1, %.preheader66 ]
  %14 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv99
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %indvars.iv.next100 = add nuw nsw i64 %indvars.iv99, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %.not53.not = icmp slt i64 %indvars.iv99, %17
  br i1 %.not53.not, label %.lr.ph72, label %.preheader65, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph75.preheader, %.preheader65
  store i32 0, ptr @dp, align 16, !tbaa !5
  %.not5584 = icmp slt i32 %.lcssa, 1
  br i1 %.not5584, label %.preheader64, label %.preheader63.lr.ph

.preheader63.lr.ph:                               ; preds = %._crit_edge
  %.not5980 = icmp slt i32 %11, 0
  %18 = add i32 %11, 1
  %19 = add nuw i32 %.lcssa, 1
  %wide.trip.count116 = zext i32 %19 to i64
  %wide.trip.count = zext i32 %18 to i64
  %wide.trip.count111 = zext i32 %18 to i64
  %20 = add nsw i64 %wide.trip.count, -1
  %min.iters.check132 = icmp ult i32 %18, 9
  %n.vec135 = and i64 %20, -8
  %ind.end136 = or disjoint i64 %n.vec135, 1
  %cmp.n158 = icmp eq i64 %20, %n.vec135
  br label %.preheader63

.preheader64:                                     ; preds = %._crit_edge83, %._crit_edge
  br i1 %.not5473, label %._crit_edge90, label %.lr.ph89.preheader

.lr.ph89.preheader:                               ; preds = %.preheader64
  %21 = add nuw i32 %11, 1
  %wide.trip.count121 = zext i32 %21 to i64
  %22 = zext nneg i32 %11 to i64
  %min.iters.check = icmp ult i32 %11, 8
  br i1 %min.iters.check, label %.lr.ph89.preheader160, label %vector.ph

.lr.ph89.preheader160:                            ; preds = %middle.block, %.lr.ph89.preheader
  %indvars.iv118.ph = phi i64 [ 1, %.lr.ph89.preheader ], [ %ind.end, %middle.block ]
  %.04087.ph = phi i32 [ 0, %.lr.ph89.preheader ], [ %32, %middle.block ]
  br label %.lr.ph89

vector.ph:                                        ; preds = %.lr.ph89.preheader
  %n.vec = and i64 %22, 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 ], [ %29, %vector.body ]
  %vec.phi128 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %30, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %23 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %offset.idx
  %24 = getelementptr inbounds i8, ptr %23, i64 16
  %wide.load = load <4 x i32>, ptr %23, align 4, !tbaa !5
  %wide.load129 = load <4 x i32>, ptr %24, align 4, !tbaa !5
  %25 = icmp ne <4 x i32> %wide.load, <i32 -1, i32 -1, i32 -1, i32 -1>
  %26 = icmp ne <4 x i32> %wide.load129, <i32 -1, i32 -1, i32 -1, i32 -1>
  %27 = zext <4 x i1> %25 to <4 x i32>
  %28 = zext <4 x i1> %26 to <4 x i32>
  %29 = add <4 x i32> %vec.phi, %27
  %30 = add <4 x i32> %vec.phi128, %28
  %index.next = add nuw i64 %index, 8
  %31 = icmp eq i64 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %30, %29
  %32 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %22
  br i1 %cmp.n, label %._crit_edge90, label %.lr.ph89.preheader160

.preheader63:                                     ; preds = %.preheader63.lr.ph, %._crit_edge83
  %indvars.iv113 = phi i64 [ 1, %.preheader63.lr.ph ], [ %indvars.iv.next114, %._crit_edge83 ]
  br i1 %.not5473, label %.preheader, label %.lr.ph79.preheader

.lr.ph79.preheader:                               ; preds = %.preheader63
  br i1 %min.iters.check132, label %.lr.ph79.preheader159, label %vector.body138

.lr.ph79.preheader159:                            ; preds = %middle.block130, %.lr.ph79.preheader
  %indvars.iv105.ph = phi i64 [ 1, %.lr.ph79.preheader ], [ %ind.end136, %middle.block130 ]
  br label %.lr.ph79

vector.body138:                                   ; preds = %.lr.ph79.preheader, %pred.store.continue156
  %index139 = phi i64 [ %index.next157, %pred.store.continue156 ], [ 0, %.lr.ph79.preheader ]
  %offset.idx140 = or disjoint i64 %index139, 1
  %33 = or disjoint i64 %index139, 5
  %34 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %offset.idx140
  %35 = getelementptr inbounds i8, ptr %34, i64 16
  %wide.load141 = load <4 x i32>, ptr %34, align 4, !tbaa !5
  %wide.load142 = load <4 x i32>, ptr %35, align 4, !tbaa !5
  %36 = icmp ne <4 x i32> %wide.load141, <i32 -1, i32 -1, i32 -1, i32 -1>
  %37 = icmp ne <4 x i32> %wide.load142, <i32 -1, i32 -1, i32 -1, i32 -1>
  %38 = extractelement <4 x i1> %36, i64 0
  br i1 %38, label %pred.store.if, label %pred.store.continue

pred.store.if:                                    ; preds = %vector.body138
  %39 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %offset.idx140
  store i32 0, ptr %39, align 4, !tbaa !5
  br label %pred.store.continue

pred.store.continue:                              ; preds = %pred.store.if, %vector.body138
  %40 = extractelement <4 x i1> %36, i64 1
  br i1 %40, label %pred.store.if143, label %pred.store.continue144

pred.store.if143:                                 ; preds = %pred.store.continue
  %41 = or disjoint i64 %index139, 2
  %42 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %41
  store i32 0, ptr %42, align 8, !tbaa !5
  br label %pred.store.continue144

pred.store.continue144:                           ; preds = %pred.store.if143, %pred.store.continue
  %43 = extractelement <4 x i1> %36, i64 2
  br i1 %43, label %pred.store.if145, label %pred.store.continue146

pred.store.if145:                                 ; preds = %pred.store.continue144
  %44 = or disjoint i64 %index139, 3
  %45 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %44
  store i32 0, ptr %45, align 4, !tbaa !5
  br label %pred.store.continue146

pred.store.continue146:                           ; preds = %pred.store.if145, %pred.store.continue144
  %46 = extractelement <4 x i1> %36, i64 3
  br i1 %46, label %pred.store.if147, label %pred.store.continue148

pred.store.if147:                                 ; preds = %pred.store.continue146
  %47 = or disjoint i64 %index139, 4
  %48 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %47
  store i32 0, ptr %48, align 16, !tbaa !5
  br label %pred.store.continue148

pred.store.continue148:                           ; preds = %pred.store.if147, %pred.store.continue146
  %49 = extractelement <4 x i1> %37, i64 0
  br i1 %49, label %pred.store.if149, label %pred.store.continue150

pred.store.if149:                                 ; preds = %pred.store.continue148
  %50 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %33
  store i32 0, ptr %50, align 4, !tbaa !5
  br label %pred.store.continue150

pred.store.continue150:                           ; preds = %pred.store.if149, %pred.store.continue148
  %51 = extractelement <4 x i1> %37, i64 1
  br i1 %51, label %pred.store.if151, label %pred.store.continue152

pred.store.if151:                                 ; preds = %pred.store.continue150
  %52 = or disjoint i64 %index139, 6
  %53 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %52
  store i32 0, ptr %53, align 8, !tbaa !5
  br label %pred.store.continue152

pred.store.continue152:                           ; preds = %pred.store.if151, %pred.store.continue150
  %54 = extractelement <4 x i1> %37, i64 2
  br i1 %54, label %pred.store.if153, label %pred.store.continue154

pred.store.if153:                                 ; preds = %pred.store.continue152
  %55 = or disjoint i64 %index139, 7
  %56 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %55
  store i32 0, ptr %56, align 4, !tbaa !5
  br label %pred.store.continue154

pred.store.continue154:                           ; preds = %pred.store.if153, %pred.store.continue152
  %57 = extractelement <4 x i1> %37, i64 3
  br i1 %57, label %pred.store.if155, label %pred.store.continue156

pred.store.if155:                                 ; preds = %pred.store.continue154
  %58 = add i64 %index139, 8
  %59 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %58
  store i32 0, ptr %59, align 16, !tbaa !5
  br label %pred.store.continue156

pred.store.continue156:                           ; preds = %pred.store.if155, %pred.store.continue154
  %index.next157 = add nuw i64 %index139, 8
  %60 = icmp eq i64 %index.next157, %n.vec135
  br i1 %60, label %middle.block130, label %vector.body138, !llvm.loop !15

middle.block130:                                  ; preds = %pred.store.continue156
  br i1 %cmp.n158, label %.preheader, label %.lr.ph79.preheader159

.preheader:                                       ; preds = %66, %middle.block130, %.preheader63
  br i1 %.not5980, label %._crit_edge83, label %.lr.ph82

.lr.ph82:                                         ; preds = %.preheader
  %61 = getelementptr inbounds [100010 x i32], ptr @b, i64 0, i64 %indvars.iv113
  %62 = getelementptr inbounds [100010 x i32], ptr @a, i64 0, i64 %indvars.iv113
  br label %67

.lr.ph79:                                         ; preds = %.lr.ph79.preheader159, %66
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %66 ], [ %indvars.iv105.ph, %.lr.ph79.preheader159 ]
  %63 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv105
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %.not62 = icmp eq i32 %64, -1
  br i1 %.not62, label %66, label %65

65:                                               ; preds = %.lr.ph79
  store i32 0, ptr %63, align 4, !tbaa !5
  br label %66

66:                                               ; preds = %.lr.ph79, %65
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next106, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph79, !llvm.loop !16

._crit_edge83:                                    ; preds = %86, %.preheader
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116
  br i1 %exitcond117.not, label %.preheader64, label %.preheader63, !llvm.loop !17

67:                                               ; preds = %.lr.ph82, %86
  %indvars.iv108 = phi i64 [ 0, %.lr.ph82 ], [ %indvars.iv.next109, %86 ]
  %68 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv108
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp eq i32 %69, -1
  br i1 %70, label %86, label %71

71:                                               ; preds = %67
  %72 = load i32, ptr %61, align 4, !tbaa !5
  %73 = icmp sgt i32 %69, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %71
  store i32 -1, ptr %68, align 4, !tbaa !5
  br label %86

75:                                               ; preds = %71
  %76 = load i32, ptr %62, align 4, !tbaa !5
  %77 = trunc nuw nsw i64 %indvars.iv108 to i32
  %78 = add nsw i32 %76, %77
  %.not60 = icmp sgt i32 %78, %11
  br i1 %.not60, label %86, label %79

79:                                               ; preds = %75
  %80 = sext i32 %78 to i64
  %81 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = icmp eq i32 %82, -1
  %.not61.not = icmp sgt i32 %82, %69
  %or.cond = or i1 %83, %.not61.not
  br i1 %or.cond, label %84, label %86

84:                                               ; preds = %79
  %85 = add nuw nsw i32 %69, 1
  store i32 %85, ptr %81, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %79, %75, %84, %67, %74
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next109, %wide.trip.count111
  br i1 %exitcond112.not, label %._crit_edge83, label %67, !llvm.loop !18

._crit_edge90:                                    ; preds = %.lr.ph89, %middle.block, %.preheader64
  %.040.lcssa = phi i32 [ 0, %.preheader64 ], [ %32, %middle.block ], [ %spec.select, %.lr.ph89 ]
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.040.lcssa)
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %89 = add nuw nsw i32 %.04793, 1
  %90 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.04793, %90
  br i1 %.not.not, label %.lr.ph95, label %._crit_edge96, !llvm.loop !19

.lr.ph89:                                         ; preds = %.lr.ph89.preheader160, %.lr.ph89
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %.lr.ph89 ], [ %indvars.iv118.ph, %.lr.ph89.preheader160 ]
  %.04087 = phi i32 [ %spec.select, %.lr.ph89 ], [ %.04087.ph, %.lr.ph89.preheader160 ]
  %91 = getelementptr inbounds [100010 x i32], ptr @dp, i64 0, i64 %indvars.iv118
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not57 = icmp ne i32 %92, -1
  %93 = zext i1 %.not57 to i32
  %spec.select = add nuw nsw i32 %.04087, %93
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
  br i1 %exitcond122.not, label %._crit_edge90, label %.lr.ph89, !llvm.loop !20
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

; 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 #4 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)) #5

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

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

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


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