; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (1506)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::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" }

@a = external dso_local global [100005 x i64], align 16
@Left = external dso_local global [100005 x i64], align 16
@Right = external dso_local global [100005 x i64], align 16
@Max = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@_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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  br label %8

8:                                                ; preds = %157, %0
  %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) %3)
  %10 = load i32, ptr %3, align 4, !tbaa !5
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %161

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

13:                                               ; preds = %23, %12
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = icmp sle i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %26

18:                                               ; preds = %13
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %20
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %21)
  br label %23

23:                                               ; preds = %18
  %24 = load i32, ptr %4, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %4, align 4, !tbaa !5
  br label %13, !llvm.loop !9

26:                                               ; preds = %17
  store i64 1, ptr getelementptr inbounds ([100005 x i64], ptr @Left, i64 0, i64 1), align 8, !tbaa !11
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %30
  store i64 %28, ptr %31, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 2, ptr %5, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %68, %26
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %71

37:                                               ; preds = %32
  %38 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %38, ptr %2, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %55, %37
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 1
  br i1 %41, label %42, label %53

42:                                               ; preds = %39
  %43 = load i32, ptr %5, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !11
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sub nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = icmp sle i64 %46, %51
  br label %53

53:                                               ; preds = %42, %39
  %54 = phi i1 [ false, %39 ], [ %52, %42 ]
  br i1 %54, label %55, label %62

55:                                               ; preds = %53
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !11
  %61 = trunc i64 %60 to i32
  store i32 %61, ptr %2, align 4, !tbaa !5
  br label %39, !llvm.loop !13

62:                                               ; preds = %53
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %66
  store i64 %64, ptr %67, align 8, !tbaa !11
  br label %68

68:                                               ; preds = %62
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !5
  br label %32, !llvm.loop !14

71:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = sub nsw i32 %72, 1
  store i32 %73, ptr %6, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %110, %71
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = icmp sge i32 %75, 1
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %74
  %79 = load i32, ptr %6, align 4, !tbaa !5
  store i32 %79, ptr %2, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %97, %78
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %84, label %95

84:                                               ; preds = %80
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !11
  %89 = load i32, ptr %2, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !11
  %94 = icmp sle i64 %88, %93
  br label %95

95:                                               ; preds = %84, %80
  %96 = phi i1 [ false, %80 ], [ %94, %84 ]
  br i1 %96, label %97, label %104

97:                                               ; preds = %95
  %98 = load i32, ptr %2, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = trunc i64 %102 to i32
  store i32 %103, ptr %2, align 4, !tbaa !5
  br label %80, !llvm.loop !15

104:                                              ; preds = %95
  %105 = load i32, ptr %2, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %108
  store i64 %106, ptr %109, align 8, !tbaa !11
  br label %110

110:                                              ; preds = %104
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %6, align 4, !tbaa !5
  br label %74, !llvm.loop !16

113:                                              ; preds = %77
  store i64 0, ptr @Max, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %114

114:                                              ; preds = %154, %113
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = load i32, ptr %3, align 4, !tbaa !5
  %117 = icmp sle i32 %115, %116
  br i1 %117, label %119, label %118

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

119:                                              ; preds = %114
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %121
  %123 = load i64, ptr %122, align 8, !tbaa !11
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !11
  %128 = sub nsw i64 %123, %127
  %129 = add nsw i64 %128, 1
  %130 = load i32, ptr %7, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !11
  %134 = mul nsw i64 %129, %133
  %135 = load i64, ptr @Max, align 8, !tbaa !11
  %136 = icmp sgt i64 %134, %135
  br i1 %136, label %137, label %153

137:                                              ; preds = %119
  %138 = load i32, ptr %7, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %139
  %141 = load i64, ptr %140, align 8, !tbaa !11
  %142 = load i32, ptr %7, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !11
  %146 = sub nsw i64 %141, %145
  %147 = add nsw i64 %146, 1
  %148 = load i32, ptr %7, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %149
  %151 = load i64, ptr %150, align 8, !tbaa !11
  %152 = mul nsw i64 %147, %151
  store i64 %152, ptr @Max, align 8, !tbaa !11
  br label %153

153:                                              ; preds = %137, %119
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %7, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %7, align 4, !tbaa !5
  br label %114, !llvm.loop !17

157:                                              ; preds = %118
  %158 = load i64, ptr @Max, align 8, !tbaa !11
  %159 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %158)
  %160 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %159, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %8, !llvm.loop !18

161:                                              ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #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)) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = { 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, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::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" }

