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

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

@fact = external dso_local global [1000003 x i32], align 16
@iact = external dso_local global [1000003 x i32], align 16
@f = external dso_local global [1000003 x i32], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5solveiii(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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z1Cii(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
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = icmp sgt i32 %13, %14
  br i1 %15, label %16, label %17

16:                                               ; preds = %0
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #5
  br label %17

17:                                               ; preds = %16, %0
  store i32 1, ptr getelementptr inbounds ([1000003 x i32], ptr @iact, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %41, %17
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = add nsw i32 %20, 1
  %22 = icmp sle i32 %19, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %44

24:                                               ; preds = %18
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = sdiv i32 1000000007, %25
  %27 = sext i32 %26 to i64
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = srem i32 1000000007, %28
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = mul nsw i64 %27, %33
  %35 = srem i64 %34, 1000000007
  %36 = sub nsw i64 1000000007, %35
  %37 = trunc i64 %36 to i32
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %39
  store i32 %37, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %24
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %5, align 4, !tbaa !5
  br label %18, !llvm.loop !9

44:                                               ; preds = %23
  store i32 1, ptr @iact, align 16, !tbaa !5
  store i32 1, ptr @fact, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %83, %44
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  %49 = icmp sle i32 %46, %48
  br i1 %49, label %51, label %50

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

51:                                               ; preds = %45
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1000003 x i32], ptr @fact, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = mul nsw i64 %57, %59
  %61 = srem i64 %60, 1000000007
  %62 = trunc i64 %61 to i32
  %63 = load i32, ptr %6, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [1000003 x i32], ptr @fact, i64 0, i64 %64
  store i32 %62, ptr %65, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sub nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = load i32, ptr %6, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = mul nsw i64 %71, %76
  %78 = srem i64 %77, 1000000007
  %79 = trunc i64 %78 to i32
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %81
  store i32 %79, ptr %82, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %51
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %6, align 4, !tbaa !5
  br label %45, !llvm.loop !11

86:                                               ; preds = %50
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %87 = load i32, ptr %4, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  store i32 %88, ptr %7, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %104, %86
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  %93 = icmp sle i32 %90, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %107

95:                                               ; preds = %89
  %96 = load i32, ptr %7, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 2
  %100 = call noundef i32 @_Z1Cii(i32 noundef %97, i32 noundef %99)
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %95
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %7, align 4, !tbaa !5
  br label %89, !llvm.loop !12

107:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %108 = load i32, ptr %4, align 4, !tbaa !5
  %109 = sub nsw i32 %108, 1
  store i32 %109, ptr %8, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %149, %107
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = load i32, ptr %2, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  %114 = icmp sle i32 %111, %113
  br i1 %114, label %116, label %115

115:                                              ; preds = %110
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %152

116:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %117 = load i32, ptr %8, align 4, !tbaa !5
  %118 = load i32, ptr %8, align 4, !tbaa !5
  %119 = add nsw i32 %117, %118
  store i32 %119, ptr %10, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %144, %116
  %121 = load i32, ptr %10, align 4, !tbaa !5
  %122 = load i32, ptr %2, align 4, !tbaa !5
  %123 = add nsw i32 %122, 1
  %124 = icmp sle i32 %121, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %120
  store i32 14, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %148

126:                                              ; preds = %120
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = load i32, ptr %10, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sub nsw i32 %134, %130
  store i32 %135, ptr %133, align 4, !tbaa !5
  %136 = icmp slt i32 %135, 0
  br i1 %136, label %137, label %143

137:                                              ; preds = %126
  %138 = load i32, ptr %10, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1000000007
  store i32 %142, ptr %140, align 4, !tbaa !5
  br label %143

143:                                              ; preds = %137, %126
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = load i32, ptr %10, align 4, !tbaa !5
  %147 = add nsw i32 %146, %145
  store i32 %147, ptr %10, align 4, !tbaa !5
  br label %120, !llvm.loop !13

148:                                              ; preds = %125
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %8, align 4, !tbaa !5
  br label %110, !llvm.loop !14

152:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %153 = load i32, ptr %2, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  %155 = load i32, ptr %3, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  %157 = load i32, ptr %4, align 4, !tbaa !5
  %158 = call noundef i32 @_Z5solveiii(i32 noundef %154, i32 noundef %156, i32 noundef %157)
  %159 = load i32, ptr %2, align 4, !tbaa !5
  %160 = sub nsw i32 %159, 1
  %161 = load i32, ptr %3, align 4, !tbaa !5
  %162 = sub nsw i32 %161, 1
  %163 = load i32, ptr %4, align 4, !tbaa !5
  %164 = call noundef i32 @_Z5solveiii(i32 noundef %160, i32 noundef %162, i32 noundef %163)
  %165 = sub nsw i32 %158, %164
  store i32 %165, ptr %11, align 4, !tbaa !5
  %166 = load i32, ptr %11, align 4, !tbaa !5
  %167 = icmp slt i32 %166, 0
  br i1 %167, label %168, label %171

168:                                              ; preds = %152
  %169 = load i32, ptr %11, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1000000007
  store i32 %170, ptr %11, align 4, !tbaa !5
  br label %171

171:                                              ; preds = %168, %152
  %172 = load i32, ptr %11, align 4, !tbaa !5
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %172)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %174 = load i32, ptr %1, align 4
  ret i32 %174
}

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

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

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

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 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 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 = { 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}


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

@fact = external dso_local local_unnamed_addr global [1000003 x i32], align 16
@iact = external dso_local local_unnamed_addr global [1000003 x i32], align 16
@f = external dso_local local_unnamed_addr global [1000003 x i32], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5solveiii(i32 noundef, i32 noundef, i32 noundef) 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z1Cii(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp sgt i32 %5, %6
  br i1 %7, label %8, label %9

8:                                                ; preds = %0
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) #5
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %8, %0
  %10 = phi i32 [ %.pre, %8 ], [ %6, %0 ]
  store i32 1, ptr getelementptr inbounds (i8, ptr @iact, i64 4), align 4, !tbaa !5
  %.not45 = icmp slt i32 %10, 1
  br i1 %.not45, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %9
  %11 = add nuw i32 %10, 2
  %wide.trip.count = zext i32 %11 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %9
  store i32 1, ptr @iact, align 16, !tbaa !5
  store i32 1, ptr @fact, align 16, !tbaa !5
  %.not3947 = icmp slt i32 %10, 0
  br i1 %.not3947, label %._crit_edge51, label %.lr.ph50.preheader

.lr.ph50.preheader:                               ; preds = %._crit_edge
  %12 = add nuw i32 %10, 2
  %wide.trip.count73 = zext i32 %12 to i64
  br label %.lr.ph50

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 2, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %13 = trunc nuw nsw i64 %indvars.iv to i32
  %14 = udiv i32 1000000007, %13
  %15 = zext nneg i32 %14 to i64
  %16 = urem i32 1000000007, %13
  %17 = zext nneg i32 %16 to i64
  %18 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %17
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = mul nsw i64 %20, %15
  %22 = srem i64 %21, 1000000007
  %23 = trunc nsw i64 %22 to i32
  %24 = sub nsw i32 1000000007, %23
  %25 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %indvars.iv
  store i32 %24, ptr %25, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond, label %._crit_edge, label %.lr.ph, !llvm.loop !9

._crit_edge51:                                    ; preds = %.lr.ph50, %._crit_edge
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = add nsw i32 %26, -1
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  %.not4052 = icmp sgt i32 %27, %29
  br i1 %.not4052, label %._crit_edge56, label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %._crit_edge51
  %30 = sext i32 %26 to i64
  %31 = add nsw i64 %30, -1
  br label %.lr.ph55

.lr.ph50:                                         ; preds = %.lr.ph50.preheader, %.lr.ph50
  %32 = phi i64 [ 1, %.lr.ph50.preheader ], [ %42, %.lr.ph50 ]
  %33 = phi i64 [ 1, %.lr.ph50.preheader ], [ %35, %.lr.ph50 ]
  %indvars.iv70 = phi i64 [ 1, %.lr.ph50.preheader ], [ %indvars.iv.next71, %.lr.ph50 ]
  %34 = mul nsw i64 %33, %indvars.iv70
  %35 = srem i64 %34, 1000000007
  %36 = trunc nsw i64 %35 to i32
  %37 = getelementptr inbounds [1000003 x i32], ptr @fact, i64 0, i64 %indvars.iv70
  store i32 %36, ptr %37, align 4, !tbaa !5
  %38 = getelementptr inbounds [1000003 x i32], ptr @iact, i64 0, i64 %indvars.iv70
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = mul nsw i64 %32, %40
  %42 = srem i64 %41, 1000000007
  %43 = trunc nsw i64 %42 to i32
  store i32 %43, ptr %38, align 4, !tbaa !5
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %exitcond74 = icmp eq i64 %indvars.iv.next71, %wide.trip.count73
  br i1 %exitcond74, label %._crit_edge51, label %.lr.ph50, !llvm.loop !11

._crit_edge56.loopexit:                           ; preds = %.lr.ph55
  %44 = add nsw i32 %58, 1
  %.pre87 = load i32, ptr %3, align 4, !tbaa !5
  %.pre88 = add nsw i32 %.pre87, -1
  br label %._crit_edge56

._crit_edge56:                                    ; preds = %._crit_edge56.loopexit, %._crit_edge51
  %.pre-phi = phi i32 [ %.pre88, %._crit_edge56.loopexit ], [ %27, %._crit_edge51 ]
  %45 = phi i32 [ %.pre87, %._crit_edge56.loopexit ], [ %26, %._crit_edge51 ]
  %.lcssa = phi i32 [ %44, %._crit_edge56.loopexit ], [ %29, %._crit_edge51 ]
  %.not4163 = icmp sgt i32 %.pre-phi, %.lcssa
  br i1 %.not4163, label %._crit_edge67, label %.lr.ph66.preheader

.lr.ph66.preheader:                               ; preds = %._crit_edge56
  %46 = shl i32 %45, 1
  %47 = add i32 %46, -2
  %48 = sext i32 %45 to i64
  %49 = add nsw i64 %48, -1
  %50 = sext i32 %.lcssa to i64
  %51 = add i32 %.lcssa, 1
  br label %.lr.ph66

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.lr.ph55
  %indvars.iv75 = phi i64 [ %31, %.lr.ph55.preheader ], [ %indvars.iv.next76, %.lr.ph55 ]
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = add nsw i32 %52, -2
  %54 = trunc i64 %indvars.iv75 to i32
  %55 = add i32 %54, -1
  %56 = call noundef i32 @_Z1Cii(i32 noundef %55, i32 noundef %53)
  %57 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %indvars.iv75
  store i32 %56, ptr %57, align 4, !tbaa !5
  %indvars.iv.next76 = add nsw i64 %indvars.iv75, 1
  %58 = load i32, ptr %1, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %.not40 = icmp sgt i64 %indvars.iv75, %59
  br i1 %.not40, label %._crit_edge56.loopexit, label %.lr.ph55, !llvm.loop !12

._crit_edge67:                                    ; preds = %._crit_edge62, %._crit_edge56
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = add nsw i32 %60, 1
  %62 = call noundef i32 @_Z5solveiii(i32 noundef %.lcssa, i32 noundef %61, i32 noundef %45)
  %63 = load i32, ptr %1, align 4, !tbaa !5
  %64 = add nsw i32 %63, -1
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = call noundef i32 @_Z5solveiii(i32 noundef %64, i32 noundef %66, i32 noundef %67)
  %69 = sub nsw i32 %62, %68
  %70 = icmp slt i32 %69, 0
  %71 = add nsw i32 %69, 1000000007
  %spec.select = select i1 %70, i32 %71, i32 %69
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %spec.select)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph66:                                         ; preds = %.lr.ph66.preheader, %._crit_edge62
  %indvars.iv80 = phi i64 [ %49, %.lr.ph66.preheader ], [ %indvars.iv.next81, %._crit_edge62 ]
  %indvars.iv78 = phi i32 [ %47, %.lr.ph66.preheader ], [ %indvars.iv.next79, %._crit_edge62 ]
  %73 = shl nsw i64 %indvars.iv80, 1
  %.not4258 = icmp sgt i64 %73, %50
  br i1 %.not4258, label %._crit_edge62, label %.lr.ph61

.lr.ph61:                                         ; preds = %.lr.ph66
  %74 = sext i32 %indvars.iv78 to i64
  %75 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %indvars.iv80
  br label %76

._crit_edge62:                                    ; preds = %76, %.lr.ph66
  %indvars.iv.next81 = add nsw i64 %indvars.iv80, 1
  %indvars.iv.next79 = add i32 %indvars.iv78, 2
  %lftr.wideiv = trunc i64 %indvars.iv.next81 to i32
  %exitcond86.not = icmp eq i32 %51, %lftr.wideiv
  br i1 %exitcond86.not, label %._crit_edge67, label %.lr.ph66, !llvm.loop !13

76:                                               ; preds = %.lr.ph61, %76
  %indvars.iv82 = phi i64 [ %74, %.lr.ph61 ], [ %indvars.iv.next83, %76 ]
  %77 = load i32, ptr %75, align 4, !tbaa !5
  %78 = getelementptr inbounds [1000003 x i32], ptr @f, i64 0, i64 %indvars.iv82
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = sub nsw i32 %79, %77
  %81 = icmp slt i32 %80, 0
  %82 = add nsw i32 %80, 1000000007
  %spec.select43 = select i1 %81, i32 %82, i32 %80
  store i32 %spec.select43, ptr %78, align 4, !tbaa !5
  %indvars.iv.next83 = add nsw i64 %indvars.iv82, %indvars.iv80
  %.not42 = icmp sgt i64 %indvars.iv.next83, %50
  br i1 %.not42, label %._crit_edge62, label %76, !llvm.loop !14
}

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

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

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

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 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 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 = { 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 #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}


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