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

; 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.Trapezoid = type { i32, i32, i32, i32 }
%struct.Info = type { i32, i32 }

@n = external dso_local global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@m = external dso_local global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x %struct.Trapezoid], align 16
@f = external dso_local global [100001 x %struct.Info], align 16
@g = external dso_local global [100001 x %struct.Info], align 16
@ans = external dso_local global %struct.Info, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 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
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

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

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %33

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %16
  call void @_ZN9Trapezoid4readEv(ptr noundef nonnull align 4 dereferenceable(16) %17)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %20
  store i32 %18, ptr %21, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.Trapezoid, ptr %24, i32 0, i32 3
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %28
  store i32 %26, ptr %29, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %14
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !11

33:                                               ; preds = %13
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds %struct.Trapezoid, ptr @a, i64 %35
  call void @_ZSt4sortIP9TrapezoidEvT_S2_(ptr noundef @a, ptr noundef %36)
  %37 = load i32, ptr @n, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds i32, ptr @ord, i64 %38
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @ord, ptr noundef %39, ptr noundef @_Z3cmpRKiS0_)
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds i32, ptr @que, i64 %41
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @que, ptr noundef %42)
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr @que, i64 %44
  %46 = call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef @que, ptr noundef %45)
  %47 = ptrtoint ptr %46 to i64
  %48 = sub i64 %47, ptrtoint (ptr @que to i64)
  %49 = sdiv exact i64 %48, 4
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr @m, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %162, %33
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %165

56:                                               ; preds = %51
  br label %57

57:                                               ; preds = %115, %56
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %61, label %76

61:                                               ; preds = %57
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %66
  %68 = getelementptr inbounds %struct.Trapezoid, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 4, !tbaa !13
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %71
  %73 = getelementptr inbounds %struct.Trapezoid, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 16, !tbaa !14
  %75 = icmp slt i32 %69, %74
  br label %76

76:                                               ; preds = %61, %57
  %77 = phi i1 [ false, %57 ], [ %75, %61 ]
  br i1 %77, label %78, label %118

78:                                               ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  store i32 %82, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %83 = load i32, ptr @m, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i32, ptr @que, i64 %84
  %86 = load i32, ptr %5, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %87
  %89 = getelementptr inbounds %struct.Trapezoid, ptr %88, i32 0, i32 3
  %90 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %85, ptr noundef nonnull align 4 dereferenceable(4) %89)
  %91 = ptrtoint ptr %90 to i64
  %92 = sub i64 %91, ptrtoint (ptr @que to i64)
  %93 = sdiv exact i64 %92, 4
  %94 = add nsw i64 %93, 1
  %95 = trunc i64 %94 to i32
  store i32 %95, ptr %6, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %107, %78
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = load i32, ptr @m, align 4, !tbaa !5
  %99 = icmp sle i32 %97, %98
  br i1 %99, label %100, label %114

100:                                              ; preds = %96
  %101 = load i32, ptr %6, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [100001 x %struct.Info], ptr @g, i64 0, i64 %102
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %105
  call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) %103, ptr noundef nonnull align 4 dereferenceable(8) %106)
  br label %107

107:                                              ; preds = %100
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = load i32, ptr %6, align 4, !tbaa !5
  %110 = sub nsw i32 0, %109
  %111 = and i32 %108, %110
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = add nsw i32 %112, %111
  store i32 %113, ptr %6, align 4, !tbaa !5
  br label %96, !llvm.loop !15

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

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

118:                                              ; preds = %76
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %119 = load i32, ptr @m, align 4, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr @que, i64 %120
  %122 = load i32, ptr %3, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %123
  %125 = getelementptr inbounds %struct.Trapezoid, ptr %124, i32 0, i32 2
  %126 = call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef @que, ptr noundef %121, ptr noundef nonnull align 4 dereferenceable(4) %125)
  %127 = ptrtoint ptr %126 to i64
  %128 = sub i64 %127, ptrtoint (ptr @que to i64)
  %129 = sdiv exact i64 %128, 4
  %130 = trunc i64 %129 to i32
  store i32 %130, ptr %7, align 4, !tbaa !5
  %131 = load i32, ptr %3, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %132
  %134 = getelementptr inbounds %struct.Info, ptr %133, i32 0, i32 1
  store i32 1, ptr %134, align 4, !tbaa !17
  br label %135

135:                                              ; preds = %145, %118
  %136 = load i32, ptr %7, align 4, !tbaa !5
  %137 = icmp sgt i32 %136, 0
  br i1 %137, label %138, label %152

138:                                              ; preds = %135
  %139 = load i32, ptr %3, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %140
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100001 x %struct.Info], ptr @g, i64 0, i64 %143
  call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) %141, ptr noundef nonnull align 4 dereferenceable(8) %144)
  br label %145

