; LLVM IR from tangjz/acm-icpc :: 51nod (1223)

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

@tot = external dso_local global i32, align 4
@prime = external dso_local global [316229 x i32], align 16
@last = external dso_local global [316229 x i32], align 16
@sqn = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@d = external dso_local global [11 x i32], align 16
@n = external dso_local global i64, align 8
@T = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5calc1ii(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 uwtable
declare dso_local noundef i64 @_Z5calc2ii(i32 noundef, i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %10 = load i64, ptr @n, align 8, !tbaa !5
  %11 = call noundef double @_ZSt4sqrtIxEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %10)
  %12 = call double @llvm.ceil.f64(double %11)
  %13 = fptosi double %12 to i32
  store i32 %13, ptr @sqn, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2, ptr %2, align 4, !tbaa !9
  br label %14

14:                                               ; preds = %79, %0
  %15 = load i32, ptr %2, align 4, !tbaa !9
  %16 = load i32, ptr @sqn, align 4, !tbaa !9
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %82

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %34, label %25

25:                                               ; preds = %19
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !9
  %30 = load i32, ptr @tot, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr @tot, align 4, !tbaa !9
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %32
  store i32 %26, ptr %33, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %25, %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %35 = load i32, ptr @sqn, align 4, !tbaa !9
  %36 = load i32, ptr %2, align 4, !tbaa !9
  %37 = sdiv i32 %35, %36
  store i32 %37, ptr %5, align 4, !tbaa !9
  br label %38

38:                                               ; preds = %74, %34
  %39 = load i32, ptr %4, align 4, !tbaa !9
  %40 = load i32, ptr @tot, align 4, !tbaa !9
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %49

42:                                               ; preds = %38
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = load i32, ptr %5, align 4, !tbaa !9
  %48 = icmp sle i32 %46, %47
  br label %49

49:                                               ; preds = %42, %38
  %50 = phi i1 [ false, %38 ], [ %48, %42 ]
  br i1 %50, label %52, label %51

51:                                               ; preds = %49
  store i32 5, ptr %3, align 4
  br label %77

52:                                               ; preds = %49
  %53 = load i32, ptr %2, align 4, !tbaa !9
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = load i32, ptr %2, align 4, !tbaa !9
  %58 = load i32, ptr %4, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = mul nsw i32 %57, %61
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %63
  store i32 %56, ptr %64, align 4, !tbaa !9
  %65 = load i32, ptr %2, align 4, !tbaa !9
  %66 = load i32, ptr %4, align 4, !tbaa !9
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !9
  %70 = srem i32 %65, %69
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %73

72:                                               ; preds = %52
  store i32 5, ptr %3, align 4
  br label %77

73:                                               ; preds = %52
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr %4, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !9
  br label %38, !llvm.loop !11

77:                                               ; preds = %72, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %78

78:                                               ; preds = %77
  br label %79

79:                                               ; preds = %78
  %80 = load i32, ptr %2, align 4, !tbaa !9
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %2, align 4, !tbaa !9
  br label %14, !llvm.loop !13

82:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %83

83:                                               ; preds = %181, %82
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = add nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = load i64, ptr @n, align 8, !tbaa !5
  %88 = load i32, ptr %6, align 4, !tbaa !9
  %89 = sext i32 %88 to i64
  %90 = sdiv i64 %87, %89
  store i64 %90, ptr @T, align 8, !tbaa !5
  %91 = icmp sle i64 %86, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %83
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %184

93:                                               ; preds = %83
  store i32 0, ptr @cnt, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %94 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %94, ptr %7, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %119, %93
  %96 = load i32, ptr %7, align 4, !tbaa !9
  %97 = icmp sgt i32 %96, 1
  br i1 %97, label %99, label %98

98:                                               ; preds = %95
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %126

99:                                               ; preds = %95
  %100 = load i32, ptr @cnt, align 4, !tbaa !9
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [11 x i32], ptr @d, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = load i32, ptr %7, align 4, !tbaa !9
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !9
  %108 = icmp ne i32 %103, %107
  br i1 %108, label %109, label %118

109:                                              ; preds = %99
  %110 = load i32, ptr %7, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = load i32, ptr @cnt, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr @cnt, align 4, !tbaa !9
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [11 x i32], ptr @d, i64 0, i64 %116
  store i32 %113, ptr %117, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %109, %99
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %7, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !9
  %124 = load i32, ptr %7, align 4, !tbaa !9
  %125 = sdiv i32 %124, %123
  store i32 %125, ptr %7, align 4, !tbaa !9
  br label %95, !llvm.loop !14

126:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %127 = load i32, ptr @cnt, align 4, !tbaa !9
  %128 = shl i32 1, %127
  %129 = sitofp i32 %128 to double
  %130 = load i64, ptr @T, align 8, !tbaa !5
  %131 = sitofp i64 %130 to double
  %132 = fmul double %129, %131
  %133 = load i32, ptr @cnt, align 4, !tbaa !9
  %134 = sitofp i32 %133 to double
  %135 = fdiv double %132, %134
  %136 = call double @sqrt(double noundef %135) #8
  %137 = fptosi double %136 to i32
  store i32 %137, ptr %8, align 4, !tbaa !9
  %138 = load i32, ptr %8, align 4, !tbaa !9
  %139 = load i32, ptr %6, align 4, !tbaa !9
  %140 = icmp sle i32 %138, %139
  br i1 %140, label %141, label %150

141:                                              ; preds = %126
  %142 = load i32, ptr %6, align 4, !tbaa !9
  %143 = add nsw i32 %142, 1
  %144 = load i32, ptr %6, align 4, !tbaa !9
  %145 = mul nsw i32 2, %144
  %146 = sub nsw i32 %145, 1
  %147 = call noundef i64 @_Z5calc2ii(i32 noundef %143, i32 noundef %146)
  %148 = load i64, ptr @ans, align 8, !tbaa !5
  %149 = add nsw i64 %148, %147
  store i64 %149, ptr @ans, align 8, !tbaa !5
  br label %180

150:                                              ; preds = %126
  %151 = load i32, ptr %8, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  %153 = load i32, ptr %6, align 4, !tbaa !9
  %154 = mul nsw i32 2, %153
  %155 = icmp sge i32 %152, %154
  br i1 %155, label %156, label %165

156:                                              ; preds = %150
  %157 = load i32, ptr %6, align 4, !tbaa !9
  %158 = add nsw i32 %157, 1
  %159 = load i32, ptr %6, align 4, !tbaa !9
  %160 = mul nsw i32 2, %159
  %161 = sub nsw i32 %160, 1
  %162 = call noundef i64 @_Z5calc1ii(i32 noundef %158, i32 noundef %161)
  %163 = load i64, ptr @ans, align 8, !tbaa !5
  %164 = add nsw i64 %163, %162
  store i64 %164, ptr @ans, align 8, !tbaa !5
  br label %179

165:                                              ; preds = %150
  %166 = load i32, ptr %6, align 4, !tbaa !9
  %167 = add nsw i32 %166, 1
  %168 = load i32, ptr %8, align 4, !tbaa !9
  %169 = call noundef i64 @_Z5calc1ii(i32 noundef %167, i32 noundef %168)
  %170 = load i32, ptr %8, align 4, !tbaa !9
  %171 = add nsw i32 %170, 1
  %172 = load i32, ptr %6, align 4, !tbaa !9
  %173 = mul nsw i32 2, %172
  %174 = sub nsw i32 %173, 1
  %175 = call noundef i64 @_Z5calc2ii(i32 noundef %171, i32 noundef %174)
  %176 = add nsw i64 %169, %175
  %177 = load i64, ptr @ans, align 8, !tbaa !5
  %178 = add nsw i64 %177, %176
  store i64 %178, ptr @ans, align 8, !tbaa !5
  br label %179

179:                                              ; preds = %165, %156
  br label %180

180:                                              ; preds = %179, %141
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %181

181:                                              ; preds = %180
  %182 = load i32, ptr %6, align 4, !tbaa !9
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %6, align 4, !tbaa !9
  br label %83, !llvm.loop !15

184:                                              ; preds = %92
  %185 = load i64, ptr @ans, align 8, !tbaa !5
  %186 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %185)
  ret i32 0
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIxEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #6

; Function Attrs: nounwind
declare double @sqrt(double noundef) #7

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 #8 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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

@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [316229 x i32], align 16
@last = external dso_local local_unnamed_addr global [316229 x i32], align 16
@sqn = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local local_unnamed_addr global [11 x i32], align 16
@n = external dso_local global i64, align 8
@T = external dso_local local_unnamed_addr global i64, align 8
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5calc1ii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5calc2ii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i64, ptr @n, align 8, !tbaa !5
  %3 = tail call noundef double @_ZSt4sqrtIxEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef %2)
  %4 = tail call double @llvm.ceil.f64(double %3)
  %5 = fptosi double %4 to i32
  store i32 %5, ptr @sqn, align 4, !tbaa !9
  %.not53 = icmp slt i32 %5, 2
  br i1 %.not53, label %.preheader, label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %0
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !9
  %6 = add nuw i32 %5, 1
  %wide.trip.count = zext i32 %6 to i64
  br label %.lr.ph55

.preheader:                                       ; preds = %.critedge, %0
  %7 = load i64, ptr @n, align 8, !tbaa !5
  %8 = sdiv i64 %7, 2
  store i64 %8, ptr @T, align 8, !tbaa !5
  %.not4457 = icmp slt i64 %7, 6
  br i1 %.not4457, label %.preheader.._crit_edge_crit_edge, label %.lr.ph59

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre = load i64, ptr @ans, align 8, !tbaa !5
  br label %._crit_edge

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.critedge
  %indvars.iv61 = phi i64 [ 2, %.lr.ph55.preheader ], [ %indvars.iv.next62, %.critedge ]
  %9 = phi i32 [ %tot.promoted, %.lr.ph55.preheader ], [ %18, %.critedge ]
  %10 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %indvars.iv61
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %.not48 = icmp eq i32 %11, 0
  %12 = trunc nuw nsw i64 %indvars.iv61 to i32
  br i1 %.not48, label %13, label %.lr.ph55._crit_edge

13:                                               ; preds = %.lr.ph55
  store i32 %12, ptr %10, align 4, !tbaa !9
  %14 = add nsw i32 %9, 1
  store i32 %14, ptr @tot, align 4, !tbaa !9
  %15 = sext i32 %9 to i64
  %16 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %15
  store i32 %12, ptr %16, align 4, !tbaa !9
  br label %.lr.ph55._crit_edge

.lr.ph55._crit_edge:                              ; preds = %.lr.ph55, %13
  %17 = phi i32 [ %12, %13 ], [ %11, %.lr.ph55 ]
  %18 = phi i32 [ %14, %13 ], [ %9, %.lr.ph55 ]
  %19 = udiv i32 %5, %12
  %20 = icmp sgt i32 %18, 0
  br i1 %20, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %.lr.ph55._crit_edge
  %21 = zext nneg i32 %18 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %24
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %24 ]
  %22 = getelementptr inbounds [316229 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %.not49 = icmp sgt i32 %23, %19
  br i1 %.not49, label %.critedge, label %24

24:                                               ; preds = %.lr.ph
  %25 = mul nsw i32 %23, %12
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %26
  store i32 %17, ptr %27, align 4, !tbaa !9
  %28 = srem i32 %12, %23
  %29 = icmp ne i32 %28, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = icmp ult i64 %indvars.iv.next, %21
  %or.cond = select i1 %29, i1 %30, i1 false
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %.lr.ph, %24, %.lr.ph55._crit_edge
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
  br i1 %exitcond.not, label %.preheader, label %.lr.ph55, !llvm.loop !13

._crit_edge:                                      ; preds = %83, %.preheader.._crit_edge_crit_edge
  %31 = phi i64 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %.sink, %83 ]
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %31)
  ret i32 0

.lr.ph59:                                         ; preds = %.preheader, %83
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %83 ], [ 3, %.preheader ]
  %33 = phi i64 [ %85, %83 ], [ %8, %.preheader ]
  %.03758 = phi i32 [ %.pre-phi, %83 ], [ 2, %.preheader ]
  store i32 0, ptr @cnt, align 4, !tbaa !9
  br label %43

