; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/163 Division 2/Problem D (D)

; 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
@g = external dso_local global [210 x [210 x i32]], align 16
@inf = external dso_local global i32, align 4
@x = external dso_local global [21945 x i32], align 16
@y = external dso_local global [21945 x i32], align 16
@w = external dso_local global [21945 x i32], align 16
@ans = external dso_local global double, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiii(i32 noundef, i32 noundef, i32 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

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

12:                                               ; preds = %41, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

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

18:                                               ; preds = %31, %17
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sle i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  %24 = load i32, ptr @inf, align 4, !tbaa !5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %26
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [210 x i32], ptr %27, i64 0, i64 %29
  store i32 %24, ptr %30, align 4, !tbaa !5
  br label %31

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

34:                                               ; preds = %22
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %36
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [210 x i32], ptr %37, i64 0, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %34
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !11

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

45:                                               ; preds = %89, %44
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  %51 = load i32, ptr %5, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %52
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %55
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [21945 x i32], ptr @w, i64 0, i64 %58
  %60 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %53, ptr noundef %56, ptr noundef %59)
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [21945 x i32], ptr @w, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %69
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [210 x i32], ptr %70, i64 0, i64 %75
  store i32 %64, ptr %76, align 4, !tbaa !5
  %77 = load i32, ptr %5, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %81
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [210 x i32], ptr %82, i64 0, i64 %87
  store i32 %64, ptr %88, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %50
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !12

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

93:                                               ; preds = %148, %92
  %94 = load i32, ptr %6, align 4, !tbaa !5
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %93
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %151

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

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

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

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

105:                                              ; preds = %140, %104
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = icmp sle i32 %106, %107
  br i1 %108, label %110, label %109

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

110:                                              ; preds = %105
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %112
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [210 x i32], ptr %113, i64 0, i64 %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %118
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [210 x i32], ptr %119, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %125
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [210 x i32], ptr %126, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = add nsw i32 %123, %130
  store i32 %131, ptr %9, align 4, !tbaa !5
  %132 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %116, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %135
  %137 = load i32, ptr %8, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [210 x i32], ptr %136, i64 0, i64 %138
  store i32 %133, ptr %139, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %140

140:                                              ; preds = %110
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %8, align 4, !tbaa !5
  br label %105, !llvm.loop !13

143:                                              ; preds = %109
  br label %144

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

147:                                              ; preds = %103
  br label %148

148:                                              ; preds = %147
  %149 = load i32, ptr %6, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %6, align 4, !tbaa !5
  br label %93, !llvm.loop !15

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

152:                                              ; preds = %170, %151
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = load i32, ptr @m, align 4, !tbaa !5
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %157, label %156

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

157:                                              ; preds = %152
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !5
  %162 = load i32, ptr %10, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = load i32, ptr %10, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [21945 x i32], ptr @w, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  call void @_Z5solveiii(i32 noundef %161, i32 noundef %165, i32 noundef %169)
  br label %170

170:                                              ; preds = %157
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %10, align 4, !tbaa !5
  br label %152, !llvm.loop !16

173:                                              ; preds = %156
  %174 = load double, ptr @ans, align 8, !tbaa !17
  %175 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %174)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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


; 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
@g = external dso_local global [210 x [210 x i32]], align 16
@inf = external dso_local local_unnamed_addr global i32, align 4
@x = external dso_local global [21945 x i32], align 16
@y = external dso_local global [21945 x i32], align 16
@w = external dso_local global [21945 x i32], align 16
@ans = external dso_local local_unnamed_addr global double, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5solveiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not54 = icmp slt i32 %3, 1
  br i1 %.not54, label %.preheader50, label %.preheader51.lr.ph

.preheader51.lr.ph:                               ; preds = %0
  %4 = load i32, ptr @inf, align 4
  %5 = add nuw i32 %3, 1
  %wide.trip.count75 = zext i32 %5 to i64
  %6 = zext nneg i32 %3 to i64
  %min.iters.check = icmp ult i32 %3, 8
  %n.vec = and i64 %6, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %4, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %n.vec, %6
  br label %.preheader51

.preheader51:                                     ; preds = %.preheader51.lr.ph, %._crit_edge
  %indvars.iv72 = phi i64 [ 1, %.preheader51.lr.ph ], [ %indvars.iv.next73, %._crit_edge ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader51
  %indvars.iv.ph = phi i64 [ 1, %.preheader51 ], [ %ind.end, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.preheader51, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader51 ]
  %offset.idx = or disjoint i64 %index, 1
  %7 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv72, i64 %offset.idx
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> %broadcast.splat, ptr %7, align 4, !tbaa !5
  store <4 x i32> %broadcast.splat, ptr %8, align 4, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %9 = icmp eq i64 %index.next, %n.vec
  br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

.preheader50:                                     ; preds = %._crit_edge, %0
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %.preheader49

._crit_edge:                                      ; preds = %scalar.ph, %middle.block
  %12 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv72, i64 %indvars.iv72
  store i32 0, ptr %12, align 4, !tbaa !5
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count75
  br i1 %exitcond76.not, label %.preheader50, label %.preheader51, !llvm.loop !13

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %scalar.ph ], [ %indvars.iv.ph, %scalar.ph.preheader ]
  %13 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv72, i64 %indvars.iv
  store i32 %4, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count75
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !14

.preheader49.loopexit:                            ; preds = %.lr.ph
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.preheader49

.preheader49:                                     ; preds = %.preheader49.loopexit, %.preheader50
  %14 = phi i32 [ %27, %.preheader49.loopexit ], [ %10, %.preheader50 ]
  %15 = phi i32 [ %.pre, %.preheader49.loopexit ], [ %3, %.preheader50 ]
  %.not4364 = icmp slt i32 %15, 1
  br i1 %.not4364, label %.preheader, label %.preheader48

.lr.ph:                                           ; preds = %.preheader50, %.lr.ph
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %.lr.ph ], [ 0, %.preheader50 ]
  %16 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %indvars.iv77
  %17 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %indvars.iv77
  %18 = getelementptr inbounds [21945 x i32], ptr @w, i64 0, i64 %indvars.iv77
  %19 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %16, ptr noundef nonnull %17, ptr noundef nonnull %18)
  %20 = load i32, ptr %18, align 4, !tbaa !5
  %21 = load i32, ptr %17, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = load i32, ptr %16, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %22, i64 %24
  store i32 %20, ptr %25, align 4, !tbaa !5
  %26 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %24, i64 %22
  store i32 %20, ptr %26, align 4, !tbaa !5
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %27 = load i32, ptr @m, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next78, %28
  br i1 %29, label %.lr.ph, label %.preheader49.loopexit, !llvm.loop !15

.preheader48:                                     ; preds = %.preheader49, %._crit_edge63
  %30 = phi i32 [ %36, %._crit_edge63 ], [ %15, %.preheader49 ]
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %._crit_edge63 ], [ 1, %.preheader49 ]
  %.not4461 = icmp slt i32 %30, 1
  br i1 %.not4461, label %._crit_edge63, label %.preheader47

.preheader.loopexit70:                            ; preds = %._crit_edge63
  %.pre92 = load i32, ptr @m, align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit70, %.preheader49
  %31 = phi i32 [ %.pre92, %.preheader.loopexit70 ], [ %14, %.preheader49 ]
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph67, label %._crit_edge68

.preheader47:                                     ; preds = %.preheader48, %._crit_edge60
  %33 = phi i32 [ %38, %._crit_edge60 ], [ %30, %.preheader48 ]
  %34 = phi i32 [ %39, %._crit_edge60 ], [ %30, %.preheader48 ]
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %._crit_edge60 ], [ 1, %.preheader48 ]
  %.not4557 = icmp slt i32 %34, 1
  br i1 %.not4557, label %.preheader47.._crit_edge60_crit_edge, label %.lr.ph59

.preheader47.._crit_edge60_crit_edge:             ; preds = %.preheader47
  %.pre93 = sext i32 %34 to i64
  br label %._crit_edge60

.lr.ph59:                                         ; preds = %.preheader47
  %35 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv83, i64 %indvars.iv86
  br label %40

._crit_edge63:                                    ; preds = %._crit_edge60, %.preheader48
  %36 = phi i32 [ %30, %.preheader48 ], [ %38, %._crit_edge60 ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %37 = sext i32 %36 to i64
  %.not43.not = icmp slt i64 %indvars.iv86, %37
  br i1 %.not43.not, label %.preheader48, label %.preheader.loopexit70, !llvm.loop !16

._crit_edge60:                                    ; preds = %40, %.preheader47.._crit_edge60_crit_edge
  %.pre-phi = phi i64 [ %.pre93, %.preheader47.._crit_edge60_crit_edge ], [ %49, %40 ]
  %38 = phi i32 [ %33, %.preheader47.._crit_edge60_crit_edge ], [ %48, %40 ]
  %39 = phi i32 [ %34, %.preheader47.._crit_edge60_crit_edge ], [ %48, %40 ]
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %.not44.not = icmp slt i64 %indvars.iv83, %.pre-phi
  br i1 %.not44.not, label %.preheader47, label %._crit_edge63, !llvm.loop !18

40:                                               ; preds = %.lr.ph59, %40
  %indvars.iv80 = phi i64 [ 1, %.lr.ph59 ], [ %indvars.iv.next81, %40 ]
  %41 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv83, i64 %indvars.iv80
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %42 = load i32, ptr %35, align 4, !tbaa !5
  %43 = getelementptr inbounds [210 x [210 x i32]], ptr @g, i64 0, i64 %indvars.iv86, i64 %indvars.iv80
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = add nsw i32 %44, %42
  store i32 %45, ptr %1, align 4, !tbaa !5
  %46 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %41, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %47 = load i32, ptr %46, align 4, !tbaa !5
  store i32 %47, ptr %41, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %.not45.not = icmp slt i64 %indvars.iv80, %49
  br i1 %.not45.not, label %40, label %._crit_edge60, !llvm.loop !19

._crit_edge68:                                    ; preds = %.lr.ph67, %.preheader
  %50 = load double, ptr @ans, align 8, !tbaa !20
  %51 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %50)
  ret i32 0

.lr.ph67:                                         ; preds = %.preheader, %.lr.ph67
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %.lr.ph67 ], [ 0, %.preheader ]
  %52 = getelementptr inbounds [21945 x i32], ptr @x, i64 0, i64 %indvars.iv89
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = getelementptr inbounds [21945 x i32], ptr @y, i64 0, i64 %indvars.iv89
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [21945 x i32], ptr @w, i64 0, i64 %indvars.iv89
  %57 = load i32, ptr %56, align 4, !tbaa !5
  call void @_Z5solveiii(i32 noundef %53, i32 noundef %55, i32 noundef %57)
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %58 = load i32, ptr @m, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = icmp slt i64 %indvars.iv.next90, %59
  br i1 %60, label %.lr.ph67, label %._crit_edge68, !llvm.loop !22
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

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

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


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