; LLVM IR from mhsitu/welding_robot :: coppeliaSim-client/common/stack/stackMap.ll (ZN9CStackMap8containsEiimb)

; 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.std::_Rb_tree_iterator.15" = type { ptr }
%class.CStackMap = type { %class.CStackObject.base, %"class.std::map", %"class.std::map.0", %"class.std::map.6" }
%class.CStackObject.base = type <{ ptr, i32 }>
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, CStackObject *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, CStackObject *>>, std::less<std::__cxx11::basic_string<char>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::__cxx11::basic_string<char>, std::pair<const std::__cxx11::basic_string<char>, CStackObject *>, std::_Select1st<std::pair<const std::__cxx11::basic_string<char>, CStackObject *>>, std::less<std::__cxx11::basic_string<char>>>::_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::map.0" = type { %"class.std::_Rb_tree.1" }
%"class.std::_Rb_tree.1" = type { %"struct.std::_Rb_tree<int, std::pair<const int, CStackObject *>, std::_Select1st<std::pair<const int, CStackObject *>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, CStackObject *>, std::_Select1st<std::pair<const int, CStackObject *>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"class.std::map.6" = type { %"class.std::_Rb_tree.7" }
%"class.std::_Rb_tree.7" = type { %"struct.std::_Rb_tree<bool, std::pair<const bool, CStackObject *>, std::_Select1st<std::pair<const bool, CStackObject *>>, std::less<bool>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<bool, std::pair<const bool, CStackObject *>, std::_Select1st<std::pair<const bool, CStackObject *>>, std::less<bool>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::pair.16" = type { i32, ptr }

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

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

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

declare noundef i32 @_ZNK12CStackObject13getObjectTypeEv(ptr noundef nonnull align 8 dereferenceable(12)) #3

declare noundef i64 @_ZN11CStackArray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(89)) #3

declare noundef zeroext i1 @_ZN11CStackArray13isNumberArrayEv(ptr noundef nonnull align 8 dereferenceable(89)) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9CStackMap8containsEiimb(ptr noundef nonnull align 8 dereferenceable(160) %0, i32 noundef %1, i32 noundef %2, i64 noundef %3, i1 noundef zeroext %4) #2 align 2 {
  %6 = alloca i1, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i8, align 1
  %12 = alloca %"struct.std::_Rb_tree_iterator.15", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator.15", align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i64 %3, ptr %10, align 8, !tbaa !11
  %16 = zext i1 %4 to i8
  store i8 %16, ptr %11, align 1, !tbaa !13
  %17 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %18 = getelementptr inbounds %class.CStackMap, ptr %17, i32 0, i32 2
  %19 = call ptr @_ZNSt3mapIiP12CStackObjectSt4lessIiESaISt4pairIKiS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %18, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %20 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.15", ptr %12, i32 0, i32 0
  store ptr %19, ptr %20, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %21 = getelementptr inbounds %class.CStackMap, ptr %17, i32 0, i32 2
  %22 = call ptr @_ZNSt3mapIiP12CStackObjectSt4lessIiESaISt4pairIKiS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %21) #4
  %23 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.15", ptr %13, i32 0, i32 0
  store ptr %22, ptr %23, align 8
  %24 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  br i1 %24, label %25, label %37

25:                                               ; preds = %5
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = icmp eq i32 %26, -1
  br i1 %27, label %35, label %28

28:                                               ; preds = %25
  %29 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %30 = getelementptr inbounds %"struct.std::pair.16", ptr %29, i32 0, i32 1
  %31 = load ptr, ptr %30, align 8, !tbaa !15
  %32 = call noundef i32 @_ZNK12CStackObject13getObjectTypeEv(ptr noundef nonnull align 8 dereferenceable(12) %31)
  %33 = load i32, ptr %9, align 4, !tbaa !9
  %34 = icmp eq i32 %32, %33
  br label %35

35:                                               ; preds = %28, %25
  %36 = phi i1 [ true, %25 ], [ %34, %28 ]
  br label %37

37:                                               ; preds = %35, %5
  %38 = phi i1 [ false, %5 ], [ %36, %35 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br i1 %38, label %39, label %63

39:                                               ; preds = %37
  %40 = load i32, ptr %9, align 4, !tbaa !9
  %41 = icmp ne i32 %40, 4
  br i1 %41, label %42, label %43

42:                                               ; preds = %39
  store i1 true, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %64

43:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %44 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #4
  %45 = getelementptr inbounds %"struct.std::pair.16", ptr %44, i32 0, i32 1
  %46 = load ptr, ptr %45, align 8, !tbaa !15
  store ptr %46, ptr %15, align 8, !tbaa !5
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = call noundef i64 @_ZN11CStackArray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(89) %47)
  %49 = load i64, ptr %10, align 8, !tbaa !11
  %50 = icmp uge i64 %48, %49
  br i1 %50, label %51, label %59

