; LLVM IR from tangjz/acm-icpc :: codeforces/complete (924D)

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

@seq = external dso_local global [100001 x %struct.Fraction], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@seg = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7bit_addii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7bit_sumi(i32 noundef) #0

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

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

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

15:                                               ; preds = %80, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = icmp slt i32 %22, 0
  br i1 %23, label %24, label %49

24:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %25 = getelementptr inbounds %struct.Fraction, ptr %6, i32 0, i32 0
  %26 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %26, ptr %25, align 4, !tbaa !9
  %27 = getelementptr inbounds %struct.Fraction, ptr %6, i32 0, i32 1
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = sub nsw i32 0, %28
  %30 = load i32, ptr @m, align 4, !tbaa !5
  %31 = add nsw i32 %29, %30
  store i32 %31, ptr %27, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %32 = getelementptr inbounds %struct.Fraction, ptr %7, i32 0, i32 0
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = sub nsw i32 0, %33
  store i32 %34, ptr %32, align 4, !tbaa !9
  %35 = getelementptr inbounds %struct.Fraction, ptr %7, i32 0, i32 1
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sub nsw i32 0, %36
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sub nsw i32 %37, %38
  store i32 %39, ptr %35, align 4, !tbaa !11
  %40 = call { i64, i64 } @_ZSt9make_pairI8FractionS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
  %41 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  %42 = extractvalue { i64, i64 } %40, 0
  store i64 %42, ptr %41, align 4
  %43 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  %44 = extractvalue { i64, i64 } %40, 1
  store i64 %44, ptr %43, align 4
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %46
  %48 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt4pairI8FractionS0_EaSEOS1_(ptr noundef nonnull align 4 dereferenceable(16) %47, ptr noundef nonnull align 4 dereferenceable(16) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  br label %72

49:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %50 = getelementptr inbounds %struct.Fraction, ptr %9, i32 0, i32 0
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sub nsw i32 0, %51
  store i32 %52, ptr %50, align 4, !tbaa !9
  %53 = getelementptr inbounds %struct.Fraction, ptr %9, i32 0, i32 1
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr @m, align 4, !tbaa !5
  %56 = sub nsw i32 %54, %55
  store i32 %56, ptr %53, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %57 = getelementptr inbounds %struct.Fraction, ptr %10, i32 0, i32 0
  %58 = load i32, ptr %3, align 4, !tbaa !5
  store i32 %58, ptr %57, align 4, !tbaa !9
  %59 = getelementptr inbounds %struct.Fraction, ptr %10, i32 0, i32 1
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = load i32, ptr @m, align 4, !tbaa !5
  %62 = add nsw i32 %60, %61
  store i32 %62, ptr %59, align 4, !tbaa !11
  %63 = call { i64, i64 } @_ZSt9make_pairI8FractionS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 4 dereferenceable(8) %10)
  %64 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 0
  %65 = extractvalue { i64, i64 } %63, 0
  store i64 %65, ptr %64, align 4
  %66 = getelementptr inbounds { i64, i64 }, ptr %8, i32 0, i32 1
  %67 = extractvalue { i64, i64 } %63, 1
  store i64 %67, ptr %66, align 4
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %69
  %71 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt4pairI8FractionS0_EaSEOS1_(ptr noundef nonnull align 4 dereferenceable(16) %70, ptr noundef nonnull align 4 dereferenceable(16) %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  br label %72

72:                                               ; preds = %49, %24
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %74
  %76 = getelementptr inbounds %"struct.std::pair", ptr %75, i32 0, i32 1
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100001 x %struct.Fraction], ptr @seq, i64 0, i64 %78
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %79, ptr align 8 %76, i64 8, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %80

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

83:                                               ; preds = %19
  %84 = load i32, ptr @n, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds %"struct.std::pair", ptr @seg, i64 %85
  call void @_ZSt4sortIPSt4pairI8FractionS1_EEvT_S4_(ptr noundef @seg, ptr noundef %86)
  %87 = load i32, ptr @n, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %88
  call void @_ZSt4sortIP8FractionEvT_S2_(ptr noundef @seq, ptr noundef %89)
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %91
  %93 = call noundef ptr @_ZSt6uniqueIP8FractionET_S2_S2_(ptr noundef @seq, ptr noundef %92)
  %94 = ptrtoint ptr %93 to i64
  %95 = sub i64 %94, ptrtoint (ptr @seq to i64)
  %96 = sdiv exact i64 %95, 8
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 0, ptr %11, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %123, %83
  %99 = load i32, ptr %12, align 4, !tbaa !5
  %100 = load i32, ptr @n, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %103, label %102

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

103:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %104 = load i32, ptr @m, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %105
  %107 = load i32, ptr %12, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %108
  %110 = getelementptr inbounds %"struct.std::pair", ptr %109, i32 0, i32 1
  %111 = call noundef ptr @_ZSt11lower_boundIP8FractionS0_ET_S2_S2_RKT0_(ptr noundef @seq, ptr noundef %106, ptr noundef nonnull align 4 dereferenceable(8) %110)
  %112 = ptrtoint ptr %111 to i64
  %113 = sub i64 %112, ptrtoint (ptr @seq to i64)
  %114 = sdiv exact i64 %113, 8
  %115 = add nsw i64 %114, 1
  %116 = trunc i64 %115 to i32
  store i32 %116, ptr %13, align 4, !tbaa !5
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = call noundef i32 @_Z7bit_sumi(i32 noundef %117)
  %119 = sext i32 %118 to i64
  %120 = load i64, ptr %11, align 8, !tbaa !15
  %121 = add nsw i64 %120, %119
  store i64 %121, ptr %11, align 8, !tbaa !15
  %122 = load i32, ptr %13, align 4, !tbaa !5
  call void @_Z7bit_addii(i32 noundef %122, i32 noundef 1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %123

123:                                              ; preds = %103
  %124 = load i32, ptr %12, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %12, align 4, !tbaa !5
  br label %98, !llvm.loop !17

126:                                              ; preds = %102
  %127 = load i64, ptr %11, align 8, !tbaa !15
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %127)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret i32 0
}

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

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS8Fraction", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = distinct !{!17, !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.Fraction = type { i32, i32 }
%"struct.std::pair" = type { %struct.Fraction, %struct.Fraction }

@seq = external dso_local global [100001 x %struct.Fraction], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@seg = external dso_local global [100001 x %"struct.std::pair"], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z7bit_addii(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7bit_sumi(i32 noundef) local_unnamed_addr #0

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

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

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

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %10 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %0
  %12 = getelementptr inbounds i8, ptr %7, i64 4
  %13 = getelementptr inbounds i8, ptr %8, i64 4
  %14 = getelementptr inbounds i8, ptr %6, i64 8
  %15 = getelementptr inbounds i8, ptr %4, i64 4
  %16 = getelementptr inbounds i8, ptr %5, i64 4
  %17 = getelementptr inbounds i8, ptr %3, i64 8
  br label %32

._crit_edge:                                      ; preds = %59, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %64, %59 ]
  %18 = getelementptr inbounds %"struct.std::pair", ptr @seg, i64 %.pre-phi
  call void @_ZSt4sortIPSt4pairI8FractionS1_EEvT_S4_(ptr noundef nonnull @seg, ptr noundef nonnull %18)
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %20
  call void @_ZSt4sortIP8FractionEvT_S2_(ptr noundef nonnull @seq, ptr noundef nonnull %21)
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %23
  %25 = call noundef ptr @_ZSt6uniqueIP8FractionET_S2_S2_(ptr noundef nonnull @seq, ptr noundef nonnull %24)
  %26 = ptrtoint ptr %25 to i64
  %27 = sub i64 %26, ptrtoint (ptr @seq to i64)
  %28 = lshr exact i64 %27, 3
  %29 = trunc i64 %28 to i32
  store i32 %29, ptr @m, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp sgt i32 %30, 0
  br i1 %31, label %.lr.ph20, label %._crit_edge21

