; LLVM IR from upupming/algorithm :: acwing/日常刷题/扫描线/1228. 油漆面积-O(N^2) (main)

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

@seg = external dso_local global [20020 x %struct.Segment], align 16
@n = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@x2 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@c = external dso_local global [20020 x i32], align 16
@y = external dso_local global [20020 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

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

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

15:                                               ; preds = %10
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x1)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 4 dereferenceable(4) @y1)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) @x2)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) @y2)
  %20 = load i32, ptr @x1, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = mul nsw i32 2, %21
  %23 = sub nsw i32 %22, 1
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %24
  %26 = getelementptr inbounds %struct.Segment, ptr %25, i32 0, i32 0
  store i32 %20, ptr %26, align 16, !tbaa !9
  %27 = load i32, ptr @y1, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = mul nsw i32 2, %28
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %31
  %33 = getelementptr inbounds %struct.Segment, ptr %32, i32 0, i32 1
  store i32 %27, ptr %33, align 4, !tbaa !11
  %34 = load i32, ptr @y2, align 4, !tbaa !5
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = mul nsw i32 2, %35
  %37 = sub nsw i32 %36, 1
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %38
  %40 = getelementptr inbounds %struct.Segment, ptr %39, i32 0, i32 2
  store i32 %34, ptr %40, align 8, !tbaa !12
  %41 = load i32, ptr %2, align 4, !tbaa !5
  %42 = mul nsw i32 2, %41
  %43 = sub nsw i32 %42, 1
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %44
  %46 = getelementptr inbounds %struct.Segment, ptr %45, i32 0, i32 3
  store i32 1, ptr %46, align 4, !tbaa !13
  %47 = load i32, ptr @x2, align 4, !tbaa !5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = mul nsw i32 2, %48
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.Segment, ptr %51, i32 0, i32 0
  store i32 %47, ptr %52, align 16, !tbaa !9
  %53 = load i32, ptr @y1, align 4, !tbaa !5
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = mul nsw i32 2, %54
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.Segment, ptr %57, i32 0, i32 1
  store i32 %53, ptr %58, align 4, !tbaa !11
  %59 = load i32, ptr @y2, align 4, !tbaa !5
  %60 = load i32, ptr %2, align 4, !tbaa !5
  %61 = mul nsw i32 2, %60
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %62
  %64 = getelementptr inbounds %struct.Segment, ptr %63, i32 0, i32 2
  store i32 %59, ptr %64, align 8, !tbaa !12
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = mul nsw i32 2, %65
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.Segment, ptr %68, i32 0, i32 3
  store i32 -1, ptr %69, align 4, !tbaa !13
  %70 = load i32, ptr @y1, align 4, !tbaa !5
  %71 = load i32, ptr %2, align 4, !tbaa !5
  %72 = mul nsw i32 2, %71
  %73 = sub nsw i32 %72, 1
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %74
  store i32 %70, ptr %75, align 4, !tbaa !5
  %76 = load i32, ptr @y2, align 4, !tbaa !5
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = mul nsw i32 2, %77
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %79
  store i32 %76, ptr %80, align 4, !tbaa !5
  br label %81

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

84:                                               ; preds = %14
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = mul nsw i32 2, %85
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.Segment, ptr getelementptr inbounds (%struct.Segment, ptr @seg, i64 1), i64 %87
  call void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef getelementptr inbounds (%struct.Segment, ptr @seg, i64 1), ptr noundef %88)
  %89 = load i32, ptr @n, align 4, !tbaa !5
  %90 = mul nsw i32 2, %89
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr getelementptr inbounds (i32, ptr @y, i64 1), i64 %91
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef getelementptr inbounds (i32, ptr @y, i64 1), ptr noundef %92)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %195, %84
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = load i32, ptr @n, align 4, !tbaa !5
  %96 = mul nsw i32 2, %95
  %97 = icmp sle i32 %94, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %93
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %198

99:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %100

100:                                              ; preds = %126, %99
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = load i32, ptr @n, align 4, !tbaa !5
  %103 = mul nsw i32 2, %102
  %104 = icmp slt i32 %101, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %129

106:                                              ; preds = %100
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %125

112:                                              ; preds = %106
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = load i32, ptr %7, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = sub nsw i32 %117, %121
  %123 = load i32, ptr %6, align 4, !tbaa !5
  %124 = add nsw i32 %123, %122
  store i32 %124, ptr %6, align 4, !tbaa !5
  br label %125

125:                                              ; preds = %112, %106
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %7, align 4, !tbaa !5
  br label %100, !llvm.loop !16

129:                                              ; preds = %105
  %130 = load i32, ptr %4, align 4, !tbaa !5
  %131 = icmp sge i32 %130, 2
  br i1 %131, label %132, label %149

