; LLVM IR from kazunetakahashi/atcoder :: 2019/0525_ABC127/past (D)

; 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::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.1" = type { i64 }
%"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
@M = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@S = external dso_local global [100010 x %"class.std::tuple"], 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 i64, align 8
  %6 = alloca %"class.std::tuple", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i64, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = 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)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @M)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %25, %0
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @N, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %22
  %24 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %23)
  br label %25

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

28:                                               ; preds = %19
  %29 = load i32, ptr @N, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i64, ptr @A, i64 %30
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @A, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %44, %28
  %33 = load i32, ptr %3, align 4, !tbaa !5
  %34 = load i32, ptr @M, align 4, !tbaa !5
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %38, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  call void @_ZNSt5tupleIJxxEEC2IRxS2_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100010 x %"class.std::tuple"], ptr @S, i64 0, i64 %41
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJxxEEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %42, ptr noundef nonnull align 8 dereferenceable(16) %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %44

44:                                               ; preds = %37
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %3, align 4, !tbaa !5
  br label %32, !llvm.loop !11

47:                                               ; preds = %36
  %48 = load i32, ptr @M, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds %"class.std::tuple", ptr @S, i64 %49
  call void @_ZSt4sortIPSt5tupleIJxxEEEvT_S3_(ptr noundef @S, ptr noundef %50)
  %51 = load i32, ptr @M, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %"class.std::tuple", ptr @S, i64 %52
  call void @_ZSt7reverseIPSt5tupleIJxxEEEvT_S3_(ptr noundef @S, ptr noundef %53)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %97, %47
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = load i32, ptr @N, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %58, label %98

58:                                               ; preds = %54
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %80

61:                                               ; preds = %58
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = load i32, ptr @M, align 4, !tbaa !5
  %64 = icmp sge i32 %62, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %61
  br label %98

66:                                               ; preds = %61
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100010 x %"class.std::tuple"], ptr @S, i64 0, i64 %68
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %69) #6
  %71 = load i64, ptr %70, align 8, !tbaa !12
  store i64 %71, ptr %9, align 8, !tbaa !12
  %72 = load i32, ptr %8, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100010 x %"class.std::tuple"], ptr @S, i64 0, i64 %73
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm1EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %74) #6
  %76 = load i64, ptr %75, align 8, !tbaa !12
  %77 = trunc i64 %76 to i32
  store i32 %77, ptr %10, align 4, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %8, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %66, %58
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !12
  %85 = load i64, ptr %9, align 8, !tbaa !12
  %86 = icmp slt i64 %84, %85
  br i1 %86, label %87, label %96

87:                                               ; preds = %80
  %88 = load i64, ptr %9, align 8, !tbaa !12
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %90
  store i64 %88, ptr %91, align 8, !tbaa !12
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !5
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = add nsw i32 %94, -1
  store i32 %95, ptr %10, align 4, !tbaa !5
  br label %97

96:                                               ; preds = %80
  br label %98

97:                                               ; preds = %87
  br label %54, !llvm.loop !14

98:                                               ; preds = %96, %65, %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %111, %98
  %100 = load i32, ptr %12, align 4, !tbaa !5
  %101 = load i32, ptr @N, 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 %12) #6
  br label %114

104:                                              ; preds = %99
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !12
  %109 = load i64, ptr %11, align 8, !tbaa !12
  %110 = add nsw i64 %109, %108
  store i64 %110, ptr %11, align 8, !tbaa !12
  br label %111

111:                                              ; preds = %104
  %112 = load i32, ptr %12, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %12, align 4, !tbaa !5
  br label %99, !llvm.loop !15