145:                                              ; preds = %138
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = sub nsw i32 0, %147
  %149 = and i32 %146, %148
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = sub nsw i32 %150, %149
  store i32 %151, ptr %7, align 4, !tbaa !5
  br label %135, !llvm.loop !19

152:                                              ; preds = %135
  %153 = load i32, ptr %3, align 4, !tbaa !5
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %154
  %156 = getelementptr inbounds %struct.Info, ptr %155, i32 0, i32 0
  %157 = load i32, ptr %156, align 8, !tbaa !20
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %156, align 8, !tbaa !20
  %159 = load i32, ptr %3, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %160
  call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %161)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %162

162:                                              ; preds = %152
  %163 = load i32, ptr %3, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %3, align 4, !tbaa !5
  br label %51, !llvm.loop !21

165:                                              ; preds = %55
  %166 = load i32, ptr @ans, align 4, !tbaa !20
  %167 = load i32, ptr getelementptr inbounds (%struct.Info, ptr @ans, i32 0, i32 1), align 4, !tbaa !17
  %168 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %166, i32 noundef %167)
  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 @_ZN9Trapezoid4readEv(ptr noundef nonnull align 4 dereferenceable(16)) #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #5

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

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

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

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

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 12}
!10 = !{!"_ZTS9Trapezoid", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 4}
!14 = !{!10, !6, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = !{!18, !6, i64 4}
!18 = !{!"_ZTS4Info", !6, i64 0, !6, i64 4}
!19 = distinct !{!19, !12}
!20 = !{!18, !6, i64 0}
!21 = distinct !{!21, !12}


; 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.Trapezoid = type { i32, i32, i32, i32 }
%struct.Info = type { i32, i32 }

@n = external dso_local global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@m = external dso_local local_unnamed_addr global i32, align 4
@que = external dso_local global [100001 x i32], align 16
@a = external dso_local global [100001 x %struct.Trapezoid], align 16
@f = external dso_local global [100001 x %struct.Info], align 16
@g = external dso_local global [100001 x %struct.Info], align 16
@ans = external dso_local global %struct.Info, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %.._crit_edge_crit_edge

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

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %28, %.lr.ph ]
  %4 = getelementptr inbounds %struct.Trapezoid, ptr @a, i64 %.pre-phi
  tail call void @_ZSt4sortIP9TrapezoidEvT_S2_(ptr noundef nonnull @a, ptr noundef nonnull %4)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = getelementptr inbounds i32, ptr @ord, i64 %6
  tail call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %7, ptr noundef nonnull @_Z3cmpRKiS0_)
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = getelementptr inbounds i32, ptr @que, i64 %9
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @que, ptr noundef nonnull %10)
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds i32, ptr @que, i64 %12
  %14 = tail call noundef ptr @_ZSt6uniqueIPiET_S1_S1_(ptr noundef nonnull @que, ptr noundef nonnull %13)
  %15 = ptrtoint ptr %14 to i64
  %16 = sub i64 %15, ptrtoint (ptr @que to i64)
  %17 = lshr exact i64 %16, 2
  %18 = trunc i64 %17 to i32
  store i32 %18, ptr @m, align 4, !tbaa !5
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.preheader, label %._crit_edge53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %21 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %indvars.iv
  tail call void @_ZN9Trapezoid4readEv(ptr noundef nonnull align 4 dereferenceable(16) %21)
  %22 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %23 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %23, ptr %22, align 4, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %21, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = getelementptr inbounds [100001 x i32], ptr @que, i64 0, i64 %indvars.iv
  store i32 %25, ptr %26, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %._crit_edge, %._crit_edge50
  %30 = phi i32 [ %86, %._crit_edge50 ], [ %19, %._crit_edge ]
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %._crit_edge50 ], [ 0, %._crit_edge ]
  %.03352 = phi i32 [ %.1.lcssa, %._crit_edge50 ], [ 0, %._crit_edge ]
  %31 = icmp slt i32 %.03352, %30
  br i1 %31, label %.lr.ph44, label %.critedge

.lr.ph44:                                         ; preds = %.preheader
  %32 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %indvars.iv59
  %33 = sext i32 %.03352 to i64
  br label %37

._crit_edge53:                                    ; preds = %._crit_edge50, %._crit_edge
  %34 = load i32, ptr @ans, align 4, !tbaa !13
  %35 = load i32, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !15
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %34, i32 noundef %35)
  ret i32 0

37:                                               ; preds = %.lr.ph44, %._crit_edge42
  %indvars.iv56 = phi i64 [ %33, %.lr.ph44 ], [ %indvars.iv.next57, %._crit_edge42 ]
  %38 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv56
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %40
  %42 = getelementptr inbounds i8, ptr %41, i64 4
  %43 = load i32, ptr %42, align 4, !tbaa !16
  %44 = load i32, ptr %32, align 16, !tbaa !17
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %.critedge.loopexit

