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

; 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.18" = 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.19" = type { i8, 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_iteratorISt4pairIKbP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) #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 @_ZN9CStackMap8containsEbimb(ptr noundef nonnull align 8 dereferenceable(160) %0, i1 noundef zeroext %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 i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  %11 = alloca i8, align 1
  %12 = alloca %"struct.std::_Rb_tree_iterator.18", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator.18", align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  %16 = zext i1 %1 to i8
  store i8 %16, ptr %8, align 1, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !11
  store i64 %3, ptr %10, align 8, !tbaa !13
  %17 = zext i1 %4 to i8
  store i8 %17, ptr %11, align 1, !tbaa !9
  %18 = load ptr, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %19 = getelementptr inbounds %class.CStackMap, ptr %18, i32 0, i32 3
  %20 = call ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %19, ptr noundef nonnull align 1 dereferenceable(1) %8)
  %21 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.18", ptr %12, i32 0, i32 0
  store ptr %20, ptr %21, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %22 = getelementptr inbounds %class.CStackMap, ptr %18, i32 0, i32 3
  %23 = call ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %22) #4
  %24 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.18", ptr %13, i32 0, i32 0
  store ptr %23, ptr %24, align 8
  %25 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKbP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #4
  br i1 %25, label %26, label %38

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

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

36:                                               ; preds = %29, %26
  %37 = phi i1 [ true, %26 ], [ %35, %29 ]
  br label %38

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

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

43:                                               ; preds = %40
  store i1 true, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %65

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

52:                                               ; preds = %44
  %53 = load i8, ptr %11, align 1, !tbaa !9, !range !17, !noundef !18
  %54 = trunc i8 %53 to i1
  br i1 %54, label %55, label %58

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

58:                                               ; preds = %55, %52
  %59 = phi i1 [ true, %52 ], [ %57, %55 ]
  store i1 %59, ptr %6, align 1
  store i32 1, ptr %14, align 4
  br label %61

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

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

63:                                               ; preds = %61
  br label %64

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

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

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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIKbP12CStackObjectE", !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.18" = 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_iteratorISt4pairIKbP12CStackObjectEES7_(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 @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_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_iteratorISt4pairIKbP12CStackObjectEEptEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 1 dereferenceable(1)) 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 @_ZN9CStackMap8containsEbimb(ptr noundef nonnull align 8 dereferenceable(160) %0, i1 noundef zeroext %1, i32 noundef %2, i64 noundef %3, i1 noundef zeroext %4) local_unnamed_addr #2 align 2 {
  %6 = alloca i8, align 1
  %7 = alloca %"struct.std::_Rb_tree_iterator.18", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator.18", align 8
  %9 = zext i1 %1 to i8
  store i8 %9, ptr %6, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #4
  %10 = getelementptr inbounds i8, ptr %0, i64 112
  %11 = call ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE4findERS5_(ptr noundef nonnull align 8 dereferenceable(48) %10, ptr noundef nonnull align 1 dereferenceable(1) %6)
  store ptr %11, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  %12 = call ptr @_ZNSt3mapIbP12CStackObjectSt4lessIbESaISt4pairIKbS1_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %10) #4
  store ptr %12, ptr %8, align 8
  %13 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKbP12CStackObjectEES7_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #4
  br i1 %13, label %14, label %.critedge

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

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

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

22:                                               ; preds = %16
  %.not = icmp eq i32 %2, 4
  br i1 %.not, label %23, label %32

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

28:                                               ; preds = %23
  %29 = call noundef zeroext i1 @_ZN11CStackArray13isNumberArrayEv(ptr noundef nonnull align 8 dereferenceable(89) %26)
  br label %30

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

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

31:                                               ; preds = %30, %.critedge, %16
  br label %32

32:                                               ; preds = %.thread, %22, %30, %31
  %.1 = phi i1 [ false, %31 ], [ %.0, %30 ], [ true, %22 ], [ 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"_ZTSSt4pairIKbP12CStackObjectE", !6, i64 0, !11, i64 8}
!11 = !{!"any pointer", !7, i64 0}


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