; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/268 Division 2/Problem B (B)

; 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, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@p = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@x = external dso_local global [1000 x %"struct.std::pair"], align 16
@z = external dso_local global [1000 x %"struct.std::pair"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @p)
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) @l)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 4 dereferenceable(4) @r)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

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

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

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %19
  %21 = getelementptr inbounds %"struct.std::pair", ptr %20, i32 0, i32 0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %23
  %25 = getelementptr inbounds %"struct.std::pair", ptr %24, i32 0, i32 1
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %21, ptr noundef %25)
  br label %27

27:                                               ; preds = %17
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

30:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %46, %30
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr @q, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %49

36:                                               ; preds = %31
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %38
  %40 = getelementptr inbounds %"struct.std::pair", ptr %39, i32 0, i32 0
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %42
  %44 = getelementptr inbounds %"struct.std::pair", ptr %43, i32 0, i32 1
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %40, ptr noundef %44)
  br label %46

46:                                               ; preds = %36
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !5
  br label %31, !llvm.loop !11

49:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %50 = load i32, ptr @l, align 4, !tbaa !5
  store i32 %50, ptr %4, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %111, %49
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load i32, ptr @r, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %114

56:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %107, %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr @q, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %62, label %61

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

62:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %102, %62
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = load i32, ptr @p, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %63
  store i32 14, ptr %5, align 4
  br label %105

68:                                               ; preds = %63
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %71
  %73 = getelementptr inbounds %"struct.std::pair", ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !12
  %75 = add nsw i32 %69, %74
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %77
  %79 = getelementptr inbounds %"struct.std::pair", ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !14
  %81 = icmp slt i32 %75, %80
  br i1 %81, label %96, label %82

82:                                               ; preds = %68
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %85
  %87 = getelementptr inbounds %"struct.std::pair", ptr %86, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !14
  %89 = add nsw i32 %83, %88
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %91
  %93 = getelementptr inbounds %"struct.std::pair", ptr %92, i32 0, i32 1
  %94 = load i32, ptr %93, align 4, !tbaa !12
  %95 = icmp sgt i32 %89, %94
  br i1 %95, label %96, label %97

96:                                               ; preds = %82, %68
  br label %102

97:                                               ; preds = %82
  %98 = load i32, ptr @cnt, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr @cnt, align 4, !tbaa !5
  %100 = load i32, ptr @p, align 4, !tbaa !5
  store i32 %100, ptr %7, align 4, !tbaa !5
  %101 = load i32, ptr @q, align 4, !tbaa !5
  store i32 %101, ptr %6, align 4, !tbaa !5
  store i32 14, ptr %5, align 4
  br label %105

102:                                              ; preds = %96
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %7, align 4, !tbaa !5
  br label %63, !llvm.loop !15

105:                                              ; preds = %97, %67
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %57, !llvm.loop !16

110:                                              ; preds = %61
  br label %111

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

114:                                              ; preds = %55
  %115 = load i32, ptr @cnt, align 4, !tbaa !5
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %115)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = !{!13, !6, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!13, !6, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !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"

%"struct.std::pair" = type { i32, i32 }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@p = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@x = external dso_local global [1000 x %"struct.std::pair"], align 16
@z = external dso_local global [1000 x %"struct.std::pair"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @p)
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @q)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @l)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @r)
  %5 = load i32, ptr @p, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader25

.preheader25:                                     ; preds = %.lr.ph, %0
  %7 = load i32, ptr @q, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph28, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %indvars.iv
  %10 = getelementptr inbounds i8, ptr %9, i64 4
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr @p, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = icmp slt i64 %indvars.iv.next, %13
  br i1 %14, label %.lr.ph, label %.preheader25, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph28, %.preheader25
  %.lcssa = phi i32 [ %7, %.preheader25 ], [ %49, %.lr.ph28 ]
  %15 = load i32, ptr @l, align 4, !tbaa !5
  %16 = load i32, ptr @r, align 4, !tbaa !5
  %cnt.promoted33 = load i32, ptr @cnt, align 4, !tbaa !5
  %.not35 = icmp sgt i32 %15, %16
  br i1 %.not35, label %._crit_edge38, label %.preheader24.lr.ph

.preheader24.lr.ph:                               ; preds = %._crit_edge
  %17 = icmp sgt i32 %.lcssa, 0
  %18 = load i32, ptr @p, align 4
  %19 = icmp sgt i32 %18, 0
  %or.cond = select i1 %17, i1 %19, i1 false
  br i1 %or.cond, label %.preheader24.us.us.preheader, label %._crit_edge38

.preheader24.us.us.preheader:                     ; preds = %.preheader24.lr.ph
  %wide.trip.count = zext nneg i32 %18 to i64
  br label %.preheader24.us.us

.preheader24.us.us:                               ; preds = %.preheader24.us.us.preheader, %._crit_edge32.split.us.us.us
  %.02136.us.us = phi i32 [ %45, %._crit_edge32.split.us.us.us ], [ %15, %.preheader24.us.us.preheader ]
  %20 = phi i32 [ %40, %._crit_edge32.split.us.us.us ], [ %cnt.promoted33, %.preheader24.us.us.preheader ]
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %..loopexit_crit_edge.us.us.us, %.preheader24.us.us
  %21 = phi i32 [ %20, %.preheader24.us.us ], [ %40, %..loopexit_crit_edge.us.us.us ]
  %.02031.us.us.us = phi i32 [ 0, %.preheader24.us.us ], [ %42, %..loopexit_crit_edge.us.us.us ]
  %22 = phi i32 [ %20, %.preheader24.us.us ], [ %41, %..loopexit_crit_edge.us.us.us ]
  %23 = sext i32 %.02031.us.us.us to i64
  %24 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %23
  %25 = getelementptr inbounds i8, ptr %24, i64 4
  %26 = load i32, ptr %25, align 4, !tbaa !11
  %27 = add nsw i32 %26, %.02136.us.us
  br label %28

28:                                               ; preds = %44, %.preheader.us.us.us
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %44 ], [ 0, %.preheader.us.us.us ]
  %29 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @z, i64 0, i64 %indvars.iv51
  %30 = load i32, ptr %29, align 8, !tbaa !13
  %31 = icmp slt i32 %27, %30
  br i1 %31, label %44, label %32

32:                                               ; preds = %28
  %33 = load i32, ptr %24, align 8, !tbaa !13
  %34 = add nsw i32 %33, %.02136.us.us
  %35 = getelementptr inbounds i8, ptr %29, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = icmp sgt i32 %34, %36
  br i1 %37, label %44, label %38

38:                                               ; preds = %32
  %39 = add nsw i32 %22, 1
  store i32 %39, ptr @cnt, align 4, !tbaa !5
  br label %..loopexit_crit_edge.us.us.us

..loopexit_crit_edge.us.us.us:                    ; preds = %44, %38
  %40 = phi i32 [ %39, %38 ], [ %21, %44 ]
  %41 = phi i32 [ %39, %38 ], [ %22, %44 ]
  %.1.us.us.us = phi i32 [ %.lcssa, %38 ], [ %.02031.us.us.us, %44 ]
  %42 = add nsw i32 %.1.us.us.us, 1
  %43 = icmp slt i32 %42, %.lcssa
  br i1 %43, label %.preheader.us.us.us, label %._crit_edge32.split.us.us.us, !llvm.loop !14

44:                                               ; preds = %32, %28
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next52, %wide.trip.count
  br i1 %exitcond.not, label %..loopexit_crit_edge.us.us.us, label %28, !llvm.loop !15

._crit_edge32.split.us.us.us:                     ; preds = %..loopexit_crit_edge.us.us.us
  %45 = add i32 %.02136.us.us, 1
  %exitcond54.not = icmp eq i32 %.02136.us.us, %16
  br i1 %exitcond54.not, label %._crit_edge38, label %.preheader24.us.us, !llvm.loop !16

.lr.ph28:                                         ; preds = %.preheader25, %.lr.ph28
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %.lr.ph28 ], [ 0, %.preheader25 ]
  %46 = getelementptr inbounds [1000 x %"struct.std::pair"], ptr @x, i64 0, i64 %indvars.iv48
  %47 = getelementptr inbounds i8, ptr %46, i64 4
  %48 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %46, ptr noundef nonnull %47)
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %49 = load i32, ptr @q, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next49, %50
  br i1 %51, label %.lr.ph28, label %._crit_edge, !llvm.loop !17

._crit_edge38:                                    ; preds = %._crit_edge32.split.us.us.us, %.preheader24.lr.ph, %._crit_edge
  %52 = phi i32 [ %cnt.promoted33, %._crit_edge ], [ %cnt.promoted33, %.preheader24.lr.ph ], [ %40, %._crit_edge32.split.us.us.us ]
  %53 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %52)
  %54 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #4

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 = { 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 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 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!12, !6, i64 4}
!12 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!13 = !{!12, !6, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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