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

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

%struct.FactExp = type { i32, [12 x i32] }

@sz = external dso_local global [4358 x i32], align 16
@f = external dso_local global [4358 x [40 x i64]], align 16
@tot = external dso_local global i32, align 4
@prime = external dso_local global [125000 x i32], align 16
@vis = external dso_local global [1000004 x i8], align 16
@.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 [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfs7FactExp(ptr noundef byval(%struct.FactExp) align 8) #0

; 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 uwtable
declare dso_local noundef zeroext i1 @_Z8getNewIDxRi(i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #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 nounwind uwtable
declare dso_local void @_Z10getFactExpx(ptr dead_on_unwind noalias writable sret(%struct.FactExp) align 4, i64 noundef) #3

; 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.FactExp, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %13

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

16:                                               ; preds = %13
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %72

17:                                               ; preds = %13
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1000004 x i8], ptr @vis, i64 0, i64 %19
  %21 = load i8, ptr %20, align 1, !tbaa !9, !range !11, !noundef !12
  %22 = trunc i8 %21 to i1
  br i1 %22, label %29, label %23

23:                                               ; preds = %17
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = load i32, ptr @tot, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @tot, align 4, !tbaa !5
  %27 = sext i32 %25 to i64
  %28 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %27
  store i32 %24, ptr %28, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %23, %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sdiv i32 1000003, %30
  store i32 %31, ptr %5, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %64, %29
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = load i32, ptr @tot, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %32
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr %5, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br label %43

43:                                               ; preds = %36, %32
  %44 = phi i1 [ false, %32 ], [ %42, %36 ]
  br i1 %44, label %46, label %45

45:                                               ; preds = %43
  store i32 5, ptr %3, align 4
  br label %67

46:                                               ; preds = %43
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = mul nsw i32 %47, %51
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1000004 x i8], ptr @vis, i64 0, i64 %53
  store i8 1, ptr %54, align 1, !tbaa !9
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = srem i32 %55, %59
  %61 = icmp eq i32 %60, 0
  br i1 %61, label %62, label %63

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

63:                                               ; preds = %46
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %4, align 4, !tbaa !5
  br label %32, !llvm.loop !13

67:                                               ; preds = %62, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %2, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !15

72:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %73 = call noundef zeroext i1 @_Z8getNewIDxRi(i64 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store i32 1, ptr @sz, align 16, !tbaa !5
  store i64 1, ptr @f, align 16, !tbaa !16
  %74 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %147, %72
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = load i32, ptr %6, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !16
  %81 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %9)
  %82 = load i64, ptr %9, align 8, !tbaa !16
  %83 = icmp eq i64 %82, 1
  br i1 %83, label %84, label %87

84:                                               ; preds = %80
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %85)
  store i32 10, ptr %3, align 4
  br label %144

87:                                               ; preds = %80
  %88 = load i64, ptr %9, align 8, !tbaa !16
  call void @_Z10getFactExpx(ptr dead_on_unwind writable sret(%struct.FactExp) align 4 %11, i64 noundef %88)
  %89 = call noundef i32 @_Z3dfs7FactExp(ptr noundef byval(%struct.FactExp) align 8 %11)
  store i32 %89, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 1, ptr %12, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %130, %87
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [4358 x i32], ptr @sz, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp slt i32 %91, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %90
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %133

98:                                               ; preds = %90
  %99 = load i64, ptr %10, align 8, !tbaa !16
  %100 = sext i64 %99 to i128
  %101 = load i32, ptr %8, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [4358 x [40 x i64]], ptr @f, i64 0, i64 %102
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [40 x i64], ptr %103, i64 0, i64 %105
  %107 = load i64, ptr %106, align 8, !tbaa !16
  %108 = sext i64 %107 to i128
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [4358 x [40 x i64]], ptr @f, i64 0, i64 %110
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [40 x i64], ptr %111, i64 0, i64 %114
  %116 = load i64, ptr %115, align 8, !tbaa !16
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [4358 x [40 x i64]], ptr @f, i64 0, i64 %118
  %120 = load i32, ptr %12, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [40 x i64], ptr %119, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !16
  %124 = add nsw i64 %116, %123
  %125 = sext i64 %124 to i128
  %126 = mul nsw i128 %108, %125
  %127 = add nsw i128 %100, %126
  %128 = srem i128 %127, 10000000061
  %129 = trunc i128 %128 to i64
  store i64 %129, ptr %10, align 8, !tbaa !16
  br label %130

