; LLVM IR from tangjz/acm-icpc :: codeforces/complete (526E)

; 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
@q = external dso_local global i32, align 4
@a = external dso_local global [2000001 x i32], align 16
@f = external dso_local global [2000001 x i32], align 16
@g = external dso_local global [2000001 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 [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @q)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %25, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %28

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i32, ptr @a, i64 %22
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

28:                                               ; preds = %19
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @a, i64 %30
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = mul i64 %33, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %31, ptr align 16 @a, i64 %34, i1 false)
  br label %35

35:                                               ; preds = %155, %28
  %36 = load i32, ptr @q, align 4, !tbaa !5
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr @q, align 4, !tbaa !5
  %38 = icmp ne i32 %36, 0
  br i1 %38, label %39, label %158

39:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %40 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %40, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  store i64 0, ptr %6, align 8, !tbaa !11
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %107, %39
  %43 = load i32, ptr %7, align 4, !tbaa !5
  %44 = load i32, ptr @n, align 4, !tbaa !5
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %110

47:                                               ; preds = %42
  br label %48

48:                                               ; preds = %66, %47
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = load i32, ptr @n, align 4, !tbaa !5
  %51 = shl i32 %50, 1
  %52 = icmp slt i32 %49, %51
  br i1 %52, label %53, label %63

53:                                               ; preds = %48
  %54 = load i64, ptr %6, align 8, !tbaa !11
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2000001 x i32], ptr @a, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = add nsw i64 %54, %59
  %61 = load i64, ptr %5, align 8, !tbaa !11
  %62 = icmp sle i64 %60, %61
  br label %63

63:                                               ; preds = %53, %48
  %64 = phi i1 [ false, %48 ], [ %62, %53 ]
  br i1 %64, label %65, label %75

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = add nsw i32 %67, 1
  store i32 %68, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %67 to i64
  %70 = getelementptr inbounds [2000001 x i32], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = load i64, ptr %6, align 8, !tbaa !11
  %74 = add nsw i64 %73, %72
  store i64 %74, ptr %6, align 8, !tbaa !11
  br label %48, !llvm.loop !13

75:                                               ; preds = %63
  %76 = load i32, ptr %8, align 4, !tbaa !5
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sub nsw i32 %76, %77
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %80
  store i32 %78, ptr %81, align 4, !tbaa !5
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr @n, align 4, !tbaa !5
  %84 = srem i32 %82, %83
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [2000001 x i32], ptr @g, i64 0, i64 %86
  store i32 %84, ptr %87, align 4, !tbaa !5
  %88 = load i32, ptr %7, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [2000001 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = load i64, ptr %6, align 8, !tbaa !11
  %94 = sub nsw i64 %93, %92
  store i64 %94, ptr %6, align 8, !tbaa !11
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = icmp slt i32 %98, %102
  br i1 %103, label %104, label %106

104:                                              ; preds = %75
  %105 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %105, ptr %4, align 4, !tbaa !5
  br label %106

106:                                              ; preds = %104, %75
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %42, !llvm.loop !14

110:                                              ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %111 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %111, ptr %9, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %152, %110
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !5
  %119 = add nsw i32 %114, %118
  %120 = icmp sle i32 %113, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %112
  store i32 13, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %155

122:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = load i32, ptr @n, align 4, !tbaa !5
  %125 = srem i32 %123, %124
  store i32 %125, ptr %13, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %132, %122
  %127 = load i32, ptr %12, align 4, !tbaa !5
  %128 = load i32, ptr @n, align 4, !tbaa !5
  %129 = icmp slt i32 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 16, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %145

131:                                              ; preds = %126
  br label %132

132:                                              ; preds = %131
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %11, align 4, !tbaa !5
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr %12, align 4, !tbaa !5
  %140 = add nsw i32 %139, %138
  store i32 %140, ptr %12, align 4, !tbaa !5
  %141 = load i32, ptr %13, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [2000001 x i32], ptr @g, i64 0, i64 %142
  %144 = load i32, ptr %143, align 4, !tbaa !5
  store i32 %144, ptr %13, align 4, !tbaa !5
  br label %126, !llvm.loop !15

145:                                              ; preds = %130
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = load i32, ptr %3, align 4, !tbaa !5
  %148 = icmp slt i32 %146, %147
  br i1 %148, label %149, label %151

149:                                              ; preds = %145
  %150 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %150, ptr %3, align 4, !tbaa !5
  br label %151

151:                                              ; preds = %149, %145
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %9, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %9, align 4, !tbaa !5
  br label %112, !llvm.loop !16

155:                                              ; preds = %121
  %156 = load i32, ptr %3, align 4, !tbaa !5
  %157 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %156)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %35, !llvm.loop !17

158:                                              ; preds = %35
  ret i32 0
}

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!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
@q = external dso_local global i32, align 4
@a = external dso_local global [2000001 x i32], align 16
@f = external dso_local local_unnamed_addr global [2000001 x i32], align 16
@g = external dso_local local_unnamed_addr global [2000001 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 [6 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i64, align 8
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @q)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %12, %.lr.ph ]
  %5 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi
  %6 = shl nsw i64 %.pre-phi, 2
  tail call void @llvm.memcpy.p0.p0.i64(ptr nonnull align 4 %5, ptr nonnull align 16 @a, i64 %6, i1 false)
  %7 = load i32, ptr @q, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @q, align 4, !tbaa !5
  %.not82 = icmp eq i32 %7, 0
  br i1 %.not82, label %._crit_edge85, label %.lr.ph84

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

.lr.ph84:                                         ; preds = %._crit_edge, %._crit_edge80
  %14 = load i32, ptr @n, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %1)
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.preheader.lr.ph, label %.preheader52.thread

.preheader.lr.ph:                                 ; preds = %.lr.ph84
  %18 = shl nuw i32 %16, 1
  %19 = load i64, ptr %1, align 8
  %20 = sext i32 %18 to i64
  %wide.trip.count = zext nneg i32 %16 to i64
  br label %.preheader

.preheader52:                                     ; preds = %.critedge
  %21 = sext i32 %spec.select to i64
  %22 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = add i32 %23, %spec.select
  %.not4976 = icmp slt i32 %23, 0
  br i1 %.not4976, label %._crit_edge80, label %.lr.ph79

.preheader52.thread:                              ; preds = %.lr.ph84
  %25 = load i32, ptr @f, align 16, !tbaa !5
  %.not4976100 = icmp slt i32 %25, 0
  br i1 %.not4976100, label %._crit_edge80, label %.lr.ph79.split.preheader

.lr.ph79:                                         ; preds = %.preheader52
  br i1 %17, label %.lr.ph73.us.preheader, label %.lr.ph79.split.preheader

.lr.ph79.split.preheader:                         ; preds = %.preheader52.thread, %.lr.ph79
  %.042.lcssa101103 = phi i32 [ %spec.select, %.lr.ph79 ], [ 0, %.preheader52.thread ]
  %26 = phi i32 [ %24, %.lr.ph79 ], [ %25, %.preheader52.thread ]
  %smax = call i32 @llvm.smax.i32(i32 %.042.lcssa101103, i32 %26)
  %27 = add i32 %smax, 1
  %28 = sub i32 %27, %.042.lcssa101103
  %min.iters.check = icmp ult i32 %28, 8
  br i1 %min.iters.check, label %.lr.ph79.split.preheader115, label %vector.ph

.lr.ph79.split.preheader115:                      ; preds = %middle.block, %.lr.ph79.split.preheader
  %.03778.ph = phi i32 [ %.042.lcssa101103, %.lr.ph79.split.preheader ], [ %ind.end, %middle.block ]
  %.04477.ph = phi i32 [ %14, %.lr.ph79.split.preheader ], [ %32, %middle.block ]
  br label %.lr.ph79.split

vector.ph:                                        ; preds = %.lr.ph79.split.preheader
  %n.vec = and i32 %28, -8
  %ind.end = add i32 %.042.lcssa101103, %n.vec
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %14, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i32 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %29, %vector.body ]
  %vec.phi114 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %30, %vector.body ]
  %29 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi, <4 x i32> zeroinitializer)
  %30 = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %vec.phi114, <4 x i32> zeroinitializer)
  %index.next = add nuw i32 %index, 8
  %31 = icmp eq i32 %index.next, %n.vec
  br i1 %31, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smin.v4i32(<4 x i32> %29, <4 x i32> %30)
  %32 = call i32 @llvm.vector.reduce.smin.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i32 %28, %n.vec
  br i1 %cmp.n, label %._crit_edge80, label %.lr.ph79.split.preheader115

.lr.ph73.us.preheader:                            ; preds = %.lr.ph79
  %smax97 = call i32 @llvm.smax.i32(i32 %spec.select, i32 %24)
  br label %.lr.ph73.us

.lr.ph73.us:                                      ; preds = %.lr.ph73.us.preheader, %._crit_edge74.us
  %.03778.us = phi i32 [ %43, %._crit_edge74.us ], [ %spec.select, %.lr.ph73.us.preheader ]
  %.04477.us = phi i32 [ %spec.select51.us, %._crit_edge74.us ], [ %14, %.lr.ph73.us.preheader ]
  %33 = srem i32 %.03778.us, %16
  br label %34

34:                                               ; preds = %.lr.ph73.us, %34
  %.071.us = phi i32 [ %33, %.lr.ph73.us ], [ %41, %34 ]
  %.03570.us = phi i32 [ 0, %.lr.ph73.us ], [ %39, %34 ]
  %.03669.us = phi i32 [ 0, %.lr.ph73.us ], [ %35, %34 ]
  %35 = add nuw nsw i32 %.03669.us, 1
  %36 = sext i32 %.071.us to i64
  %37 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, %.03570.us
  %40 = getelementptr inbounds [2000001 x i32], ptr @g, i64 0, i64 %36
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = icmp slt i32 %39, %16
  br i1 %42, label %34, label %._crit_edge74.us, !llvm.loop !14

._crit_edge74.us:                                 ; preds = %34
  %spec.select51.us = call i32 @llvm.smin.i32(i32 %35, i32 %.04477.us)
  %43 = add i32 %.03778.us, 1
  %exitcond98.not = icmp eq i32 %.03778.us, %smax97
  br i1 %exitcond98.not, label %._crit_edge80, label %.lr.ph73.us, !llvm.loop !15

.preheader:                                       ; preds = %.preheader.lr.ph, %.critedge
  %indvars.iv92 = phi i64 [ 0, %.preheader.lr.ph ], [ %indvars.iv.next93, %.critedge ]
  %.03866 = phi i32 [ 0, %.preheader.lr.ph ], [ %.1.lcssa, %.critedge ]
  %.04064 = phi i64 [ 0, %.preheader.lr.ph ], [ %60, %.critedge ]
  %.04263 = phi i32 [ 0, %.preheader.lr.ph ], [ %spec.select, %.critedge ]
  %44 = icmp slt i32 %.03866, %18
  br i1 %44, label %.lr.ph57.preheader, label %.critedge

.lr.ph57.preheader:                               ; preds = %.preheader
  %45 = sext i32 %.03866 to i64
  br label %.lr.ph57

.lr.ph57:                                         ; preds = %.lr.ph57.preheader, %50
  %indvars.iv89 = phi i64 [ %45, %.lr.ph57.preheader ], [ %indvars.iv.next90, %50 ]
  %.14155 = phi i64 [ %.04064, %.lr.ph57.preheader ], [ %49, %50 ]
  %46 = getelementptr inbounds [2000001 x i32], ptr @a, i64 0, i64 %indvars.iv89
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = add nsw i64 %.14155, %48
  %.not50 = icmp sgt i64 %49, %19
  br i1 %.not50, label %.critedge.loopexit.split.loop.exit106, label %50

50:                                               ; preds = %.lr.ph57
  %indvars.iv.next90 = add nsw i64 %indvars.iv89, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next90, %20
  br i1 %exitcond.not, label %.critedge, label %.lr.ph57, !llvm.loop !16

.critedge.loopexit.split.loop.exit106:            ; preds = %.lr.ph57
  %51 = trunc nsw i64 %indvars.iv89 to i32
  br label %.critedge

.critedge:                                        ; preds = %50, %.critedge.loopexit.split.loop.exit106, %.preheader
  %.141.lcssa = phi i64 [ %.04064, %.preheader ], [ %.14155, %.critedge.loopexit.split.loop.exit106 ], [ %49, %50 ]
  %.1.lcssa = phi i32 [ %.03866, %.preheader ], [ %51, %.critedge.loopexit.split.loop.exit106 ], [ %18, %50 ]
  %52 = trunc nuw nsw i64 %indvars.iv92 to i32
  %53 = sub nsw i32 %.1.lcssa, %52
  %54 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %indvars.iv92
  store i32 %53, ptr %54, align 4, !tbaa !5
  %55 = srem i32 %.1.lcssa, %16
  %56 = getelementptr inbounds [2000001 x i32], ptr @g, i64 0, i64 %indvars.iv92
  store i32 %55, ptr %56, align 4, !tbaa !5
  %57 = getelementptr inbounds [2000001 x i32], ptr @a, i64 0, i64 %indvars.iv92
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = sub nsw i64 %.141.lcssa, %59
  %61 = sext i32 %.04263 to i64
  %62 = getelementptr inbounds [2000001 x i32], ptr @f, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp slt i32 %53, %63
  %spec.select = select i1 %64, i32 %52, i32 %.04263
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond95.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count
  br i1 %exitcond95.not, label %.preheader52, label %.preheader, !llvm.loop !17

._crit_edge80:                                    ; preds = %.lr.ph79.split, %._crit_edge74.us, %middle.block, %.preheader52.thread, %.preheader52
  %.044.lcssa = phi i32 [ %14, %.preheader52 ], [ %14, %.preheader52.thread ], [ %32, %middle.block ], [ %spec.select51.us, %._crit_edge74.us ], [ %spec.select51, %.lr.ph79.split ]
  %65 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.044.lcssa)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  %66 = load i32, ptr @q, align 4, !tbaa !5
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr @q, align 4, !tbaa !5
  %.not = icmp eq i32 %66, 0
  br i1 %.not, label %._crit_edge85, label %.lr.ph84, !llvm.loop !18

.lr.ph79.split:                                   ; preds = %.lr.ph79.split.preheader115, %.lr.ph79.split
  %.03778 = phi i32 [ %68, %.lr.ph79.split ], [ %.03778.ph, %.lr.ph79.split.preheader115 ]
  %.04477 = phi i32 [ %spec.select51, %.lr.ph79.split ], [ %.04477.ph, %.lr.ph79.split.preheader115 ]
  %spec.select51 = call i32 @llvm.smin.i32(i32 %.04477, i32 0)
  %68 = add i32 %.03778, 1
  %exitcond96.not = icmp eq i32 %.03778, %smax
  br i1 %exitcond96.not, label %._crit_edge80, label %.lr.ph79.split, !llvm.loop !19

._crit_edge85:                                    ; preds = %._crit_edge80, %._crit_edge
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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

; 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 <4 x i32> @llvm.smin.v4i32(<4 x i32>, <4 x i32>) #4

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

attributes #0 = { mustprogress nofree norecurse 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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10, !13, !12}


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