; LLVM IR from tangjz/acm-icpc :: codeforces/gym/103957B.ll (Z5checkx)

; 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
@a = external dso_local global [100001 x i32], align 16
@m = external dso_local global i64, align 8
@v = external dso_local global i64, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checkx(i64 noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca i64, align 8
  %17 = alloca i32, align 4
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca i32, align 4
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  store i64 %0, ptr %3, align 8, !tbaa !5
  %30 = load i64, ptr @m, align 8, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !9
  %32 = shl i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = icmp sle i64 %30, %33
  br i1 %34, label %35, label %70

35:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %36 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %36, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %37 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %37, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %64, %35
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = load i64, ptr @m, align 8, !tbaa !5
  %42 = icmp slt i64 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  br label %66

44:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %45 = load i64, ptr %5, align 8, !tbaa !5
  %46 = load i32, ptr %7, align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = add nsw i64 %45, %50
  store i64 %51, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store i64 0, ptr %9, align 8, !tbaa !5
  %52 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %53 = load i64, ptr %52, align 8, !tbaa !5
  store i64 %53, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %55 = load i64, ptr %54, align 8, !tbaa !5
  store i64 %55, ptr %4, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %44
  %57 = load i32, ptr %6, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %6, align 4, !tbaa !9
  %59 = load i32, ptr %7, align 4, !tbaa !9
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %7, align 4, !tbaa !9
  %61 = load i32, ptr @n, align 4, !tbaa !9
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %64

63:                                               ; preds = %56
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %63, %56
  %65 = phi i1 [ false, %56 ], [ false, %63 ]
  br label %38, !llvm.loop !11

66:                                               ; preds = %43
  %67 = load i64, ptr %4, align 8, !tbaa !5
  %68 = load i64, ptr @v, align 8, !tbaa !5
  %69 = icmp sge i64 %67, %68
  store i1 %69, ptr %2, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %209

70:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %71 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %71, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %72 = load i64, ptr %3, align 8, !tbaa !5
  store i64 %72, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %73

73:                                               ; preds = %90, %70
  %74 = load i32, ptr %12, align 4, !tbaa !9
  %75 = load i32, ptr @n, align 4, !tbaa !9
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  br label %93

78:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %79 = load i64, ptr %11, align 8, !tbaa !5
  %80 = load i32, ptr %12, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = add nsw i64 %79, %84
  store i64 %85, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %87 = load i64, ptr %86, align 8, !tbaa !5
  store i64 %87, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %89 = load i64, ptr %88, align 8, !tbaa !5
  store i64 %89, ptr %10, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %78
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %12, align 4, !tbaa !9
  br label %73, !llvm.loop !13

93:                                               ; preds = %77
  %94 = load i64, ptr %10, align 8, !tbaa !5
  %95 = load i64, ptr @v, align 8, !tbaa !5
  %96 = icmp sge i64 %94, %95
  br i1 %96, label %97, label %98

97:                                               ; preds = %93
  store i1 true, ptr %2, align 1
  store i32 1, ptr %15, align 4
  br label %208

98:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  %99 = load i64, ptr %11, align 8, !tbaa !5
  store i64 %99, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %100

100:                                              ; preds = %115, %98
  %101 = load i32, ptr %17, align 4, !tbaa !9
  %102 = load i32, ptr @n, align 4, !tbaa !9
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %105, label %104

104:                                              ; preds = %100
  store i32 8, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  br label %118

105:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %106 = load i64, ptr %16, align 8, !tbaa !5
  %107 = load i32, ptr %17, align 4, !tbaa !9
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = add nsw i64 %106, %111
  store i64 %112, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  store i64 0, ptr %19, align 8, !tbaa !5
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %18, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %114 = load i64, ptr %113, align 8, !tbaa !5
  store i64 %114, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  br label %115

115:                                              ; preds = %105
  %116 = load i32, ptr %17, align 4, !tbaa !9
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %17, align 4, !tbaa !9
  br label %100, !llvm.loop !14

118:                                              ; preds = %104
  %119 = load i64, ptr %11, align 8, !tbaa !5
  %120 = load i64, ptr %16, align 8, !tbaa !5
  %121 = icmp sge i64 %119, %120
  br i1 %121, label %122, label %123

122:                                              ; preds = %118
  store i1 false, ptr %2, align 1
  store i32 1, ptr %15, align 4
  br label %207

123:                                              ; preds = %118
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %124 = load i64, ptr @m, align 8, !tbaa !5
  %125 = load i32, ptr @n, align 4, !tbaa !9
  %126 = sext i32 %125 to i64
  %127 = sdiv i64 %124, %126
  store i64 %127, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %128 = load i64, ptr @m, align 8, !tbaa !5
  %129 = load i32, ptr @n, align 4, !tbaa !9
  %130 = sext i32 %129 to i64
  %131 = srem i64 %128, %130
  %132 = trunc i64 %131 to i32
  store i32 %132, ptr %21, align 4, !tbaa !9
  %133 = load i64, ptr %20, align 8, !tbaa !5
  %134 = sub nsw i64 %133, 1
  %135 = load i64, ptr @v, align 8, !tbaa !5
  %136 = load i64, ptr %11, align 8, !tbaa !5
  %137 = sub nsw i64 %135, %136
  %138 = sub nsw i64 %137, 1
  %139 = load i64, ptr %16, align 8, !tbaa !5
  %140 = load i64, ptr %11, align 8, !tbaa !5
  %141 = sub nsw i64 %139, %140
  %142 = sdiv i64 %138, %141
  %143 = add nsw i64 %142, 1
  %144 = icmp sge i64 %134, %143
  br i1 %144, label %145, label %146

145:                                              ; preds = %123
  store i1 true, ptr %2, align 1
  store i32 1, ptr %15, align 4
  br label %206

146:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %147 = load i64, ptr %11, align 8, !tbaa !5
  %148 = load i64, ptr %20, align 8, !tbaa !5
  %149 = sub nsw i64 %148, 2
  %150 = load i64, ptr %16, align 8, !tbaa !5
  %151 = load i64, ptr %11, align 8, !tbaa !5
  %152 = sub nsw i64 %150, %151
  %153 = mul nsw i64 %149, %152
  %154 = add nsw i64 %147, %153
  store i64 %154, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %155

155:                                              ; preds = %170, %146
  %156 = load i32, ptr %23, align 4, !tbaa !9
  %157 = load i32, ptr %21, align 4, !tbaa !9
  %158 = icmp slt i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  store i32 11, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  br label %173

160:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %161 = load i64, ptr %22, align 8, !tbaa !5
  %162 = load i32, ptr %23, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !9
  %166 = sext i32 %165 to i64
  %167 = add nsw i64 %161, %166
  store i64 %167, ptr %24, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #3
  store i64 0, ptr %25, align 8, !tbaa !5
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef nonnull align 8 dereferenceable(8) %25)
  %169 = load i64, ptr %168, align 8, !tbaa !5
  store i64 %169, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  br label %170

