; LLVM IR from tangjz/acm-icpc :: self_training/2015-01-31 (F)

; 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
@k = external dso_local global i32, align 4
@cnt = external dso_local global [4000010 x i32], align 16
@sum = external dso_local global [4000010 x i32], align 16
@.str = external hidden unnamed_addr constant [7 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %9

9:                                                ; preds = %134, %0
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  %11 = icmp eq i32 %10, 3
  br i1 %11, label %12, label %137

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @cnt, i8 0, i64 16000040, i1 false)
  call void @llvm.memset.p0.i64(ptr align 16 @sum, i8 0, i64 16000040, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  br label %13

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

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

18:                                               ; preds = %13
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %6)
  %20 = load i32, ptr %6, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %29, label %25

25:                                               ; preds = %18
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %27
  store i32 1, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %25, %18
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %32, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %38, label %40

38:                                               ; preds = %29
  %39 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %39, ptr %4, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %38, %29
  br label %41

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

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

45:                                               ; preds = %63, %44
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr @k, align 4, !tbaa !5
  %49 = add nsw i32 %47, %48
  %50 = icmp sle i32 %46, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %45
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = sub nsw i32 %53, 1
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %57
  store i32 %62, ptr %60, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %52
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %7, align 4, !tbaa !5
  br label %45, !llvm.loop !11

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

67:                                               ; preds = %131, %66
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %134

72:                                               ; preds = %67
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = load i32, ptr @k, align 4, !tbaa !5
  %75 = add nsw i32 %73, %74
  %76 = sub nsw i32 %75, 1
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = sub nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = sub nsw i32 %79, %84
  store i32 %85, ptr %3, align 4, !tbaa !5
  %86 = load i32, ptr %8, align 4, !tbaa !5
  %87 = load i32, ptr @k, align 4, !tbaa !5
  %88 = add nsw i32 %86, %87
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr @m, align 4, !tbaa !5
  %94 = load i32, ptr @k, align 4, !tbaa !5
  %95 = sub nsw i32 %93, %94
  %96 = icmp sgt i32 %92, %95
  br i1 %96, label %97, label %103

97:                                               ; preds = %72
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = load i32, ptr @k, align 4, !tbaa !5
  %100 = sub nsw i32 %98, %99
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = add nsw i32 %101, %100
  store i32 %102, ptr %3, align 4, !tbaa !5
  br label %124

103:                                              ; preds = %72
  %104 = load i32, ptr %8, align 4, !tbaa !5
  %105 = load i32, ptr @k, align 4, !tbaa !5
  %106 = add nsw i32 %104, %105
  %107 = sub nsw i32 %106, 1
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = icmp sgt i32 %110, 0
  br i1 %111, label %112, label %123

112:                                              ; preds = %103
  %113 = load i32, ptr %8, align 4, !tbaa !5
  %114 = load i32, ptr @k, align 4, !tbaa !5
  %115 = add nsw i32 %113, %114
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = load i32, ptr %3, align 4, !tbaa !5
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr %3, align 4, !tbaa !5
  br label %123

123:                                              ; preds = %112, %103
  br label %124

124:                                              ; preds = %123, %97
  %125 = load i32, ptr %2, align 4, !tbaa !5
  %126 = load i32, ptr %3, align 4, !tbaa !5
  %127 = icmp slt i32 %125, %126
  br i1 %127, label %128, label %130

128:                                              ; preds = %124
  %129 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %129, ptr %2, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %128, %124
  br label %131

131:                                              ; preds = %130
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %8, align 4, !tbaa !5
  br label %67, !llvm.loop !12

134:                                              ; preds = %71
  %135 = load i32, ptr %2, align 4, !tbaa !5
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %135)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %9, !llvm.loop !13

137:                                              ; preds = %9
  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 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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: write) }
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 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !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
@k = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global [4000010 x i32], align 16
@sum = external dso_local local_unnamed_addr global [4000010 x i32], align 16
@.str = external hidden unnamed_addr constant [7 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: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %3 = icmp eq i32 %2, 3
  br i1 %3, label %.lr.ph48, label %._crit_edge49

.lr.ph48:                                         ; preds = %0, %._crit_edge45
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16000040) @cnt, i8 0, i64 16000040, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16000040) @sum, i8 0, i64 16000040, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %4 = load i32, ptr @n, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %20, %.lr.ph48
  %.024.lcssa = phi i32 [ 0, %.lr.ph48 ], [ %spec.select, %20 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %6 = load i32, ptr @k, align 4, !tbaa !5
  %7 = add nsw i32 %6, %.024.lcssa
  %.not36 = icmp slt i32 %7, 1
  br i1 %.not36, label %.preheader, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %._crit_edge
  %8 = add nuw i32 %.024.lcssa, 1
  %9 = add i32 %8, %6
  %wide.trip.count = zext i32 %9 to i64
  %.pre = load i32, ptr @sum, align 16, !tbaa !5
  %10 = add nsw i64 %wide.trip.count, -1
  %11 = add nsw i64 %wide.trip.count, -2
  %xtraiter = and i64 %10, 3
  %12 = icmp ult i64 %11, 3
  br i1 %12, label %.preheader.loopexit.unr-lcssa, label %.lr.ph39.preheader.new

.lr.ph39.preheader.new:                           ; preds = %.lr.ph39.preheader
  %unroll_iter = and i64 %10, -4
  br label %.lr.ph39

.lr.ph:                                           ; preds = %.lr.ph48, %20
  %.02335 = phi i32 [ %22, %20 ], [ 0, %.lr.ph48 ]
  %.02434 = phi i32 [ %spec.select, %20 ], [ 0, %.lr.ph48 ]
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %.not32 = icmp eq i32 %17, 0
  br i1 %.not32, label %18, label %20

18:                                               ; preds = %.lr.ph
  %19 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %15
  store i32 1, ptr %19, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %18, %.lr.ph
  %21 = add nsw i32 %17, 1
  store i32 %21, ptr %16, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smax.i32(i32 %.02434, i32 %14)
  %22 = add nuw nsw i32 %.02335, 1
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader.loopexit.unr-lcssa:                    ; preds = %.lr.ph39, %.lr.ph39.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph39.preheader ], [ %80, %.lr.ph39 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph39.preheader ], [ %indvars.iv.next.3, %.lr.ph39 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph39.epil

.lr.ph39.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph39.epil
  %25 = phi i32 [ %28, %.lr.ph39.epil ], [ %.unr, %.preheader.loopexit.unr-lcssa ]
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.lr.ph39.epil ], [ %indvars.iv.unr, %.preheader.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph39.epil ], [ 0, %.preheader.loopexit.unr-lcssa ]
  %26 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %indvars.iv.epil
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = add nsw i32 %27, %25
  store i32 %28, ptr %26, align 4, !tbaa !5
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph39.epil, !llvm.loop !11

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %.lr.ph39.epil, %._crit_edge
  %.not3141 = icmp slt i32 %.024.lcssa, 1
  br i1 %.not3141, label %._crit_edge45, label %.lr.ph44

.lr.ph44:                                         ; preds = %.preheader
  %29 = add i32 %6, -1
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = sub nsw i32 %30, %6
  %32 = add nuw i32 %.024.lcssa, 1
  %wide.trip.count54 = zext i32 %32 to i64
  %33 = zext nneg i32 %.024.lcssa to i64
  %min.iters.check = icmp ult i32 %.024.lcssa, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.scevcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.scevcheck, %.lr.ph44
  %indvars.iv51.ph = phi i64 [ 1, %vector.scevcheck ], [ 1, %.lr.ph44 ], [ %ind.end, %middle.block ]
  %.02642.ph = phi i32 [ 0, %vector.scevcheck ], [ 0, %.lr.ph44 ], [ %67, %middle.block ]
  br label %scalar.ph

vector.scevcheck:                                 ; preds = %.lr.ph44
  %34 = add nsw i64 %wide.trip.count54, -2
  %35 = trunc i64 %34 to i32
  %36 = add i32 %6, %35
  %37 = icmp slt i32 %36, %6
  %38 = icmp ugt i64 %34, 4294967295
  %39 = or i1 %37, %38
  br i1 %39, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %vector.scevcheck
  %n.vec = and i64 %33, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %31, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  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 ], [ %64, %vector.body ]
  %vec.phi56 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %65, %vector.body ]
  %40 = trunc i64 %index to i32
  %41 = or disjoint i32 %40, 1
  %42 = add i32 %29, %41
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %43
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %wide.load = load <4 x i32>, ptr %44, align 4, !tbaa !5
  %wide.load58 = load <4 x i32>, ptr %45, align 4, !tbaa !5
  %46 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %index
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  %wide.load59 = load <4 x i32>, ptr %46, align 16, !tbaa !5
  %wide.load60 = load <4 x i32>, ptr %47, align 16, !tbaa !5
  %48 = sub nsw <4 x i32> %wide.load, %wide.load59
  %49 = sub nsw <4 x i32> %wide.load58, %wide.load60
  %50 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %43
  %51 = getelementptr inbounds i8, ptr %50, i64 16
  %wide.load61 = load <4 x i32>, ptr %50, align 4, !tbaa !5
  %wide.load62 = load <4 x i32>, ptr %51, align 4, !tbaa !5
  %52 = icmp sle <4 x i32> %wide.load61, %broadcast.splat
  %53 = icmp sle <4 x i32> %wide.load62, %broadcast.splat
  %54 = icmp sgt <4 x i32> %wide.load61, zeroinitializer
  %55 = icmp sgt <4 x i32> %wide.load62, zeroinitializer
  %56 = and <4 x i1> %52, %54
  %57 = and <4 x i1> %53, %55
  %58 = add nsw <4 x i32> %wide.load61, <i32 -1, i32 -1, i32 -1, i32 -1>
  %59 = add nsw <4 x i32> %wide.load62, <i32 -1, i32 -1, i32 -1, i32 -1>
  %60 = xor <4 x i1> %54, <i1 true, i1 true, i1 true, i1 true>
  %61 = xor <4 x i1> %55, <i1 true, i1 true, i1 true, i1 true>
  %62 = and <4 x i1> %52, %60
  %63 = and <4 x i1> %53, %61
  %predphi.v = select <4 x i1> %56, <4 x i32> %58, <4 x i32> %broadcast.splat
  %predphi63.v = select <4 x i1> %57, <4 x i32> %59, <4 x i32> %broadcast.splat
  %predphi = select <4 x i1> %62, <4 x i32> zeroinitializer, <4 x i32> %predphi.v
  %predphi64 = add nsw <4 x i32> %48, %predphi
  %predphi63 = select <4 x i1> %63, <4 x i32> zeroinitializer, <4 x i32> %predphi63.v
  %predphi65 = add nsw <4 x i32> %49, %predphi63
  %64 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> %predphi64)
  %65 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi56, <4 x i32> %predphi65)
  %index.next = add nuw i64 %index, 8
  %66 = icmp eq i64 %index.next, %n.vec
  br i1 %66, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %64, <4 x i32> %65)
  %67 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i64 %n.vec, %33
  br i1 %cmp.n, label %._crit_edge45, label %scalar.ph.preheader

.lr.ph39:                                         ; preds = %.lr.ph39, %.lr.ph39.preheader.new
  %68 = phi i32 [ %.pre, %.lr.ph39.preheader.new ], [ %80, %.lr.ph39 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph39.preheader.new ], [ %indvars.iv.next.3, %.lr.ph39 ]
  %niter = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %niter.next.3, %.lr.ph39 ]
  %69 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %indvars.iv
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, %68
  store i32 %71, ptr %69, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %72 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %indvars.iv.next
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, %71
  store i32 %74, ptr %72, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %75 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %indvars.iv.next.1
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = add nsw i32 %76, %74
  store i32 %77, ptr %75, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %78 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %indvars.iv.next.2
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = add nsw i32 %79, %77
  store i32 %80, ptr %78, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.loopexit.unr-lcssa, label %.lr.ph39, !llvm.loop !16

._crit_edge45:                                    ; preds = %103, %middle.block, %.preheader
  %.026.lcssa = phi i32 [ 0, %.preheader ], [ %67, %middle.block ], [ %spec.select33, %103 ]
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.026.lcssa)
  %82 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %83 = icmp eq i32 %82, 3
  br i1 %83, label %.lr.ph48, label %._crit_edge49, !llvm.loop !17

scalar.ph:                                        ; preds = %scalar.ph.preheader, %103
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %103 ], [ %indvars.iv51.ph, %scalar.ph.preheader ]
  %.02642 = phi i32 [ %spec.select33, %103 ], [ %.02642.ph, %scalar.ph.preheader ]
  %84 = trunc nuw nsw i64 %indvars.iv51 to i32
  %85 = add i32 %29, %84
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = add nsw i64 %indvars.iv51, -1
  %90 = getelementptr inbounds [4000010 x i32], ptr @sum, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sub nsw i32 %88, %91
  %93 = getelementptr inbounds [4000010 x i32], ptr @cnt, i64 0, i64 %86
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = icmp sgt i32 %94, %31
  br i1 %95, label %96, label %98

96:                                               ; preds = %scalar.ph
  %97 = add nsw i32 %31, %92
  br label %103

98:                                               ; preds = %scalar.ph
  %99 = icmp sgt i32 %94, 0
  br i1 %99, label %100, label %103

100:                                              ; preds = %98
  %101 = add nsw i32 %94, -1
  %102 = add nsw i32 %101, %92
  br label %103

103:                                              ; preds = %98, %100, %96
  %.025 = phi i32 [ %97, %96 ], [ %102, %100 ], [ %92, %98 ]
  %spec.select33 = call i32 @llvm.smax.i32(i32 %.02642, i32 %.025)
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond55.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count54
  br i1 %exitcond55.not, label %._crit_edge45, label %scalar.ph, !llvm.loop !18

._crit_edge49:                                    ; preds = %._crit_edge45, %0
  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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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

; 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.smax.i32(i32, i32) #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.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: write) }
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, !12}
!12 = !{!"llvm.loop.unroll.disable"}
!13 = distinct !{!13, !10, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10, !14}


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