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

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

@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
@p = external dso_local global [110 x i32], align 16
@r = external dso_local global [110 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

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

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

11:                                               ; preds = %193, %0
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %18, label %15

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

18:                                               ; preds = %15, %11
  %19 = phi i1 [ true, %11 ], [ %17, %15 ]
  br i1 %19, label %20, label %196

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

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

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

26:                                               ; preds = %21
  %27 = load i32, ptr %1, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [110 x i32], ptr @a, i64 0, i64 %28
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %29)
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [110 x i32], ptr @a, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [110 x i32], ptr @w, i64 0, i64 %36
  store i32 %34, ptr %37, align 4, !tbaa !5
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %39
  store i32 %34, ptr %40, align 4, !tbaa !5
  br label %41

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

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

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

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

50:                                               ; preds = %45
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %52
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %53)
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  %60 = call noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %59)
  %61 = fsub double %60, 1.000000e+00
  %62 = fptosi double %61 to i32
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  %66 = load i32, ptr %2, 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 = sitofp i32 %69 to double
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  %76 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 2, i32 noundef %75)
  %77 = fsub double %76, 1.000000e+00
  %78 = fsub double %70, %77
  %79 = fptosi double %78 to i32
  %80 = load i32, ptr %2, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [110 x i32], ptr @r, i64 0, i64 %81
  store i32 %79, ptr %82, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %50
  %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 %45, !llvm.loop !11

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

87:                                               ; preds = %96, %86
  %88 = load i32, ptr %3, align 4, !tbaa !5
  %89 = load i32, ptr @m, align 4, !tbaa !5
  %90 = icmp sle i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %99

92:                                               ; preds = %87
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %94
  store i32 0, ptr %95, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %92
  %97 = load i32, ptr %3, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %3, align 4, !tbaa !5
  br label %87, !llvm.loop !12

99:                                               ; preds = %91
  store i32 1, ptr @f, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %174, %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = icmp sle i32 %101, %102
  br i1 %103, label %105, label %104

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

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %168, %105
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = load i32, ptr %4, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = add nsw i32 %115, 2
  %117 = icmp sle i32 %111, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %110
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = add nsw i32 %124, 2
  %126 = icmp eq i32 %120, %125
  br i1 %126, label %127, label %137

127:                                              ; preds = %119
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [110 x i32], ptr @r, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = load i32, ptr %4, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = mul nsw i32 %131, %135
  store i32 %136, ptr %7, align 4, !tbaa !5
  br label %137

137:                                              ; preds = %127, %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %138 = load i32, ptr @m, align 4, !tbaa !5
  store i32 %138, ptr %8, align 4, !tbaa !5
  br label %139

139:                                              ; preds = %164, %137
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = icmp sge i32 %140, %141
  br i1 %142, label %144, label %143

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

144:                                              ; preds = %139
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = icmp ne i32 %148, 0
  br i1 %149, label %158, label %150

150:                                              ; preds = %144
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = load i32, ptr %7, align 4, !tbaa !5
  %153 = sub nsw i32 %151, %152
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %154
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = icmp ne i32 %156, 0
  br label %158

158:                                              ; preds = %150, %144
  %159 = phi i1 [ true, %144 ], [ %157, %150 ]
  %160 = zext i1 %159 to i32
  %161 = load i32, ptr %8, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %162
  store i32 %160, ptr %163, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %158
  %165 = load i32, ptr %8, align 4, !tbaa !5
  %166 = add nsw i32 %165, -1
  store i32 %166, ptr %8, align 4, !tbaa !5
  br label %139, !llvm.loop !13

167:                                              ; preds = %143
  br label %168

168:                                              ; preds = %167
  %169 = load i32, ptr %6, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %6, align 4, !tbaa !5
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = mul nsw i32 %171, 2
  store i32 %172, ptr %7, align 4, !tbaa !5
  br label %110, !llvm.loop !14

173:                                              ; preds = %118
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %4, align 4, !tbaa !5
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %4, align 4, !tbaa !5
  br label %100, !llvm.loop !15

177:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %178

178:                                              ; preds = %190, %177
  %179 = load i32, ptr %10, align 4, !tbaa !5
  %180 = load i32, ptr @m, align 4, !tbaa !5
  %181 = icmp sle i32 %179, %180
  br i1 %181, label %183, label %182