34:                                               ; preds = %55
  %35 = shl nuw i32 1, %56
  %36 = sitofp i32 %35 to double
  %37 = sitofp i64 %33 to double
  %38 = fmul double %37, %36
  %39 = sitofp i32 %56 to double
  %40 = fdiv double %38, %39
  %41 = tail call double @sqrt(double noundef %40) #7
  %42 = fptosi double %41 to i32
  %.not45 = icmp slt i32 %.03758, %42
  br i1 %.not45, label %66, label %59

43:                                               ; preds = %.lr.ph59, %55
  %.03656 = phi i32 [ %.03758, %.lr.ph59 ], [ %57, %55 ]
  %44 = phi i32 [ 0, %.lr.ph59 ], [ %56, %55 ]
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [11 x i32], ptr @d, i64 0, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = zext nneg i32 %.03656 to i64
  %49 = getelementptr inbounds [316229 x i32], ptr @last, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %.not47 = icmp eq i32 %47, %50
  br i1 %.not47, label %55, label %51

51:                                               ; preds = %43
  %52 = add nsw i32 %44, 1
  store i32 %52, ptr @cnt, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [11 x i32], ptr @d, i64 0, i64 %53
  store i32 %50, ptr %54, align 4, !tbaa !9
  br label %55

55:                                               ; preds = %43, %51
  %56 = phi i32 [ %44, %43 ], [ %52, %51 ]
  %57 = sdiv i32 %.03656, %50
  %58 = icmp sgt i32 %57, 1
  br i1 %58, label %43, label %34, !llvm.loop !14

59:                                               ; preds = %34
  %60 = shl nuw nsw i32 %.03758, 1
  %61 = add nsw i32 %60, -1
  %62 = trunc nuw nsw i64 %indvars.iv64 to i32
  %63 = tail call noundef i64 @_Z5calc2ii(i32 noundef %62, i32 noundef %61)
  %64 = load i64, ptr @ans, align 8, !tbaa !5
  %65 = add nsw i64 %64, %63
  br label %83

66:                                               ; preds = %34
  %67 = add nsw i32 %42, 1
  %68 = shl nuw nsw i32 %.03758, 1
  %.not46 = icmp slt i32 %67, %68
  br i1 %.not46, label %75, label %69

69:                                               ; preds = %66
  %70 = add nsw i32 %68, -1
  %71 = trunc nuw nsw i64 %indvars.iv64 to i32
  %72 = tail call noundef i64 @_Z5calc1ii(i32 noundef %71, i32 noundef %70)
  %73 = load i64, ptr @ans, align 8, !tbaa !5
  %74 = add nsw i64 %73, %72
  br label %83

75:                                               ; preds = %66
  %76 = trunc nuw nsw i64 %indvars.iv64 to i32
  %77 = tail call noundef i64 @_Z5calc1ii(i32 noundef %76, i32 noundef %42)
  %78 = add nsw i32 %68, -1
  %79 = tail call noundef i64 @_Z5calc2ii(i32 noundef %67, i32 noundef %78)
  %80 = add nsw i64 %79, %77
  %81 = load i64, ptr @ans, align 8, !tbaa !5
  %82 = add nsw i64 %80, %81
  br label %83

83:                                               ; preds = %69, %75, %59
  %.sink = phi i64 [ %74, %69 ], [ %82, %75 ], [ %65, %59 ]
  %.pre-phi = phi i32 [ %71, %69 ], [ %76, %75 ], [ %62, %59 ]
  store i64 %.sink, ptr @ans, align 8, !tbaa !5
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %84 = load i64, ptr @n, align 8, !tbaa !5
  %85 = sdiv i64 %84, %indvars.iv64
  store i64 %85, ptr @T, align 8, !tbaa !5
  %.not44.not = icmp sgt i64 %85, %indvars.iv64
  br i1 %.not44.not, label %.lr.ph59, label %._crit_edge, !llvm.loop !15
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt4sqrtIxEN9__gnu_cxx11__enable_ifIXsr12__is_integerIT_EE7__valueEdE6__typeES2_(i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #6

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

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 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 = { 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 = { 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 #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { mustprogress nofree nounwind willreturn memory(write) "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 #7 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


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