; LLVM IR from kazunetakahashi/atcoder :: 2017/1104_ddcc2017-final/D.ll (Z5valueSt5tupleIJxiiEE)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::tuple<long long, int, int>, std::pair<const std::tuple<long long, int, int>, long long>, std::_Select1st<std::pair<const std::tuple<long long, int, int>, long long>>, std::less<std::tuple<long long, int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::tuple<long long, int, int>, std::pair<const std::tuple<long long, int, int>, long long>, std::_Select1st<std::pair<const std::tuple<long long, int, int>, long long>>, std::less<std::tuple<long long, int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.8", %"struct.std::_Head_base.11" }
%"struct.std::_Tuple_impl.8" = type { %"struct.std::_Tuple_impl.9", %"struct.std::_Head_base.10" }
%"struct.std::_Tuple_impl.9" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i32 }
%"struct.std::_Head_base.10" = type { i32 }
%"struct.std::_Head_base.11" = type { i64 }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { %"class.std::tuple", i64 }

@dp = external dso_local global %"class.std::map", align 8
@N = external dso_local global i32, align 4

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5valueSt5tupleIJxiiEE(ptr noundef %0) #1 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::tuple", align 8
  %7 = alloca i32, align 4
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::tuple", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  %16 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %16, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %17 = load i64, ptr %4, align 8, !tbaa !9
  %18 = call noundef i32 @_Z7cnt_onex(i64 noundef %17)
  store i32 %18, ptr %5, align 4, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %0, i64 16, i1 false)
  %19 = call noundef zeroext i1 @_Z5validSt5tupleIJxiiEE(ptr noundef %6)
  br i1 %19, label %21, label %20

20:                                               ; preds = %1
  store i64 0, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %78

21:                                               ; preds = %1
  %22 = load i32, ptr %5, align 4, !tbaa !11
  %23 = icmp eq i32 %22, 2
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i64 1, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %78

25:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %26 = call ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 8 dereferenceable(16) %0)
  %27 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %26, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %28 = call ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @dp) #6
  %29 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %9, i32 0, i32 0
  store ptr %28, ptr %29, align 8
  %30 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEES7_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br i1 %30, label %31, label %35

31:                                               ; preds = %25
  %32 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  %33 = getelementptr inbounds %"struct.std::pair", ptr %32, i32 0, i32 1
  %34 = load i64, ptr %33, align 8, !tbaa !13
  store i64 %34, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %77

35:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  store ptr %36, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  store ptr %37, ptr %12, align 8, !tbaa !5
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = zext i32 %39 to i64
  %41 = shl i64 1, %40
  %42 = load i64, ptr %4, align 8, !tbaa !9
  %43 = sub nsw i64 %42, %41
  store i64 %43, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %44

44:                                               ; preds = %70, %35
  %45 = load i32, ptr %13, align 4, !tbaa !11
  %46 = load i32, ptr @N, align 4, !tbaa !11
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %73

49:                                               ; preds = %44
  %50 = load i32, ptr %13, align 4, !tbaa !11
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load i32, ptr %51, align 4, !tbaa !11
  %53 = icmp eq i32 %50, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  br label %70

55:                                               ; preds = %49
  %56 = load i64, ptr %4, align 8, !tbaa !9
  %57 = load i32, ptr %13, align 4, !tbaa !11
  %58 = zext i32 %57 to i64
  %59 = shl i64 1, %58
  %60 = and i64 %56, %59
  %61 = icmp eq i64 %60, 0
  br i1 %61, label %62, label %63

62:                                               ; preds = %55
  br label %70

63:                                               ; preds = %55
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  call void @_ZNSt5tupleIJxiiEEC2IJRxRiRKiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS7_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %64) #6
  %65 = call noundef i64 @_Z5valueSt5tupleIJxiiEE(ptr noundef %14)
  %66 = load i64, ptr %10, align 8, !tbaa !9
  %67 = add nsw i64 %66, %65
  store i64 %67, ptr %10, align 8, !tbaa !9
  %68 = load i64, ptr %10, align 8, !tbaa !9
  %69 = srem i64 %68, 1000000007
  store i64 %69, ptr %10, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %63, %62, %54
  %71 = load i32, ptr %13, align 4, !tbaa !11
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %13, align 4, !tbaa !11
  br label %44, !llvm.loop !22