132:                                              ; preds = %129
  %133 = load i32, ptr %6, align 4, !tbaa !5
  %134 = load i32, ptr %4, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %135
  %137 = getelementptr inbounds %struct.Segment, ptr %136, i32 0, i32 0
  %138 = load i32, ptr %137, align 16, !tbaa !9
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = sub nsw i32 %139, 1
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %141
  %143 = getelementptr inbounds %struct.Segment, ptr %142, i32 0, i32 0
  %144 = load i32, ptr %143, align 16, !tbaa !9
  %145 = sub nsw i32 %138, %144
  %146 = mul nsw i32 %133, %145
  %147 = load i32, ptr %3, align 4, !tbaa !5
  %148 = add nsw i32 %147, %146
  store i32 %148, ptr %3, align 4, !tbaa !5
  br label %149

149:                                              ; preds = %132, %129
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %191, %149
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = load i32, ptr @n, align 4, !tbaa !5
  %153 = mul nsw i32 2, %152
  %154 = icmp slt i32 %151, %153
  br i1 %154, label %156, label %155

155:                                              ; preds = %150
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %194

156:                                              ; preds = %150
  %157 = load i32, ptr %4, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %158
  %160 = getelementptr inbounds %struct.Segment, ptr %159, i32 0, i32 1
  %161 = load i32, ptr %160, align 4, !tbaa !11
  %162 = load i32, ptr %8, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = icmp sle i32 %161, %165
  br i1 %166, label %167, label %190

167:                                              ; preds = %156
  %168 = load i32, ptr %4, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %169
  %171 = getelementptr inbounds %struct.Segment, ptr %170, i32 0, i32 2
  %172 = load i32, ptr %171, align 8, !tbaa !12
  %173 = load i32, ptr %8, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  %178 = icmp sge i32 %172, %177
  br i1 %178, label %179, label %190

179:                                              ; preds = %167
  %180 = load i32, ptr %4, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %181
  %183 = getelementptr inbounds %struct.Segment, ptr %182, i32 0, i32 3
  %184 = load i32, ptr %183, align 4, !tbaa !13
  %185 = load i32, ptr %8, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = add nsw i32 %188, %184
  store i32 %189, ptr %187, align 4, !tbaa !5
  br label %190

190:                                              ; preds = %179, %167, %156
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %8, align 4, !tbaa !5
  %193 = add nsw i32 %192, 1
  store i32 %193, ptr %8, align 4, !tbaa !5
  br label %150, !llvm.loop !17

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

195:                                              ; preds = %194
  %196 = load i32, ptr %4, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %4, align 4, !tbaa !5
  br label %93, !llvm.loop !18

198:                                              ; preds = %98
  %199 = load i32, ptr %3, align 4, !tbaa !5
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %199)
  %201 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %200, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %202 = load i32, ptr %1, align 4
  ret i32 %202
}

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

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

; 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 @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef, ptr noundef) #3

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

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

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

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

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

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

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


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

@seg = external dso_local global [20020 x %struct.Segment], align 16
@n = external dso_local global i32, align 4
@x1 = external dso_local global i32, align 4
@x2 = external dso_local global i32, align 4
@y1 = external dso_local global i32, align 4
@y2 = external dso_local global i32, align 4
@c = external dso_local local_unnamed_addr global [20020 x i32], align 16
@y = external dso_local global [20020 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not46 = icmp slt i32 %2, 1
  br i1 %.not46, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa = phi i32 [ %2, %0 ], [ %91, %.lr.ph ]
  %3 = shl nsw i32 %.lcssa, 1
  %4 = sext i32 %3 to i64
  %5 = getelementptr inbounds %struct.Segment, ptr getelementptr inbounds (i8, ptr @seg, i64 16), i64 %4
  tail call void @_ZSt4sortIP7SegmentEvT_S2_(ptr noundef nonnull getelementptr inbounds (i8, ptr @seg, i64 16), ptr noundef nonnull %5)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = shl nsw i32 %6, 1
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i32, ptr getelementptr inbounds (i8, ptr @y, i64 4), i64 %8
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull getelementptr inbounds (i8, ptr @y, i64 4), ptr noundef nonnull %9)
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not4257 = icmp slt i32 %10, 1
  br i1 %.not4257, label %._crit_edge60, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %._crit_edge
  %11 = shl nuw i32 %10, 1
  %smax = tail call i32 @llvm.smax.i32(i32 %11, i32 2)
  %smax93 = tail call i32 @llvm.smax.i32(i32 %11, i32 1)
  %12 = add nuw nsw i32 %smax93, 1
  %wide.trip.count94 = zext nneg i32 %12 to i64
  %wide.trip.count = zext nneg i32 %smax to i64
  %wide.trip.count88 = zext nneg i32 %smax to i64
  %13 = icmp slt i32 %11, 3
  %14 = add nsw i64 %wide.trip.count, -4
  br label %.lr.ph50.us.preheader