170:                                              ; preds = %160
  %171 = load i32, ptr %23, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %23, align 4, !tbaa !9
  br label %155, !llvm.loop !15

173:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  store i32 0, ptr %26, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  %174 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %174, ptr %27, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %200, %173
  %176 = load i32, ptr %26, align 4, !tbaa !9
  %177 = load i32, ptr @n, align 4, !tbaa !9
  %178 = icmp slt i32 %176, %177
  br i1 %178, label %180, label %179

179:                                              ; preds = %175
  store i32 14, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  br label %202

180:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #3
  %181 = load i64, ptr %22, align 8, !tbaa !5
  %182 = load i32, ptr %27, align 4, !tbaa !9
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !9
  %186 = sext i32 %185 to i64
  %187 = add nsw i64 %181, %186
  store i64 %187, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #3
  store i64 0, ptr %29, align 8, !tbaa !5
  %188 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %189 = load i64, ptr %188, align 8, !tbaa !5
  store i64 %189, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #3
  %190 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %191 = load i64, ptr %190, align 8, !tbaa !5
  store i64 %191, ptr %10, align 8, !tbaa !5
  br label %192

192:                                              ; preds = %180
  %193 = load i32, ptr %26, align 4, !tbaa !9
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %26, align 4, !tbaa !9
  %195 = load i32, ptr %27, align 4, !tbaa !9
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %27, align 4, !tbaa !9
  %197 = load i32, ptr @n, align 4, !tbaa !9
  %198 = icmp eq i32 %196, %197
  br i1 %198, label %199, label %200

199:                                              ; preds = %192
  store i32 0, ptr %27, align 4, !tbaa !9
  br label %200

200:                                              ; preds = %199, %192
  %201 = phi i1 [ false, %192 ], [ false, %199 ]
  br label %175, !llvm.loop !16

202:                                              ; preds = %179
  %203 = load i64, ptr %10, align 8, !tbaa !5
  %204 = load i64, ptr @v, align 8, !tbaa !5
  %205 = icmp sge i64 %203, %204
  store i1 %205, ptr %2, align 1
  store i32 1, ptr %15, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  br label %206

206:                                              ; preds = %202, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  br label %207

207:                                              ; preds = %206, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %208

208:                                              ; preds = %207, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %209

