; LLVM IR from VastoLorde95/Competitive-Programming :: SPOJ/Random/LCMSUM (A)

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

@p = external dso_local global [1001000 x i32], align 16
@phi = external dso_local global [1001000 x i32], align 16
@ans = external dso_local global [1001000 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %21, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 1001000
  br i1 %14, label %16, label %15

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

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %19
  store i32 %17, ptr %20, align 4, !tbaa !5
  br label %21

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

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

25:                                               ; preds = %33, %24
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 1001000
  br i1 %27, label %29, label %28

28:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %36

29:                                               ; preds = %25
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %31
  store i32 1, ptr %32, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %29
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %3, align 4, !tbaa !5
  br label %25, !llvm.loop !11

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

37:                                               ; preds = %74, %36
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = icmp slt i32 %38, 1001000
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %37
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %48, label %47

47:                                               ; preds = %41
  br label %74

48:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %49 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %49, ptr %6, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %69, %48
  %51 = load i32, ptr %6, align 4, !tbaa !5
  %52 = icmp slt i32 %51, 1001000
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %50
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %56
  store i32 0, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sdiv i32 %61, %62
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sub nsw i32 %67, %63
  store i32 %68, ptr %66, align 4, !tbaa !5
  br label %69

69:                                               ; preds = %54
  %70 = load i32, ptr %4, align 4, !tbaa !5
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = add nsw i32 %71, %70
  store i32 %72, ptr %6, align 4, !tbaa !5
  br label %50, !llvm.loop !12

73:                                               ; preds = %53
  br label %74

74:                                               ; preds = %73, %47
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !5
  br label %37, !llvm.loop !13

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

78:                                               ; preds = %108, %77
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = icmp slt i32 %79, 1001000
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %78
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %83 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %83, ptr %8, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %103, %82
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = icmp slt i32 %85, 1001000
  br i1 %86, label %88, label %87

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

88:                                               ; preds = %84
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = mul nsw i64 1, %90
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = mul nsw i64 %91, %96
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !14
  %102 = add nsw i64 %101, %97
  store i64 %102, ptr %100, align 8, !tbaa !14
  br label %103

103:                                              ; preds = %88
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = load i32, ptr %8, align 4, !tbaa !5
  %106 = add nsw i32 %105, %104
  store i32 %106, ptr %8, align 4, !tbaa !5
  br label %84, !llvm.loop !16

107:                                              ; preds = %87
  br label %108

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

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

112:                                              ; preds = %129, %111
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = icmp slt i32 %113, 1001000
  br i1 %114, label %116, label %115

115:                                              ; preds = %112
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  br label %132

116:                                              ; preds = %112
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %118
  %120 = load i64, ptr %119, align 8, !tbaa !14
  %121 = sdiv i64 %120, 2
  store i64 %121, ptr %119, align 8, !tbaa !14
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = load i32, ptr %9, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !14
  %128 = mul nsw i64 %127, %123
  store i64 %128, ptr %126, align 8, !tbaa !14
  br label %129

129:                                              ; preds = %116
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %9, align 4, !tbaa !5
  br label %112, !llvm.loop !18

132:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %133 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %10)
  br label %134

134:                                              ; preds = %138, %132
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = add nsw i32 %135, -1
  store i32 %136, ptr %10, align 4, !tbaa !5
  %137 = icmp ne i32 %135, 0
  br i1 %137, label %138, label %148

138:                                              ; preds = %134
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %139 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %11)
  %140 = load i32, ptr %11, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %141
  %143 = load i64, ptr %142, align 8, !tbaa !14
  %144 = load i32, ptr %11, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = add nsw i64 %143, %145
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %146)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %134, !llvm.loop !19

148:                                              ; preds = %134
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %149 = load i32, ptr %1, align 4
  ret i32 %149
}

; 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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

@p = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@phi = external dso_local local_unnamed_addr global [1001000 x i32], align 16
@ans = external dso_local local_unnamed_addr global [1001000 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() 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.2, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next.2, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %2 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %offset.idx
  %3 = getelementptr inbounds i8, ptr %2, i64 16
  store <4 x i32> %vec.ind, ptr %2, align 4, !tbaa !5
  store <4 x i32> %step.add, ptr %3, align 4, !tbaa !5
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %step.add.1 = add <4 x i32> %vec.ind, <i32 12, i32 12, i32 12, i32 12>
  %offset.idx.1 = add nuw nsw i64 %index, 9
  %4 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %offset.idx.1
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  store <4 x i32> %vec.ind.next, ptr %4, align 4, !tbaa !5
  store <4 x i32> %step.add.1, ptr %5, align 4, !tbaa !5
  %vec.ind.next.1 = add <4 x i32> %vec.ind, <i32 16, i32 16, i32 16, i32 16>
  %step.add.2 = add <4 x i32> %vec.ind, <i32 20, i32 20, i32 20, i32 20>
  %offset.idx.2 = add nuw nsw i64 %index, 17
  %6 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %offset.idx.2
  %7 = getelementptr inbounds i8, ptr %6, i64 16
  store <4 x i32> %vec.ind.next.1, ptr %6, align 4, !tbaa !5
  store <4 x i32> %step.add.2, ptr %7, align 4, !tbaa !5
  %index.next.2 = add nuw nsw i64 %index, 24
  %vec.ind.next.2 = add <4 x i32> %vec.ind, <i32 24, i32 24, i32 24, i32 24>
  %8 = icmp eq i64 %index.next.2, 1000992
  br i1 %8, label %scalar.ph, label %vector.body, !llvm.loop !9

scalar.ph:                                        ; preds = %vector.body
  store i32 1000993, ptr getelementptr inbounds (i8, ptr @phi, i64 4003972), align 4, !tbaa !5
  store i32 1000994, ptr getelementptr inbounds (i8, ptr @phi, i64 4003976), align 8, !tbaa !5
  store i32 1000995, ptr getelementptr inbounds (i8, ptr @phi, i64 4003980), align 4, !tbaa !5
  store i32 1000996, ptr getelementptr inbounds (i8, ptr @phi, i64 4003984), align 16, !tbaa !5
  store i32 1000997, ptr getelementptr inbounds (i8, ptr @phi, i64 4003988), align 4, !tbaa !5
  store i32 1000998, ptr getelementptr inbounds (i8, ptr @phi, i64 4003992), align 8, !tbaa !5
  store i32 1000999, ptr getelementptr inbounds (i8, ptr @phi, i64 4003996), align 4, !tbaa !5
  br label %vector.body83

vector.body83:                                    ; preds = %vector.body83, %scalar.ph
  %index84 = phi i64 [ 0, %scalar.ph ], [ %index.next86.3, %vector.body83 ]
  %offset.idx85 = or disjoint i64 %index84, 2
  %9 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %offset.idx85
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %9, align 8, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %10, align 8, !tbaa !5
  %offset.idx85.1 = or disjoint i64 %index84, 10
  %11 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %offset.idx85.1
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %11, align 8, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %12, align 8, !tbaa !5
  %offset.idx85.2 = or disjoint i64 %index84, 18
  %13 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %offset.idx85.2
  %14 = getelementptr inbounds i8, ptr %13, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %13, align 8, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %14, align 8, !tbaa !5
  %offset.idx85.3 = or disjoint i64 %index84, 26
  %15 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %offset.idx85.3
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %15, align 8, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %16, align 8, !tbaa !5
  %index.next86.3 = add nuw nsw i64 %index84, 32
  %17 = icmp eq i64 %index.next86.3, 1000992
  br i1 %17, label %.preheader44, label %vector.body83, !llvm.loop !13

.preheader44:                                     ; preds = %vector.body83
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003976), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003980), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003984), align 16, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003988), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003992), align 8, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @p, i64 4003996), align 4, !tbaa !5
  br label %.preheader43

.preheader43:                                     ; preds = %.preheader44, %.loopexit
  %indvars.iv60 = phi i64 [ %indvars.iv.next61, %.loopexit ], [ 2, %.preheader44 ]
  %18 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %indvars.iv60
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %.not39.not = icmp eq i32 %19, 0
  br i1 %.not39.not, label %.loopexit, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader43
  %20 = trunc nuw nsw i64 %indvars.iv60 to i32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv62 = phi i64 [ %indvars.iv60, %.lr.ph.preheader ], [ %indvars.iv.next63, %.lr.ph ]
  %21 = getelementptr inbounds [1001000 x i32], ptr @p, i64 0, i64 %indvars.iv62
  store i32 0, ptr %21, align 4, !tbaa !5
  %22 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %indvars.iv62
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = sdiv i32 %23, %20
  %25 = sub nsw i32 %23, %24
  store i32 %25, ptr %22, align 4, !tbaa !5
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, %indvars.iv60
  %26 = icmp ult i64 %indvars.iv.next63, 1001000
  br i1 %26, label %.lr.ph, label %.loopexit, !llvm.loop !14

.loopexit:                                        ; preds = %.lr.ph, %.preheader43
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next61, 1001000
  br i1 %exitcond66.not, label %.preheader40, label %.preheader43, !llvm.loop !15

.preheader40:                                     ; preds = %.loopexit, %41
  %indvars.iv67 = phi i64 [ %indvars.iv.next68.1, %41 ], [ 1, %.loopexit ]
  %27 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %indvars.iv67
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = mul nsw i64 %indvars.iv67, %29
  br label %49

31:                                               ; preds = %49
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond73.not = icmp eq i64 %indvars.iv.next68, 1001000
  br i1 %exitcond73.not, label %vector.body91, label %.preheader40.1, !llvm.loop !16

.preheader40.1:                                   ; preds = %31
  %32 = getelementptr inbounds [1001000 x i32], ptr @phi, i64 0, i64 %indvars.iv.next68
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = mul nsw i64 %indvars.iv.next68, %34
  br label %36

36:                                               ; preds = %36, %.preheader40.1
  %indvars.iv69.1 = phi i64 [ %indvars.iv.next68, %.preheader40.1 ], [ %indvars.iv.next70.1, %36 ]
  %37 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %indvars.iv69.1
  %38 = load i64, ptr %37, align 8, !tbaa !17
  %39 = add nsw i64 %35, %38
  store i64 %39, ptr %37, align 8, !tbaa !17
  %indvars.iv.next70.1 = add nuw nsw i64 %indvars.iv69.1, %indvars.iv.next68
  %40 = icmp ult i64 %indvars.iv.next70.1, 1001000
  br i1 %40, label %36, label %41, !llvm.loop !19

41:                                               ; preds = %36
  %indvars.iv.next68.1 = add nuw nsw i64 %indvars.iv67, 2
  br label %.preheader40

vector.body91:                                    ; preds = %31, %vector.body91
  %index92 = phi i64 [ %index.next99, %vector.body91 ], [ 0, %31 ]
  %vec.ind93 = phi <2 x i64> [ %vec.ind.next96, %vector.body91 ], [ <i64 1, i64 2>, %31 ]
  %step.add94 = add <2 x i64> %vec.ind93, <i64 2, i64 2>
  %offset.idx97 = or disjoint i64 %index92, 1
  %42 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %offset.idx97
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  %wide.load = load <2 x i64>, ptr %42, align 8, !tbaa !17
  %wide.load98 = load <2 x i64>, ptr %43, align 8, !tbaa !17
  %44 = sdiv <2 x i64> %wide.load, <i64 2, i64 2>
  %45 = sdiv <2 x i64> %wide.load98, <i64 2, i64 2>
  %46 = mul nsw <2 x i64> %44, %vec.ind93
  %47 = mul nsw <2 x i64> %45, %step.add94
  store <2 x i64> %46, ptr %42, align 8, !tbaa !17
  store <2 x i64> %47, ptr %43, align 8, !tbaa !17
  %index.next99 = add nuw i64 %index92, 4
  %vec.ind.next96 = add <2 x i64> %vec.ind93, <i64 4, i64 4>
  %48 = icmp eq i64 %index.next99, 1000996
  br i1 %48, label %.preheader, label %vector.body91, !llvm.loop !20

49:                                               ; preds = %.preheader40, %49
  %indvars.iv69 = phi i64 [ %indvars.iv67, %.preheader40 ], [ %indvars.iv.next70, %49 ]
  %50 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %indvars.iv69
  %51 = load i64, ptr %50, align 8, !tbaa !17
  %52 = add nsw i64 %30, %51
  store i64 %52, ptr %50, align 8, !tbaa !17
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, %indvars.iv67
  %53 = icmp ult i64 %indvars.iv.next70, 1001000
  br i1 %53, label %49, label %31, !llvm.loop !19

.preheader:                                       ; preds = %vector.body91
  %54 = load i64, ptr getelementptr inbounds (i8, ptr @ans, i64 8007976), align 8, !tbaa !17
  %55 = sdiv i64 %54, 2
  %56 = mul nsw i64 %55, 1000997
  store i64 %56, ptr getelementptr inbounds (i8, ptr @ans, i64 8007976), align 8, !tbaa !17
  %57 = load i64, ptr getelementptr inbounds (i8, ptr @ans, i64 8007984), align 16, !tbaa !17
  %58 = sdiv i64 %57, 2
  %59 = mul nsw i64 %58, 1000998
  store i64 %59, ptr getelementptr inbounds (i8, ptr @ans, i64 8007984), align 16, !tbaa !17
  %60 = load i64, ptr getelementptr inbounds (i8, ptr @ans, i64 8007992), align 8, !tbaa !17
  %61 = sdiv i64 %60, 2
  %62 = mul nsw i64 %61, 1000999
  store i64 %62, ptr getelementptr inbounds (i8, ptr @ans, i64 8007992), align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #3
  %63 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %64 = load i32, ptr %0, align 4, !tbaa !5
  %65 = add nsw i32 %64, -1
  store i32 %65, ptr %0, align 4, !tbaa !5
  %.not53 = icmp eq i32 %64, 0
  br i1 %.not53, label %._crit_edge, label %.lr.ph54

.lr.ph54:                                         ; preds = %.preheader, %.lr.ph54
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  %66 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %67 = load i32, ptr %1, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1001000 x i64], ptr @ans, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !17
  %71 = add nsw i64 %70, %68
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %71)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  %73 = load i32, ptr %0, align 4, !tbaa !5
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %0, align 4, !tbaa !5
  %.not = icmp eq i32 %73, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph54, !llvm.loop !21

._crit_edge:                                      ; preds = %.lr.ph54, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #3
  ret i32 0
}

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

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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, !11, !12}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10, !11, !12}
!21 = distinct !{!21, !10}


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