32:                                               ; preds = %.lr.ph, %59
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %59 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = icmp slt i32 %34, 0
  br i1 %35, label %36, label %48

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %37 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %37, ptr %4, align 4, !tbaa !9
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sub i32 %38, %34
  store i32 %39, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %40 = sub nsw i32 0, %37
  store i32 %40, ptr %5, align 4, !tbaa !9
  %41 = add i32 %34, %38
  %42 = sub i32 0, %41
  store i32 %42, ptr %16, align 4, !tbaa !11
  %43 = call { i64, i64 } @_ZSt9make_pairI8FractionS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(8) %5)
  %44 = extractvalue { i64, i64 } %43, 0
  store i64 %44, ptr %3, align 8
  %45 = extractvalue { i64, i64 } %43, 1
  store i64 %45, ptr %17, align 8
  %46 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv
  %47 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt4pairI8FractionS0_EaSEOS1_(ptr noundef nonnull align 4 dereferenceable(16) %46, ptr noundef nonnull align 4 dereferenceable(16) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #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
  br label %59

48:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %49 = load i32, ptr %1, align 4, !tbaa !5
  %50 = sub nsw i32 0, %49
  store i32 %50, ptr %7, align 4, !tbaa !9
  %51 = load i32, ptr @m, align 4, !tbaa !5
  %52 = sub nsw i32 %34, %51
  store i32 %52, ptr %12, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  store i32 %49, ptr %8, align 4, !tbaa !9
  %53 = add nsw i32 %51, %34
  store i32 %53, ptr %13, align 4, !tbaa !11
  %54 = call { i64, i64 } @_ZSt9make_pairI8FractionS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 4 dereferenceable(8) %7, ptr noundef nonnull align 4 dereferenceable(8) %8)
  %55 = extractvalue { i64, i64 } %54, 0
  store i64 %55, ptr %6, align 8
  %56 = extractvalue { i64, i64 } %54, 1
  store i64 %56, ptr %14, align 8
  %57 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv
  %58 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZNSt4pairI8FractionS0_EaSEOS1_(ptr noundef nonnull align 4 dereferenceable(16) %57, ptr noundef nonnull align 4 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #6
  br label %59

59:                                               ; preds = %48, %36
  %60 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv, i32 1
  %61 = getelementptr inbounds [100001 x %struct.Fraction], ptr @seq, i64 0, i64 %indvars.iv
  %62 = load i64, ptr %60, align 8
  store i64 %62, ptr %61, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = icmp slt i64 %indvars.iv.next, %64
  br i1 %65, label %32, label %._crit_edge, !llvm.loop !12

._crit_edge21:                                    ; preds = %.lr.ph20, %._crit_edge
  %.014.lcssa = phi i64 [ 0, %._crit_edge ], [ %79, %.lr.ph20 ]
  %66 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %.014.lcssa)
  ret i32 0

.lr.ph20:                                         ; preds = %._crit_edge, %.lr.ph20
  %indvars.iv26 = phi i64 [ %indvars.iv.next27, %.lr.ph20 ], [ 0, %._crit_edge ]
  %.01417 = phi i64 [ %79, %.lr.ph20 ], [ 0, %._crit_edge ]
  %67 = load i32, ptr @m, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %struct.Fraction, ptr @seq, i64 %68
  %70 = getelementptr inbounds [100001 x %"struct.std::pair"], ptr @seg, i64 0, i64 %indvars.iv26, i32 1
  %71 = call noundef ptr @_ZSt11lower_boundIP8FractionS0_ET_S2_S2_RKT0_(ptr noundef nonnull @seq, ptr noundef nonnull %69, ptr noundef nonnull align 4 dereferenceable(8) %70)
  %72 = ptrtoint ptr %71 to i64
  %73 = sub i64 %72, ptrtoint (ptr @seq to i64)
  %74 = lshr exact i64 %73, 3
  %75 = trunc i64 %74 to i32
  %76 = add i32 %75, 1
  %77 = call noundef i32 @_Z7bit_sumi(i32 noundef %76)
  %78 = sext i32 %77 to i64
  %79 = add nsw i64 %.01417, %78
  call void @_Z7bit_addii(i32 noundef %76, i32 noundef 1)
  %indvars.iv.next27 = add nuw nsw i64 %indvars.iv26, 1
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next27, %81
  br i1 %82, label %.lr.ph20, label %._crit_edge21, !llvm.loop !14
}

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 = { 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 = !{!10, !6, i64 0}
!10 = !{!"_ZTS8Fraction", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}


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