209:                                              ; preds = %208, %66
  %210 = load i1, ptr %2, align 1
  ret i1 %210
}

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

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

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

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 = { 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 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; 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 local_unnamed_addr global i32, align 4
@a = external dso_local local_unnamed_addr global [100001 x i32], align 16
@m = external dso_local local_unnamed_addr global i64, align 8
@v = external dso_local local_unnamed_addr global i64, align 8

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z5checkx(i64 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = load i64, ptr @m, align 8, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !9
  %19 = shl i32 %18, 1
  %20 = sext i32 %19 to i64
  %.not = icmp sgt i64 %17, %20
  br i1 %.not, label %41, label %21

21:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i64 %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  store i64 %0, ptr %3, align 8, !tbaa !5
  %22 = icmp sgt i64 %17, 0
  br i1 %22, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %21
  %23 = phi i64 [ %0, %21 ], [ %35, %.lr.ph ]
  %24 = load i64, ptr @v, align 8, !tbaa !5
  %25 = icmp sge i64 %23, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  br label %112

.lr.ph:                                           ; preds = %21, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %21 ]
  %.03744 = phi i32 [ %spec.store.select, %.lr.ph ], [ 0, %21 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %26 = load i64, ptr %3, align 8, !tbaa !5
  %27 = sext i32 %.03744 to i64
  %28 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = add nsw i64 %26, %30
  store i64 %31, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  store i64 0, ptr %5, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %33 = load i64, ptr %32, align 8, !tbaa !5
  store i64 %33, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %35 = load i64, ptr %34, align 8, !tbaa !5
  store i64 %35, ptr %2, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = add nsw i32 %.03744, 1
  %37 = load i32, ptr @n, align 4, !tbaa !9
  %38 = icmp eq i32 %36, %37
  %spec.store.select = select i1 %38, i32 0, i32 %36
  %39 = load i64, ptr @m, align 8, !tbaa !5
  %40 = icmp sgt i64 %39, %indvars.iv.next
  br i1 %40, label %.lr.ph, label %._crit_edge, !llvm.loop !11

41:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  store i64 %0, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  store i64 %0, ptr %7, align 8, !tbaa !5
  %42 = icmp sgt i32 %18, 0
  br i1 %42, label %.lr.ph48, label %._crit_edge49

._crit_edge49.loopexit:                           ; preds = %.lr.ph48
  %43 = icmp slt i32 %55, 1
  br label %._crit_edge49

._crit_edge49:                                    ; preds = %._crit_edge49.loopexit, %41
  %.not90 = phi i1 [ true, %41 ], [ %43, %._crit_edge49.loopexit ]
  %44 = phi i64 [ %0, %41 ], [ %54, %._crit_edge49.loopexit ]
  %45 = load i64, ptr @v, align 8, !tbaa !5
  %.not41 = icmp sge i64 %44, %45
  %brmerge = or i1 %.not41, %.not90
  br i1 %brmerge, label %._crit_edge54.thread, label %.lr.ph53.preheader

.lr.ph48:                                         ; preds = %41, %.lr.ph48
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %.lr.ph48 ], [ 0, %41 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %46 = load i64, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv66
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = add nsw i64 %46, %49
  store i64 %50, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  store i64 0, ptr %9, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9)
  %52 = load i64, ptr %51, align 8, !tbaa !5
  store i64 %52, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %54 = load i64, ptr %53, align 8, !tbaa !5
  store i64 %54, ptr %6, align 8, !tbaa !5
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %55 = load i32, ptr @n, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = icmp slt i64 %indvars.iv.next67, %56
  br i1 %57, label %.lr.ph48, label %._crit_edge49.loopexit, !llvm.loop !13

.lr.ph53.preheader:                               ; preds = %._crit_edge49
  %58 = load i64, ptr %7, align 8, !tbaa !5
  br label %.lr.ph53

._crit_edge54:                                    ; preds = %.lr.ph53
  %.pre = load i64, ptr %7, align 8, !tbaa !5
  %.not42 = icmp slt i64 %.pre, %64
  br i1 %.not42, label %68, label %._crit_edge54.thread

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %.lr.ph53
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %.lr.ph53 ], [ 0, %.lr.ph53.preheader ]
  %.03550 = phi i64 [ %64, %.lr.ph53 ], [ %58, %.lr.ph53.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  %59 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv69
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = add nsw i64 %.03550, %61
  store i64 %62, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #4
  store i64 0, ptr %11, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %64 = load i64, ptr %63, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %65 = load i32, ptr @n, align 4, !tbaa !9
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next70, %66
  br i1 %67, label %.lr.ph53, label %._crit_edge54, !llvm.loop !14

68:                                               ; preds = %._crit_edge54
  %69 = load i64, ptr @m, align 8, !tbaa !5
  %70 = sext i32 %65 to i64
  %71 = sdiv i64 %69, %70
  %72 = srem i64 %69, %70
  %73 = trunc nsw i64 %72 to i32
  %74 = load i64, ptr @v, align 8, !tbaa !5
  %75 = xor i64 %.pre, -1
  %76 = add i64 %74, %75
  %77 = sub nsw i64 %64, %.pre
  %78 = sdiv i64 %76, %77
  %79 = add nsw i64 %78, 1
  %.not43.not = icmp sgt i64 %71, %79
  br i1 %.not43.not, label %._crit_edge54.thread, label %80

80:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #4
  %81 = add nsw i64 %71, -2
  %82 = mul nsw i64 %81, %77
  %83 = add nsw i64 %82, %.pre
  store i64 %83, ptr %12, align 8, !tbaa !5
  %84 = icmp sgt i64 %72, 0
  br i1 %84, label %.lr.ph58.preheader, label %.preheader

.lr.ph58.preheader:                               ; preds = %80
  %smax = call i32 @llvm.smax.i32(i32 %73, i32 1)
  %wide.trip.count = zext nneg i32 %smax to i64
  br label %.lr.ph58

.preheader.loopexit:                              ; preds = %.lr.ph58
  %.pre75 = load i32, ptr @n, align 4, !tbaa !9
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %80
  %85 = phi i32 [ %.pre75, %.preheader.loopexit ], [ %65, %80 ]
  %86 = icmp sgt i32 %85, 0
  br i1 %86, label %.lr.ph61, label %.preheader.._crit_edge62_crit_edge

.preheader.._crit_edge62_crit_edge:               ; preds = %.preheader
  %.pre76 = load i64, ptr %6, align 8, !tbaa !5
  br label %._crit_edge62

.lr.ph58:                                         ; preds = %.lr.ph58.preheader, %.lr.ph58
  %87 = phi i64 [ %83, %.lr.ph58.preheader ], [ %93, %.lr.ph58 ]
  %indvars.iv72 = phi i64 [ 0, %.lr.ph58.preheader ], [ %indvars.iv.next73, %.lr.ph58 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #4
  %88 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv72
  %89 = load i32, ptr %88, align 4, !tbaa !9
  %90 = sext i32 %89 to i64
  %91 = add nsw i64 %87, %90
  store i64 %91, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %14) #4
  store i64 0, ptr %14, align 8, !tbaa !5
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14)
  %93 = load i64, ptr %92, align 8, !tbaa !5
  store i64 %93, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #4
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
  br i1 %exitcond.not, label %.preheader.loopexit, label %.lr.ph58, !llvm.loop !15

