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

; 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.Line = type { i32, i32, i32 }

@line = external dso_local global [50001 x %struct.Line], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@fa = external dso_local global [501 x i32], align 16
@ans_max = external dso_local global i32, align 4
@ans_min = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3gcdii(i32 noundef, i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11union_clearv() #0

; 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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %30, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @m, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %16, label %33

16:                                               ; preds = %12
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.Line, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.Line, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Line, ptr %27, i32 0, i32 2
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %20, ptr noundef %24, ptr noundef %28)
  br label %30

30:                                               ; preds = %16
  %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 %12, !llvm.loop !9

33:                                               ; preds = %12
  %34 = load i32, ptr @m, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds %struct.Line, ptr @line, i64 %35
  call void @_ZSt4sortIP4LinePFbRKS0_S3_EEvT_S6_T0_(ptr noundef @line, ptr noundef %36, ptr noundef @_Z3cmpRK4LineS1_)
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @s, ptr noundef @t)
  br label %38

38:                                               ; preds = %156, %33
  %39 = load i32, ptr %9, align 4, !tbaa !5
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %157

42:                                               ; preds = %38
  store i32 -1, ptr %6, align 4, !tbaa !5
  store i32 -1, ptr %7, align 4, !tbaa !5
  call void @_Z11union_clearv()
  %43 = load i32, ptr %9, align 4, !tbaa !5
  store i32 %43, ptr %3, align 4, !tbaa !5
  br label %44

44:                                               ; preds = %77, %42
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = load i32, ptr @m, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %48, label %80

48:                                               ; preds = %44
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.Line, ptr %51, i32 0, i32 0
  %53 = load i32, ptr %52, align 4, !tbaa !11
  %54 = call noundef i32 @_Z4findi(i32 noundef %53)
  store i32 %54, ptr %4, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.Line, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !13
  %60 = call noundef i32 @_Z4findi(i32 noundef %59)
  store i32 %60, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [501 x i32], ptr @fa, i64 0, i64 %63
  store i32 %61, ptr %64, align 4, !tbaa !5
  %65 = load i32, ptr @s, align 4, !tbaa !5
  %66 = call noundef i32 @_Z4findi(i32 noundef %65)
  %67 = load i32, ptr @t, align 4, !tbaa !5
  %68 = call noundef i32 @_Z4findi(i32 noundef %67)
  %69 = icmp eq i32 %66, %68
  br i1 %69, label %70, label %76

70:                                               ; preds = %48
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %72
  %74 = getelementptr inbounds %struct.Line, ptr %73, i32 0, i32 2
  %75 = load i32, ptr %74, align 4, !tbaa !14
  store i32 %75, ptr %6, align 4, !tbaa !5
  br label %80

76:                                               ; preds = %48
  br label %77

77:                                               ; preds = %76
  %78 = load i32, ptr %3, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %3, align 4, !tbaa !5
  br label %44, !llvm.loop !15

80:                                               ; preds = %70, %44
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = icmp eq i32 %81, -1
  br i1 %82, label %83, label %89

83:                                               ; preds = %80
  %84 = load i32, ptr @ans_min, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %88, label %86

86:                                               ; preds = %83
  %87 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %168

88:                                               ; preds = %83
  br label %157

89:                                               ; preds = %80
  call void @_Z11union_clearv()
  br label %90

90:                                               ; preds = %122, %89
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = icmp sge i32 %91, 0
  br i1 %92, label %93, label %125

