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

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

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@top = external dso_local global i32, align 4
@ans = external dso_local global i64, align 8
@s = external dso_local global [15 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 uwtable
declare dso_local noundef i64 @_Z3gcdxx(i64 noundef, i64 noundef) #0

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

13:                                               ; preds = %118, %0
  %14 = load i32, ptr @t, align 4, !tbaa !5
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr @t, align 4, !tbaa !5
  %16 = icmp ne i32 %14, 0
  br i1 %16, label %17, label %121

17:                                               ; preds = %13
  store i32 0, ptr @top, align 4, !tbaa !5
  store i64 0, ptr @ans, align 8, !tbaa !9
  %18 = 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 %19

19:                                               ; preds = %115, %17
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr @n, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

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

24:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  call void @_ZNSt4pairIixEC2IRixTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %26 = load i32, ptr @top, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @top, align 4, !tbaa !5
  %28 = sext i32 %26 to i64
  %29 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt4pairIixEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 8 dereferenceable(16) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %48, %24
  %32 = load i32, ptr %7, align 4, !tbaa !5
  %33 = load i32, ptr @top, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

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

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

48:                                               ; preds = %36
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %7, align 4, !tbaa !5
  br label %31, !llvm.loop !13

51:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, 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 %52

52:                                               ; preds = %83, %51
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = load i32, ptr @top, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %73

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

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

82:                                               ; preds = %73, %60
  br label %83

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

86:                                               ; preds = %56
  %87 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %87, ptr @top, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %88

88:                                               ; preds = %111, %86
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = load i32, ptr @top, align 4, !tbaa !5
  %91 = icmp slt i32 %89, %90
  br i1 %91, label %93, label %92

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

93:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = load i32, ptr %10, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %96
  %98 = getelementptr inbounds %"struct.std::pair", ptr %97, i32 0, i32 0
  %99 = load i32, ptr %98, align 16, !tbaa !16
  %100 = sub nsw i32 %94, %99
  %101 = add nsw i32 %100, 1
  %102 = sext i32 %101 to i64
  %103 = load i32, ptr %10, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %104
  %106 = getelementptr inbounds %"struct.std::pair", ptr %105, i32 0, i32 1
  %107 = load i64, ptr %106, align 8, !tbaa !11
  %108 = mul nsw i64 %102, %107
  store i64 %108, ptr %11, align 8, !tbaa !9
  %109 = 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) %11)
  %110 = load i64, ptr %109, align 8, !tbaa !9
  store i64 %110, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %111

111:                                              ; preds = %93
  %112 = load i32, ptr %10, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %10, align 4, !tbaa !5
  br label %88, !llvm.loop !17

114:                                              ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %115

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

118:                                              ; preds = %23
  %119 = load i64, ptr @ans, align 8, !tbaa !9
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %119)
  br label %13, !llvm.loop !19

121:                                              ; preds = %13
  ret i32 0
}

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

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

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

; 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) #3

; 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, ...) #2

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 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 #2 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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}
!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.std::pair" = type { i32, i64 }

@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@top = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local global i64, align 8
@s = external dso_local global [15 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 uwtable
declare dso_local noundef i64 @_Z3gcdxx(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %7 = load i32, ptr @t, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @t, align 4, !tbaa !5
  %.not34 = icmp eq i32 %7, 0
  br i1 %.not34, label %._crit_edge37, label %.lr.ph36

.lr.ph36:                                         ; preds = %0, %._crit_edge33
  store i32 0, ptr @top, align 4, !tbaa !5
  store i64 0, ptr @ans, align 8, !tbaa !9
  %9 = 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
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not1930 = icmp slt i32 %10, 1
  br i1 %.not1930, label %._crit_edge33, label %.lr.ph32

._crit_edge33:                                    ; preds = %._crit_edge29, %.lr.ph36
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %11 = load i64, ptr @ans, align 8, !tbaa !9
  %12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %11)
  %13 = load i32, ptr @t, align 4, !tbaa !5
  %14 = add nsw i32 %13, -1
  store i32 %14, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %13, 0
  br i1 %.not, label %._crit_edge37, label %.lr.ph36, !llvm.loop !11

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

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

24:                                               ; preds = %.preheader
  %25 = 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
  %26 = icmp sgt i32 %.pre, 1
  br i1 %26, label %.lr.ph25.peel.next, label %._crit_edge.thread50

._crit_edge.thread50:                             ; preds = %24
  store i32 1, ptr @top, align 4, !tbaa !5
  br label %.lr.ph28.preheader

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

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

._crit_edge:                                      ; preds = %47
  store i32 %.1, ptr @top, align 4, !tbaa !5
  %34 = icmp sgt i32 %.1, 0
  br i1 %34, label %.lr.ph28.preheader, label %._crit_edge29

.lr.ph28.preheader:                               ; preds = %._crit_edge.thread50, %._crit_edge
  br label %.lr.ph28

.lr.ph25.peel.next:                               ; preds = %24, %47
  %35 = phi i32 [ %48, %47 ], [ %.pre, %24 ]
  %indvars.iv39 = phi i64 [ %indvars.iv.next40, %47 ], [ 1, %24 ]
  %.01723 = phi i32 [ %.1, %47 ], [ 1, %24 ]
  %36 = add nsw i64 %indvars.iv39, -1
  %37 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %36, i32 1
  %38 = load i64, ptr %37, align 8, !tbaa !13
  %39 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv39, i32 1
  %40 = load i64, ptr %39, align 8, !tbaa !13
  %.not21 = icmp eq i64 %38, %40
  br i1 %.not21, label %47, label %41

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

47:                                               ; preds = %.lr.ph25.peel.next, %41
  %48 = phi i32 [ %.pre48, %41 ], [ %35, %.lr.ph25.peel.next ]
  %.1 = phi i32 [ %43, %41 ], [ %.01723, %.lr.ph25.peel.next ]
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %49 = sext i32 %48 to i64
  %50 = icmp slt i64 %indvars.iv.next40, %49
  br i1 %50, label %.lr.ph25.peel.next, label %._crit_edge, !llvm.loop !16

._crit_edge29:                                    ; preds = %.lr.ph28, %._crit_edge.thread, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %51 = load i32, ptr %1, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %1, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %.not19.not = icmp slt i32 %51, %53
  br i1 %.not19.not, label %.lr.ph32, label %._crit_edge33, !llvm.loop !18

.lr.ph28:                                         ; preds = %.lr.ph28.preheader, %.lr.ph28
  %indvars.iv43 = phi i64 [ %indvars.iv.next44, %.lr.ph28 ], [ 0, %.lr.ph28.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %54 = load i32, ptr %1, align 4, !tbaa !5
  %55 = getelementptr inbounds [15 x %"struct.std::pair"], ptr @s, i64 0, i64 %indvars.iv43
  %56 = load i32, ptr %55, align 16, !tbaa !19
  %57 = add i32 %54, 1
  %58 = sub i32 %57, %56
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds i8, ptr %55, i64 8
  %61 = load i64, ptr %60, align 8, !tbaa !13
  %62 = mul nsw i64 %61, %59
  store i64 %62, ptr %5, align 8, !tbaa !9
  %63 = 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) %5)
  %64 = load i64, ptr %63, align 8, !tbaa !9
  store i64 %64, ptr @ans, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %indvars.iv.next44 = add nuw nsw i64 %indvars.iv43, 1
  %65 = load i32, ptr @top, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next44, %66
  br i1 %67, label %.lr.ph28, label %._crit_edge29, !llvm.loop !20

._crit_edge37:                                    ; preds = %._crit_edge33, %0
  ret i32 0
}

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

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

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

; 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) #3

; 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 #2

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 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 #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" }
attributes #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 8}
!14 = !{!"_ZTSSt4pairIixE", !6, i64 0, !10, i64 8}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !12}
!19 = !{!14, !6, i64 0}
!20 = distinct !{!20, !12}


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