; LLVM IR from kazunetakahashi/atcoder :: 2018/0603_AGC025 (C)

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

@N = external dso_local global i32, align 4
@L = external dso_local global [100010 x i64], align 16
@imos_L = external dso_local global [100010 x i64], align 16
@R = external dso_local global [100010 x i64], align 16
@imos_R = external dso_local global [100010 x i64], 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 i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  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) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %32, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @N, 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 %2) #6
  br label %35

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %17
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %18)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %21
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) %22)
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %25
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = sub nsw i64 0, %27
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %30
  store i64 %28, ptr %31, align 8, !tbaa !9
  br label %32

32:                                               ; preds = %15
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

35:                                               ; preds = %14
  %36 = load i32, ptr @N, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i64, ptr @L, i64 %37
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @L, ptr noundef %38)
  %39 = load i32, ptr @N, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i64, ptr @L, i64 %40
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef @L, ptr noundef %41)
  %42 = load i32, ptr @N, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i64, ptr @R, i64 %43
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @R, ptr noundef %44)
  %45 = load i32, ptr @N, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i64, ptr @R, i64 %46
  call void @_ZSt7reverseIPxEvT_S1_(ptr noundef @R, ptr noundef %47)
  store i64 0, ptr @imos_L, align 16, !tbaa !9
  store i64 0, ptr @imos_R, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %80, %35
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr @N, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

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

53:                                               ; preds = %48
  %54 = load i32, ptr %3, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !9
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !9
  %62 = add nsw i64 %57, %61
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = add nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %65
  store i64 %62, ptr %66, align 8, !tbaa !9
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !9
  %71 = load i32, ptr %3, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !9
  %75 = add nsw i64 %70, %74
  %76 = load i32, ptr %3, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %78
  store i64 %75, ptr %79, align 8, !tbaa !9
  br label %80

80:                                               ; preds = %53
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %3, align 4, !tbaa !5
  br label %48, !llvm.loop !13

83:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %122, %83
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = load i32, ptr @N, align 4, !tbaa !5
  %87 = icmp sle i32 %85, %86
  br i1 %87, label %89, label %88

88:                                               ; preds = %84
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %125

89:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = sub nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %118, %89
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  %96 = icmp sle i32 %93, %95
  br i1 %96, label %98, label %97

97:                                               ; preds = %92
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %121

98:                                               ; preds = %92
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = icmp sle i32 0, %99
  br i1 %100, label %101, label %117

101:                                              ; preds = %98
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = load i32, ptr @N, align 4, !tbaa !5
  %104 = icmp sle i32 %102, %103
  br i1 %104, label %105, label %117

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

117:                                              ; preds = %105, %101, %98
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %7, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %7, align 4, !tbaa !5
  br label %92, !llvm.loop !14

121:                                              ; preds = %97
  br label %122

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

125:                                              ; preds = %88
  %126 = load i64, ptr %4, align 8, !tbaa !9
  %127 = mul nsw i64 2, %126
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %127)
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %128, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %130 = load i32, ptr %1, align 4
  ret i32 %130
}

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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !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}


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

@N = external dso_local global i32, align 4
@L = external dso_local global [100010 x i64], align 16
@imos_L = external dso_local local_unnamed_addr global [100010 x i64], align 16
@R = external dso_local global [100010 x i64], align 16
@imos_R = external dso_local local_unnamed_addr global [100010 x i64], 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 i64, align 8
  %2 = alloca i64, align 8
  %3 = 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)
  %4 = load i32, ptr @N, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre60 = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi61 = phi i64 [ %.pre60, %.._crit_edge_crit_edge ], [ %26, %.lr.ph ]
  %6 = getelementptr inbounds i64, ptr @L, i64 %.pre-phi61
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @L, ptr noundef nonnull %6)
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds i64, ptr @L, i64 %8
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull @L, ptr noundef nonnull %9)
  %10 = load i32, ptr @N, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds i64, ptr @R, i64 %11
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @R, ptr noundef nonnull %12)
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds i64, ptr @R, i64 %14
  tail call void @_ZSt7reverseIPxEvT_S1_(ptr noundef nonnull @R, ptr noundef nonnull %15)
  store i64 0, ptr @imos_L, align 16, !tbaa !9
  store i64 0, ptr @imos_R, align 16, !tbaa !9
  %16 = load i32, ptr @N, align 4
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph36.preheader, label %._crit_edge37

.lr.ph36.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %16 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %18 = icmp eq i32 %16, 1
  br i1 %18, label %._crit_edge37.loopexit.unr-lcssa, label %.lr.ph36.preheader.new