73:                                               ; preds = %48
  %74 = load i64, ptr %10, align 8, !tbaa !9
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 8 dereferenceable(16) %0)
  store i64 %74, ptr %75, align 8, !tbaa !9
  %76 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %76, ptr %2, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %77

77:                                               ; preds = %73, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %78

78:                                               ; preds = %77, %24, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %79 = load i64, ptr %2, align 8
  ret i64 %79
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7cnt_onex(i64 noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5validSt5tupleIJxiiEE(ptr noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxiiEEC2IJRxRiRKiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS7_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"any pointer", !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 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !10, i64 16}
!14 = !{!"_ZTSSt4pairIKSt5tupleIJxiiEExE", !15, i64 0, !10, i64 16}
!15 = !{!"_ZTSSt5tupleIJxiiEE", !16, i64 0}
!16 = !{!"_ZTSSt11_Tuple_implILm0EJxiiEE", !17, i64 0, !21, i64 8}
!17 = !{!"_ZTSSt11_Tuple_implILm1EJiiEE", !18, i64 0, !20, i64 4}
!18 = !{!"_ZTSSt11_Tuple_implILm2EJiEE", !19, i64 0}
!19 = !{!"_ZTSSt10_Head_baseILm2EiLb0EE", !12, i64 0}
!20 = !{!"_ZTSSt10_Head_baseILm1EiLb0EE", !12, i64 0}
!21 = !{!"_ZTSSt10_Head_baseILm0ExLb0EE", !10, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::tuple<long long, int, int>, std::pair<const std::tuple<long long, int, int>, long long>, std::_Select1st<std::pair<const std::tuple<long long, int, int>, long long>>, std::less<std::tuple<long long, int, int>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::tuple<long long, int, int>, std::pair<const std::tuple<long long, int, int>, long long>, std::_Select1st<std::pair<const std::tuple<long long, int, int>, long long>>, std::less<std::tuple<long long, int, int>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Tuple_impl.8", %"struct.std::_Head_base.11" }
%"struct.std::_Tuple_impl.8" = type { %"struct.std::_Tuple_impl.9", %"struct.std::_Head_base.10" }
%"struct.std::_Tuple_impl.9" = type { %"struct.std::_Head_base" }
%"struct.std::_Head_base" = type { i32 }
%"struct.std::_Head_base.10" = type { i32 }
%"struct.std::_Head_base.11" = type { i64 }
%"struct.std::_Rb_tree_iterator" = type { ptr }

@dp = external dso_local global %"class.std::map", align 8
@N = external dso_local local_unnamed_addr global i32, align 4

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_Z5valueSt5tupleIJxiiEE(ptr noundef nonnull %0) local_unnamed_addr #1 {
  %2 = alloca i64, align 8
  %3 = alloca %"class.std::tuple", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::tuple", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3getILm0EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  %9 = load i64, ptr %8, align 8, !tbaa !5
  %10 = tail call noundef i32 @_Z7cnt_onex(i64 noundef %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %0, i64 16, i1 false)
  %11 = call noundef zeroext i1 @_Z5validSt5tupleIJxiiEE(ptr noundef nonnull %3)
  br i1 %11, label %12, label %50

12:                                               ; preds = %1
  %13 = icmp eq i32 %10, 2
  br i1 %13, label %50, label %14

14:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %15 = call ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 8 dereferenceable(16) %0)
  store ptr %15, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %16 = call ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @dp) #6
  store ptr %16, ptr %5, align 8
  %17 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEES7_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br i1 %17, label %18, label %22

18:                                               ; preds = %14
  %19 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  %20 = getelementptr inbounds i8, ptr %19, i64 16
  %21 = load i64, ptr %20, align 8, !tbaa !9
  br label %49

22:                                               ; preds = %14
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm1EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3getILm2EJxiiEERNSt13tuple_elementIXT_ESt5tupleIJDpT0_EEE4typeERS4_(ptr noundef nonnull align 8 dereferenceable(16) %0) #6
  %25 = load i32, ptr %24, align 4, !tbaa !19
  %26 = zext nneg i32 %25 to i64
  %.neg = shl nsw i64 -1, %26
  %27 = add i64 %.neg, %9
  store i64 %27, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  store i32 0, ptr %6, align 4, !tbaa !19
  %28 = load i32, ptr @N, align 4, !tbaa !19
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %44, %22
  %.08.lcssa = phi i64 [ 0, %22 ], [ %.19, %44 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48) @dp, ptr noundef nonnull align 8 dereferenceable(16) %0)
  store i64 %.08.lcssa, ptr %30, align 8, !tbaa !5
  br label %49

.lr.ph:                                           ; preds = %22, %44
  %31 = phi i32 [ %45, %44 ], [ %28, %22 ]
  %.0812 = phi i64 [ %.19, %44 ], [ 0, %22 ]
  %storemerge11 = phi i32 [ %47, %44 ], [ 0, %22 ]
  %32 = load i32, ptr %23, align 4, !tbaa !19
  %33 = icmp eq i32 %storemerge11, %32
  br i1 %33, label %44, label %34

34:                                               ; preds = %.lr.ph
  %35 = load i64, ptr %2, align 8, !tbaa !5
  %36 = zext nneg i32 %storemerge11 to i64
  %37 = shl nuw i64 1, %36
  %38 = and i64 %35, %37
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %44, label %40

40:                                               ; preds = %34
  call void @_ZNSt5tupleIJxiiEEC2IJRxRiRKiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS7_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %23) #6
  %41 = call noundef i64 @_Z5valueSt5tupleIJxiiEE(ptr noundef nonnull %7)
  %42 = add nsw i64 %41, %.0812
  %43 = srem i64 %42, 1000000007
  %.pre = load i32, ptr %6, align 4, !tbaa !19
  %.pre13 = load i32, ptr @N, align 4, !tbaa !19
  br label %44

44:                                               ; preds = %34, %.lr.ph, %40
  %45 = phi i32 [ %31, %.lr.ph ], [ %31, %34 ], [ %.pre13, %40 ]
  %46 = phi i32 [ %storemerge11, %.lr.ph ], [ %storemerge11, %34 ], [ %.pre, %40 ]
  %.19 = phi i64 [ %.0812, %.lr.ph ], [ %.0812, %34 ], [ %43, %40 ]
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !19
  %48 = icmp slt i32 %47, %45
  br i1 %48, label %.lr.ph, label %._crit_edge, !llvm.loop !20

49:                                               ; preds = %._crit_edge, %18
  %.0 = phi i64 [ %21, %18 ], [ %.08.lcssa, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  br label %50

50:                                               ; preds = %12, %1, %49
  %.1 = phi i64 [ %.0, %49 ], [ 0, %1 ], [ 1, %12 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret i64 %.1
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7cnt_onex(i64 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5validSt5tupleIJxiiEE(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKSt5tupleIJxiiEExEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5tupleIJxiiEEC2IJRxRiRKiELb1ETnNSt9enable_ifIXclsr4_TCCIXT0_EEE29__is_implicitly_constructibleIDpT_EEEbE4typeELb1EEEDpOS7_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt5tupleIJxiiEExSt4lessIS1_ESaISt4pairIKS1_xEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #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 = { 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_ZTSSt4pairIKSt5tupleIJxiiEExE", !11, i64 0, !6, i64 16}
!11 = !{!"_ZTSSt5tupleIJxiiEE", !12, i64 0}
!12 = !{!"_ZTSSt11_Tuple_implILm0EJxiiEE", !13, i64 0, !18, i64 8}
!13 = !{!"_ZTSSt11_Tuple_implILm1EJiiEE", !14, i64 0, !17, i64 4}
!14 = !{!"_ZTSSt11_Tuple_implILm2EJiEE", !15, i64 0}
!15 = !{!"_ZTSSt10_Head_baseILm2EiLb0EE", !16, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSSt10_Head_baseILm1EiLb0EE", !16, i64 0}
!18 = !{!"_ZTSSt10_Head_baseILm0ExLb0EE", !6, i64 0}
!19 = !{!16, !16, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass