; LLVM IR from tangjz/acm-icpc :: codeforces/complete (1351C)

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

@pat = external dso_local global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3seq = external hidden global [100001 x %"struct.std::pair"], align 16
@_ZZ4mainE3buf = external hidden global [100001 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL2dt = external hidden constant [4 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [4 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 i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair", align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %110, %0
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp sle i32 %18, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @_ZZ4mainE3buf)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  br label %24

24:                                               ; preds = %86, %22
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !9
  %29 = icmp ne i8 %28, 0
  br i1 %29, label %31, label %30

30:                                               ; preds = %24
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %91

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

32:                                               ; preds = %81, %31
  %33 = load ptr, ptr @pat, align 8, !tbaa !10
  %34 = load i32, ptr %11, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i8, ptr %33, i64 %35
  %37 = load i8, ptr %36, align 1, !tbaa !9
  %38 = icmp ne i8 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %32
  store i32 8, ptr %4, align 4
  br label %84

40:                                               ; preds = %32
  %41 = load i32, ptr %6, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !9
  %45 = sext i8 %44 to i32
  %46 = load ptr, ptr @pat, align 8, !tbaa !10
  %47 = load i32, ptr %11, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i8, ptr %46, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !9
  %51 = sext i8 %50 to i32
  %52 = icmp eq i32 %45, %51
  br i1 %52, label %53, label %80

53:                                               ; preds = %40
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = load i32, ptr %11, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL2dt, i64 0, i64 %56
  %58 = getelementptr inbounds [2 x i32], ptr %57, i64 0, i64 0
  %59 = load i32, ptr %58, align 8, !tbaa !5
  %60 = add nsw i32 %54, %59
  store i32 %60, ptr %9, align 4, !tbaa !5
  %61 = load i32, ptr %8, align 4, !tbaa !5
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL2dt, i64 0, i64 %63
  %65 = getelementptr inbounds [2 x i32], ptr %64, i64 0, i64 1
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %61, %66
  store i32 %67, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = add nsw i32 %68, %69
  store i32 %70, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %71 = load i32, ptr %8, align 4, !tbaa !5
  %72 = load i32, ptr %10, align 4, !tbaa !5
  %73 = add nsw i32 %71, %72
  store i32 %73, ptr %14, align 4, !tbaa !5
  %74 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %14)
  store i64 %74, ptr %12, align 4
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !5
  %77 = sext i32 %75 to i64
  %78 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ4mainE3seq, i64 0, i64 %77
  %79 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %78, ptr noundef nonnull align 4 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  store i32 8, ptr %4, align 4
  br label %84

80:                                               ; preds = %40
  br label %81

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

84:                                               ; preds = %53, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %6, align 4, !tbaa !5
  %89 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %89, ptr %7, align 4, !tbaa !5
  %90 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %90, ptr %8, align 4, !tbaa !5
  br label %24, !llvm.loop !14

91:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %92 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %92, ptr %15, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds %"struct.std::pair", ptr @_ZZ4mainE3seq, i64 %94
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef @_ZZ4mainE3seq, ptr noundef %95)
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %"struct.std::pair", ptr @_ZZ4mainE3seq, i64 %97
  %99 = call noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef @_ZZ4mainE3seq, ptr noundef %98)
  %100 = ptrtoint ptr %99 to i64
  %101 = sub i64 %100, ptrtoint (ptr @_ZZ4mainE3seq to i64)
  %102 = sdiv exact i64 %101, 8
  %103 = shl i64 %102, 2
  %104 = load i32, ptr %15, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = add nsw i64 %105, %103
  %107 = trunc i64 %106 to i32
  store i32 %107, ptr %15, align 4, !tbaa !5
  %108 = load i32, ptr %15, align 4, !tbaa !5
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %108)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %110

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

113:                                              ; preds = %21
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %114 = load i32, ptr %1, align 4
  ret i32 %114
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef, ptr noundef) #5

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

@pat = external dso_local local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZZ4mainE3seq = external hidden global [100001 x %"struct.std::pair"], align 16
@_ZZ4mainE3buf = external hidden global [100001 x i8], align 16
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZL2dt = external hidden local_unnamed_addr constant [4 x [2 x i32]], align 16
@.str.3 = external hidden unnamed_addr constant [4 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 i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 1, ptr %1, align 4, !tbaa !5
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %6 = load i32, ptr %1, align 4, !tbaa !5
  %.not52 = icmp slt i32 %6, 1
  br i1 %.not52, label %._crit_edge58, label %.lr.ph57

._crit_edge58:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph57:                                         ; preds = %0, %._crit_edge
  %.02555 = phi i32 [ %.1.lcssa, %._crit_edge ], [ undef, %0 ]
  %.02654 = phi i32 [ %.127.lcssa, %._crit_edge ], [ undef, %0 ]
  %.03453 = phi i32 [ %24, %._crit_edge ], [ 1, %0 ]
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @_ZZ4mainE3buf)
  %8 = load i8, ptr @_ZZ4mainE3buf, align 16, !tbaa !9
  %.not3641 = icmp eq i8 %8, 0
  br i1 %.not3641, label %._crit_edge, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %.lr.ph57
  %9 = load ptr, ptr @pat, align 8, !tbaa !10
  %10 = load i8, ptr %9, align 1, !tbaa !9
  %11 = icmp eq i8 %10, 0
  br i1 %11, label %._crit_edge, label %.preheader