.lr.ph36.preheader.new:                           ; preds = %.lr.ph36.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %19 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %indvars.iv
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %21 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %indvars.iv
  %22 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) %21)
  %23 = load i64, ptr %21, align 8, !tbaa !9
  %24 = sub nsw i64 0, %23
  store i64 %24, ptr %21, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %25 = load i32, ptr @N, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next, %26
  br i1 %27, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge37.loopexit.unr-lcssa:                 ; preds = %.lr.ph36, %.lr.ph36.preheader
  %.unr = phi i64 [ 0, %.lr.ph36.preheader ], [ %63, %.lr.ph36 ]
  %.unr66 = phi i64 [ 0, %.lr.ph36.preheader ], [ %59, %.lr.ph36 ]
  %indvars.iv45.unr = phi i64 [ 0, %.lr.ph36.preheader ], [ %indvars.iv.next46.1, %.lr.ph36 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge37, label %.lr.ph36.epil

.lr.ph36.epil:                                    ; preds = %._crit_edge37.loopexit.unr-lcssa
  %28 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %indvars.iv45.unr
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = add nsw i64 %29, %.unr66
  %indvars.iv.next46.epil = add nuw nsw i64 %indvars.iv45.unr, 1
  %31 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %indvars.iv.next46.epil
  store i64 %30, ptr %31, align 8, !tbaa !9
  %32 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %indvars.iv45.unr
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = add nsw i64 %33, %.unr
  %35 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %indvars.iv.next46.epil
  store i64 %34, ptr %35, align 8, !tbaa !9
  br label %._crit_edge37

._crit_edge37:                                    ; preds = %.lr.ph36.epil, %._crit_edge37.loopexit.unr-lcssa, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  store i64 0, ptr %1, align 8, !tbaa !9
  %.not39 = icmp slt i32 %16, 0
  br i1 %.not39, label %._crit_edge43, label %36

36:                                               ; preds = %._crit_edge37
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %37 = load i64, ptr @imos_L, align 16, !tbaa !9
  %38 = load i64, ptr @imos_R, align 16, !tbaa !9
  %39 = add nsw i64 %38, %37
  store i64 %39, ptr %2, align 8, !tbaa !9
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %41 = load i64, ptr %40, align 8, !tbaa !9
  store i64 %41, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre = load i32, ptr @N, align 4
  %.not31.2.peel = icmp slt i32 %.pre, 1
  br i1 %.not31.2.peel, label %._crit_edge43.loopexit, label %.loopexit.peel

.loopexit.peel:                                   ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %42 = load i64, ptr @imos_L, align 16, !tbaa !9
  %43 = load i64, ptr getelementptr inbounds (i8, ptr @imos_R, i64 8), align 8, !tbaa !9
  %44 = add nsw i64 %43, %42
  store i64 %44, ptr %2, align 8, !tbaa !9
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %46 = load i64, ptr %45, align 8, !tbaa !9
  store i64 %46, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre55 = load i32, ptr @N, align 4
  %.not.not.peel = icmp sgt i32 %.pre55, 0
  br i1 %.not.not.peel, label %.lr.ph42, label %._crit_edge43.loopexit

.lr.ph36:                                         ; preds = %.lr.ph36, %.lr.ph36.preheader.new
  %47 = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %63, %.lr.ph36 ]
  %48 = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %59, %.lr.ph36 ]
  %indvars.iv45 = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %indvars.iv.next46.1, %.lr.ph36 ]
  %niter = phi i64 [ 0, %.lr.ph36.preheader.new ], [ %niter.next.1, %.lr.ph36 ]
  %49 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %indvars.iv45
  %50 = load i64, ptr %49, align 16, !tbaa !9
  %51 = add nsw i64 %50, %48
  %indvars.iv.next46 = or disjoint i64 %indvars.iv45, 1
  %52 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %indvars.iv.next46
  store i64 %51, ptr %52, align 8, !tbaa !9
  %53 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %indvars.iv45
  %54 = load i64, ptr %53, align 16, !tbaa !9
  %55 = add nsw i64 %54, %47
  %56 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %indvars.iv.next46
  store i64 %55, ptr %56, align 8, !tbaa !9
  %57 = getelementptr inbounds [100010 x i64], ptr @L, i64 0, i64 %indvars.iv.next46
  %58 = load i64, ptr %57, align 8, !tbaa !9
  %59 = add nsw i64 %58, %51
  %indvars.iv.next46.1 = add nuw nsw i64 %indvars.iv45, 2
  %60 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %indvars.iv.next46.1
  store i64 %59, ptr %60, align 16, !tbaa !9
  %61 = getelementptr inbounds [100010 x i64], ptr @R, i64 0, i64 %indvars.iv.next46
  %62 = load i64, ptr %61, align 8, !tbaa !9
  %63 = add nsw i64 %62, %55
  %64 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %indvars.iv.next46.1
  store i64 %63, ptr %64, align 16, !tbaa !9
  %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_edge37.loopexit.unr-lcssa, label %.lr.ph36, !llvm.loop !13

._crit_edge43.loopexit:                           ; preds = %.loopexit, %36, %.loopexit.peel
  %65 = phi i64 [ %46, %.loopexit.peel ], [ %41, %36 ], [ %104, %.loopexit ]
  %66 = shl nsw i64 %65, 1
  br label %._crit_edge43

._crit_edge43:                                    ; preds = %._crit_edge43.loopexit, %._crit_edge37
  %67 = phi i64 [ %66, %._crit_edge43.loopexit ], [ 0, %._crit_edge37 ]
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %67)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph42:                                         ; preds = %.loopexit.peel, %.loopexit
  %70 = phi i64 [ %104, %.loopexit ], [ %46, %.loopexit.peel ]
  %71 = phi i32 [ %105, %.loopexit ], [ %.pre55, %.loopexit.peel ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %.loopexit ], [ 1, %.loopexit.peel ]
  %72 = add nsw i64 %indvars.iv51, -1
  %73 = getelementptr inbounds [100010 x i64], ptr @imos_L, i64 0, i64 %indvars.iv51
  %74 = sext i32 %71 to i64
  %.not31 = icmp sgt i64 %72, %74
  br i1 %.not31, label %82, label %75

75:                                               ; preds = %.lr.ph42
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %76 = load i64, ptr %73, align 8, !tbaa !9
  %77 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %72
  %78 = load i64, ptr %77, align 8, !tbaa !9
  %79 = add nsw i64 %78, %76
  store i64 %79, ptr %2, align 8, !tbaa !9
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %81 = load i64, ptr %80, align 8, !tbaa !9
  store i64 %81, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre56 = load i32, ptr @N, align 4
  %.pre59 = sext i32 %.pre56 to i64
  br label %82

82:                                               ; preds = %.lr.ph42, %75
  %.pre-phi = phi i64 [ %74, %.lr.ph42 ], [ %.pre59, %75 ]
  %83 = phi i64 [ %70, %.lr.ph42 ], [ %81, %75 ]
  %84 = phi i32 [ %71, %.lr.ph42 ], [ %.pre56, %75 ]
  %.not31.1 = icmp sgt i64 %indvars.iv51, %.pre-phi
  br i1 %.not31.1, label %92, label %85

85:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %86 = load i64, ptr %73, align 8, !tbaa !9
  %87 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %indvars.iv51
  %88 = load i64, ptr %87, align 8, !tbaa !9
  %89 = add nsw i64 %88, %86
  store i64 %89, ptr %2, align 8, !tbaa !9
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %91 = load i64, ptr %90, align 8, !tbaa !9
  store i64 %91, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre57 = load i32, ptr @N, align 4
  br label %92

92:                                               ; preds = %85, %82
  %93 = phi i64 [ %91, %85 ], [ %83, %82 ]
  %94 = phi i32 [ %.pre57, %85 ], [ %84, %82 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %95 = trunc nuw i64 %indvars.iv.next52 to i32
  %96 = icmp slt i32 %95, 0
  %.not31.2 = icmp slt i32 %94, %95
  %or.cond.2 = select i1 %96, i1 true, i1 %.not31.2
  br i1 %or.cond.2, label %.loopexit, label %97

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %98 = load i64, ptr %73, align 8, !tbaa !9
  %99 = getelementptr inbounds [100010 x i64], ptr @imos_R, i64 0, i64 %indvars.iv.next52
  %100 = load i64, ptr %99, align 8, !tbaa !9
  %101 = add nsw i64 %100, %98
  store i64 %101, ptr %2, align 8, !tbaa !9
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %103 = load i64, ptr %102, align 8, !tbaa !9
  store i64 %103, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %.pre58 = load i32, ptr @N, align 4
  br label %.loopexit

.loopexit:                                        ; preds = %97, %92
  %104 = phi i64 [ %103, %97 ], [ %93, %92 ]
  %105 = phi i32 [ %.pre58, %97 ], [ %94, %92 ]
  %106 = sext i32 %105 to i64
  %.not.not = icmp slt i64 %indvars.iv51, %106
  br i1 %.not.not, label %.lr.ph42, label %._crit_edge43.loopexit, !llvm.loop !14
}

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

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

; Function Attrs: mustprogress 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 @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; 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 #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) 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)) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !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}
!15 = !{!"llvm.loop.peeled.count", i32 1}


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