; LLVM IR from kazunetakahashi/atcoder :: 201510_201609/1030_ARC036 (B)

; 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" }

@h = external dso_local global [300010 x i32], align 16
@l = external dso_local global [300010 x i32], align 16
@r = external dso_local global [300010 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  %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) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %20, %0
  %11 = load i32, ptr %3, align 4, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
  br label %20

20:                                               ; preds = %15
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %3, align 4, !tbaa !5
  br label %10, !llvm.loop !9

23:                                               ; preds = %14
  store i32 0, ptr @l, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %55, %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %58

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sub nsw i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp slt i32 %34, %38
  br i1 %39, label %40, label %50

40:                                               ; preds = %29
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sub nsw i32 %41, 1
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  br label %54

50:                                               ; preds = %29
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %52
  store i32 0, ptr %53, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %50, %40
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !11

58:                                               ; preds = %28
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %61
  store i32 0, ptr %62, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 2
  store i32 %64, ptr %5, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %95, %58
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = icmp sge i32 %66, 0
  br i1 %67, label %69, label %68

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

69:                                               ; preds = %65
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp slt i32 %74, %78
  br i1 %79, label %80, label %90

80:                                               ; preds = %69
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %88
  store i32 %86, ptr %89, align 4, !tbaa !5
  br label %94

90:                                               ; preds = %69
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %92
  store i32 0, ptr %93, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %90, %80
  br label %95

95:                                               ; preds = %94
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = add nsw i32 %96, -1
  store i32 %97, ptr %5, align 4, !tbaa !5
  br label %65, !llvm.loop !12

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

99:                                               ; preds = %116, %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = load i32, ptr %2, align 4, !tbaa !5
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %119

104:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = add nsw i32 %108, %112
  store i32 %113, ptr %8, align 4, !tbaa !5
  %114 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %115 = load i32, ptr %114, align 4, !tbaa !5
  store i32 %115, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %116

116:                                              ; preds = %104
  %117 = load i32, ptr %7, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %7, align 4, !tbaa !5
  br label %99, !llvm.loop !13

119:                                              ; preds = %103
  %120 = load i32, ptr %6, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %121)
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %122, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %124 = load i32, ptr %1, align 4
  ret i32 %124
}

; 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

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

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

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

; 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)) #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 = { 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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !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" }

@h = external dso_local global [300010 x i32], align 16
@l = external dso_local local_unnamed_addr global [300010 x i32], align 16
@r = external dso_local local_unnamed_addr global [300010 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 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %4 = 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)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  store i32 0, ptr @l, align 16, !tbaa !5
  br label %._crit_edge30.thread

._crit_edge:                                      ; preds = %.lr.ph
  store i32 0, ptr @l, align 16, !tbaa !5
  %7 = icmp sgt i32 %12, 1
  br i1 %7, label %.lr.ph29.preheader, label %._crit_edge30.thread

.lr.ph29.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %12 to i64
  %.pre = load i32, ptr @h, align 16, !tbaa !5
  %8 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %8, 1
  %9 = icmp eq i32 %12, 2
  br i1 %9, label %._crit_edge30.unr-lcssa, label %.lr.ph29.preheader.new

.lr.ph29.preheader.new:                           ; preds = %.lr.ph29.preheader
  %unroll_iter = and i64 %8, -2
  br label %.lr.ph29

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = icmp slt i64 %indvars.iv.next, %13
  br i1 %14, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge30.thread:                             ; preds = %._crit_edge.thread, %._crit_edge
  %.ph51 = phi i32 [ %12, %._crit_edge ], [ %5, %._crit_edge.thread ]
  %15 = add nsw i32 %.ph51, -1
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %16
  store i32 0, ptr %17, align 4, !tbaa !5
  %18 = icmp sgt i32 %.ph51, 0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !5
  br i1 %18, label %.lr.ph37.preheader, label %._crit_edge38

.lr.ph37.preheader:                               ; preds = %.lr.ph37.preheader.critedge, %._crit_edge30.thread
  br label %.lr.ph37