@a = external dso_local global [100005 x i64], align 16
@Left = external dso_local local_unnamed_addr global [100005 x i64], align 16
@Right = external dso_local local_unnamed_addr global [100005 x i64], align 16
@Max = external dso_local local_unnamed_addr global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@_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 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %.not63 = icmp eq i32 %3, 0
  br i1 %.not63, label %._crit_edge64, label %.preheader44

.preheader44:                                     ; preds = %0, %._crit_edge62
  %4 = phi i32 [ %94, %._crit_edge62 ], [ %3, %0 ]
  %.not3745 = icmp slt i32 %4, 1
  br i1 %.not3745, label %._crit_edge57.thread, label %.lr.ph

._crit_edge57.thread:                             ; preds = %.preheader44
  %.pre = sext i32 %4 to i64
  store i64 1, ptr getelementptr inbounds (i8, ptr @Left, i64 8), align 8, !tbaa !9
  %5 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %.pre
  store i64 %.pre, ptr %5, align 8, !tbaa !9
  store i64 0, ptr @Max, align 8, !tbaa !9
  br label %._crit_edge62

._crit_edge:                                      ; preds = %.lr.ph
  store i64 1, ptr getelementptr inbounds (i8, ptr @Left, i64 8), align 8, !tbaa !9
  %6 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %14
  store i64 %14, ptr %6, align 8, !tbaa !9
  %.not3848 = icmp slt i32 %13, 2
  br i1 %.not3848, label %._crit_edge57, label %.preheader42.preheader

.preheader42.preheader:                           ; preds = %._crit_edge
  %7 = add nuw i32 %13, 1
  %wide.trip.count = zext i32 %7 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %8 = icmp eq i32 %7, 3
  br i1 %8, label %.preheader.preheader.unr-lcssa, label %.preheader42.preheader.new

.preheader42.preheader.new:                       ; preds = %.preheader42.preheader
  %9 = and i64 %wide.trip.count, 4294967294
  %10 = add nsw i64 %9, -4
  br label %.preheader42

