; LLVM IR from tangjz/acm-icpc :: hdu (5527)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@t = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@c = external dso_local global [10 x i32], align 16
@sum = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@_ZL1w = external hidden constant [10 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z5solvei(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %4

4:                                                ; preds = %94, %0
  %5 = load i32, ptr @t, align 4, !tbaa !5
  %6 = add nsw i32 %5, -1
  store i32 %6, ptr @t, align 4, !tbaa !5
  %7 = icmp ne i32 %5, 0
  br i1 %7, label %8, label %95

8:                                                ; preds = %4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @p)
  store i32 0, ptr @sum, align 4, !tbaa !5
  %10 = load i32, ptr @p, align 4, !tbaa !5
  %11 = sub nsw i32 0, %10
  store i32 %11, ptr @p, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %38, %8
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = icmp slt i32 %13, 10
  br i1 %14, label %16, label %15

15:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %41

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds i32, ptr @c, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %19)
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10 x i32], ptr @c, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = load i32, ptr @sum, align 4, !tbaa !5
  %26 = add nsw i32 %25, %24
  store i32 %26, ptr @sum, align 4, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [10 x i32], ptr @c, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10 x i32], ptr @_ZL1w, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = mul nsw i32 %30, %34
  %36 = load i32, ptr @p, align 4, !tbaa !5
  %37 = add nsw i32 %36, %35
  store i32 %37, ptr @p, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %16
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

41:                                               ; preds = %15
  %42 = load i32, ptr @p, align 4, !tbaa !5
  %43 = call noundef i32 @_Z5solvei(i32 noundef %42)
  store i32 %43, ptr @ans, align 4, !tbaa !5
  %44 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 7), align 4, !tbaa !5
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %71

46:                                               ; preds = %41
  %47 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 7), align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  store i32 %48, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 7), align 4, !tbaa !5
  %49 = load i32, ptr @p, align 4, !tbaa !5
  %50 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @_ZL1w, i64 0, i64 7), align 4, !tbaa !5
  %51 = sub nsw i32 %49, %50
  %52 = call noundef i32 @_Z5solvei(i32 noundef %51)
  %53 = add nsw i32 %52, 1
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %53)
  %54 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %68

56:                                               ; preds = %46
  %57 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %58 = add nsw i32 %57, -1
  store i32 %58, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %59 = load i32, ptr @p, align 4, !tbaa !5
  %60 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @_ZL1w, i64 0, i64 7), align 4, !tbaa !5
  %61 = sub nsw i32 %59, %60
  %62 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @_ZL1w, i64 0, i64 4), align 16, !tbaa !5
  %63 = sub nsw i32 %61, %62
  %64 = call noundef i32 @_Z5solvei(i32 noundef %63)
  %65 = add nsw i32 %64, 2
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %65)
  %66 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  br label %68

68:                                               ; preds = %56, %46
  %69 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 7), align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 7), align 4, !tbaa !5
  br label %71

71:                                               ; preds = %68, %41
  %72 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %73 = icmp ne i32 %72, 0
  br i1 %73, label %74, label %84

74:                                               ; preds = %71
  %75 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %77 = load i32, ptr @p, align 4, !tbaa !5
  %78 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @_ZL1w, i64 0, i64 4), align 16, !tbaa !5
  %79 = sub nsw i32 %77, %78
  %80 = call noundef i32 @_Z5solvei(i32 noundef %79)
  %81 = add nsw i32 %80, 1
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %81)
  %82 = load i32, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr getelementptr inbounds ([10 x i32], ptr @c, i64 0, i64 4), align 16, !tbaa !5
  br label %84

84:                                               ; preds = %74, %71
  %85 = load i32, ptr @ans, align 4, !tbaa !5
  %86 = icmp eq i32 %85, 2000000
  br i1 %86, label %87, label %89

87:                                               ; preds = %84
  %88 = call i32 @puts(ptr noundef @.str.1)
  br label %94

89:                                               ; preds = %84
  %90 = load i32, ptr @sum, align 4, !tbaa !5
  %91 = load i32, ptr @ans, align 4, !tbaa !5
  %92 = sub nsw i32 %90, %91
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %92)
  br label %94

94:                                               ; preds = %89, %87
  br label %4, !llvm.loop !11

95:                                               ; preds = %4
  ret i32 0
}

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

declare i32 @puts(ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@t = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@c = external dso_local global [10 x i32], align 16
@sum = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local global i32, align 4
@_ZL1w = external hidden local_unnamed_addr constant [10 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %2 = load i32, ptr @t, align 4, !tbaa !5
  %3 = add nsw i32 %2, -1
  store i32 %3, ptr @t, align 4, !tbaa !5
  %.not16 = icmp eq i32 %2, 0
  br i1 %.not16, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 28), align 4
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 16), align 16
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 4), align 4, !tbaa !5
  %.pre18 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 8), align 8, !tbaa !5
  %.pre19 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 12), align 4, !tbaa !5
  %.pre20 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 20), align 4, !tbaa !5
  %.pre21 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 24), align 8, !tbaa !5
  %.pre22 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 32), align 16, !tbaa !5
  %.pre23 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL1w, i64 36), align 4, !tbaa !5
  %6 = load i32, ptr @_ZL1w, align 16
  %7 = add i32 %4, %5
  br label %8

8:                                                ; preds = %.lr.ph, %122
  %9 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @p)
  store i32 0, ptr @sum, align 4, !tbaa !5
  %10 = load i32, ptr @p, align 4, !tbaa !5
  %11 = sub nsw i32 0, %10
  store i32 %11, ptr @p, align 4, !tbaa !5
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @c)
  %13 = load i32, ptr @c, align 16, !tbaa !5
  %14 = load i32, ptr @sum, align 4, !tbaa !5
  %15 = add nsw i32 %14, %13
  store i32 %15, ptr @sum, align 4, !tbaa !5
  %16 = mul nsw i32 %6, %13
  %17 = load i32, ptr @p, align 4, !tbaa !5
  %18 = add nsw i32 %17, %16
  store i32 %18, ptr @p, align 4, !tbaa !5
  %19 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 4))
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 4), align 4, !tbaa !5
  %21 = load i32, ptr @sum, align 4, !tbaa !5
  %22 = add nsw i32 %21, %20
  store i32 %22, ptr @sum, align 4, !tbaa !5
  %23 = mul nsw i32 %.pre, %20
  %24 = load i32, ptr @p, align 4, !tbaa !5
  %25 = add nsw i32 %24, %23
  store i32 %25, ptr @p, align 4, !tbaa !5
  %26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 8))
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 8), align 8, !tbaa !5
  %28 = load i32, ptr @sum, align 4, !tbaa !5
  %29 = add nsw i32 %28, %27
  store i32 %29, ptr @sum, align 4, !tbaa !5
  %30 = mul nsw i32 %.pre18, %27
  %31 = load i32, ptr @p, align 4, !tbaa !5
  %32 = add nsw i32 %31, %30
  store i32 %32, ptr @p, align 4, !tbaa !5
  %33 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 12))
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 12), align 4, !tbaa !5
  %35 = load i32, ptr @sum, align 4, !tbaa !5
  %36 = add nsw i32 %35, %34
  store i32 %36, ptr @sum, align 4, !tbaa !5
  %37 = mul nsw i32 %.pre19, %34
  %38 = load i32, ptr @p, align 4, !tbaa !5
  %39 = add nsw i32 %38, %37
  store i32 %39, ptr @p, align 4, !tbaa !5
  %40 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 16))
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %42 = load i32, ptr @sum, align 4, !tbaa !5
  %43 = add nsw i32 %42, %41
  store i32 %43, ptr @sum, align 4, !tbaa !5
  %44 = mul nsw i32 %5, %41
  %45 = load i32, ptr @p, align 4, !tbaa !5
  %46 = add nsw i32 %45, %44
  store i32 %46, ptr @p, align 4, !tbaa !5
  %47 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 20))
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 20), align 4, !tbaa !5
  %49 = load i32, ptr @sum, align 4, !tbaa !5
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr @sum, align 4, !tbaa !5
  %51 = mul nsw i32 %.pre20, %48
  %52 = load i32, ptr @p, align 4, !tbaa !5
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr @p, align 4, !tbaa !5
  %54 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 24))
  %55 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 24), align 8, !tbaa !5
  %56 = load i32, ptr @sum, align 4, !tbaa !5
  %57 = add nsw i32 %56, %55
  store i32 %57, ptr @sum, align 4, !tbaa !5
  %58 = mul nsw i32 %.pre21, %55
  %59 = load i32, ptr @p, align 4, !tbaa !5
  %60 = add nsw i32 %59, %58
  store i32 %60, ptr @p, align 4, !tbaa !5
  %61 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 28))
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 28), align 4, !tbaa !5
  %63 = load i32, ptr @sum, align 4, !tbaa !5
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr @sum, align 4, !tbaa !5
  %65 = mul nsw i32 %4, %62
  %66 = load i32, ptr @p, align 4, !tbaa !5
  %67 = add nsw i32 %66, %65
  store i32 %67, ptr @p, align 4, !tbaa !5
  %68 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 32))
  %69 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 32), align 16, !tbaa !5
  %70 = load i32, ptr @sum, align 4, !tbaa !5
  %71 = add nsw i32 %70, %69
  store i32 %71, ptr @sum, align 4, !tbaa !5
  %72 = mul nsw i32 %.pre22, %69
  %73 = load i32, ptr @p, align 4, !tbaa !5
  %74 = add nsw i32 %73, %72
  store i32 %74, ptr @p, align 4, !tbaa !5
  %75 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @c, i64 36))
  %76 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 36), align 4, !tbaa !5
  %77 = load i32, ptr @sum, align 4, !tbaa !5
  %78 = add nsw i32 %77, %76
  store i32 %78, ptr @sum, align 4, !tbaa !5
  %79 = mul nsw i32 %.pre23, %76
  %80 = load i32, ptr @p, align 4, !tbaa !5
  %81 = add nsw i32 %80, %79
  store i32 %81, ptr @p, align 4, !tbaa !5
  %82 = tail call noundef i32 @_Z5solvei(i32 noundef %81)
  store i32 %82, ptr @ans, align 4, !tbaa !5
  %83 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 28), align 4, !tbaa !5
  %.not10 = icmp eq i32 %83, 0
  br i1 %.not10, label %._crit_edge24, label %84

._crit_edge24:                                    ; preds = %8
  %.pre25 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  br label %103

84:                                               ; preds = %8
  %85 = add nsw i32 %83, -1
  store i32 %85, ptr getelementptr inbounds (i8, ptr @c, i64 28), align 4, !tbaa !5
  %86 = load i32, ptr @p, align 4, !tbaa !5
  %87 = sub nsw i32 %86, %4
  %88 = tail call noundef i32 @_Z5solvei(i32 noundef %87)
  %89 = add nsw i32 %88, 1
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %89)
  %90 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %.not11 = icmp eq i32 %90, 0
  br i1 %.not11, label %99, label %91

91:                                               ; preds = %84
  %92 = add nsw i32 %90, -1
  store i32 %92, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %93 = load i32, ptr @p, align 4, !tbaa !5
  %94 = sub i32 %93, %7
  %95 = tail call noundef i32 @_Z5solvei(i32 noundef %94)
  %96 = add nsw i32 %95, 2
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %96)
  %97 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  br label %99

99:                                               ; preds = %91, %84
  %100 = phi i32 [ %98, %91 ], [ 0, %84 ]
  %101 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 28), align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr getelementptr inbounds (i8, ptr @c, i64 28), align 4, !tbaa !5
  br label %103

103:                                              ; preds = %._crit_edge24, %99
  %104 = phi i32 [ %.pre25, %._crit_edge24 ], [ %100, %99 ]
  %.not12 = icmp eq i32 %104, 0
  br i1 %.not12, label %113, label %105

105:                                              ; preds = %103
  %106 = add nsw i32 %104, -1
  store i32 %106, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %107 = load i32, ptr @p, align 4, !tbaa !5
  %108 = sub nsw i32 %107, %5
  %109 = tail call noundef i32 @_Z5solvei(i32 noundef %108)
  %110 = add nsw i32 %109, 1
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @ans, i32 noundef %110)
  %111 = load i32, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr getelementptr inbounds (i8, ptr @c, i64 16), align 16, !tbaa !5
  br label %113

113:                                              ; preds = %105, %103
  %114 = load i32, ptr @ans, align 4, !tbaa !5
  %115 = icmp eq i32 %114, 2000000
  br i1 %115, label %116, label %118

116:                                              ; preds = %113
  %117 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %122

118:                                              ; preds = %113
  %119 = load i32, ptr @sum, align 4, !tbaa !5
  %120 = sub nsw i32 %119, %114
  %121 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %120)
  br label %122

122:                                              ; preds = %118, %116
  %123 = load i32, ptr @t, align 4, !tbaa !5
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %123, 0
  br i1 %.not, label %._crit_edge, label %8, !llvm.loop !9

._crit_edge:                                      ; preds = %122, %0
  ret i32 0
}

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

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

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

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 norecurse 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 #2 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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"}


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