; LLVM IR from tangjz/acm-icpc :: uvalive (6912)

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@prime = external dso_local global [1010 x i32], align 16
@tot = external dso_local global i32, align 4
@seq = external dso_local global [12 x i32], align 16
@pow2 = external dso_local global [12 x i32], align 16
@tmp = external dso_local global i32, align 4
@tmp2 = external dso_local global i32, align 4
@ans = 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 [14 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3addiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  store i32 1, ptr @pow2, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %11

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

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

15:                                               ; preds = %11
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sub nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [12 x i32], ptr @pow2, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = shl i32 %20, 1
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [12 x i32], ptr @pow2, i64 0, i64 %23
  store i32 %21, ptr %24, align 4, !tbaa !5
  br label %25

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

28:                                               ; preds = %14
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %30

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

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

35:                                               ; preds = %30
  %36 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %47, %35
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = load i32, ptr @k, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %44
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %45)
  br label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %5, align 4, !tbaa !5
  br label %37, !llvm.loop !11

50:                                               ; preds = %41
  %51 = load i32, ptr @k, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds i32, ptr @prime, i64 %52
  %54 = getelementptr inbounds i32, ptr %53, i64 1
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @prime, i64 1), ptr noundef %54)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %75, %50
  %56 = load i32, ptr %7, align 4, !tbaa !5
  %57 = load i32, ptr @k, align 4, !tbaa !5
  %58 = icmp sle i32 %56, %57
  br i1 %58, label %60, label %59

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

60:                                               ; preds = %55
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = mul nsw i32 %64, %68
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %72, label %74

72:                                               ; preds = %60
  %73 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %73, ptr %6, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %72, %60
  br label %75

75:                                               ; preds = %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %7, align 4, !tbaa !5
  br label %55, !llvm.loop !12

78:                                               ; preds = %59
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %79

79:                                               ; preds = %141, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = shl i32 1, %81
  %83 = icmp slt i32 %80, %82
  br i1 %83, label %85, label %84

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

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

86:                                               ; preds = %108, %85
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %111

91:                                               ; preds = %86
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sub nsw i32 %93, 1
  %95 = shl i32 1, %94
  %96 = and i32 %92, %95
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %107

98:                                               ; preds = %91
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = load i32, ptr @tot, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr @tot, align 4, !tbaa !5
  %105 = sext i32 %103 to i64
  %106 = getelementptr inbounds [12 x i32], ptr @seq, i64 0, i64 %105
  store i32 %102, ptr %106, align 4, !tbaa !5
  br label %107

107:                                              ; preds = %98, %91
  br label %108

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

111:                                              ; preds = %90
  store i32 0, ptr @tmp, align 4, !tbaa !5
  call void @_Z3dfsiii(i32 noundef 0, i32 noundef 1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %10, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %131, %111
  %115 = load i32, ptr %10, align 4, !tbaa !5
  %116 = load i32, ptr @k, align 4, !tbaa !5
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %114
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %134

119:                                              ; preds = %114
  store i32 0, ptr @tmp2, align 4, !tbaa !5
  %120 = load i32, ptr %10, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  call void @_Z3addiiii(i32 noundef 0, i32 noundef %123, i32 noundef 1, i32 noundef 0)
  %124 = load i32, ptr @tmp2, align 4, !tbaa !5
  %125 = icmp sgt i32 %124, 0
  br i1 %125, label %126, label %130

126:                                              ; preds = %119
  %127 = load i32, ptr @tmp2, align 4, !tbaa !5
  %128 = load i32, ptr @tmp, align 4, !tbaa !5
  %129 = add nsw i32 %128, %127
  store i32 %129, ptr @tmp, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %126, %119
  br label %131

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

134:                                              ; preds = %118
  %135 = load i32, ptr @ans, align 4, !tbaa !5
  %136 = load i32, ptr @tmp, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %138, label %140

138:                                              ; preds = %134
  %139 = load i32, ptr @tmp, align 4, !tbaa !5
  store i32 %139, ptr @ans, align 4, !tbaa !5
  br label %140

140:                                              ; preds = %138, %134
  br label %141

141:                                              ; preds = %140
  %142 = load i32, ptr %8, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %8, align 4, !tbaa !5
  br label %79, !llvm.loop !15

144:                                              ; preds = %84
  %145 = load i32, ptr %3, align 4, !tbaa !5
  %146 = load i32, ptr @ans, align 4, !tbaa !5
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %145, i32 noundef %146)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %148

148:                                              ; preds = %144
  %149 = load i32, ptr %3, align 4, !tbaa !5
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %3, align 4, !tbaa !5
  br label %30, !llvm.loop !16

151:                                              ; preds = %34
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #4

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

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 = { 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 #3 = { "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 = { inlinehint 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 #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = 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"

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@prime = external dso_local global [1010 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local local_unnamed_addr global [12 x i32], align 16
@pow2 = external dso_local local_unnamed_addr global [12 x i32], align 16
@tmp = external dso_local local_unnamed_addr global i32, align 4
@tmp2 = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr 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 [14 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsiii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3addiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  store <4 x i32> <i32 1, i32 2, i32 4, i32 8>, ptr @pow2, align 16, !tbaa !5
  store <4 x i32> <i32 16, i32 32, i32 64, i32 128>, ptr getelementptr inbounds (i8, ptr @pow2, i64 16), align 16, !tbaa !5
  store <4 x i32> <i32 256, i32 512, i32 1024, i32 2048>, ptr getelementptr inbounds (i8, ptr @pow2, i64 32), align 16, !tbaa !5
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %.not69 = icmp slt i32 %2, 1
  br i1 %.not69, label %._crit_edge73, label %.lr.ph72

._crit_edge73:                                    ; preds = %._crit_edge68, %0
  ret i32 0

.lr.ph72:                                         ; preds = %0, %._crit_edge68
  %.03370 = phi i32 [ %41, %._crit_edge68 ], [ 1, %0 ]
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %4 = load i32, ptr @k, align 4, !tbaa !5
  %.not3845 = icmp slt i32 %4, 1
  br i1 %.not3845, label %.lr.ph72.._crit_edge_crit_edge, label %.lr.ph

.lr.ph72.._crit_edge_crit_edge:                   ; preds = %.lr.ph72
  %.pre = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph72.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.lr.ph72.._crit_edge_crit_edge ], [ %12, %.lr.ph ]
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @prime, i64 4), i64 %.pre-phi
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @prime, i64 4), ptr noundef nonnull %gep)
  %5 = load i32, ptr @k, align 4, !tbaa !5
  %.not3947 = icmp slt i32 %5, 1
  br i1 %.not3947, label %._crit_edge52.thread, label %.lr.ph51

._crit_edge52.thread:                             ; preds = %._crit_edge
  store i32 0, ptr @ans, align 4, !tbaa !5
  br label %.lr.ph67

.lr.ph51:                                         ; preds = %._crit_edge
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = zext nneg i32 %5 to i64
  %xtraiter = and i64 %7, 3
  %8 = icmp ult i32 %5, 4
  br i1 %8, label %._crit_edge52.unr-lcssa, label %.lr.ph51.new

.lr.ph51.new:                                     ; preds = %.lr.ph51
  %unroll_iter = and i64 %7, 2147483644
  br label %22

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

._crit_edge52.unr-lcssa:                          ; preds = %22, %.lr.ph51
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph51 ], [ %spec.select.3, %22 ]
  %indvars.iv78.unr = phi i64 [ 1, %.lr.ph51 ], [ %indvars.iv.next79.3, %22 ]
  %.03148.unr = phi i32 [ 0, %.lr.ph51 ], [ %spec.select.3, %22 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge52, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge52.unr-lcssa, %.epil.preheader
  %indvars.iv78.epil = phi i64 [ %indvars.iv.next79.epil, %.epil.preheader ], [ %indvars.iv78.unr, %._crit_edge52.unr-lcssa ]
  %.03148.epil = phi i32 [ %spec.select.epil, %.epil.preheader ], [ %.03148.unr, %._crit_edge52.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge52.unr-lcssa ]
  %13 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv78.epil
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = mul nsw i32 %14, %14
  %.not43.epil = icmp sgt i32 %15, %6
  %16 = trunc nuw nsw i64 %indvars.iv78.epil to i32
  %spec.select.epil = select i1 %.not43.epil, i32 %.03148.epil, i32 %16
  %indvars.iv.next79.epil = add nuw nsw i64 %indvars.iv78.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_edge52, label %.epil.preheader, !llvm.loop !11

._crit_edge52:                                    ; preds = %.epil.preheader, %._crit_edge52.unr-lcssa
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge52.unr-lcssa ], [ %spec.select.epil, %.epil.preheader ]
  store i32 0, ptr @ans, align 4, !tbaa !5
  %.not74 = icmp eq i32 %spec.select.lcssa, 31
  br i1 %.not74, label %._crit_edge68, label %.lr.ph67

.lr.ph67:                                         ; preds = %._crit_edge52.thread, %._crit_edge52
  %.031.lcssa92 = phi i32 [ 0, %._crit_edge52.thread ], [ %spec.select.lcssa, %._crit_edge52 ]
  %17 = shl nuw nsw i32 1, %.031.lcssa92
  %.not4054 = icmp slt i32 %.031.lcssa92, 1
  %18 = add i32 %.031.lcssa92, 1
  %19 = sext i32 %.031.lcssa92 to i64
  %wide.trip.count84 = zext i32 %18 to i64
  %20 = add nsw i64 %wide.trip.count84, -1
  %xtraiter97 = and i64 %20, 1
  %21 = icmp eq i32 %18, 2
  %unroll_iter100 = and i64 %20, -2
  %lcmp.mod99.not = icmp eq i64 %xtraiter97, 0
  br label %43

22:                                               ; preds = %22, %.lr.ph51.new
  %indvars.iv78 = phi i64 [ 1, %.lr.ph51.new ], [ %indvars.iv.next79.3, %22 ]
  %.03148 = phi i32 [ 0, %.lr.ph51.new ], [ %spec.select.3, %22 ]
  %niter = phi i64 [ 0, %.lr.ph51.new ], [ %niter.next.3, %22 ]
  %23 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv78
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = mul nsw i32 %24, %24
  %.not43 = icmp sgt i32 %25, %6
  %26 = trunc nuw nsw i64 %indvars.iv78 to i32
  %spec.select = select i1 %.not43, i32 %.03148, i32 %26
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %27 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next79
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = mul nsw i32 %28, %28
  %.not43.1 = icmp sgt i32 %29, %6
  %30 = trunc nuw nsw i64 %indvars.iv.next79 to i32
  %spec.select.1 = select i1 %.not43.1, i32 %spec.select, i32 %30
  %indvars.iv.next79.1 = add nuw nsw i64 %indvars.iv78, 2
  %31 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next79.1
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = mul nsw i32 %32, %32
  %.not43.2 = icmp sgt i32 %33, %6
  %34 = trunc nuw nsw i64 %indvars.iv.next79.1 to i32
  %spec.select.2 = select i1 %.not43.2, i32 %spec.select.1, i32 %34
  %indvars.iv.next79.2 = add nuw nsw i64 %indvars.iv78, 3
  %35 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next79.2
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = mul nsw i32 %36, %36
  %.not43.3 = icmp sgt i32 %37, %6
  %38 = trunc nuw nsw i64 %indvars.iv.next79.2 to i32
  %spec.select.3 = select i1 %.not43.3, i32 %spec.select.2, i32 %38
  %indvars.iv.next79.3 = add nuw nsw i64 %indvars.iv78, 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_edge52.unr-lcssa, label %22, !llvm.loop !13

._crit_edge68:                                    ; preds = %93, %._crit_edge52
  %39 = phi i32 [ 0, %._crit_edge52 ], [ %94, %93 ]
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.03370, i32 noundef %39)
  %41 = add nuw nsw i32 %.03370, 1
  %42 = load i32, ptr @t, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03370, %42
  br i1 %.not.not, label %.lr.ph72, label %._crit_edge73, !llvm.loop !14

43:                                               ; preds = %.lr.ph67, %93
  %.02965 = phi i32 [ 0, %.lr.ph67 ], [ %95, %93 ]
  store i32 0, ptr @tot, align 4, !tbaa !5
  br i1 %.not4054, label %._crit_edge58, label %.lr.ph57.preheader

.lr.ph57.preheader:                               ; preds = %43
  br i1 %21, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57

._crit_edge58.loopexit.unr-lcssa:                 ; preds = %77, %.lr.ph57.preheader
  %indvars.iv81.unr = phi i64 [ 1, %.lr.ph57.preheader ], [ %indvars.iv.next82.1, %77 ]
  %.unr = phi i32 [ 0, %.lr.ph57.preheader ], [ %78, %77 ]
  br i1 %lcmp.mod99.not, label %._crit_edge58, label %.lr.ph57.epil

.lr.ph57.epil:                                    ; preds = %._crit_edge58.loopexit.unr-lcssa
  %44 = trunc i64 %indvars.iv81.unr to i32
  %45 = add i32 %44, -1
  %46 = shl nuw i32 1, %45
  %47 = and i32 %46, %.02965
  %.not42.epil = icmp eq i32 %47, 0
  br i1 %.not42.epil, label %._crit_edge58, label %48

48:                                               ; preds = %.lr.ph57.epil
  %49 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv81.unr
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %.unr, 1
  store i32 %51, ptr @tot, align 4, !tbaa !5
  %52 = sext i32 %.unr to i64
  %53 = getelementptr inbounds [12 x i32], ptr @seq, i64 0, i64 %52
  store i32 %50, ptr %53, align 4, !tbaa !5
  br label %._crit_edge58