51:                                               ; preds = %43
  %52 = load i8, ptr %11, align 1, !tbaa !13, !range !17, !noundef !18
  %53 = trunc i8 %52 to i1
  br i1 %53, label %54, label %57

54:                                               ; preds = %51
  %55 = load ptr, ptr %15, align 8, !tbaa !5
  %56 = call noundef zeroext i1 @_ZN11CStackArray13isNumberArrayEv(ptr noundef nonnull align 8 dereferenceable(89) %55)
  br label %57

57:                                               ; preds = %54, %51
  %58 = phi i1 [ true, %51 ], [ %56, %54 ]
  store i1 %58, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %60

59:                                               ; preds = %43
  store i32 0, ptr %14, align 4
  br label %60

60:                                               ; preds = %59, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %61 = load i32, ptr %14, align 4
  switch i32 %61, label %64 [
    i32 0, label %62
  ]

62:                                               ; preds = %60
  br label %63

63:                                               ; preds = %62, %37
  store i1 false, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %64

64:                                               ; preds = %63, %60, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  %65 = load i1, ptr %6, align 1
  ret i1 %65
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIKiP12CStackObjectE", !10, i64 0, !6, i64 8}
!17 = !{i8 0, i8 2}
!18 = !{}


; 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.std::_Rb_tree_iterator.15" = type { ptr }

; 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1

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

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

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

declare noundef i32 @_ZNK12CStackObject13getObjectTypeEv(ptr noundef nonnull align 8 dereferenceable(12)) local_unnamed_addr #3

declare noundef i64 @_ZN11CStackArray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(89)) local_unnamed_addr #3

declare noundef zeroext i1 @_ZN11CStackArray13isNumberArrayEv(ptr noundef nonnull align 8 dereferenceable(89)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN9CStackMap8containsEiimb(ptr noundef nonnull align 8 dereferenceable(160) %0, i32 noundef %1, i32 noundef %2, i64 noundef %3, i1 noundef zeroext %4) local_unnamed_addr #2 align 2 {
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::_Rb_tree_iterator.15", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator.15", align 8
  store i32 %1, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %9 = getelementptr inbounds i8, ptr %0, i64 64
  %10 = call ptr @_ZNSt3mapIiP12CStackObjectSt4lessIiESaISt4pairIKiS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %9, ptr noundef nonnull align 4 dereferenceable(4) %6)
  store ptr %10, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %11 = call ptr @_ZNSt3mapIiP12CStackObjectSt4lessIiESaISt4pairIKiS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %9) #4
  store ptr %11, ptr %8, align 8
  %12 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br i1 %12, label %13, label %.critedge

13:                                               ; preds = %5
  %14 = icmp eq i32 %2, -1
  br i1 %14, label %.thread, label %15

15:                                               ; preds = %13
  %16 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %17 = getelementptr inbounds i8, ptr %16, i64 8
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = call noundef i32 @_ZNK12CStackObject13getObjectTypeEv(ptr noundef nonnull align 8 dereferenceable(12) %18)
  %20 = icmp eq i32 %19, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br i1 %20, label %21, label %30

.thread:                                          ; preds = %13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %31

21:                                               ; preds = %15
  %.not = icmp eq i32 %2, 4
  br i1 %.not, label %22, label %31

22:                                               ; preds = %21
  %23 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKiP12CStackObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #4
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = call noundef i64 @_ZN11CStackArray7getSizeEv(ptr noundef nonnull align 8 dereferenceable(89) %25)
  %.not13 = icmp uge i64 %26, %3
  %brmerge.not = and i1 %.not13, %4
  br i1 %brmerge.not, label %27, label %29

27:                                               ; preds = %22
  %28 = call noundef zeroext i1 @_ZN11CStackArray13isNumberArrayEv(ptr noundef nonnull align 8 dereferenceable(89) %25)
  br label %29

29:                                               ; preds = %22, %27
  %.0 = phi i1 [ %28, %27 ], [ true, %22 ]
  br i1 %.not13, label %31, label %30

.critedge:                                        ; preds = %5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  br label %30

30:                                               ; preds = %29, %.critedge, %15
  br label %31

31:                                               ; preds = %.thread, %21, %29, %30
  %.1 = phi i1 [ false, %30 ], [ %.0, %29 ], [ true, %21 ], [ true, %.thread ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #4
  ret i1 %.1
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { "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 = { 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, !11, i64 8}
!10 = !{!"_ZTSSt4pairIKiP12CStackObjectE", !6, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,ReassociatePass,SROAPass,SimplifyCFGPass