.preheader:                                       ; preds = %.preheader.lr.ph, %.loopexit
  %12 = phi ptr [ %45, %.loopexit ], [ %9, %.preheader.lr.ph ]
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.loopexit ], [ 0, %.preheader.lr.ph ]
  %13 = phi i8 [ %47, %.loopexit ], [ %8, %.preheader.lr.ph ]
  %.147 = phi i32 [ %.2, %.loopexit ], [ %.02555, %.preheader.lr.ph ]
  %.12746 = phi i32 [ %.228, %.loopexit ], [ %.02654, %.preheader.lr.ph ]
  %.02945 = phi i32 [ %.2, %.loopexit ], [ 0, %.preheader.lr.ph ]
  %.03044 = phi i32 [ %.228, %.loopexit ], [ 0, %.preheader.lr.ph ]
  %.03242 = phi i32 [ %.133, %.loopexit ], [ 0, %.preheader.lr.ph ]
  %14 = load i8, ptr %12, align 1, !tbaa !9
  %.not3739 = icmp eq i8 %14, 0
  br i1 %.not3739, label %.loopexit, label %.lr.ph

._crit_edge:                                      ; preds = %.loopexit, %.preheader.lr.ph, %.lr.ph57
  %.032.lcssa = phi i32 [ 0, %.lr.ph57 ], [ 0, %.preheader.lr.ph ], [ %.133, %.loopexit ]
  %.127.lcssa = phi i32 [ %.02654, %.lr.ph57 ], [ %.02654, %.preheader.lr.ph ], [ %.228, %.loopexit ]
  %.1.lcssa = phi i32 [ %.02555, %.lr.ph57 ], [ %.02555, %.preheader.lr.ph ], [ %.2, %.loopexit ]
  %15 = sext i32 %.032.lcssa to i64
  %16 = getelementptr inbounds %"struct.std::pair", ptr @_ZZ4mainE3seq, i64 %15
  call void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef nonnull @_ZZ4mainE3seq, ptr noundef nonnull %16)
  %17 = call noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef nonnull @_ZZ4mainE3seq, ptr noundef nonnull %16)
  %18 = ptrtoint ptr %17 to i64
  %19 = sub i64 %18, ptrtoint (ptr @_ZZ4mainE3seq to i64)
  %20 = lshr exact i64 %19, 1
  %21 = trunc i64 %20 to i32
  %22 = add i32 %.032.lcssa, %21
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
  %24 = add nuw nsw i32 %.03453, 1
  %25 = load i32, ptr %1, align 4, !tbaa !5
  %.not.not = icmp slt i32 %.03453, %25
  br i1 %.not.not, label %.lr.ph57, label %._crit_edge58, !llvm.loop !12

26:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = getelementptr inbounds i8, ptr %12, i64 %indvars.iv.next
  %28 = load i8, ptr %27, align 1, !tbaa !9
  %.not37 = icmp eq i8 %28, 0
  br i1 %.not37, label %.loopexit, label %.lr.ph, !llvm.loop !14

.lr.ph:                                           ; preds = %.preheader, %26
  %indvars.iv = phi i64 [ %indvars.iv.next, %26 ], [ 0, %.preheader ]
  %29 = phi i8 [ %28, %26 ], [ %14, %.preheader ]
  %30 = icmp eq i8 %13, %29
  br i1 %30, label %31, label %26

31:                                               ; preds = %.lr.ph
  %32 = getelementptr inbounds [4 x [2 x i32]], ptr @_ZL2dt, i64 0, i64 %indvars.iv
  %33 = load i32, ptr %32, align 8, !tbaa !5
  %34 = add nsw i32 %33, %.03044
  %35 = getelementptr inbounds i8, ptr %32, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = add nsw i32 %36, %.02945
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %38 = add nsw i32 %34, %.03044
  store i32 %38, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %39 = add nsw i32 %37, %.02945
  store i32 %39, ptr %4, align 4, !tbaa !5
  %40 = call i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %4)
  store i64 %40, ptr %2, align 8
  %41 = add nsw i32 %.03242, 1
  %42 = sext i32 %.03242 to i64
  %43 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @_ZZ4mainE3seq, i64 0, i64 %42
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8) %43, ptr noundef nonnull align 4 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre = load ptr, ptr @pat, align 8, !tbaa !10
  br label %.loopexit

.loopexit:                                        ; preds = %26, %.preheader, %31
  %45 = phi ptr [ %.pre, %31 ], [ %12, %.preheader ], [ %12, %26 ]
  %.133 = phi i32 [ %41, %31 ], [ %.03242, %.preheader ], [ %.03242, %26 ]
  %.228 = phi i32 [ %34, %31 ], [ %.12746, %.preheader ], [ %.12746, %26 ]
  %.2 = phi i32 [ %37, %31 ], [ %.147, %.preheader ], [ %.147, %26 ]
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %46 = getelementptr inbounds [100001 x i8], ptr @_ZZ4mainE3buf, i64 0, i64 %indvars.iv.next62
  %47 = load i8, ptr %46, align 1, !tbaa !9
  %.not36 = icmp eq i8 %47, 0
  br i1 %.not36, label %._crit_edge, label %.preheader, !llvm.loop !15
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIiiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS1_INS2_IT0_E4typeEE6__typeEEOS3_OS8_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt4pairIiiEaSEOS0_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(8)) 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) #1

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPSt4pairIiiEEvT_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt6uniqueIPSt4pairIiiEET_S3_S3_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13, !16}
!16 = !{!"llvm.loop.unswitch.partial.disable"}


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