.lr.ph50.us.preheader:                            ; preds = %._crit_edge56.us, %.preheader.us.preheader
  %indvars.iv90 = phi i64 [ 1, %.preheader.us.preheader ], [ %indvars.iv.next91, %._crit_edge56.us ]
  %.03858.us = phi i32 [ 0, %.preheader.us.preheader ], [ %.139.us, %._crit_edge56.us ]
  br i1 %13, label %.lr.ph50.us.epil, label %.lr.ph50.us

.lr.ph50.us.epil:                                 ; preds = %.lr.ph50.us._crit_edge.1, %.lr.ph50.us.preheader
  %indvars.iv81.unr = phi i64 [ 1, %.lr.ph50.us.preheader ], [ %.pre.1, %.lr.ph50.us._crit_edge.1 ]
  %.03648.us.unr = phi i32 [ 0, %.lr.ph50.us.preheader ], [ %.1.us.1, %.lr.ph50.us._crit_edge.1 ]
  %15 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %indvars.iv81.unr
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %.not45.us.epil = icmp eq i32 %16, 0
  br i1 %.not45.us.epil, label %._crit_edge51.us, label %17

17:                                               ; preds = %.lr.ph50.us.epil
  %.pre.epil = add nuw nsw i64 %indvars.iv81.unr, 1
  %18 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %.pre.epil
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %indvars.iv81.unr
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = add i32 %19, %.03648.us.unr
  %23 = sub i32 %22, %21
  br label %._crit_edge51.us

._crit_edge51.us:                                 ; preds = %.lr.ph50.us.epil, %17
  %.1.us.epil = phi i32 [ %23, %17 ], [ %.03648.us.unr, %.lr.ph50.us.epil ]
  %24 = icmp ugt i64 %indvars.iv90, 1
  br i1 %24, label %25, label %.lr.ph55.us

25:                                               ; preds = %._crit_edge51.us
  %26 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %indvars.iv90
  %27 = load i32, ptr %26, align 16, !tbaa !9
  %28 = add nsw i64 %indvars.iv90, -1
  %29 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %28
  %30 = load i32, ptr %29, align 16, !tbaa !9
  %31 = sub nsw i32 %27, %30
  %32 = mul nsw i32 %31, %.1.us.epil
  %33 = add nsw i32 %32, %.03858.us
  br label %.lr.ph55.us

.lr.ph55.us:                                      ; preds = %25, %._crit_edge51.us
  %.139.us = phi i32 [ %33, %25 ], [ %.03858.us, %._crit_edge51.us ]
  %34 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %indvars.iv90
  %35 = getelementptr inbounds i8, ptr %34, i64 4
  %36 = load i32, ptr %35, align 4, !tbaa !11
  %37 = getelementptr inbounds i8, ptr %34, i64 8
  %38 = getelementptr inbounds i8, ptr %34, i64 12
  br label %39

39:                                               ; preds = %.lr.ph55.us, %52
  %indvars.iv84 = phi i64 [ 1, %.lr.ph55.us ], [ %indvars.iv.next85.pre-phi, %52 ]
  %40 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %indvars.iv84
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %.not43.us = icmp sgt i32 %36, %41
  br i1 %.not43.us, label %._crit_edge96, label %42

._crit_edge96:                                    ; preds = %39
  %.pre97 = add nuw nsw i64 %indvars.iv84, 1
  br label %52

42:                                               ; preds = %39
  %43 = load i32, ptr %37, align 8, !tbaa !12
  %44 = add nuw nsw i64 %indvars.iv84, 1
  %45 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %.not44.us = icmp slt i32 %43, %46
  br i1 %.not44.us, label %52, label %47

47:                                               ; preds = %42
  %48 = load i32, ptr %38, align 4, !tbaa !13
  %49 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %indvars.iv84
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = add nsw i32 %50, %48
  store i32 %51, ptr %49, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %._crit_edge96, %47, %42
  %indvars.iv.next85.pre-phi = phi i64 [ %.pre97, %._crit_edge96 ], [ %44, %47 ], [ %44, %42 ]
  %exitcond89.not = icmp eq i64 %indvars.iv.next85.pre-phi, %wide.trip.count88
  br i1 %exitcond89.not, label %._crit_edge56.us, label %39, !llvm.loop !14

.lr.ph50.us:                                      ; preds = %.lr.ph50.us.preheader, %.lr.ph50.us._crit_edge.1
  %indvars.iv81 = phi i64 [ %.pre.1, %.lr.ph50.us._crit_edge.1 ], [ 1, %.lr.ph50.us.preheader ]
  %.03648.us = phi i32 [ %.1.us.1, %.lr.ph50.us._crit_edge.1 ], [ 0, %.lr.ph50.us.preheader ]
  %niter = phi i64 [ %niter.next.1, %.lr.ph50.us._crit_edge.1 ], [ 0, %.lr.ph50.us.preheader ]
  %53 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %indvars.iv81
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %.not45.us = icmp eq i32 %54, 0
  %.pre = add nuw nsw i64 %indvars.iv81, 1
  br i1 %.not45.us, label %.lr.ph50.us._crit_edge, label %55

55:                                               ; preds = %.lr.ph50.us
  %56 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %.pre
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %indvars.iv81
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add i32 %57, %.03648.us
  %61 = sub i32 %60, %59
  br label %.lr.ph50.us._crit_edge

.lr.ph50.us._crit_edge:                           ; preds = %.lr.ph50.us, %55
  %.1.us = phi i32 [ %61, %55 ], [ %.03648.us, %.lr.ph50.us ]
  %62 = getelementptr inbounds [20020 x i32], ptr @c, i64 0, i64 %.pre
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %.not45.us.1 = icmp eq i32 %63, 0
  %.pre.1 = add nuw nsw i64 %indvars.iv81, 2
  br i1 %.not45.us.1, label %.lr.ph50.us._crit_edge.1, label %64

64:                                               ; preds = %.lr.ph50.us._crit_edge
  %65 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %.pre.1
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %.pre
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add i32 %66, %.1.us
  %70 = sub i32 %69, %68
  br label %.lr.ph50.us._crit_edge.1

.lr.ph50.us._crit_edge.1:                         ; preds = %64, %.lr.ph50.us._crit_edge
  %.1.us.1 = phi i32 [ %70, %64 ], [ %.1.us, %.lr.ph50.us._crit_edge ]
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %14
  br i1 %niter.ncmp.1, label %.lr.ph50.us.epil, label %.lr.ph50.us, !llvm.loop !16

._crit_edge56.us:                                 ; preds = %52
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %exitcond95.not = icmp eq i64 %indvars.iv.next91, %wide.trip.count94
  br i1 %exitcond95.not, label %._crit_edge60, label %.lr.ph50.us.preheader, !llvm.loop !17

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %71 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @x1)
  %72 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %71, ptr noundef nonnull align 4 dereferenceable(4) @y1)
  %73 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %72, ptr noundef nonnull align 4 dereferenceable(4) @x2)
  %74 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %73, ptr noundef nonnull align 4 dereferenceable(4) @y2)
  %75 = load i32, ptr @x1, align 4, !tbaa !5
  %76 = shl nuw nsw i64 %indvars.iv, 1
  %77 = add nsw i64 %76, -1
  %78 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %77
  store i32 %75, ptr %78, align 16, !tbaa !9
  %79 = load i32, ptr @y1, align 4, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %78, i64 4
  store i32 %79, ptr %80, align 4, !tbaa !11
  %81 = load i32, ptr @y2, align 4, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %78, i64 8
  store i32 %81, ptr %82, align 8, !tbaa !12
  %83 = getelementptr inbounds i8, ptr %78, i64 12
  store i32 1, ptr %83, align 4, !tbaa !13
  %84 = load i32, ptr @x2, align 4, !tbaa !5
  %85 = getelementptr inbounds [20020 x %struct.Segment], ptr @seg, i64 0, i64 %76
  store i32 %84, ptr %85, align 16, !tbaa !9
  %86 = getelementptr inbounds i8, ptr %85, i64 4
  store i32 %79, ptr %86, align 4, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %85, i64 8
  store i32 %81, ptr %87, align 8, !tbaa !12
  %88 = getelementptr inbounds i8, ptr %85, i64 12
  store i32 -1, ptr %88, align 4, !tbaa !13
  %89 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %77
  store i32 %79, ptr %89, align 4, !tbaa !5
  %90 = getelementptr inbounds [20020 x i32], ptr @y, i64 0, i64 %76
  store i32 %81, ptr %90, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %.not.not = icmp slt i64 %indvars.iv, %92
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !18

._crit_edge60:                                    ; preds = %._crit_edge56.us, %._crit_edge
  %.038.lcssa = phi i32 [ 0, %._crit_edge ], [ %.139.us, %._crit_edge56.us ]
  %93 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.038.lcssa)
  %94 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %93, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #4

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 #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 nosync nounwind speculatable willreturn memory(none) }

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


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