.lr.ph:                                           ; preds = %.preheader44, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader44 ]
  %11 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %.not37.not = icmp slt i64 %indvars.iv, %14
  br i1 %.not37.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader.preheader.unr-lcssa:                   ; preds = %.critedge.1, %.preheader42.preheader
  %indvars.iv68.unr = phi i64 [ 2, %.preheader42.preheader ], [ %indvars.iv.next69.1, %.critedge.1 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader.preheader, label %.preheader42.epil

.preheader42.epil:                                ; preds = %.preheader.preheader.unr-lcssa
  %15 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv68.unr
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = trunc nuw nsw i64 %indvars.iv68.unr to i32
  br label %18

18:                                               ; preds = %23, %.preheader42.epil
  %.03447.epil = phi i32 [ %17, %.preheader42.epil ], [ %26, %23 ]
  %19 = add nsw i32 %.03447.epil, -1
  %20 = zext nneg i32 %19 to i64
  %21 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %20
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %.not41.epil = icmp sgt i64 %16, %22
  br i1 %.not41.epil, label %.critedge.epil, label %23

23:                                               ; preds = %18
  %24 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %20
  %25 = load i64, ptr %24, align 8, !tbaa !9
  %26 = trunc i64 %25 to i32
  %27 = icmp sgt i32 %26, 1
  br i1 %27, label %18, label %.critedge.epil, !llvm.loop !13

.critedge.epil:                                   ; preds = %23, %18
  %.034.lcssa.epil = phi i32 [ %26, %23 ], [ %.03447.epil, %18 ]
  %28 = sext i32 %.034.lcssa.epil to i64
  %29 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv68.unr
  store i64 %28, ptr %29, align 8, !tbaa !9
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader.preheader.unr-lcssa, %.critedge.epil
  %30 = zext nneg i32 %13 to i64
  br label %.preheader

.preheader42:                                     ; preds = %.critedge.1, %.preheader42.preheader.new
  %indvars.iv68 = phi i64 [ 2, %.preheader42.preheader.new ], [ %indvars.iv.next69.1, %.critedge.1 ]
  %niter = phi i64 [ 0, %.preheader42.preheader.new ], [ %niter.next.1, %.critedge.1 ]
  %31 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv68
  %32 = load i64, ptr %31, align 16, !tbaa !9
  %33 = trunc nuw nsw i64 %indvars.iv68 to i32
  br label %34

34:                                               ; preds = %.preheader42, %39
  %.03447 = phi i32 [ %33, %.preheader42 ], [ %42, %39 ]
  %35 = add nsw i32 %.03447, -1
  %36 = zext nneg i32 %35 to i64
  %37 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !9
  %.not41 = icmp sgt i64 %32, %38
  br i1 %.not41, label %.critedge, label %39

39:                                               ; preds = %34
  %40 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %36
  %41 = load i64, ptr %40, align 8, !tbaa !9
  %42 = trunc i64 %41 to i32
  %43 = icmp sgt i32 %42, 1
  br i1 %43, label %34, label %.critedge, !llvm.loop !13

.critedge:                                        ; preds = %39, %34
  %.034.lcssa = phi i32 [ %42, %39 ], [ %.03447, %34 ]
  %44 = sext i32 %.034.lcssa to i64
  %45 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv68
  store i64 %44, ptr %45, align 16, !tbaa !9
  %indvars.iv.next69 = or disjoint i64 %indvars.iv68, 1
  %46 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next69
  %47 = load i64, ptr %46, align 8, !tbaa !9
  %48 = trunc nuw nsw i64 %indvars.iv.next69 to i32
  br label %49

49:                                               ; preds = %54, %.critedge
  %.03447.1 = phi i32 [ %48, %.critedge ], [ %57, %54 ]
  %50 = add nsw i32 %.03447.1, -1
  %51 = zext nneg i32 %50 to i64
  %52 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %.not41.1 = icmp sgt i64 %47, %53
  br i1 %.not41.1, label %.critedge.1, label %54

54:                                               ; preds = %49
  %55 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %51
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = trunc i64 %56 to i32
  %58 = icmp sgt i32 %57, 1
  br i1 %58, label %49, label %.critedge.1, !llvm.loop !13

.critedge.1:                                      ; preds = %54, %49
  %.034.lcssa.1 = phi i32 [ %57, %54 ], [ %.03447.1, %49 ]
  %59 = sext i32 %.034.lcssa.1 to i64
  %60 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv.next69
  store i64 %59, ptr %60, align 8, !tbaa !9
  %indvars.iv.next69.1 = add nuw nsw i64 %indvars.iv68, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter, %10
  br i1 %niter.ncmp.1, label %.preheader.preheader.unr-lcssa, label %.preheader42, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.preheader, %.critedge2
  %indvars.iv71 = phi i64 [ %30, %.preheader.preheader ], [ %indvars.iv.next72, %.critedge2 ]
  %indvars.iv.next72 = add nsw i64 %indvars.iv71, -1
  %.not65 = icmp sgt i64 %indvars.iv71, %14
  %61 = trunc nuw nsw i64 %indvars.iv.next72 to i32
  br i1 %.not65, label %.critedge2, label %.lr.ph51

.lr.ph51:                                         ; preds = %.preheader
  %62 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next72
  %63 = load i64, ptr %62, align 8, !tbaa !9
  br label %66

._crit_edge57:                                    ; preds = %.critedge2, %._crit_edge
  store i64 0, ptr @Max, align 8, !tbaa !9
  %.not3958 = icmp slt i32 %13, 1
  br i1 %.not3958, label %._crit_edge62, label %.lr.ph61.preheader

.lr.ph61.preheader:                               ; preds = %._crit_edge57
  %64 = zext nneg i32 %13 to i64
  %xtraiter95 = and i64 %64, 1
  %65 = icmp eq i32 %13, 1
  br i1 %65, label %._crit_edge62.loopexit.unr-lcssa, label %.lr.ph61.preheader.new

.lr.ph61.preheader.new:                           ; preds = %.lr.ph61.preheader
  %unroll_iter98 = and i64 %64, 2147483646
  br label %.lr.ph61

66:                                               ; preds = %.lr.ph51, %71
  %.150 = phi i32 [ %61, %.lr.ph51 ], [ %74, %71 ]
  %67 = add nsw i32 %.150, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %.not40 = icmp sgt i64 %63, %70
  br i1 %.not40, label %.critedge2, label %71

71:                                               ; preds = %66
  %72 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %68
  %73 = load i64, ptr %72, align 8, !tbaa !9
  %74 = trunc i64 %73 to i32
  %75 = icmp sgt i32 %13, %74
  br i1 %75, label %66, label %.critedge2, !llvm.loop !15

.critedge2:                                       ; preds = %66, %71, %.preheader
  %.1.lcssa = phi i32 [ %61, %.preheader ], [ %74, %71 ], [ %.150, %66 ]
  %76 = sext i32 %.1.lcssa to i64
  %77 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %indvars.iv.next72
  store i64 %76, ptr %77, align 8, !tbaa !9
  %78 = icmp sgt i64 %indvars.iv71, 2
  br i1 %78, label %.preheader, label %._crit_edge57, !llvm.loop !16

._crit_edge62.loopexit.unr-lcssa:                 ; preds = %119, %.lr.ph61.preheader
  %.lcssa94.ph = phi i64 [ poison, %.lr.ph61.preheader ], [ %120, %119 ]
  %indvars.iv74.unr = phi i64 [ 1, %.lr.ph61.preheader ], [ %indvars.iv.next75.1, %119 ]
  %.unr = phi i64 [ 0, %.lr.ph61.preheader ], [ %120, %119 ]
  %lcmp.mod96.not = icmp eq i64 %xtraiter95, 0
  br i1 %lcmp.mod96.not, label %._crit_edge62, label %.lr.ph61.epil

.lr.ph61.epil:                                    ; preds = %._crit_edge62.loopexit.unr-lcssa
  %79 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %indvars.iv74.unr
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv74.unr
  %82 = load i64, ptr %81, align 8, !tbaa !9
  %83 = add i64 %80, 1
  %84 = sub i64 %83, %82
  %85 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv74.unr
  %86 = load i64, ptr %85, align 8, !tbaa !9
  %87 = mul nsw i64 %84, %86
  %88 = icmp sgt i64 %87, %.unr
  br i1 %88, label %89, label %._crit_edge62

89:                                               ; preds = %.lr.ph61.epil
  store i64 %87, ptr @Max, align 8, !tbaa !9
  br label %._crit_edge62

._crit_edge62:                                    ; preds = %._crit_edge62.loopexit.unr-lcssa, %89, %.lr.ph61.epil, %._crit_edge57.thread, %._crit_edge57
  %90 = phi i64 [ 0, %._crit_edge57 ], [ 0, %._crit_edge57.thread ], [ %.lcssa94.ph, %._crit_edge62.loopexit.unr-lcssa ], [ %.unr, %.lr.ph61.epil ], [ %87, %89 ]
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %90)
  %92 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %91, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %93 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %94 = load i32, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %94, 0
  br i1 %.not, label %._crit_edge64, label %.preheader44, !llvm.loop !17

.lr.ph61:                                         ; preds = %119, %.lr.ph61.preheader.new
  %indvars.iv74 = phi i64 [ 1, %.lr.ph61.preheader.new ], [ %indvars.iv.next75.1, %119 ]
  %95 = phi i64 [ 0, %.lr.ph61.preheader.new ], [ %120, %119 ]
  %niter99 = phi i64 [ 0, %.lr.ph61.preheader.new ], [ %niter99.next.1, %119 ]
  %96 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %indvars.iv74
  %97 = load i64, ptr %96, align 8, !tbaa !9
  %98 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv74
  %99 = load i64, ptr %98, align 8, !tbaa !9
  %100 = add i64 %97, 1
  %101 = sub i64 %100, %99
  %102 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv74
  %103 = load i64, ptr %102, align 8, !tbaa !9
  %104 = mul nsw i64 %101, %103
  %105 = icmp sgt i64 %104, %95
  br i1 %105, label %106, label %.lr.ph61.1

106:                                              ; preds = %.lr.ph61
  store i64 %104, ptr @Max, align 8, !tbaa !9
  br label %.lr.ph61.1

.lr.ph61.1:                                       ; preds = %.lr.ph61, %106
  %107 = phi i64 [ %95, %.lr.ph61 ], [ %104, %106 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %108 = getelementptr inbounds [100005 x i64], ptr @Right, i64 0, i64 %indvars.iv.next75
  %109 = load i64, ptr %108, align 8, !tbaa !9
  %110 = getelementptr inbounds [100005 x i64], ptr @Left, i64 0, i64 %indvars.iv.next75
  %111 = load i64, ptr %110, align 8, !tbaa !9
  %112 = add i64 %109, 1
  %113 = sub i64 %112, %111
  %114 = getelementptr inbounds [100005 x i64], ptr @a, i64 0, i64 %indvars.iv.next75
  %115 = load i64, ptr %114, align 8, !tbaa !9
  %116 = mul nsw i64 %113, %115
  %117 = icmp sgt i64 %116, %107
  br i1 %117, label %118, label %119

118:                                              ; preds = %.lr.ph61.1
  store i64 %116, ptr @Max, align 8, !tbaa !9
  br label %119

119:                                              ; preds = %118, %.lr.ph61.1
  %120 = phi i64 [ %107, %.lr.ph61.1 ], [ %116, %118 ]
  %indvars.iv.next75.1 = add nuw nsw i64 %indvars.iv74, 2
  %niter99.next.1 = add i64 %niter99, 2
  %niter99.ncmp.1 = icmp eq i64 %niter99.next.1, %unroll_iter98
  br i1 %niter99.ncmp.1, label %._crit_edge62.loopexit.unr-lcssa, label %.lr.ph61, !llvm.loop !18

._crit_edge64:                                    ; preds = %._crit_edge62, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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 #2

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

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

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

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

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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