._crit_edge30.unr-lcssa.loopexit:                 ; preds = %.lr.ph29
  %19 = add nsw i32 %.sink.1, 1
  br label %._crit_edge30.unr-lcssa

._crit_edge30.unr-lcssa:                          ; preds = %._crit_edge30.unr-lcssa.loopexit, %.lr.ph29.preheader
  %.unr = phi i32 [ 1, %.lr.ph29.preheader ], [ %19, %._crit_edge30.unr-lcssa.loopexit ]
  %.unr55 = phi i32 [ %.pre, %.lr.ph29.preheader ], [ %50, %._crit_edge30.unr-lcssa.loopexit ]
  %indvars.iv41.unr = phi i64 [ 1, %.lr.ph29.preheader ], [ %indvars.iv.next42.1, %._crit_edge30.unr-lcssa.loopexit ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge30, label %.lr.ph29.epil

.lr.ph29.epil:                                    ; preds = %._crit_edge30.unr-lcssa
  %20 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv41.unr
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp slt i32 %.unr55, %21
  %.sink.epil = select i1 %22, i32 %.unr, i32 0
  %23 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %indvars.iv41.unr
  store i32 %.sink.epil, ptr %23, align 4
  br label %._crit_edge30

._crit_edge30:                                    ; preds = %._crit_edge30.unr-lcssa, %.lr.ph29.epil
  %24 = add nsw i32 %12, -1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %25
  store i32 0, ptr %26, align 4, !tbaa !5
  br i1 %7, label %.lr.ph33.preheader, label %.lr.ph37.preheader.critedge

.lr.ph33.preheader:                               ; preds = %._crit_edge30
  %27 = add nsw i32 %12, -2
  %28 = zext i32 %27 to i64
  %29 = and i64 %28, 1
  %lcmp.mod57.not.not = icmp eq i64 %29, 0
  br i1 %lcmp.mod57.not.not, label %.lr.ph33.prol, label %.lr.ph33.prol.loopexit

.lr.ph33.prol:                                    ; preds = %.lr.ph33.preheader
  %30 = or disjoint i64 %28, 1
  %31 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %28
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp slt i32 %32, %34
  br i1 %35, label %36, label %.lr.ph33.prol.loopexit.unr-lcssa

36:                                               ; preds = %.lr.ph33.prol
  %37 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %30
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  br label %.lr.ph33.prol.loopexit.unr-lcssa

.lr.ph33.prol.loopexit.unr-lcssa:                 ; preds = %36, %.lr.ph33.prol
  %.sink50.prol = phi i32 [ %39, %36 ], [ 0, %.lr.ph33.prol ]
  %40 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %28
  store i32 %.sink50.prol, ptr %40, align 4
  %indvars.iv.next45.prol = add nsw i64 %28, -1
  br label %.lr.ph33.prol.loopexit

.lr.ph33.prol.loopexit:                           ; preds = %.lr.ph33.prol.loopexit.unr-lcssa, %.lr.ph33.preheader
  %indvars.iv44.unr = phi i64 [ %28, %.lr.ph33.preheader ], [ %indvars.iv.next45.prol, %.lr.ph33.prol.loopexit.unr-lcssa ]
  %41 = icmp eq i32 %27, 0
  br i1 %41, label %.lr.ph37.preheader.critedge, label %.lr.ph33

.lr.ph29:                                         ; preds = %.lr.ph29, %.lr.ph29.preheader.new
  %42 = phi i32 [ 0, %.lr.ph29.preheader.new ], [ %.sink.1, %.lr.ph29 ]
  %43 = phi i32 [ %.pre, %.lr.ph29.preheader.new ], [ %50, %.lr.ph29 ]
  %indvars.iv41 = phi i64 [ 1, %.lr.ph29.preheader.new ], [ %indvars.iv.next42.1, %.lr.ph29 ]
  %niter = phi i64 [ 0, %.lr.ph29.preheader.new ], [ %niter.next.1, %.lr.ph29 ]
  %44 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv41
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp slt i32 %43, %45
  %47 = add nsw i32 %42, 1
  %.sink = select i1 %46, i32 %47, i32 0
  %48 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %indvars.iv41
  store i32 %.sink, ptr %48, align 4
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %49 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv.next42
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp slt i32 %45, %50
  %52 = add nsw i32 %.sink, 1
  %.sink.1 = select i1 %51, i32 %52, i32 0
  %53 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %indvars.iv.next42
  store i32 %.sink.1, ptr %53, align 4
  %indvars.iv.next42.1 = add nuw nsw i64 %indvars.iv41, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge30.unr-lcssa.loopexit, label %.lr.ph29, !llvm.loop !11

.lr.ph37.preheader.critedge:                      ; preds = %.lr.ph33.prol.loopexit, %72, %._crit_edge30
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  store i32 -1, ptr %2, align 4, !tbaa !5
  br label %.lr.ph37.preheader

.lr.ph33:                                         ; preds = %.lr.ph33.prol.loopexit, %72
  %indvars.iv44 = phi i64 [ %indvars.iv.next45.1, %72 ], [ %indvars.iv44.unr, %.lr.ph33.prol.loopexit ]
  %54 = add nuw nsw i64 %indvars.iv44, 1
  %55 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv44
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = icmp slt i32 %56, %58
  br i1 %59, label %60, label %.lr.ph33.1

60:                                               ; preds = %.lr.ph33
  %61 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %54
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = add nsw i32 %62, 1
  br label %.lr.ph33.1

.lr.ph33.1:                                       ; preds = %.lr.ph33, %60
  %.sink50 = phi i32 [ %63, %60 ], [ 0, %.lr.ph33 ]
  %64 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %indvars.iv44
  store i32 %.sink50, ptr %64, align 4
  %indvars.iv.next45 = add nsw i64 %indvars.iv44, -1
  %65 = getelementptr inbounds [300010 x i32], ptr @h, i64 0, i64 %indvars.iv.next45
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = icmp slt i32 %58, %66
  br i1 %67, label %68, label %72

68:                                               ; preds = %.lr.ph33.1
  %69 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %indvars.iv44
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  br label %72

72:                                               ; preds = %68, %.lr.ph33.1
  %.sink50.1 = phi i32 [ %71, %68 ], [ 0, %.lr.ph33.1 ]
  %73 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %indvars.iv.next45
  store i32 %.sink50.1, ptr %73, align 4
  %indvars.iv.next45.1 = add nsw i64 %indvars.iv44, -2
  %74 = icmp sgt i64 %indvars.iv44, 1
  br i1 %74, label %.lr.ph33, label %.lr.ph37.preheader.critedge, !llvm.loop !12

._crit_edge38.loopexit:                           ; preds = %.lr.ph37
  %75 = add nsw i32 %85, 1
  br label %._crit_edge38

._crit_edge38:                                    ; preds = %._crit_edge38.loopexit, %._crit_edge30.thread
  %76 = phi i32 [ %75, %._crit_edge38.loopexit ], [ 0, %._crit_edge30.thread ]
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %76)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph37:                                         ; preds = %.lr.ph37.preheader, %.lr.ph37
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %.lr.ph37 ], [ 0, %.lr.ph37.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %79 = getelementptr inbounds [300010 x i32], ptr @l, i64 0, i64 %indvars.iv47
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = getelementptr inbounds [300010 x i32], ptr @r, i64 0, i64 %indvars.iv47
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = add nsw i32 %82, %80
  store i32 %83, ptr %3, align 4, !tbaa !5
  %84 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %85 = load i32, ptr %84, align 4, !tbaa !5
  store i32 %85, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %86 = load i32, ptr %1, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = icmp slt i64 %indvars.iv.next48, %87
  br i1 %88, label %.lr.ph37, label %._crit_edge38.loopexit, !llvm.loop !13
}

; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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