; LLVM IR from ShahjalalShohag/code-library :: Data Structures (Implicit Treap)

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

%struct.treap = type <{ ptr, %"class.std::map", i8, [7 x i8] }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, treap::node *>, std::_Select1st<std::pair<const int, treap::node *>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, treap::node *>, std::_Select1st<std::pair<const int, treap::node *>>, std::less<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::basic_ostream" = type { ptr, %"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 }

@t = external dso_local global %struct.treap, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

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

13:                                               ; preds = %10
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = mul nsw i32 %15, 10
  call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef %14, i32 noundef %16)
  br label %17

17:                                               ; preds = %13
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !9

20:                                               ; preds = %10
  call void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 4, i32 noundef 5, i32 noundef 1, i1 noundef zeroext false)
  call void @_ZN5treap6updateEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 1)
  call void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 100)
  call void @_ZN5treap7reverseEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 9)
  call void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 200)
  %21 = call noundef i32 @_ZN5treap5queryEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 0, i32 noundef 7)
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %21)
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %22, i8 noundef signext 10)
  call void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 3, i32 noundef 2, i1 noundef zeroext true)
  %24 = call noundef i32 @_ZN5treap7get_posEi(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 20)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %24)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %25, i8 noundef signext 10)
  call void @_ZN5treap5eraseEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 2)
  %27 = call noundef zeroext i1 @_ZN5treap4findEi(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 30)
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i1 noundef zeroext %27)
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %28, i8 noundef signext 10)
  call void @_ZN5treap11print_arrayEv(ptr noundef nonnull align 8 dereferenceable(57) @t)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap6updateEiii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap7reverseEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5treap5queryEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5treap7get_posEi(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap5eraseEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap11print_arrayEv(ptr noundef nonnull align 8 dereferenceable(57)) #2 align 2

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

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

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


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

%struct.treap = type <{ ptr, %"class.std::map", i8, [7 x i8] }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, treap::node *>, std::_Select1st<std::pair<const int, treap::node *>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, treap::node *>, std::_Select1st<std::pair<const int, treap::node *>>, std::less<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::basic_ostream" = type { ptr, %"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 }

@t = external dso_local global %struct.treap, 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 {
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 0, i32 noundef 0)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 1, i32 noundef 10)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 20)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 3, i32 noundef 30)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 4, i32 noundef 40)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 5, i32 noundef 50)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 6, i32 noundef 60)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 7, i32 noundef 70)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 8, i32 noundef 80)
  tail call void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 9, i32 noundef 90)
  tail call void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 4, i32 noundef 5, i32 noundef 1, i1 noundef zeroext false)
  tail call void @_ZN5treap6updateEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 1)
  tail call void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 100)
  tail call void @_ZN5treap7reverseEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 9)
  tail call void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 5, i32 noundef 200)
  %1 = tail call noundef i32 @_ZN5treap5queryEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 0, i32 noundef 7)
  %2 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %1)
  %3 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %2, i8 noundef signext 10)
  tail call void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 3, i32 noundef 2, i1 noundef zeroext true)
  %4 = tail call noundef i32 @_ZN5treap7get_posEi(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 20)
  %5 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %4)
  %6 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %5, i8 noundef signext 10)
  tail call void @_ZN5treap5eraseEii(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 2, i32 noundef 2)
  %7 = tail call noundef zeroext i1 @_ZN5treap4findEi(ptr noundef nonnull align 8 dereferenceable(57) @t, i32 noundef 30)
  %8 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEb(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i1 noundef zeroext %7)
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %8, i8 noundef signext 10)
  tail call void @_ZN5treap11print_arrayEv(ptr noundef nonnull align 8 dereferenceable(57) @t)
  ret i32 0
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap6insertEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap12cyclic_shiftEiiib(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap6updateEiii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap7replaceEiii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap7reverseEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5treap5queryEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5treap7get_posEi(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap5eraseEii(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN5treap4findEi(ptr noundef nonnull align 8 dereferenceable(57), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5treap11print_arrayEv(ptr noundef nonnull align 8 dereferenceable(57)) local_unnamed_addr #1 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { 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 #3 = { "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" }

!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)"}


; Effective O3 passes: GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass