; LLVM IR from lzyrapx/Competitive-Programming :: jisuanke/2018Game5/A.ll (Z4initv)

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

@dp = external dso_local global [1000011 x i32], align 16
@dp2 = external dso_local global [1000011 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z4initv() #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
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  store i32 1, ptr %1, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %21, %0
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sitofp i32 %10 to double
  %12 = fcmp ole double %11, 1.000000e+06
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  br label %24

14:                                               ; preds = %9
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %16
  store i32 1000000000, ptr %17, align 4, !tbaa !5
  %18 = load i32, ptr %1, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %19
  store i32 1000000000, ptr %20, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %14
  %22 = load i32, ptr %1, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %1, align 4, !tbaa !5
  br label %9, !llvm.loop !9

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

25:                                               ; preds = %60, %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sitofp i32 %26 to double
  %28 = fcmp ole double %27, 1.000000e+06
  br i1 %28, label %30, label %29

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

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

31:                                               ; preds = %56, %30
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = mul nsw i32 %32, %33
  %35 = sitofp i32 %34 to double
  %36 = fcmp ole double %35, 1.000000e+06
  br i1 %36, label %38, label %37

37:                                               ; preds = %31
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  br label %59

38:                                               ; preds = %31
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = mul nsw i32 %39, %40
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add nsw i32 %44, 2
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = add nsw i32 %46, 2
  %48 = mul nsw i32 %45, %47
  store i32 %48, ptr %5, align 4, !tbaa !5
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = mul nsw i32 %51, %52
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %54
  store i32 %50, ptr %55, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %56

56:                                               ; preds = %38
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %4, align 4, !tbaa !5
  br label %31, !llvm.loop !11

59:                                               ; preds = %37
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %2, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %2, align 4, !tbaa !5
  br label %25, !llvm.loop !12

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

64:                                               ; preds = %101, %63
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = sitofp i32 %65 to double
  %67 = fcmp ole double %66, 1.000000e+06
  br i1 %67, label %69, label %68

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

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

70:                                               ; preds = %97, %69
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = load i32, ptr %7, align 4, !tbaa !5
  %73 = mul nsw i32 %71, %72
  %74 = sitofp i32 %73 to double
  %75 = fcmp ole double %74, 1.000000e+06
  br i1 %75, label %77, label %76

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

77:                                               ; preds = %70
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = mul nsw i32 %78, %79
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %81
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  %89 = mul nsw i32 %86, %88
  store i32 %89, ptr %8, align 4, !tbaa !5
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %82, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = mul nsw i32 %92, %93
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %95
  store i32 %91, ptr %96, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %97

97:                                               ; preds = %77
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %7, align 4, !tbaa !5
  br label %70, !llvm.loop !13

100:                                              ; preds = %76
  br label %101

101:                                              ; preds = %100
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %6, align 4, !tbaa !5
  br label %64, !llvm.loop !14

104:                                              ; preds = %68
  ret void
}

; 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: 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)) #2

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 = !{!"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}


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

@dp = external dso_local global [1000011 x i32], align 16
@dp2 = external dso_local global [1000011 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z4initv() local_unnamed_addr #0 {
vector.ph:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next.1, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %2 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %offset.idx
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %2, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %3, align 4, !tbaa !5
  %4 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %offset.idx
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %4, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %5, align 4, !tbaa !5
  %offset.idx.1 = or disjoint i64 %index, 9
  %6 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %offset.idx.1
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %6, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %offset.idx.1
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %8, align 4, !tbaa !5
  store <4 x i32> <i32 1000000000, i32 1000000000, i32 1000000000, i32 1000000000>, ptr %9, align 4, !tbaa !5
  %index.next.1 = add nuw nsw i64 %index, 16
  %10 = icmp eq i64 %index.next.1, 1000000
  br i1 %10, label %.preheader31, label %vector.body, !llvm.loop !9

.preheader31:                                     ; preds = %vector.body, %12
  %indvars.iv42 = phi i64 [ %indvars.iv.next43, %12 ], [ 1, %vector.body ]
  %11 = add nuw nsw i64 %indvars.iv42, 2
  br label %13

12:                                               ; preds = %13
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %exitcond45.not = icmp eq i64 %indvars.iv.next43, 1000001
  br i1 %exitcond45.not, label %.preheader, label %.preheader31, !llvm.loop !13

13:                                               ; preds = %.preheader31, %13
  %indvars.iv39 = phi i64 [ 1, %.preheader31 ], [ %indvars.iv.next40, %13 ]
  %14 = mul nuw nsw i64 %indvars.iv39, %indvars.iv42
  %15 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #3
  %16 = add nuw nsw i64 %indvars.iv39, 2
  %17 = mul nuw nsw i64 %16, %11
  %18 = trunc nuw i64 %17 to i32
  store i32 %18, ptr %0, align 4, !tbaa !5
  %19 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %15, ptr noundef nonnull align 4 dereferenceable(4) %0)
  %20 = load i32, ptr %19, align 4, !tbaa !5
  store i32 %20, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #3
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %21 = mul nuw nsw i64 %indvars.iv.next40, %indvars.iv42
  %22 = icmp ult i64 %21, 1000001
  br i1 %22, label %13, label %12, !llvm.loop !14

.preheader:                                       ; preds = %12, %25
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %25 ], [ 1, %12 ]
  %23 = getelementptr inbounds [1000011 x i32], ptr @dp, i64 0, i64 %indvars.iv49
  br label %26

24:                                               ; preds = %25
  ret void

25:                                               ; preds = %26
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %exitcond52.not = icmp eq i64 %indvars.iv.next50, 1000001
  br i1 %exitcond52.not, label %24, label %.preheader, !llvm.loop !15

26:                                               ; preds = %.preheader, %26
  %indvars.iv46 = phi i64 [ 1, %.preheader ], [ %indvars.iv.next47, %26 ]
  %27 = mul nuw nsw i64 %indvars.iv46, %indvars.iv49
  %28 = getelementptr inbounds [1000011 x i32], ptr @dp2, i64 0, i64 %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %29 = load i32, ptr %23, align 4, !tbaa !5
  %indvars.iv.next47 = add nuw nsw i64 %indvars.iv46, 1
  %30 = trunc nuw nsw i64 %indvars.iv.next47 to i32
  %31 = mul nsw i32 %29, %30
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %28, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr %28, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  %34 = mul nuw nsw i64 %indvars.iv.next47, %indvars.iv49
  %35 = icmp ult i64 %34, 1000001
  br i1 %35, label %26, label %25, !llvm.loop !16
}

; 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: 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 #2

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 = { 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}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass