; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/199 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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair" = type { i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@f = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@cur = external dso_local global i32, align 4
@inc = external dso_local global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@c = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 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 %"struct.std::pair", align 4
  %4 = alloca %"struct.std::pair.0", align 4
  %5 = alloca { i64, i32 }, align 8
  store i32 0, ptr %1, align 4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @s, ptr noundef @f)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %17, %0
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = load i32, ptr @m, align 4, !tbaa !5
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %13, label %12

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

13:                                               ; preds = %8
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @a, ptr noundef @b, ptr noundef @d)
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  %15 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @b, ptr noundef nonnull align 4 dereferenceable(4) @d)
  store i64 %15, ptr %4, align 4
  %16 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(8) %4)
  store { i64, i32 } %16, ptr %5, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 8 %5, i64 12, i1 false)
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @c, ptr noundef nonnull align 4 dereferenceable(12) %3)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #7
  br label %17

17:                                               ; preds = %13
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !9

20:                                               ; preds = %12
  store i32 0, ptr @cur, align 4, !tbaa !5
  store i32 1, ptr @cnt, align 4, !tbaa !5
  %21 = load i32, ptr @s, align 4, !tbaa !5
  %22 = load i32, ptr @f, align 4, !tbaa !5
  %23 = icmp slt i32 %21, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %20
  store i32 1, ptr @inc, align 4, !tbaa !5
  br label %26

25:                                               ; preds = %20
  store i32 -1, ptr @inc, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %25, %24
  br label %27

27:                                               ; preds = %126, %26
  %28 = load i32, ptr @s, align 4, !tbaa !5
  %29 = load i32, ptr @f, align 4, !tbaa !5
  %30 = icmp ne i32 %28, %29
  br i1 %30, label %31, label %127

31:                                               ; preds = %27
  %32 = load i32, ptr @cur, align 4, !tbaa !5
  %33 = load i32, ptr @m, align 4, !tbaa !5
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %59

35:                                               ; preds = %31
  %36 = load i32, ptr @cnt, align 4, !tbaa !5
  %37 = load i32, ptr @cur, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %38) #7
  %40 = getelementptr inbounds %"struct.std::pair", ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = icmp slt i32 %36, %41
  br i1 %42, label %43, label %59

43:                                               ; preds = %35
  %44 = load i32, ptr @inc, align 4, !tbaa !5
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %52

46:                                               ; preds = %43
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %48 = load i32, ptr @s, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr @s, align 4, !tbaa !5
  %50 = load i32, ptr @cnt, align 4, !tbaa !5
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr @cnt, align 4, !tbaa !5
  br label %58

52:                                               ; preds = %43
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %54 = load i32, ptr @s, align 4, !tbaa !5
  %55 = add nsw i32 %54, -1
  store i32 %55, ptr @s, align 4, !tbaa !5
  %56 = load i32, ptr @cnt, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr @cnt, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %52, %46
  br label %126

59:                                               ; preds = %35, %31
  %60 = load i32, ptr @cur, align 4, !tbaa !5
  %61 = load i32, ptr @m, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %63, label %107

63:                                               ; preds = %59
  %64 = load i32, ptr @cur, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %65) #7
  %67 = getelementptr inbounds %"struct.std::pair", ptr %66, i32 0, i32 1
  %68 = getelementptr inbounds %"struct.std::pair.0", ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 4, !tbaa !14
  %70 = load i32, ptr @s, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %72, label %81

72:                                               ; preds = %63
  %73 = load i32, ptr @s, align 4, !tbaa !5
  %74 = load i32, ptr @cur, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %75) #7
  %77 = getelementptr inbounds %"struct.std::pair", ptr %76, i32 0, i32 1
  %78 = getelementptr inbounds %"struct.std::pair.0", ptr %77, i32 0, i32 1
  %79 = load i32, ptr %78, align 4, !tbaa !15
  %80 = icmp sle i32 %73, %79
  br i1 %80, label %103, label %81

81:                                               ; preds = %72, %63
  %82 = load i32, ptr @cur, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %83) #7
  %85 = getelementptr inbounds %"struct.std::pair", ptr %84, i32 0, i32 1
  %86 = getelementptr inbounds %"struct.std::pair.0", ptr %85, i32 0, i32 0
  %87 = load i32, ptr %86, align 4, !tbaa !14
  %88 = load i32, ptr @s, align 4, !tbaa !5
  %89 = load i32, ptr @inc, align 4, !tbaa !5
  %90 = add nsw i32 %88, %89
  %91 = icmp sle i32 %87, %90
  br i1 %91, label %92, label %107

92:                                               ; preds = %81
  %93 = load i32, ptr @s, align 4, !tbaa !5
  %94 = load i32, ptr @inc, align 4, !tbaa !5
  %95 = add nsw i32 %93, %94
  %96 = load i32, ptr @cur, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %97) #7
  %99 = getelementptr inbounds %"struct.std::pair", ptr %98, i32 0, i32 1
  %100 = getelementptr inbounds %"struct.std::pair.0", ptr %99, i32 0, i32 1
  %101 = load i32, ptr %100, align 4, !tbaa !15
  %102 = icmp sle i32 %95, %101
  br i1 %102, label %103, label %107

103:                                              ; preds = %92, %72
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %105 = load i32, ptr @cnt, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @cnt, align 4, !tbaa !5
  br label %123

107:                                              ; preds = %92, %81, %59
  %108 = load i32, ptr @inc, align 4, !tbaa !5
  %109 = icmp eq i32 %108, 1
  br i1 %109, label %110, label %116

110:                                              ; preds = %107
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %112 = load i32, ptr @s, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr @s, align 4, !tbaa !5
  %114 = load i32, ptr @cnt, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr @cnt, align 4, !tbaa !5
  br label %122

116:                                              ; preds = %107
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %118 = load i32, ptr @s, align 4, !tbaa !5
  %119 = add nsw i32 %118, -1
  store i32 %119, ptr @s, align 4, !tbaa !5
  %120 = load i32, ptr @cnt, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr @cnt, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %116, %110
  br label %123

123:                                              ; preds = %122, %103
  %124 = load i32, ptr @cur, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr @cur, align 4, !tbaa !5
  br label %126

126:                                              ; preds = %123, %58
  br label %27, !llvm.loop !16

127:                                              ; preds = %27
  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 void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) #3 align 2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; 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 nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #6

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 = { 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 #7 = { 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 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !13, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!12, !6, i64 4}
!15 = !{!12, !6, i64 8}
!16 = distinct !{!16, !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"

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<int, std::pair<int, int>>, std::allocator<std::pair<int, std::pair<int, int>>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair" = type { i32, %"struct.std::pair.0" }
%"struct.std::pair.0" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@f = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@cur = external dso_local local_unnamed_addr global i32, align 4
@inc = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global i32, align 4
@b = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@c = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca %"struct.std::pair.0", align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull @f)
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 8
  br label %10

._crit_edge:                                      ; preds = %10, %0
  store i32 0, ptr @cur, align 4, !tbaa !5
  store i32 1, ptr @cnt, align 4, !tbaa !5
  %7 = load i32, ptr @s, align 4, !tbaa !5
  %8 = load i32, ptr @f, align 4, !tbaa !5
  %9 = icmp slt i32 %7, %8
  %. = select i1 %9, i32 1, i32 -1
  store i32 %., ptr @inc, align 4, !tbaa !5
  %.not11 = icmp eq i32 %7, %8
  br i1 %.not11, label %._crit_edge14, label %.lr.ph13

10:                                               ; preds = %.lr.ph, %10
  %.010 = phi i32 [ 0, %.lr.ph ], [ %14, %10 ]
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @d)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %12 = call i64 @_ZSt9make_pairIRiS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(4) @b, ptr noundef nonnull align 4 dereferenceable(4) @d)
  store i64 %12, ptr %2, align 8
  %13 = call { i64, i32 } @_ZSt9make_pairIRiSt4pairIiiEES1_INSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS3_INS4_IT0_E4typeEE6__typeEEOS5_OSA_(ptr noundef nonnull align 4 dereferenceable(4) @a, ptr noundef nonnull align 4 dereferenceable(8) %2)
  %.fca.0.extract = extractvalue { i64, i32 } %13, 0
  %.fca.1.extract = extractvalue { i64, i32 } %13, 1
  store i64 %.fca.0.extract, ptr %1, align 8
  store i32 %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  call void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24) @c, ptr noundef nonnull align 4 dereferenceable(12) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #6
  %14 = add nuw nsw i32 %.010, 1
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %10, label %._crit_edge, !llvm.loop !9

.lr.ph13:                                         ; preds = %._crit_edge, %95
  %17 = phi i32 [ %97, %95 ], [ 1, %._crit_edge ]
  %18 = load i32, ptr @cur, align 4, !tbaa !5
  %19 = load i32, ptr @m, align 4, !tbaa !5
  %20 = icmp slt i32 %18, %19
  br i1 %20, label %21, label %41

21:                                               ; preds = %.lr.ph13
  %22 = sext i32 %18 to i64
  %23 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %22) #6
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = icmp slt i32 %17, %24
  br i1 %25, label %26, label %._crit_edge15

._crit_edge15:                                    ; preds = %21
  %.pre = load i32, ptr @cur, align 4, !tbaa !5
  %.pre16 = load i32, ptr @m, align 4, !tbaa !5
  br label %41

26:                                               ; preds = %21
  %27 = load i32, ptr @inc, align 4, !tbaa !5
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %29, label %35

29:                                               ; preds = %26
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %31 = load i32, ptr @s, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr @s, align 4, !tbaa !5
  %33 = load i32, ptr @cnt, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr @cnt, align 4, !tbaa !5
  br label %95

35:                                               ; preds = %26
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  %37 = load i32, ptr @s, align 4, !tbaa !5
  %38 = add nsw i32 %37, -1
  store i32 %38, ptr @s, align 4, !tbaa !5
  %39 = load i32, ptr @cnt, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr @cnt, align 4, !tbaa !5
  br label %95

41:                                               ; preds = %._crit_edge15, %.lr.ph13
  %42 = phi i32 [ %.pre16, %._crit_edge15 ], [ %19, %.lr.ph13 ]
  %43 = phi i32 [ %.pre, %._crit_edge15 ], [ %18, %.lr.ph13 ]
  %44 = icmp slt i32 %43, %42
  br i1 %44, label %45, label %thread-pre-split

45:                                               ; preds = %41
  %46 = sext i32 %43 to i64
  %47 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %46) #6
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !14
  %50 = load i32, ptr @s, align 4, !tbaa !5
  %.not6 = icmp sgt i32 %49, %50
  br i1 %.not6, label %57, label %51

51:                                               ; preds = %45
  %52 = load i32, ptr @cur, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %53) #6
  %55 = getelementptr inbounds i8, ptr %54, i64 8
  %56 = load i32, ptr %55, align 4, !tbaa !15
  %.not7 = icmp sgt i32 %50, %56
  br i1 %.not7, label %57, label %72

57:                                               ; preds = %51, %45
  %58 = load i32, ptr @cur, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %59) #6
  %61 = getelementptr inbounds i8, ptr %60, i64 4
  %62 = load i32, ptr %61, align 4, !tbaa !14
  %63 = load i32, ptr @s, align 4, !tbaa !5
  %64 = load i32, ptr @inc, align 4, !tbaa !5
  %65 = add nsw i32 %64, %63
  %.not8 = icmp sgt i32 %62, %65
  br i1 %.not8, label %76, label %66

66:                                               ; preds = %57
  %67 = load i32, ptr @cur, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = call noundef nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @c, i64 noundef %68) #6
  %70 = getelementptr inbounds i8, ptr %69, i64 8
  %71 = load i32, ptr %70, align 4, !tbaa !15
  %.not9 = icmp sgt i32 %65, %71
  br i1 %.not9, label %thread-pre-split, label %72

72:                                               ; preds = %66, %51
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
  %74 = load i32, ptr @cnt, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr @cnt, align 4, !tbaa !5
  %.pre17.pre = load i32, ptr @s, align 4, !tbaa !5
  br label %91

thread-pre-split:                                 ; preds = %41, %66
  %.pr = load i32, ptr @inc, align 4, !tbaa !5
  br label %76

76:                                               ; preds = %thread-pre-split, %57
  %77 = phi i32 [ %.pr, %thread-pre-split ], [ %64, %57 ]
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %85

79:                                               ; preds = %76
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.3)
  %81 = load i32, ptr @s, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr @s, align 4, !tbaa !5
  %83 = load i32, ptr @cnt, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr @cnt, align 4, !tbaa !5
  br label %91

85:                                               ; preds = %76
  %86 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.4)
  %87 = load i32, ptr @s, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr @s, align 4, !tbaa !5
  %89 = load i32, ptr @cnt, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @cnt, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %79, %85, %72
  %.pre17 = phi i32 [ %82, %79 ], [ %88, %85 ], [ %.pre17.pre, %72 ]
  %92 = phi i32 [ %84, %79 ], [ %90, %85 ], [ %75, %72 ]
  %93 = load i32, ptr @cur, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr @cur, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %29, %35, %91
  %96 = phi i32 [ %32, %29 ], [ %38, %35 ], [ %.pre17, %91 ]
  %97 = phi i32 [ %34, %29 ], [ %40, %35 ], [ %92, %91 ]
  %98 = load i32, ptr @f, align 4, !tbaa !5
  %.not = icmp eq i32 %96, %98
  br i1 %.not, label %._crit_edge14, label %.lr.ph13, !llvm.loop !16

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

; 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 void @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EE9push_backEOS2_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #3 align 2

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

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

; 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 nonnull align 4 dereferenceable(12) ptr @_ZNSt6vectorISt4pairIiS0_IiiEESaIS2_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

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

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 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSSt4pairIiS_IiiEE", !6, i64 0, !13, i64 4}
!13 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!14 = !{!12, !6, i64 4}
!15 = !{!12, !6, i64 8}
!16 = distinct !{!16, !10}


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