46:                                               ; preds = %37
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i32, ptr @que, i64 %48
  %50 = getelementptr inbounds i8, ptr %41, i64 12
  %51 = tail call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %49, ptr noundef nonnull align 4 dereferenceable(4) %50)
  %52 = ptrtoint ptr %51 to i64
  %53 = sub i64 %52, ptrtoint (ptr @que to i64)
  %54 = lshr exact i64 %53, 2
  %55 = trunc i64 %54 to i32
  %56 = add i32 %55, 1
  %57 = load i32, ptr @m, align 4, !tbaa !5
  %.not3638 = icmp sgt i32 %56, %57
  br i1 %.not3638, label %._crit_edge42, label %.lr.ph41

.lr.ph41:                                         ; preds = %46
  %58 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %40
  br label %59

59:                                               ; preds = %.lr.ph41, %59
  %.03139 = phi i32 [ %56, %.lr.ph41 ], [ %64, %59 ]
  %60 = sext i32 %.03139 to i64
  %61 = getelementptr inbounds [100001 x %struct.Info], ptr @g, i64 0, i64 %60
  tail call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) %61, ptr noundef nonnull align 4 dereferenceable(8) %58)
  %62 = sub nsw i32 0, %.03139
  %63 = and i32 %.03139, %62
  %64 = add nsw i32 %63, %.03139
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %.not36 = icmp sgt i32 %64, %65
  br i1 %.not36, label %._crit_edge42, label %59, !llvm.loop !18

._crit_edge42:                                    ; preds = %59, %46
  %indvars.iv.next57 = add nsw i64 %indvars.iv56, 1
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = icmp slt i64 %indvars.iv.next57, %67
  br i1 %68, label %37, label %.critedge.loopexit, !llvm.loop !19

.critedge.loopexit:                               ; preds = %._crit_edge42, %37
  %.1.lcssa.ph.in = phi i64 [ %indvars.iv56, %37 ], [ %indvars.iv.next57, %._crit_edge42 ]
  %.1.lcssa.ph = trunc i64 %.1.lcssa.ph.in to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader
  %.1.lcssa = phi i32 [ %.03352, %.preheader ], [ %.1.lcssa.ph, %.critedge.loopexit ]
  %69 = load i32, ptr @m, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr @que, i64 %70
  %72 = getelementptr inbounds [100001 x %struct.Trapezoid], ptr @a, i64 0, i64 %indvars.iv59, i32 2
  %73 = tail call noundef ptr @_ZSt11lower_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull @que, ptr noundef nonnull %71, ptr noundef nonnull align 4 dereferenceable(4) %72)
  %74 = ptrtoint ptr %73 to i64
  %75 = sub i64 %74, ptrtoint (ptr @que to i64)
  %76 = lshr exact i64 %75, 2
  %77 = trunc i64 %76 to i32
  %78 = getelementptr inbounds [100001 x %struct.Info], ptr @f, i64 0, i64 %indvars.iv59
  %79 = getelementptr inbounds i8, ptr %78, i64 4
  store i32 1, ptr %79, align 4, !tbaa !15
  %80 = icmp sgt i32 %77, 0
  br i1 %80, label %.lr.ph49, label %._crit_edge50

.lr.ph49:                                         ; preds = %.critedge, %.lr.ph49
  %.048 = phi i32 [ %83, %.lr.ph49 ], [ %77, %.critedge ]
  %81 = zext nneg i32 %.048 to i64
  %82 = getelementptr inbounds [100001 x %struct.Info], ptr @g, i64 0, i64 %81
  tail call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) %78, ptr noundef nonnull align 4 dereferenceable(8) %82)
  %.not = add nsw i32 %.048, -1
  %83 = and i32 %.not, %.048
  %.not63 = icmp eq i32 %83, 0
  br i1 %.not63, label %._crit_edge50, label %.lr.ph49, !llvm.loop !20

._crit_edge50:                                    ; preds = %.lr.ph49, %.critedge
  %84 = load i32, ptr %78, align 8, !tbaa !13
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %78, align 8, !tbaa !13
  tail call void @_ZN4Info6updateERKS_(ptr noundef nonnull align 4 dereferenceable(8) @ans, ptr noundef nonnull align 4 dereferenceable(8) %78)
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %86 = load i32, ptr @n, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = icmp slt i64 %indvars.iv.next60, %87
  br i1 %88, label %.preheader, label %._crit_edge53, !llvm.loop !21
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9Trapezoid4readEv(ptr noundef nonnull align 4 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

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

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

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

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

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

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

!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 12}
!10 = !{!"_ZTS9Trapezoid", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS4Info", !6, i64 0, !6, i64 4}
!15 = !{!14, !6, i64 4}
!16 = !{!10, !6, i64 4}
!17 = !{!10, !6, i64 0}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


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