._crit_edge58:                                    ; preds = %._crit_edge58.loopexit.unr-lcssa, %48, %.lr.ph57.epil, %43
  store i32 0, ptr @tmp, align 4, !tbaa !5
  tail call void @_Z3dfsiii(i32 noundef 0, i32 noundef 1, i32 noundef 0)
  %54 = load i32, ptr @k, align 4, !tbaa !5
  %.not41.not60 = icmp slt i32 %.031.lcssa92, %54
  br i1 %.not41.not60, label %.lr.ph63, label %._crit_edge64

.lr.ph57:                                         ; preds = %.lr.ph57.preheader, %77
  %indvars.iv81 = phi i64 [ %indvars.iv.next82.1, %77 ], [ 1, %.lr.ph57.preheader ]
  %55 = phi i32 [ %78, %77 ], [ 0, %.lr.ph57.preheader ]
  %niter101 = phi i64 [ %niter101.next.1, %77 ], [ 0, %.lr.ph57.preheader ]
  %56 = trunc i64 %indvars.iv81 to i32
  %57 = add nsw i32 %56, -1
  %58 = shl nuw i32 1, %57
  %59 = and i32 %58, %.02965
  %.not42 = icmp eq i32 %59, 0
  br i1 %.not42, label %.lr.ph57.1, label %60

60:                                               ; preds = %.lr.ph57
  %61 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv81
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = add nsw i32 %55, 1
  store i32 %63, ptr @tot, align 4, !tbaa !5
  %64 = sext i32 %55 to i64
  %65 = getelementptr inbounds [12 x i32], ptr @seq, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  br label %.lr.ph57.1

.lr.ph57.1:                                       ; preds = %.lr.ph57, %60
  %66 = phi i32 [ %55, %.lr.ph57 ], [ %63, %60 ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %67 = trunc i64 %indvars.iv.next82 to i32
  %68 = add i32 %67, -1
  %69 = shl nuw i32 1, %68
  %70 = and i32 %69, %.02965
  %.not42.1 = icmp eq i32 %70, 0
  br i1 %.not42.1, label %77, label %71

71:                                               ; preds = %.lr.ph57.1
  %72 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next82
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %66, 1
  store i32 %74, ptr @tot, align 4, !tbaa !5
  %75 = sext i32 %66 to i64
  %76 = getelementptr inbounds [12 x i32], ptr @seq, i64 0, i64 %75
  store i32 %73, ptr %76, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %71, %.lr.ph57.1
  %78 = phi i32 [ %66, %.lr.ph57.1 ], [ %74, %71 ]
  %indvars.iv.next82.1 = add nuw nsw i64 %indvars.iv81, 2
  %niter101.next.1 = add i64 %niter101, 2
  %niter101.ncmp.1 = icmp eq i64 %niter101.next.1, %unroll_iter100
  br i1 %niter101.ncmp.1, label %._crit_edge58.loopexit.unr-lcssa, label %.lr.ph57, !llvm.loop !15

._crit_edge64:                                    ; preds = %89, %._crit_edge58
  %79 = load i32, ptr @ans, align 4, !tbaa !5
  %80 = load i32, ptr @tmp, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %92, label %93

.lr.ph63:                                         ; preds = %._crit_edge58, %89
  %indvars.iv86 = phi i64 [ %indvars.iv.next87, %89 ], [ %19, %._crit_edge58 ]
  %indvars.iv.next87 = add nsw i64 %indvars.iv86, 1
  store i32 0, ptr @tmp2, align 4, !tbaa !5
  %82 = getelementptr inbounds [1010 x i32], ptr @prime, i64 0, i64 %indvars.iv.next87
  %83 = load i32, ptr %82, align 4, !tbaa !5
  tail call void @_Z3addiiii(i32 noundef 0, i32 noundef %83, i32 noundef 1, i32 noundef 0)
  %84 = load i32, ptr @tmp2, align 4, !tbaa !5
  %85 = icmp sgt i32 %84, 0
  br i1 %85, label %86, label %89

86:                                               ; preds = %.lr.ph63
  %87 = load i32, ptr @tmp, align 4, !tbaa !5
  %88 = add nsw i32 %87, %84
  store i32 %88, ptr @tmp, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %.lr.ph63, %86
  %90 = load i32, ptr @k, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %.not41.not = icmp slt i64 %indvars.iv.next87, %91
  br i1 %.not41.not, label %.lr.ph63, label %._crit_edge64, !llvm.loop !16

92:                                               ; preds = %._crit_edge64
  store i32 %80, ptr @ans, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %._crit_edge64, %92
  %94 = phi i32 [ %79, %._crit_edge64 ], [ %80, %92 ]
  %95 = add nuw nsw i32 %.02965, 1
  %exitcond89.not = icmp eq i32 %95, %17
  br i1 %exitcond89.not, label %._crit_edge68, label %43, !llvm.loop !17
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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 #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 = { inlinehint 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" }

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


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