114:                                              ; preds = %103
  %115 = load i64, ptr %11, align 8, !tbaa !12
  %116 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %115)
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %116, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %118 = load i32, ptr %1, align 4
  ret i32 %118
}

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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxxEEC2IRxS2_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm1EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16)) #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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.0", %"struct.std::_Head_base.1" }
%"struct.std::_Tuple_impl.0" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i64 }
%"struct.std::_Head_base.1" = type { i64 }
%"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
@M = external dso_local global i32, align 4
@A = external dso_local global [100010 x i64], align 16
@S = external dso_local global [100010 x %"class.std::tuple"], 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 = alloca %"class.std::tuple", align 8
  %4 = 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)
  %5 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @M)
  %6 = load i32, ptr @N, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre74 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre74, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %8 = getelementptr inbounds i64, ptr @A, i64 %.pre-phi
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @A, ptr noundef nonnull %8)
  %9 = load i32, ptr @M, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph39, label %._crit_edge.._crit_edge40_crit_edge

._crit_edge.._crit_edge40_crit_edge:              ; preds = %._crit_edge
  %.pre75 = sext i32 %9 to i64
  br label %._crit_edge40

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv
  %12 = 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) %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge40:                                    ; preds = %.lr.ph39, %._crit_edge.._crit_edge40_crit_edge
  %.pre-phi76 = phi i64 [ %.pre75, %._crit_edge.._crit_edge40_crit_edge ], [ %27, %.lr.ph39 ]
  %16 = getelementptr inbounds %"class.std::tuple", ptr @S, i64 %.pre-phi76
  call void @_ZSt4sortIPSt5tupleIJxxEEEvT_S3_(ptr noundef nonnull @S, ptr noundef nonnull %16)
  %17 = load i32, ptr @M, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds %"class.std::tuple", ptr @S, i64 %18
  call void @_ZSt7reverseIPSt5tupleIJxxEEEvT_S3_(ptr noundef nonnull @S, ptr noundef nonnull %19)
  %20 = load i32, ptr @N, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph47, label %._crit_edge55

.lr.ph39:                                         ; preds = %._crit_edge, %.lr.ph39
  %indvars.iv61 = phi i64 [ %indvars.iv.next62, %.lr.ph39 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @_ZNSt5tupleIJxxEEC2IRxS2_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %1) #7
  %24 = getelementptr inbounds [100010 x %"class.std::tuple"], ptr @S, i64 0, i64 %indvars.iv61
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt5tupleIJxxEEaSEOS0_(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %26 = load i32, ptr @M, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next62, %27
  br i1 %28, label %.lr.ph39, label %._crit_edge40, !llvm.loop !11

.lr.ph47:                                         ; preds = %._crit_edge40, %45
  %.pre.pre72 = phi i32 [ %.pre.pre, %45 ], [ %20, %._crit_edge40 ]
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %45 ], [ 0, %._crit_edge40 ]
  %.02545 = phi i32 [ %46, %45 ], [ 0, %._crit_edge40 ]
  %.02644 = phi i64 [ %.127, %45 ], [ 0, %._crit_edge40 ]
  %.02843 = phi i32 [ %.129, %45 ], [ 0, %._crit_edge40 ]
  %29 = icmp eq i32 %.02545, 0
  br i1 %29, label %30, label %41

30:                                               ; preds = %.lr.ph47
  %31 = load i32, ptr @M, align 4, !tbaa !5
  %.not = icmp slt i32 %.02843, %31
  br i1 %.not, label %32, label %._crit_edge48

32:                                               ; preds = %30
  %33 = sext i32 %.02843 to i64
  %34 = getelementptr inbounds [100010 x %"class.std::tuple"], ptr @S, i64 0, i64 %33
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %34) #7
  %36 = load i64, ptr %35, align 8, !tbaa !12
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm1EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %34) #7
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = trunc i64 %38 to i32
  %40 = add nsw i32 %.02843, 1
  %.pre.pre.pre = load i32, ptr @N, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %32, %.lr.ph47
  %.pre.pre = phi i32 [ %.pre.pre.pre, %32 ], [ %.pre.pre72, %.lr.ph47 ]
  %.129 = phi i32 [ %40, %32 ], [ %.02843, %.lr.ph47 ]
  %.127 = phi i64 [ %36, %32 ], [ %.02644, %.lr.ph47 ]
  %.1 = phi i32 [ %39, %32 ], [ %.02545, %.lr.ph47 ]
  %42 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv64
  %43 = load i64, ptr %42, align 8, !tbaa !12
  %44 = icmp slt i64 %43, %.127
  br i1 %44, label %45, label %._crit_edge48

45:                                               ; preds = %41
  store i64 %.127, ptr %42, align 8, !tbaa !12
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %46 = add nsw i32 %.1, -1
  %47 = sext i32 %.pre.pre to i64
  %48 = icmp slt i64 %indvars.iv.next65, %47
  br i1 %48, label %.lr.ph47, label %._crit_edge48, !llvm.loop !14

._crit_edge48:                                    ; preds = %45, %30, %41
  %49 = phi i32 [ %.pre.pre, %41 ], [ %.pre.pre72, %30 ], [ %.pre.pre, %45 ]
  %50 = icmp sgt i32 %49, 0
  br i1 %50, label %.lr.ph54.preheader, label %._crit_edge55

.lr.ph54.preheader:                               ; preds = %._crit_edge48
  %wide.trip.count = zext nneg i32 %49 to i64
  %min.iters.check = icmp ult i32 %49, 4
  br i1 %min.iters.check, label %.lr.ph54.preheader83, label %vector.ph

.lr.ph54.preheader83:                             ; preds = %middle.block, %.lr.ph54.preheader
  %indvars.iv67.ph = phi i64 [ 0, %.lr.ph54.preheader ], [ %n.vec, %middle.block ]
  %.02451.ph = phi i64 [ 0, %.lr.ph54.preheader ], [ %56, %middle.block ]
  br label %.lr.ph54

vector.ph:                                        ; preds = %.lr.ph54.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %53, %vector.body ]
  %vec.phi81 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %54, %vector.body ]
  %51 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %index
  %52 = getelementptr inbounds i8, ptr %51, i64 16
  %wide.load = load <2 x i64>, ptr %51, align 16, !tbaa !12
  %wide.load82 = load <2 x i64>, ptr %52, align 16, !tbaa !12
  %53 = add <2 x i64> %wide.load, %vec.phi
  %54 = add <2 x i64> %wide.load82, %vec.phi81
  %index.next = add nuw i64 %index, 4
  %55 = icmp eq i64 %index.next, %n.vec
  br i1 %55, label %middle.block, label %vector.body, !llvm.loop !15

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %54, %53
  %56 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %._crit_edge55, label %.lr.ph54.preheader83

._crit_edge55:                                    ; preds = %.lr.ph54, %middle.block, %._crit_edge40, %._crit_edge48
  %.024.lcssa = phi i64 [ 0, %._crit_edge48 ], [ 0, %._crit_edge40 ], [ %56, %middle.block ], [ %61, %.lr.ph54 ]
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.024.lcssa)
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %57, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph54:                                         ; preds = %.lr.ph54.preheader83, %.lr.ph54
  %indvars.iv67 = phi i64 [ %indvars.iv.next68, %.lr.ph54 ], [ %indvars.iv67.ph, %.lr.ph54.preheader83 ]
  %.02451 = phi i64 [ %61, %.lr.ph54 ], [ %.02451.ph, %.lr.ph54.preheader83 ]
  %59 = getelementptr inbounds [100010 x i64], ptr @A, i64 0, i64 %indvars.iv67
  %60 = load i64, ptr %59, align 8, !tbaa !12
  %61 = add nsw i64 %60, %.02451
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge55, label %.lr.ph54, !llvm.loop !18
}

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: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxxEEC2IRxS2_TnNSt9enable_ifIXclsr4_TCCIXntcl14__is_alloc_argIT_EEEEE29__is_implicitly_constructibleIS4_T0_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm1EJxxEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16)) 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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #6

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 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { 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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10, !17, !16}


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