; LLVM IR from tangjz/acm-icpc :: projecteuler (439)

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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@Hash = external dso_local global %"class.std::map", align 8
@tot = external dso_local global i32, align 4
@prime = external dso_local global [23333333 x i32], align 16
@d = external dso_local global [23333333 x i32], align 16
@f = external dso_local global [23333333 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #2

; 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 i32 @_Z6calc_gx(i64 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"class.std::map", align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([23333333 x i32], ptr @f, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %107, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 23333333
  br i1 %16, label %18, label %17

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

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %36, label %24

24:                                               ; preds = %18
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %27
  store i32 %25, ptr %28, align 4, !tbaa !5
  %29 = load i32, ptr @tot, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr @tot, align 4, !tbaa !5
  %31 = sext i32 %29 to i64
  %32 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %31
  store i32 %25, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %34
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %35, i32 noundef 1)
  br label %36

36:                                               ; preds = %24, %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sdiv i32 23333332, %37
  store i32 %38, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  br label %39

39:                                               ; preds = %82, %36
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = icmp sle i32 %43, %44
  br i1 %45, label %47, label %46

46:                                               ; preds = %39
  store i32 5, ptr %3, align 4
  br label %85

47:                                               ; preds = %39
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr %2, align 4, !tbaa !5
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = mul nsw i32 %52, %56
  store i32 %57, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %58
  store i32 %51, ptr %59, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = icmp eq i32 %63, %67
  br i1 %68, label %69, label %73

69:                                               ; preds = %47
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %71
  store i32 0, ptr %72, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %85

73:                                               ; preds = %47
  %74 = load i32, ptr %6, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %75
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %76, i32 noundef %80)
  br label %81

81:                                               ; preds = %73
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !9

85:                                               ; preds = %69, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = load i32, ptr %2, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %94, %99
  %101 = add nsw i64 %92, %100
  %102 = srem i64 %101, 1000000000
  %103 = trunc i64 %102 to i32
  %104 = load i32, ptr %2, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %105
  store i32 %103, ptr %106, align 4, !tbaa !5
  br label %107

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

110:                                              ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  br label %111

111:                                              ; preds = %146, %110
  %112 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %7)
  %113 = icmp eq i32 %112, 1
  br i1 %113, label %115, label %114

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

115:                                              ; preds = %111
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %9) #8
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %9) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr %9) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #8
  store i64 1, ptr %10, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  br label %116

116:                                              ; preds = %143, %115
  %117 = load i64, ptr %10, align 8, !tbaa !12
  %118 = load i64, ptr %7, align 8, !tbaa !12
  %119 = icmp sle i64 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 10, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %146

121:                                              ; preds = %116
  %122 = load i64, ptr %7, align 8, !tbaa !12
  %123 = load i64, ptr %10, align 8, !tbaa !12
  %124 = sdiv i64 %122, %123
  store i64 %124, ptr %12, align 8, !tbaa !12
  %125 = load i64, ptr %7, align 8, !tbaa !12
  %126 = load i64, ptr %12, align 8, !tbaa !12
  %127 = sdiv i64 %125, %126
  store i64 %127, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %128 = load i64, ptr %12, align 8, !tbaa !12
  %129 = call noundef i32 @_Z6calc_gx(i64 noundef %128)
  store i32 %129, ptr %13, align 4, !tbaa !5
  %130 = load i64, ptr %10, align 8, !tbaa !12
  %131 = load i64, ptr %11, align 8, !tbaa !12
  %132 = call noundef i32 @_Z8calc_imuxx(i64 noundef %130, i64 noundef %131)
  %133 = sext i32 %132 to i64
  %134 = load i32, ptr %13, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = mul nsw i64 %133, %135
  %137 = srem i64 %136, 1000000000
  %138 = load i32, ptr %13, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = mul nsw i64 %137, %139
  %141 = srem i64 %140, 1000000000
  %142 = trunc i64 %141 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %8, i32 noundef %142)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %143

143:                                              ; preds = %121
  %144 = load i64, ptr %11, align 8, !tbaa !12
  %145 = add nsw i64 %144, 1
  store i64 %145, ptr %10, align 8, !tbaa !12
  br label %116, !llvm.loop !14

146:                                              ; preds = %120
  %147 = load i32, ptr %8, align 4, !tbaa !5
  %148 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %147)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %111, !llvm.loop !15

149:                                              ; preds = %114
  ret i32 0
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8calc_imuxx(i64 noundef, i64 noundef) #7

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

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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { "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 nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #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 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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"

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@Hash = external dso_local global %"class.std::map", align 8
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [23333333 x i32], align 16
@d = external dso_local local_unnamed_addr global [23333333 x i32], align 16
@f = external dso_local global [23333333 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48)) unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress 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 i32 @_Z6calc_gx(i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i64, align 8
  %2 = alloca i32, align 4
  %3 = alloca %"class.std::map", align 8
  store i32 1, ptr getelementptr inbounds (i8, ptr @f, i64 4), align 4, !tbaa !5
  br label %7

4:                                                ; preds = %.loopexit
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %6 = icmp eq i32 %5, 1
  br i1 %6, label %.lr.ph44, label %._crit_edge45

7:                                                ; preds = %0, %.loopexit
  %indvars.iv48 = phi i64 [ 2, %0 ], [ %indvars.iv.next49, %.loopexit ]
  %8 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %indvars.iv48
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %.not35 = icmp eq i32 %9, 0
  %10 = trunc nuw nsw i64 %indvars.iv48 to i32
  br i1 %.not35, label %11, label %._crit_edge51

11:                                               ; preds = %7
  store i32 %10, ptr %8, align 4, !tbaa !5
  %12 = load i32, ptr @tot, align 4, !tbaa !5
  %13 = add nsw i32 %12, 1
  store i32 %13, ptr @tot, align 4, !tbaa !5
  %14 = sext i32 %12 to i64
  %15 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %14
  store i32 %10, ptr %15, align 4, !tbaa !5
  %16 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %indvars.iv48
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %16, i32 noundef 1)
  br label %._crit_edge51

._crit_edge51:                                    ; preds = %7, %11
  %17 = udiv i32 23333332, %10
  %18 = load i32, ptr @prime, align 16, !tbaa !5
  %.not3637 = icmp sgt i32 %18, %17
  br i1 %.not3637, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %._crit_edge51
  %19 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %indvars.iv48
  br label %20

20:                                               ; preds = %.lr.ph, %29
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %29 ]
  %21 = phi i32 [ %18, %.lr.ph ], [ %32, %29 ]
  %22 = sext i32 %21 to i64
  %23 = mul nsw i64 %indvars.iv48, %22
  %24 = getelementptr inbounds [23333333 x i32], ptr @d, i64 0, i64 %23
  store i32 %21, ptr %24, align 4, !tbaa !5
  %25 = load i32, ptr %8, align 4, !tbaa !5
  %26 = icmp eq i32 %25, %21
  %27 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %23
  br i1 %26, label %28, label %29

28:                                               ; preds = %20
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %.loopexit

29:                                               ; preds = %20
  %30 = load i32, ptr %19, align 4, !tbaa !5
  tail call void @_Z3decRii(ptr noundef nonnull align 4 dereferenceable(4) %27, i32 noundef %30)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = getelementptr inbounds [23333333 x i32], ptr @prime, i64 0, i64 %indvars.iv.next
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %.not36 = icmp sgt i32 %32, %17
  br i1 %.not36, label %.loopexit, label %20, !llvm.loop !9

.loopexit:                                        ; preds = %29, %._crit_edge51, %28
  %33 = add nsw i64 %indvars.iv48, -1
  %34 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [23333333 x i32], ptr @f, i64 0, i64 %indvars.iv48
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = mul nsw i64 %indvars.iv48, %39
  %41 = add nsw i64 %40, %36
  %42 = srem i64 %41, 1000000000
  %43 = trunc nsw i64 %42 to i32
  store i32 %43, ptr %37, align 4, !tbaa !5
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next49, 23333333
  br i1 %exitcond.not, label %4, label %7, !llvm.loop !11

._crit_edge45:                                    ; preds = %._crit_edge, %4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

.lr.ph44:                                         ; preds = %4, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %3, i8 0, i64 48, i1 false)
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(48) @Hash) #8
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #8
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #8
  %44 = load i64, ptr %1, align 8, !tbaa !12
  %.not40 = icmp slt i64 %44, 1
  br i1 %.not40, label %._crit_edge, label %.lr.ph42

._crit_edge:                                      ; preds = %.lr.ph42, %.lr.ph44
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %45)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %47 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %48 = icmp eq i32 %47, 1
  br i1 %48, label %.lr.ph44, label %._crit_edge45, !llvm.loop !14

.lr.ph42:                                         ; preds = %.lr.ph44, %.lr.ph42
  %49 = phi i64 [ %62, %.lr.ph42 ], [ %44, %.lr.ph44 ]
  %.03241 = phi i64 [ %61, %.lr.ph42 ], [ 1, %.lr.ph44 ]
  %50 = udiv i64 %49, %.03241
  %51 = sdiv i64 %49, %50
  %52 = call noundef i32 @_Z6calc_gx(i64 noundef %50)
  %53 = call noundef i32 @_Z8calc_imuxx(i64 noundef %.03241, i64 noundef %51)
  %54 = sext i32 %53 to i64
  %55 = sext i32 %52 to i64
  %56 = mul nsw i64 %54, %55
  %57 = srem i64 %56, 1000000000
  %58 = mul nsw i64 %57, %55
  %59 = srem i64 %58, 1000000000
  %60 = trunc nsw i64 %59 to i32
  call void @_Z3incRii(ptr noundef nonnull align 4 dereferenceable(4) %2, i32 noundef %60)
  %61 = add nuw nsw i64 %51, 1
  %62 = load i64, ptr %1, align 8, !tbaa !12
  %.not.not = icmp slt i64 %51, %62
  br i1 %.not.not, label %.lr.ph42, label %._crit_edge, !llvm.loop !15
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE4swapERS6_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z8calc_imuxx(i64 noundef, i64 noundef) local_unnamed_addr #7

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { 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 #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 = !{!"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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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