93:                                               ; preds = %90
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %95
  %97 = getelementptr inbounds %struct.Line, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 4, !tbaa !11
  %99 = call noundef i32 @_Z4findi(i32 noundef %98)
  store i32 %99, ptr %4, align 4, !tbaa !5
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.Line, ptr %102, i32 0, i32 1
  %104 = load i32, ptr %103, align 4, !tbaa !13
  %105 = call noundef i32 @_Z4findi(i32 noundef %104)
  store i32 %105, ptr %5, align 4, !tbaa !5
  %106 = load i32, ptr %5, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [501 x i32], ptr @fa, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  %110 = load i32, ptr @s, align 4, !tbaa !5
  %111 = call noundef i32 @_Z4findi(i32 noundef %110)
  %112 = load i32, ptr @t, align 4, !tbaa !5
  %113 = call noundef i32 @_Z4findi(i32 noundef %112)
  %114 = icmp eq i32 %111, %113
  br i1 %114, label %115, label %121

115:                                              ; preds = %93
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %117
  %119 = getelementptr inbounds %struct.Line, ptr %118, i32 0, i32 2
  %120 = load i32, ptr %119, align 4, !tbaa !14
  store i32 %120, ptr %7, align 4, !tbaa !5
  br label %125

121:                                              ; preds = %93
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %3, align 4, !tbaa !5
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %3, align 4, !tbaa !5
  br label %90, !llvm.loop !16

125:                                              ; preds = %115, %90
  %126 = load i32, ptr %3, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %9, align 4, !tbaa !5
  %128 = load i32, ptr %7, align 4, !tbaa !5
  %129 = icmp eq i32 %128, -1
  br i1 %129, label %130, label %136

130:                                              ; preds = %125
  %131 = load i32, ptr @ans_min, align 4, !tbaa !5
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %135, label %133

133:                                              ; preds = %130
  %134 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %168

135:                                              ; preds = %130
  br label %157

136:                                              ; preds = %125
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = call noundef i32 @_Z3gcdii(i32 noundef %137, i32 noundef %138)
  store i32 %139, ptr %8, align 4, !tbaa !5
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = load i32, ptr %6, align 4, !tbaa !5
  %142 = sdiv i32 %141, %140
  store i32 %142, ptr %6, align 4, !tbaa !5
  %143 = load i32, ptr %8, align 4, !tbaa !5
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = sdiv i32 %144, %143
  store i32 %145, ptr %7, align 4, !tbaa !5
  %146 = load i32, ptr @ans_max, align 4, !tbaa !5
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = mul nsw i32 %146, %147
  %149 = load i32, ptr @ans_min, align 4, !tbaa !5
  %150 = load i32, ptr %6, align 4, !tbaa !5
  %151 = mul nsw i32 %149, %150
  %152 = icmp sgt i32 %148, %151
  br i1 %152, label %153, label %156

153:                                              ; preds = %136
  %154 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %154, ptr @ans_max, align 4, !tbaa !5
  %155 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %155, ptr @ans_min, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %153, %136
  br label %38, !llvm.loop !17

157:                                              ; preds = %135, %88, %38
  %158 = load i32, ptr @ans_min, align 4, !tbaa !5
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %160, label %163

160:                                              ; preds = %157
  %161 = load i32, ptr @ans_max, align 4, !tbaa !5
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %161)
  br label %167

163:                                              ; preds = %157
  %164 = load i32, ptr @ans_max, align 4, !tbaa !5
  %165 = load i32, ptr @ans_min, align 4, !tbaa !5
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %164, i32 noundef %165)
  br label %167

167:                                              ; preds = %163, %160
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  br label %168

168:                                              ; preds = %167, %133, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %169 = load i32, ptr %1, align 4
  ret i32 %169
}

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

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

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

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

%struct.Line = type { i32, i32, i32 }

@line = external dso_local global [50001 x %struct.Line], align 16
@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@fa = external dso_local local_unnamed_addr global [501 x i32], align 16
@ans_max = external dso_local local_unnamed_addr global i32, align 4
@ans_min = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3gcdii(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z4findi(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z11union_clearv() local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @m, 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

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %4 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %indvars.iv
  %5 = getelementptr inbounds i8, ptr %4, i64 4
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = icmp slt i64 %indvars.iv.next, %9
  br i1 %10, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %9, %.lr.ph ]
  %11 = getelementptr inbounds %struct.Line, ptr @line, i64 %.pre-phi
  tail call void @_ZSt4sortIP4LinePFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull @line, ptr noundef nonnull %11, ptr noundef nonnull @_Z3cmpRK4LineS1_)
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @s, ptr noundef nonnull @t)
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph63, label %._crit_edge.thread-pre-split_crit_edge