130:                                              ; preds = %98
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %12, align 4, !tbaa !5
  br label %90, !llvm.loop !18

133:                                              ; preds = %97
  %134 = load i64, ptr %10, align 8, !tbaa !16
  %135 = shl i64 %134, 1
  store i64 %135, ptr %10, align 8, !tbaa !16
  %136 = icmp sge i64 %135, 10000000061
  br i1 %136, label %137, label %140

137:                                              ; preds = %133
  %138 = load i64, ptr %10, align 8, !tbaa !16
  %139 = sub nsw i64 %138, 10000000061
  store i64 %139, ptr %10, align 8, !tbaa !16
  br label %140

140:                                              ; preds = %137, %133
  %141 = load i32, ptr %7, align 4, !tbaa !5
  %142 = load i64, ptr %10, align 8, !tbaa !16
  %143 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %141, i64 noundef %142)
  store i32 0, ptr %3, align 4
  br label %144

144:                                              ; preds = %140, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %145 = load i32, ptr %3, align 4
  switch i32 %145, label %152 [
    i32 0, label %146
    i32 10, label %147
  ]

146:                                              ; preds = %144
  br label %147

147:                                              ; preds = %146, %144
  %148 = load i32, ptr %7, align 4, !tbaa !5
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %7, align 4, !tbaa !5
  br label %75, !llvm.loop !19

150:                                              ; preds = %79
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %151 = load i32, ptr %1, align 4
  ret i32 %151

152:                                              ; preds = %144
  unreachable
}

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

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

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 = { 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 #3 = { 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 = { 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 = { 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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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

%struct.FactExp = type { i32, [12 x i32] }

@sz = external dso_local local_unnamed_addr global [4358 x i32], align 16
@f = external dso_local local_unnamed_addr global [4358 x [40 x i64]], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [125000 x i32], align 16
@vis = external dso_local local_unnamed_addr global [1000004 x i8], align 16
@.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 [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3dfs7FactExp(ptr noundef byval(%struct.FactExp) align 8) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z8getNewIDxRi(i64 noundef, ptr noundef nonnull align 4 dereferenceable(4)) 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 nounwind uwtable
declare dso_local void @_Z10getFactExpx(ptr dead_on_unwind noalias writable sret(%struct.FactExp) align 4, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %struct.FactExp, align 8
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %8

4:                                                ; preds = %.critedge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %5 = call noundef zeroext i1 @_Z8getNewIDxRi(i64 noundef 0, ptr noundef nonnull align 4 dereferenceable(4) %1)
  store i32 1, ptr @sz, align 16, !tbaa !5
  store i64 1, ptr @f, align 16, !tbaa !9
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %.not47 = icmp slt i32 %7, 1
  br i1 %.not47, label %._crit_edge51, label %.lr.ph50

8:                                                ; preds = %0, %.critedge
  %indvars.iv53 = phi i64 [ 2, %0 ], [ %indvars.iv.next54, %.critedge ]
  %9 = phi i32 [ %tot.promoted, %0 ], [ %19, %.critedge ]
  %10 = getelementptr inbounds [1000004 x i8], ptr @vis, i64 0, i64 %indvars.iv53
  %11 = load i8, ptr %10, align 1, !tbaa !11, !range !13, !noundef !14
  %12 = trunc nuw i8 %11 to i1
  br i1 %12, label %._crit_edge60, label %13

._crit_edge60:                                    ; preds = %8
  %.pre61 = trunc nuw nsw i64 %indvars.iv53 to i32
  br label %18

13:                                               ; preds = %8
  %14 = add nsw i32 %9, 1
  store i32 %14, ptr @tot, align 4, !tbaa !5
  %15 = sext i32 %9 to i64
  %16 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %15
  %17 = trunc nuw nsw i64 %indvars.iv53 to i32
  store i32 %17, ptr %16, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %._crit_edge60, %13
  %.pre-phi = phi i32 [ %.pre61, %._crit_edge60 ], [ %17, %13 ]
  %19 = phi i32 [ %9, %._crit_edge60 ], [ %14, %13 ]
  %20 = udiv i32 1000003, %.pre-phi
  %21 = icmp sgt i32 %19, 0
  br i1 %21, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %18
  %22 = zext nneg i32 %19 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %25
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %25 ]
  %23 = getelementptr inbounds [125000 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %.not39 = icmp sgt i32 %24, %20
  br i1 %.not39, label %.critedge, label %25

25:                                               ; preds = %.lr.ph
  %26 = mul nsw i32 %24, %.pre-phi
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [1000004 x i8], ptr @vis, i64 0, i64 %27
  store i8 1, ptr %28, align 1, !tbaa !11
  %29 = srem i32 %.pre-phi, %24
  %30 = icmp ne i32 %29, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %31 = icmp ult i64 %indvars.iv.next, %22
  %or.cond = select i1 %30, i1 %31, i1 false
  br i1 %or.cond, label %.lr.ph, label %.critedge, !llvm.loop !15

.critedge:                                        ; preds = %.lr.ph, %25, %18
  %indvars.iv.next54 = add nuw nsw i64 %indvars.iv53, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next54, 1000004
  br i1 %exitcond.not, label %4, label %8, !llvm.loop !17

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

.lr.ph50:                                         ; preds = %4, %59
  %.03248 = phi i32 [ %60, %59 ], [ 1, %4 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2)
  %33 = load i64, ptr %2, align 8, !tbaa !9
  %34 = icmp eq i64 %33, 1
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph50
  %36 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.03248)
  br label %59

37:                                               ; preds = %.lr.ph50
  call void @_Z10getFactExpx(ptr dead_on_unwind nonnull writable sret(%struct.FactExp) align 4 %3, i64 noundef %33)
  %38 = call noundef i32 @_Z3dfs7FactExp(ptr noundef nonnull byval(%struct.FactExp) align 8 %3)
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [4358 x i32], ptr @sz, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 1
  br i1 %42, label %.lr.ph46.preheader, label %._crit_edge.thread

.lr.ph46.preheader:                               ; preds = %37
  %wide.trip.count = zext nneg i32 %41 to i64
  %.phi.trans.insert = getelementptr inbounds [4358 x [40 x i64]], ptr @f, i64 0, i64 %39, i64 0
  %.pre = load i64, ptr %.phi.trans.insert, align 16, !tbaa !9
  br label %.lr.ph46

._crit_edge:                                      ; preds = %.lr.ph46
  %43 = shl nsw i64 %58, 1
  %44 = icmp sgt i64 %58, 5000000030
  %45 = add nsw i64 %43, -10000000061
  %spec.select = select i1 %44, i64 %45, i64 %43
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %._crit_edge, %37
  %46 = phi i64 [ 0, %37 ], [ %spec.select, %._crit_edge ]
  %47 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %.03248, i64 noundef %46)
  br label %59

.lr.ph46:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %48 = phi i64 [ %.pre, %.lr.ph46.preheader ], [ %51, %.lr.ph46 ]
  %indvars.iv56 = phi i64 [ 1, %.lr.ph46.preheader ], [ %indvars.iv.next57, %.lr.ph46 ]
  %.03144 = phi i64 [ 0, %.lr.ph46.preheader ], [ %58, %.lr.ph46 ]
  %49 = sext i64 %.03144 to i128
  %50 = getelementptr inbounds [4358 x [40 x i64]], ptr @f, i64 0, i64 %39, i64 %indvars.iv56
  %51 = load i64, ptr %50, align 8, !tbaa !9
  %52 = sext i64 %51 to i128
  %53 = add nsw i64 %48, %51
  %54 = sext i64 %53 to i128
  %55 = mul nsw i128 %54, %52
  %.fr65 = freeze i128 %55
  %56 = add i128 %.fr65, %49
  %57 = srem i128 %56, 10000000061
  %58 = trunc nsw i128 %57 to i64
  %indvars.iv.next57 = add nuw nsw i64 %indvars.iv56, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next57, %wide.trip.count
  br i1 %exitcond59.not, label %._crit_edge, label %.lr.ph46, !llvm.loop !18

59:                                               ; preds = %._crit_edge.thread, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %60 = add nuw nsw i32 %.03248, 1
  %61 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03248, %61
  br i1 %.not.not, label %.lr.ph50, label %._crit_edge51, !llvm.loop !19
}

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

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

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


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