._crit_edge62:                                    ; preds = %.lr.ph61, %.preheader.._crit_edge62_crit_edge
  %94 = phi i64 [ %.pre76, %.preheader.._crit_edge62_crit_edge ], [ %106, %.lr.ph61 ]
  %95 = load i64, ptr @v, align 8, !tbaa !5
  %96 = icmp sge i64 %94, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #4
  br label %._crit_edge54.thread

.lr.ph61:                                         ; preds = %.preheader, %.lr.ph61
  %.060 = phi i32 [ %spec.store.select1, %.lr.ph61 ], [ %73, %.preheader ]
  %.03059 = phi i32 [ %107, %.lr.ph61 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %15) #4
  %97 = load i64, ptr %12, align 8, !tbaa !5
  %98 = sext i32 %.060 to i64
  %99 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = add nsw i64 %97, %101
  store i64 %102, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %16) #4
  store i64 0, ptr %16, align 8, !tbaa !5
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %104 = load i64, ptr %103, align 8, !tbaa !5
  store i64 %104, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %15) #4
  %105 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %106 = load i64, ptr %105, align 8, !tbaa !5
  store i64 %106, ptr %6, align 8, !tbaa !5
  %107 = add nuw nsw i32 %.03059, 1
  %108 = add nsw i32 %.060, 1
  %109 = load i32, ptr @n, align 4, !tbaa !9
  %110 = icmp eq i32 %108, %109
  %spec.store.select1 = select i1 %110, i32 0, i32 %108
  %111 = icmp slt i32 %107, %109
  br i1 %111, label %.lr.ph61, label %._crit_edge62, !llvm.loop !16

._crit_edge54.thread:                             ; preds = %._crit_edge49, %._crit_edge54, %68, %._crit_edge62
  %.2 = phi i1 [ %.not41, %._crit_edge49 ], [ false, %._crit_edge54 ], [ %96, %._crit_edge62 ], [ true, %68 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  br label %112

112:                                              ; preds = %._crit_edge54.thread, %._crit_edge
  %.3 = phi i1 [ %25, %._crit_edge ], [ %.2, %._crit_edge54.thread ]
  ret i1 %.3
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) 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

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass