; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/226 Division 2/Problem C (C)

; 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
@x = external dso_local global i32, align 4
@cnt = external dso_local global [10000001 x i32], align 16
@sum = external dso_local global [10000001 x i32], align 16
@primes = external dso_local global [10000001 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %25, %0
  %14 = load i32, ptr %2, 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 %2) #4
  br label %28

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

25:                                               ; preds = %18
  %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 %13, !llvm.loop !9

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

29:                                               ; preds = %71, %28
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = load i32, ptr @N, align 4, !tbaa !5
  %32 = icmp sle i32 %30, %31
  br i1 %32, label %34, label %33

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

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %70

40:                                               ; preds = %34
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %43
  store i32 %41, ptr %44, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @N, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sdiv i32 %46, %47
  %49 = icmp sle i32 %45, %48
  br i1 %49, label %50, label %69

50:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = mul nsw i32 %51, %52
  store i32 %53, ptr %5, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %64, %50
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = load i32, ptr @N, align 4, !tbaa !5
  %57 = icmp sle i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %68

59:                                               ; preds = %54
  %60 = load i32, ptr %3, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %62
  store i32 %60, ptr %63, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %59
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = add nsw i32 %66, %65
  store i32 %67, ptr %5, align 4, !tbaa !5
  br label %54, !llvm.loop !11

68:                                               ; preds = %58
  br label %69

69:                                               ; preds = %68, %40
  br label %70

70:                                               ; preds = %69, %34
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %3, align 4, !tbaa !5
  br label %29, !llvm.loop !12

74:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %75 = load i32, ptr @N, align 4, !tbaa !5
  store i32 %75, ptr %6, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %124, %74
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = icmp sge i32 %77, 2
  br i1 %78, label %80, label %79

79:                                               ; preds = %76
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %127

80:                                               ; preds = %76
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %86, label %123

86:                                               ; preds = %80
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %92
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = add nsw i32 %97, %90
  store i32 %98, ptr %96, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %99 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %99, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  store i32 %103, ptr %8, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %109, %86
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = srem i32 %105, %106
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %113

109:                                              ; preds = %104
  %110 = load i32, ptr %8, align 4, !tbaa !5
  %111 = load i32, ptr %7, align 4, !tbaa !5
  %112 = sdiv i32 %111, %110
  store i32 %112, ptr %7, align 4, !tbaa !5
  br label %104, !llvm.loop !13

113:                                              ; preds = %104
  %114 = load i32, ptr %6, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = add nsw i32 %121, %117
  store i32 %122, ptr %120, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %123

123:                                              ; preds = %113, %80
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = add nsw i32 %125, -1
  store i32 %126, ptr %6, align 4, !tbaa !5
  br label %76, !llvm.loop !14

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

128:                                              ; preds = %144, %127
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = load i32, ptr @N, align 4, !tbaa !5
  %131 = icmp sle i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %147

133:                                              ; preds = %128
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = sub nsw i32 %134, 1
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !5
  %139 = load i32, ptr %9, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = add nsw i32 %142, %138
  store i32 %143, ptr %141, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %133
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %9, align 4, !tbaa !5
  br label %128, !llvm.loop !15

147:                                              ; preds = %132
  %148 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %173, %147
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = load i32, ptr @m, align 4, !tbaa !5
  %152 = icmp slt i32 %150, %151
  br i1 %152, label %154, label %153

153:                                              ; preds = %149
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %176

154:                                              ; preds = %149
  %155 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @l, ptr noundef @r)
  %156 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @r, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %157 = load i32, ptr %156, align 4, !tbaa !5
  store i32 %157, ptr @r, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %158 = load i32, ptr @N, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %11, align 4, !tbaa !5
  %160 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @l, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %161 = load i32, ptr %160, align 4, !tbaa !5
  store i32 %161, ptr @l, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %162 = load i32, ptr @r, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = load i32, ptr @l, align 4, !tbaa !5
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sub nsw i32 %165, %170
  %172 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %171)
  br label %173

173:                                              ; preds = %154
  %174 = load i32, ptr %10, align 4, !tbaa !5
  %175 = add nsw i32 %174, 1
  store i32 %175, ptr %10, align 4, !tbaa !5
  br label %149, !llvm.loop !16

176:                                              ; preds = %153
  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: 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)) #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 = { 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 #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}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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
@x = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global [10000001 x i32], align 16
@sum = external dso_local local_unnamed_addr global [10000001 x i32], align 16
@primes = external dso_local local_unnamed_addr global [10000001 x i32], align 16
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress 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)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.preheader47

.preheader47:                                     ; preds = %.lr.ph, %0
  %5 = load i32, ptr @N, align 4, !tbaa !5
  %.not52 = icmp slt i32 %5, 2
  br i1 %.not52, label %.preheader, label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %.preheader47
  %6 = add nuw i32 %5, 1
  %wide.trip.count = zext i32 %6 to i64
  br label %.lr.ph55

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.03648 = phi i32 [ %13, %.lr.ph ], [ 0, %0 ]
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %8 = load i32, ptr @x, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %9
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = add nsw i32 %11, 1
  store i32 %12, ptr %10, align 4, !tbaa !5
  %13 = add nuw nsw i32 %.03648, 1
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %.lr.ph, label %.preheader47, !llvm.loop !9

.lr.ph61.preheader:                               ; preds = %.loopexit
  %16 = zext nneg i32 %5 to i64
  br label %.lr.ph61

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.loopexit
  %indvars.iv77 = phi i64 [ 5, %.lr.ph55.preheader ], [ %indvars.iv.next78, %.loopexit ]
  %indvars.iv72 = phi i64 [ 2, %.lr.ph55.preheader ], [ %indvars.iv.next73, %.loopexit ]
  %indvars.iv70 = phi i32 [ 4, %.lr.ph55.preheader ], [ %indvars.iv.next71, %.loopexit ]
  %17 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %indvars.iv72
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %.loopexit

20:                                               ; preds = %.lr.ph55
  %21 = trunc nuw nsw i64 %indvars.iv72 to i32
  store i32 %21, ptr %17, align 4, !tbaa !5
  %22 = udiv i32 %5, %21
  %23 = zext nneg i32 %22 to i64
  %.not44 = icmp ugt i64 %indvars.iv72, %23
  %24 = mul nuw nsw i64 %indvars.iv72, %indvars.iv72
  %25 = trunc nuw i64 %24 to i32
  %.not4549 = icmp slt i32 %5, %25
  %or.cond = select i1 %.not44, i1 true, i1 %.not4549
  br i1 %or.cond, label %.loopexit, label %.lr.ph51.preheader

.lr.ph51.preheader:                               ; preds = %20
  %26 = zext i32 %indvars.iv70 to i64
  br label %.lr.ph51

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %.lr.ph51
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph51 ], [ %26, %.lr.ph51.preheader ]
  %27 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %indvars.iv74
  store i32 %21, ptr %27, align 4, !tbaa !5
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, %indvars.iv72
  %28 = trunc nuw i64 %indvars.iv.next75 to i32
  %.not45 = icmp slt i32 %5, %28
  br i1 %.not45, label %.loopexit, label %.lr.ph51, !llvm.loop !11

.loopexit:                                        ; preds = %.lr.ph51, %.lr.ph55, %20
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 2
  %29 = trunc nuw i64 %indvars.iv77 to i32
  %indvars.iv.next71 = add i32 %indvars.iv70, %29
  %exitcond.not = icmp eq i64 %indvars.iv.next73, %wide.trip.count
  br i1 %exitcond.not, label %.lr.ph61.preheader, label %.lr.ph55, !llvm.loop !12

.preheader:                                       ; preds = %52, %.preheader47
  %.not4362 = icmp slt i32 %5, 1
  br i1 %.not4362, label %._crit_edge65, label %.lr.ph64.preheader

.lr.ph64.preheader:                               ; preds = %.preheader
  %.pre = load i32, ptr @sum, align 16, !tbaa !5
  %30 = zext nneg i32 %5 to i64
  %xtraiter = and i64 %30, 3
  %31 = icmp ult i32 %5, 4
  br i1 %31, label %._crit_edge65.loopexit.unr-lcssa, label %.lr.ph64.preheader.new

.lr.ph64.preheader.new:                           ; preds = %.lr.ph64.preheader
  %unroll_iter = and i64 %30, 2147483644
  br label %.lr.ph64

.lr.ph61:                                         ; preds = %.lr.ph61.preheader, %52
  %indvars.iv = phi i64 [ %16, %.lr.ph61.preheader ], [ %indvars.iv.next, %52 ]
  %32 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %indvars.iv
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %35, label %52

35:                                               ; preds = %.lr.ph61
  %36 = getelementptr inbounds [10000001 x i32], ptr @primes, i64 0, i64 %indvars.iv
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = add nsw i32 %40, %33
  store i32 %41, ptr %39, align 4, !tbaa !5
  %42 = trunc nuw nsw i64 %indvars.iv to i32
  %43 = srem i32 %42, %37
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %.lr.ph57, label %._crit_edge

.lr.ph57:                                         ; preds = %35, %.lr.ph57
  %.03756 = phi i32 [ %45, %.lr.ph57 ], [ %42, %35 ]
  %45 = sdiv i32 %.03756, %37
  %46 = srem i32 %45, %37
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %.lr.ph57, label %._crit_edge, !llvm.loop !13

._crit_edge:                                      ; preds = %.lr.ph57, %35
  %.037.lcssa = phi i32 [ %42, %35 ], [ %45, %.lr.ph57 ]
  %48 = sext i32 %.037.lcssa to i64
  %49 = getelementptr inbounds [10000001 x i32], ptr @cnt, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, %33
  store i32 %51, ptr %49, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %.lr.ph61, %._crit_edge
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %53 = icmp sgt i64 %indvars.iv, 2
  br i1 %53, label %.lr.ph61, label %.preheader, !llvm.loop !14

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

.lr.ph64.epil:                                    ; preds = %._crit_edge65.loopexit.unr-lcssa, %.lr.ph64.epil
  %54 = phi i32 [ %57, %.lr.ph64.epil ], [ %.unr, %._crit_edge65.loopexit.unr-lcssa ]
  %indvars.iv83.epil = phi i64 [ %indvars.iv.next84.epil, %.lr.ph64.epil ], [ %indvars.iv83.unr, %._crit_edge65.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph64.epil ], [ 0, %._crit_edge65.loopexit.unr-lcssa ]
  %55 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %indvars.iv83.epil
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, %54
  store i32 %57, ptr %55, align 4, !tbaa !5
  %indvars.iv.next84.epil = add nuw nsw i64 %indvars.iv83.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 %._crit_edge65, label %.lr.ph64.epil, !llvm.loop !15

._crit_edge65:                                    ; preds = %._crit_edge65.loopexit.unr-lcssa, %.lr.ph64.epil, %.preheader
  %58 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m)
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph68, label %._crit_edge69

.lr.ph64:                                         ; preds = %.lr.ph64, %.lr.ph64.preheader.new
  %61 = phi i32 [ %.pre, %.lr.ph64.preheader.new ], [ %73, %.lr.ph64 ]
  %indvars.iv83 = phi i64 [ 1, %.lr.ph64.preheader.new ], [ %indvars.iv.next84.3, %.lr.ph64 ]
  %niter = phi i64 [ 0, %.lr.ph64.preheader.new ], [ %niter.next.3, %.lr.ph64 ]
  %62 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %indvars.iv83
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = add nsw i32 %63, %61
  store i32 %64, ptr %62, align 4, !tbaa !5
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %65 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %indvars.iv.next84
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, %64
  store i32 %67, ptr %65, align 4, !tbaa !5
  %indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 2
  %68 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %indvars.iv.next84.1
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i32 %69, %67
  store i32 %70, ptr %68, align 4, !tbaa !5
  %indvars.iv.next84.2 = add nuw nsw i64 %indvars.iv83, 3
  %71 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %indvars.iv.next84.2
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %72, %70
  store i32 %73, ptr %71, align 4, !tbaa !5
  %indvars.iv.next84.3 = add nuw nsw i64 %indvars.iv83, 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 %._crit_edge65.loopexit.unr-lcssa, label %.lr.ph64, !llvm.loop !17

._crit_edge69:                                    ; preds = %.lr.ph68, %._crit_edge65
  ret i32 0

.lr.ph68:                                         ; preds = %._crit_edge65, %.lr.ph68
  %.066 = phi i32 [ %91, %.lr.ph68 ], [ 0, %._crit_edge65 ]
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @l, ptr noundef nonnull @r)
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @r, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr @r, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %77 = load i32, ptr @N, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %1, align 4, !tbaa !5
  %79 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @l, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %80 = load i32, ptr %79, align 4, !tbaa !5
  store i32 %80, ptr @l, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %81 = load i32, ptr @r, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = add nsw i32 %80, -1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [10000001 x i32], ptr @sum, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sub nsw i32 %84, %88
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %89)
  %91 = add nuw nsw i32 %.066, 1
  %92 = load i32, ptr @m, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %.lr.ph68, label %._crit_edge69, !llvm.loop !18
}

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

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

attributes #0 = { mustprogress 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 = { 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 #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}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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