._crit_edge.thread-pre-split_crit_edge:           ; preds = %._crit_edge
  %.pr.pre = load i32, ptr @ans_min, align 4, !tbaa !5
  br label %thread-pre-split

.lr.ph63:                                         ; preds = %._crit_edge, %80
  %.061 = phi i32 [ %65, %80 ], [ 0, %._crit_edge ]
  tail call void @_Z11union_clearv()
  %15 = load i32, ptr @m, align 4, !tbaa !5
  %16 = icmp slt i32 %.061, %15
  br i1 %16, label %.lr.ph55.preheader, label %.thread

.lr.ph55.preheader:                               ; preds = %.lr.ph63
  %17 = sext i32 %.061 to i64
  br label %.lr.ph55

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %31
  %indvars.iv76 = phi i32 [ %.061, %.lr.ph55.preheader ], [ %indvars.iv.next77, %31 ]
  %indvars.iv73 = phi i64 [ %17, %.lr.ph55.preheader ], [ %indvars.iv.next74, %31 ]
  %18 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %indvars.iv73
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = tail call noundef i32 @_Z4findi(i32 noundef %19)
  %21 = getelementptr inbounds i8, ptr %18, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !13
  %23 = tail call noundef i32 @_Z4findi(i32 noundef %22)
  %24 = sext i32 %20 to i64
  %25 = getelementptr inbounds [501 x i32], ptr @fa, i64 0, i64 %24
  store i32 %23, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr @s, align 4, !tbaa !5
  %27 = tail call noundef i32 @_Z4findi(i32 noundef %26)
  %28 = load i32, ptr @t, align 4, !tbaa !5
  %29 = tail call noundef i32 @_Z4findi(i32 noundef %28)
  %30 = icmp eq i32 %27, %29
  br i1 %30, label %35, label %31

31:                                               ; preds = %.lr.ph55
  %indvars.iv.next74 = add nsw i64 %indvars.iv73, 1
  %32 = load i32, ptr @m, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = icmp slt i64 %indvars.iv.next74, %33
  %indvars.iv.next77 = add i32 %indvars.iv76, 1
  br i1 %34, label %.lr.ph55, label %.thread, !llvm.loop !14

35:                                               ; preds = %.lr.ph55
  %36 = getelementptr inbounds i8, ptr %18, i64 8
  %37 = load i32, ptr %36, align 4, !tbaa !15
  %38 = icmp eq i32 %37, -1
  br i1 %38, label %.thread, label %42

.thread:                                          ; preds = %35, %.lr.ph63, %31
  %39 = load i32, ptr @ans_min, align 4, !tbaa !5
  %.not42 = icmp eq i32 %39, 0
  br i1 %.not42, label %40, label %thread-pre-split

40:                                               ; preds = %.thread
  %41 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %90

42:                                               ; preds = %35
  tail call void @_Z11union_clearv()
  %43 = icmp sgt i64 %indvars.iv73, -1
  br i1 %43, label %.lr.ph59.preheader, label %.thread44

.lr.ph59.preheader:                               ; preds = %42
  %44 = zext i32 %indvars.iv76 to i64
  br label %.lr.ph59

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %58
  %indvars.iv79 = phi i64 [ %44, %.lr.ph59.preheader ], [ %indvars.iv.next80, %58 ]
  %45 = getelementptr inbounds [50001 x %struct.Line], ptr @line, i64 0, i64 %indvars.iv79
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = tail call noundef i32 @_Z4findi(i32 noundef %46)
  %48 = getelementptr inbounds i8, ptr %45, i64 4
  %49 = load i32, ptr %48, align 4, !tbaa !13
  %50 = tail call noundef i32 @_Z4findi(i32 noundef %49)
  %51 = sext i32 %47 to i64
  %52 = getelementptr inbounds [501 x i32], ptr @fa, i64 0, i64 %51
  store i32 %50, ptr %52, align 4, !tbaa !5
  %53 = load i32, ptr @s, align 4, !tbaa !5
  %54 = tail call noundef i32 @_Z4findi(i32 noundef %53)
  %55 = load i32, ptr @t, align 4, !tbaa !5
  %56 = tail call noundef i32 @_Z4findi(i32 noundef %55)
  %57 = icmp eq i32 %54, %56
  br i1 %57, label %61, label %58

58:                                               ; preds = %.lr.ph59
  %indvars.iv.next80 = add nsw i64 %indvars.iv79, -1
  %59 = trunc nuw i64 %indvars.iv79 to i32
  %60 = icmp sgt i32 %59, 0
  br i1 %60, label %.lr.ph59, label %.thread44, !llvm.loop !16

61:                                               ; preds = %.lr.ph59
  %62 = trunc nuw i64 %indvars.iv79 to i32
  %63 = getelementptr inbounds i8, ptr %45, i64 8
  %64 = load i32, ptr %63, align 4, !tbaa !15
  %65 = add nuw nsw i32 %62, 1
  %66 = icmp eq i32 %64, -1
  br i1 %66, label %.thread44, label %70

.thread44:                                        ; preds = %61, %42, %58
  %67 = load i32, ptr @ans_min, align 4, !tbaa !5
  %.not = icmp eq i32 %67, 0
  br i1 %.not, label %68, label %thread-pre-split

68:                                               ; preds = %.thread44
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %90

70:                                               ; preds = %61
  %71 = tail call noundef i32 @_Z3gcdii(i32 noundef %37, i32 noundef %64)
  %72 = sdiv i32 %37, %71
  %73 = sdiv i32 %64, %71
  %74 = load i32, ptr @ans_max, align 4, !tbaa !5
  %75 = mul nsw i32 %74, %73
  %76 = load i32, ptr @ans_min, align 4, !tbaa !5
  %77 = mul nsw i32 %76, %72
  %78 = icmp sgt i32 %75, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %70
  store i32 %72, ptr @ans_max, align 4, !tbaa !5
  store i32 %73, ptr @ans_min, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %79, %70
  %.pr83 = phi i32 [ %73, %79 ], [ %76, %70 ]
  %81 = load i32, ptr @m, align 4, !tbaa !5
  %82 = icmp slt i32 %65, %81
  br i1 %82, label %.lr.ph63, label %thread-pre-split, !llvm.loop !17

thread-pre-split:                                 ; preds = %80, %._crit_edge.thread-pre-split_crit_edge, %.thread44, %.thread
  %83 = phi i32 [ %67, %.thread44 ], [ %39, %.thread ], [ %.pr.pre, %._crit_edge.thread-pre-split_crit_edge ], [ %.pr83, %80 ]
  %84 = icmp eq i32 %83, 1
  %85 = load i32, ptr @ans_max, align 4, !tbaa !5
  br i1 %84, label %86, label %88

86:                                               ; preds = %thread-pre-split
  %87 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %85)
  br label %90

88:                                               ; preds = %thread-pre-split
  %89 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %85, i32 noundef %83)
  br label %90

90:                                               ; preds = %86, %88, %68, %40
  ret i32 0
}

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

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

; 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 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 #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 = { 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" }

!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 = !{!"_ZTS4Line", !6, i64 0, !6, i64 4, !6, i64 8}
!13 = !{!12, !6, i64 4}
!14 = distinct !{!14, !10}
!15 = !{!12, !6, i64 8}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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