; LLVM IR from tangjz/acm-icpc :: lydsy (4488)

; 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.std::pair" = type { i32, i64 }

@n = external dso_local global i32, align 4
@top = external dso_local global i32, align 4
@x = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@s = external dso_local global [41 x %"struct.std::pair"], 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 [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %113, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @n, align 4, !tbaa !5
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @x)
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !9
  %19 = call { i32, i64 } @_ZSt9make_pairIRixESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %20 = getelementptr inbounds { i32, i64 }, ptr %4, i32 0, i32 0
  %21 = extractvalue { i32, i64 } %19, 0
  store i32 %21, ptr %20, align 8
  %22 = getelementptr inbounds { i32, i64 }, ptr %4, i32 0, i32 1
  %23 = extractvalue { i32, i64 } %19, 1
  store i64 %23, ptr %22, align 8
  %24 = load i32, ptr @top, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr @top, align 4, !tbaa !5
  %26 = sext i32 %24 to i64
  %27 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %26
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(16) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %46, %17
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = load i32, ptr @top, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %49

34:                                               ; preds = %29
  %35 = load i64, ptr @x, align 8, !tbaa !9
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %37
  %39 = getelementptr inbounds %"struct.std::pair", ptr %38, i32 0, i32 1
  %40 = load i64, ptr %39, align 8, !tbaa !11
  %41 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %35, i64 noundef %40)
  %42 = load i32, ptr %6, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %43
  %45 = getelementptr inbounds %"struct.std::pair", ptr %44, i32 0, i32 1
  store i64 %41, ptr %45, align 8, !tbaa !11
  br label %46

46:                                               ; preds = %34
  %47 = load i32, ptr %6, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %6, align 4, !tbaa !5
  br label %29, !llvm.loop !13

49:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %81, %49
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = load i32, ptr @top, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

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

55:                                               ; preds = %50
  %56 = load i32, ptr %8, align 4, !tbaa !5
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %71

58:                                               ; preds = %55
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %61
  %63 = getelementptr inbounds %"struct.std::pair", ptr %62, i32 0, i32 1
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = load i32, ptr %8, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %66
  %68 = getelementptr inbounds %"struct.std::pair", ptr %67, i32 0, i32 1
  %69 = load i64, ptr %68, align 8, !tbaa !11
  %70 = icmp ne i64 %64, %69
  br i1 %70, label %71, label %80

71:                                               ; preds = %58, %55
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %73
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %75 to i64
  %78 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %77
  %79 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %78, ptr noundef nonnull align 8 dereferenceable(16) %74)
  br label %80

80:                                               ; preds = %71, %58
  br label %81

81:                                               ; preds = %80
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = add nsw i32 %82, 1
  store i32 %83, ptr %8, align 4, !tbaa !5
  br label %50, !llvm.loop !15

84:                                               ; preds = %54
  %85 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %85, ptr @top, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %109, %84
  %87 = load i32, ptr %9, align 4, !tbaa !5
  %88 = load i32, ptr @top, align 4, !tbaa !5
  %89 = icmp slt i32 %87, %88
  br i1 %89, label %91, label %90

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

91:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %92 = load i32, ptr %2, align 4, !tbaa !5
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %94
  %96 = getelementptr inbounds %"struct.std::pair", ptr %95, i32 0, i32 0
  %97 = load i32, ptr %96, align 16, !tbaa !16
  %98 = sub nsw i32 %92, %97
  %99 = add nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = load i32, ptr %9, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %102
  %104 = getelementptr inbounds %"struct.std::pair", ptr %103, i32 0, i32 1
  %105 = load i64, ptr %104, align 8, !tbaa !11
  %106 = mul nsw i64 %100, %105
  store i64 %106, ptr %10, align 8, !tbaa !9
  %107 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %108 = load i64, ptr %107, align 8, !tbaa !9
  store i64 %108, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %109

109:                                              ; preds = %91
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  store i32 %111, ptr %9, align 4, !tbaa !5
  br label %86, !llvm.loop !17

112:                                              ; preds = %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %2, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !18

116:                                              ; preds = %16
  %117 = load i64, ptr @ans, align 8, !tbaa !9
  %118 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %117)
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i32, i64 } @_ZSt9make_pairIRixESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

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

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

@n = external dso_local global i32, align 4
@top = external dso_local local_unnamed_addr global i32, align 4
@x = external dso_local global i64, align 8
@ans = external dso_local global i64, align 8
@s = external dso_local global [41 x %"struct.std::pair"], 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 [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::pair", align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not29 = icmp slt i32 %6, 1
  br i1 %.not29, label %._crit_edge32, label %.lr.ph31

.lr.ph31:                                         ; preds = %0
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  br label %10

._crit_edge32:                                    ; preds = %._crit_edge28, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %8 = load i64, ptr @ans, align 8, !tbaa !9
  %9 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %8)
  ret i32 0

10:                                               ; preds = %.lr.ph31, %._crit_edge28
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  store i64 0, ptr %3, align 8, !tbaa !9
  %12 = call { i32, i64 } @_ZSt9make_pairIRixESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %13 = extractvalue { i32, i64 } %12, 0
  store i32 %13, ptr %2, align 8
  %14 = extractvalue { i32, i64 } %12, 1
  store i64 %14, ptr %7, align 8
  %15 = load i32, ptr @top, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr @top, align 4, !tbaa !5
  %17 = sext i32 %15 to i64
  %18 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(16) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  %20 = load i32, ptr @top, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge.thread

.preheader:                                       ; preds = %.lr.ph
  %22 = icmp sgt i32 %30, 0
  br i1 %22, label %23, label %._crit_edge.thread

23:                                               ; preds = %.preheader
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(16) @s, ptr noundef nonnull align 8 dereferenceable(16) @s)
  %.pre = load i32, ptr @top, align 4, !tbaa !5
  %25 = icmp sgt i32 %.pre, 1
  br i1 %25, label %.lr.ph24.peel.next, label %._crit_edge.thread45

._crit_edge.thread45:                             ; preds = %23
  store i32 1, ptr @top, align 4, !tbaa !5
  br label %.lr.ph27.preheader

.lr.ph:                                           ; preds = %10, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %10 ]
  %26 = load i64, ptr @x, align 8, !tbaa !9
  %27 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv, i32 1
  %28 = load i64, ptr %27, align 8, !tbaa !11
  %29 = call noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef %26, i64 noundef %28)
  store i64 %29, ptr %27, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = load i32, ptr @top, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = icmp slt i64 %indvars.iv.next, %31
  br i1 %32, label %.lr.ph, label %.preheader, !llvm.loop !13

._crit_edge.thread:                               ; preds = %.preheader, %10
  store i32 0, ptr @top, align 4, !tbaa !5
  br label %._crit_edge28

._crit_edge:                                      ; preds = %46
  store i32 %.1, ptr @top, align 4, !tbaa !5
  %33 = icmp sgt i32 %.1, 0
  br i1 %33, label %.lr.ph27.preheader, label %._crit_edge28

.lr.ph27.preheader:                               ; preds = %._crit_edge.thread45, %._crit_edge
  br label %.lr.ph27

.lr.ph24.peel.next:                               ; preds = %23, %46
  %34 = phi i32 [ %47, %46 ], [ %.pre, %23 ]
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %46 ], [ 1, %23 ]
  %.01722 = phi i32 [ %.1, %46 ], [ 1, %23 ]
  %35 = add nsw i64 %indvars.iv34, -1
  %36 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %35, i32 1
  %37 = load i64, ptr %36, align 8, !tbaa !11
  %38 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv34, i32 1
  %39 = load i64, ptr %38, align 8, !tbaa !11
  %.not20 = icmp eq i64 %37, %39
  br i1 %.not20, label %46, label %40

40:                                               ; preds = %.lr.ph24.peel.next
  %41 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv34
  %42 = add nsw i32 %.01722, 1
  %43 = sext i32 %.01722 to i64
  %44 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %43
  %45 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(16) %44, ptr noundef nonnull align 8 dereferenceable(16) %41)
  %.pre43 = load i32, ptr @top, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %.lr.ph24.peel.next, %40
  %47 = phi i32 [ %.pre43, %40 ], [ %34, %.lr.ph24.peel.next ]
  %.1 = phi i32 [ %42, %40 ], [ %.01722, %.lr.ph24.peel.next ]
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %48 = sext i32 %47 to i64
  %49 = icmp slt i64 %indvars.iv.next35, %48
  br i1 %49, label %.lr.ph24.peel.next, label %._crit_edge, !llvm.loop !15

._crit_edge28:                                    ; preds = %.lr.ph27, %._crit_edge.thread, %._crit_edge
  %50 = load i32, ptr %1, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %1, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %.not.not = icmp slt i32 %50, %52
  br i1 %.not.not, label %10, label %._crit_edge32, !llvm.loop !17

.lr.ph27:                                         ; preds = %.lr.ph27.preheader, %.lr.ph27
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %.lr.ph27 ], [ 0, %.lr.ph27.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = getelementptr inbounds [41 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv38
  %55 = load i32, ptr %54, align 16, !tbaa !18
  %56 = add i32 %53, 1
  %57 = sub i32 %56, %55
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %54, i64 8
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = mul nsw i64 %60, %58
  store i64 %61, ptr %4, align 8, !tbaa !9
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %63 = load i64, ptr %62, align 8, !tbaa !9
  store i64 %63, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %64 = load i32, ptr @top, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = icmp slt i64 %indvars.iv.next39, %65
  br i1 %66, label %.lr.ph27, label %._crit_edge28, !llvm.loop !19
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { i32, i64 } @_ZSt9make_pairIRixESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt5__gcdIxET_S0_S0_(i64 noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSERKS0_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

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

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


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