182:                                              ; preds = %178
  store i32 22, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %193

183:                                              ; preds = %178
  %184 = load i32, ptr %10, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !5
  %188 = load i32, ptr %9, align 4, !tbaa !5
  %189 = add nsw i32 %188, %187
  store i32 %189, ptr %9, align 4, !tbaa !5
  br label %190

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

193:                                              ; preds = %182
  %194 = load i32, ptr %9, align 4, !tbaa !5
  %195 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %194)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %11, !llvm.loop !17

196:                                              ; preds = %18
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) #4

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

@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
@p = external dso_local local_unnamed_addr global [110 x i32], align 16
@r = external dso_local local_unnamed_addr global [110 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef i32 @_Z11main_binaryv() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp ne i32 %2, 0
  %4 = load i32, ptr @m, align 4
  %5 = icmp ne i32 %4, 0
  %6 = select i1 %3, i1 true, i1 %5
  br i1 %6, label %.preheader58, label %._crit_edge90

.preheader58:                                     ; preds = %0, %._crit_edge88
  %7 = phi i32 [ %94, %._crit_edge88 ], [ %2, %0 ]
  %.not60 = icmp slt i32 %7, 1
  br i1 %.not60, label %.preheader56, label %.lr.ph

.preheader57:                                     ; preds = %.lr.ph
  %.not4962 = icmp slt i32 %13, 1
  br i1 %.not4962, label %.preheader56, label %.lr.ph64

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

.preheader56:                                     ; preds = %.lr.ph64, %.preheader58, %.preheader57
  %.lcssa = phi i32 [ %13, %.preheader57 ], [ %7, %.preheader58 ], [ %34, %.lr.ph64 ]
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %.not5065 = icmp slt i32 %15, 1
  br i1 %.not5065, label %._crit_edge, label %.lr.ph67.preheader

.lr.ph67.preheader:                               ; preds = %.preheader56
  %16 = zext nneg i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @f, i64 4), i8 0, i64 %17, i1 false), !tbaa !5
  br label %._crit_edge

.lr.ph64:                                         ; preds = %.preheader57, %.lr.ph64
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.lr.ph64 ], [ 1, %.preheader57 ]
  %18 = getelementptr inbounds [110 x i32], ptr @c, i64 0, i64 %indvars.iv94
  %19 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %18)
  %20 = load i32, ptr %18, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  %22 = tail call noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef %21)
  %23 = fadd double %22, -1.000000e+00
  %24 = fptosi double %23 to i32
  %25 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %indvars.iv94
  store i32 %24, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr %18, align 4, !tbaa !5
  %27 = sitofp i32 %26 to double
  %28 = add nsw i32 %24, 1
  %29 = tail call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 2, i32 noundef %28)
  %30 = fadd double %29, -1.000000e+00
  %31 = fsub double %27, %30
  %32 = fptosi double %31 to i32
  %33 = getelementptr inbounds [110 x i32], ptr @r, i64 0, i64 %indvars.iv94
  store i32 %32, ptr %33, align 4, !tbaa !5
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %.not49.not = icmp slt i64 %indvars.iv94, %35
  br i1 %.not49.not, label %.lr.ph64, label %.preheader56, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph67.preheader, %.preheader56
  store i32 1, ptr @f, align 16, !tbaa !5
  %.not5180 = icmp slt i32 %.lcssa, 1
  br i1 %.not5180, label %.preheader, label %.lr.ph83.preheader

.lr.ph83.preheader:                               ; preds = %._crit_edge
  %36 = sext i32 %15 to i64
  %37 = add nuw i32 %.lcssa, 1
  %wide.trip.count = zext i32 %37 to i64
  %38 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %36
  %indvars.iv.next101.prol = add nsw i64 %36, -1
  br label %.lr.ph83

.preheader:                                       ; preds = %._crit_edge79, %._crit_edge
  br i1 %.not5065, label %._crit_edge88, label %.lr.ph87.preheader

.lr.ph87.preheader:                               ; preds = %.preheader
  %39 = add nuw i32 %15, 1
  %wide.trip.count110 = zext i32 %39 to i64
  %40 = zext nneg i32 %15 to i64
  %min.iters.check = icmp ult i32 %15, 8
  br i1 %min.iters.check, label %.lr.ph87.preheader121, label %vector.ph

.lr.ph87.preheader121:                            ; preds = %middle.block, %.lr.ph87.preheader
  %indvars.iv107.ph = phi i64 [ 1, %.lr.ph87.preheader ], [ %ind.end, %middle.block ]
  %.04085.ph = phi i32 [ 0, %.lr.ph87.preheader ], [ %46, %middle.block ]
  br label %.lr.ph87

vector.ph:                                        ; preds = %.lr.ph87.preheader
  %n.vec = and i64 %40, 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 ], [ %43, %vector.body ]
  %vec.phi119 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %44, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %41 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %offset.idx
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %wide.load = load <4 x i32>, ptr %41, align 4, !tbaa !5
  %wide.load120 = load <4 x i32>, ptr %42, align 4, !tbaa !5
  %43 = add <4 x i32> %wide.load, %vec.phi
  %44 = add <4 x i32> %wide.load120, %vec.phi119
  %index.next = add nuw i64 %index, 8
  %45 = icmp eq i64 %index.next, %n.vec
  br i1 %45, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %44, %43
  %46 = tail call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %40
  br i1 %cmp.n, label %._crit_edge88, label %.lr.ph87.preheader121

.lr.ph83:                                         ; preds = %.lr.ph83.preheader, %._crit_edge79
  %indvars.iv103 = phi i64 [ 1, %.lr.ph83.preheader ], [ %indvars.iv.next104, %._crit_edge79 ]
  %47 = getelementptr inbounds [110 x i32], ptr @v, i64 0, i64 %indvars.iv103
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = getelementptr inbounds [110 x i32], ptr @p, i64 0, i64 %indvars.iv103
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add i32 %50, 2
  %.not5374 = icmp slt i32 %50, -1
  br i1 %.not5374, label %._crit_edge79, label %.lr.ph78

.lr.ph78:                                         ; preds = %.lr.ph83
  %52 = getelementptr inbounds [110 x i32], ptr @r, i64 0, i64 %indvars.iv103
  %smax = tail call i32 @llvm.smax.i32(i32 %51, i32 1)
  br label %53

._crit_edge79:                                    ; preds = %._crit_edge73, %.lr.ph83
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %exitcond106.not = icmp eq i64 %indvars.iv.next104, %wide.trip.count
  br i1 %exitcond106.not, label %.preheader, label %.lr.ph83, !llvm.loop !15

53:                                               ; preds = %.lr.ph78, %._crit_edge73
  %.04276 = phi i32 [ %48, %.lr.ph78 ], [ %72, %._crit_edge73 ]
  %.04375 = phi i32 [ 1, %.lr.ph78 ], [ %71, %._crit_edge73 ]
  %54 = icmp eq i32 %.04375, %51
  br i1 %54, label %55, label %58

55:                                               ; preds = %53
  %56 = load i32, ptr %52, align 4, !tbaa !5
  %57 = mul nsw i32 %56, %48
  br label %58

58:                                               ; preds = %55, %53
  %.1 = phi i32 [ %57, %55 ], [ %.04276, %53 ]
  %.not5469 = icmp slt i32 %15, %.1
  br i1 %.not5469, label %._crit_edge73, label %.lr.ph72.preheader

.lr.ph72.preheader:                               ; preds = %58
  %59 = sext i32 %.1 to i64
  %60 = add nsw i64 %36, %59
  %61 = and i64 %60, 1
  %lcmp.mod.not.not = icmp eq i64 %61, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph72.prol, label %.lr.ph72.prol.loopexit

.lr.ph72.prol:                                    ; preds = %.lr.ph72.preheader
  %62 = load i32, ptr %38, align 4, !tbaa !5
  %.not55.prol = icmp eq i32 %62, 0
  br i1 %.not55.prol, label %63, label %.lr.ph72.prol.loopexit.unr-lcssa

63:                                               ; preds = %.lr.ph72.prol
  %64 = sub nsw i64 %36, %59
  %65 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br label %.lr.ph72.prol.loopexit.unr-lcssa

.lr.ph72.prol.loopexit.unr-lcssa:                 ; preds = %63, %.lr.ph72.prol
  %68 = phi i1 [ true, %.lr.ph72.prol ], [ %67, %63 ]
  %69 = zext i1 %68 to i32
  store i32 %69, ptr %38, align 4, !tbaa !5
  br label %.lr.ph72.prol.loopexit

.lr.ph72.prol.loopexit:                           ; preds = %.lr.ph72.prol.loopexit.unr-lcssa, %.lr.ph72.preheader
  %indvars.iv100.unr = phi i64 [ %36, %.lr.ph72.preheader ], [ %indvars.iv.next101.prol, %.lr.ph72.prol.loopexit.unr-lcssa ]
  %70 = icmp eq i32 %15, %.1
  br i1 %70, label %._crit_edge73, label %.lr.ph72

._crit_edge73:                                    ; preds = %.lr.ph72.prol.loopexit, %89, %58
  %71 = add nuw i32 %.04375, 1
  %72 = shl nsw i32 %.1, 1
  %exitcond.not = icmp eq i32 %.04375, %smax
  br i1 %exitcond.not, label %._crit_edge79, label %53, !llvm.loop !16

.lr.ph72:                                         ; preds = %.lr.ph72.prol.loopexit, %89
  %indvars.iv100 = phi i64 [ %indvars.iv.next101.1, %89 ], [ %indvars.iv100.unr, %.lr.ph72.prol.loopexit ]
  %73 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv100
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %.not55 = icmp eq i32 %74, 0
  br i1 %.not55, label %75, label %.lr.ph72.1

75:                                               ; preds = %.lr.ph72
  %76 = sub nsw i64 %indvars.iv100, %59
  %77 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp ne i32 %78, 0
  br label %.lr.ph72.1

.lr.ph72.1:                                       ; preds = %75, %.lr.ph72
  %80 = phi i1 [ true, %.lr.ph72 ], [ %79, %75 ]
  %81 = zext i1 %80 to i32
  store i32 %81, ptr %73, align 4, !tbaa !5
  %indvars.iv.next101 = add nsw i64 %indvars.iv100, -1
  %82 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv.next101
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %.not55.1 = icmp eq i32 %83, 0
  br i1 %.not55.1, label %84, label %89

84:                                               ; preds = %.lr.ph72.1
  %85 = sub nsw i64 %indvars.iv.next101, %59
  %86 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp ne i32 %87, 0
  br label %89

89:                                               ; preds = %84, %.lr.ph72.1
  %90 = phi i1 [ true, %.lr.ph72.1 ], [ %88, %84 ]
  %91 = zext i1 %90 to i32
  store i32 %91, ptr %82, align 4, !tbaa !5
  %indvars.iv.next101.1 = add nsw i64 %indvars.iv100, -2
  %.not54.not.1 = icmp sgt i64 %indvars.iv.next101, %59
  br i1 %.not54.not.1, label %.lr.ph72, label %._crit_edge73, !llvm.loop !17

._crit_edge88:                                    ; preds = %.lr.ph87, %middle.block, %.preheader
  %.040.lcssa = phi i32 [ 0, %.preheader ], [ %46, %middle.block ], [ %101, %.lr.ph87 ]
  %92 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.040.lcssa)
  %93 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = icmp ne i32 %94, 0
  %96 = load i32, ptr @m, align 4
  %97 = icmp ne i32 %96, 0
  %98 = select i1 %95, i1 true, i1 %97
  br i1 %98, label %.preheader58, label %._crit_edge90, !llvm.loop !18

.lr.ph87:                                         ; preds = %.lr.ph87.preheader121, %.lr.ph87
  %indvars.iv107 = phi i64 [ %indvars.iv.next108, %.lr.ph87 ], [ %indvars.iv107.ph, %.lr.ph87.preheader121 ]
  %.04085 = phi i32 [ %101, %.lr.ph87 ], [ %.04085.ph, %.lr.ph87.preheader121 ]
  %99 = getelementptr inbounds [100010 x i32], ptr @f, i64 0, i64 %indvars.iv107
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = add nsw i32 %100, %.04085
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %exitcond111.not = icmp eq i64 %indvars.iv.next108, %wide.trip.count110
  br i1 %exitcond111.not, label %._crit_edge88, label %.lr.ph87, !llvm.loop !19

._crit_edge90:                                    ; preds = %._crit_edge88, %0
  ret i32 0
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4log2IiEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i32 noundef) local_unnamed_addr #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

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

attributes #0 = { 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 #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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass