; LLVM IR from maliput/maliput :: src/maliput/api/rules/traffic_lights.ll (ZN7maliput3api5rules15BulbColorMapperEv)

; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"struct.std::pair" = type <{ %"struct.std::__detail::_Node_iterator", i8, [7 x i8] }>
%"struct.std::__detail::_Node_iterator" = type { %"struct.std::__detail::_Node_iterator_base" }
%"struct.std::__detail::_Node_iterator_base" = type { ptr }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7maliput3api5rules15BulbColorMapperEv(ptr dead_on_unwind noalias writable sret(%"class.std::unordered_map") align 8 %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i1, align 1
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %"struct.std::pair", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca %"struct.std::pair", align 8
  store ptr %0, ptr %2, align 8
  store i1 false, ptr %3, align 1
  call void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  %12 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA4_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 1 dereferenceable(4) @.str)
          to label %13 unwind label %31

13:                                               ; preds = %1
  %14 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %15 = extractvalue { ptr, i8 } %12, 0
  store ptr %15, ptr %14, align 8
  %16 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %17 = extractvalue { ptr, i8 } %12, 1
  store i8 %17, ptr %16, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 1, ptr %8, align 4, !tbaa !5
  %18 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA7_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 1 dereferenceable(7) @.str.1)
          to label %19 unwind label %35

19:                                               ; preds = %13
  %20 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %21 = extractvalue { ptr, i8 } %18, 0
  store ptr %21, ptr %20, align 8
  %22 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %23 = extractvalue { ptr, i8 } %18, 1
  store i8 %23, ptr %22, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 2, ptr %10, align 4, !tbaa !5
  %24 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA6_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 1 dereferenceable(6) @.str.2)
          to label %25 unwind label %39

25:                                               ; preds = %19
  %26 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 0
  %27 = extractvalue { ptr, i8 } %24, 0
  store ptr %27, ptr %26, align 8
  %28 = getelementptr inbounds { ptr, i8 }, ptr %11, i32 0, i32 1
  %29 = extractvalue { ptr, i8 } %24, 1
  store i8 %29, ptr %28, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  store i1 true, ptr %3, align 1
  %30 = load i1, ptr %3, align 1
  br i1 %30, label %44, label %43

31:                                               ; preds = %1
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %5, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %45

35:                                               ; preds = %13
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %5, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %45

39:                                               ; preds = %19
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %5, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %45

43:                                               ; preds = %25
  call void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  br label %44

44:                                               ; preds = %43, %25
  ret void

45:                                               ; preds = %39, %35, %31
  call void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %5, align 8
  %48 = load i32, ptr %6, align 4
  %49 = insertvalue { ptr, i32 } poison, ptr %47, 0
  %50 = insertvalue { ptr, i32 } %49, i32 %48, 1
  resume { ptr, i32 } %50
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA4_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4)) #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA7_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(7)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA6_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(6)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 align 2

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"_ZTSN7maliput3api5rules9BulbColorE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7maliput3api5rules15BulbColorMapperEv(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::unordered_map") align 8 %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  tail call void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  %5 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA4_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 1 dereferenceable(4) @.str)
          to label %6 unwind label %11

6:                                                ; preds = %1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  store i32 1, ptr %3, align 4, !tbaa !5
  %7 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA7_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 1 dereferenceable(7) @.str.1)
          to label %8 unwind label %13

8:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  store i32 2, ptr %4, align 4, !tbaa !5
  %9 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA6_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56) %0, ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 1 dereferenceable(6) @.str.2)
          to label %10 unwind label %15

10:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret void

11:                                               ; preds = %1
  %12 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  br label %17

13:                                               ; preds = %6
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  br label %17

15:                                               ; preds = %8
  %16 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  br label %17

17:                                               ; preds = %15, %13, %11
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %14, %13 ], [ %12, %11 ]
  call void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA4_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(4)) local_unnamed_addr #0 align 2

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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA7_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(7)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEE7emplaceIJS3_RA6_S4_EEESD_INSt8__detail14_Node_iteratorISF_Lb0ELb0EEEbEDpOT_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 1 dereferenceable(6)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIN7maliput3api5rules9BulbColorEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 align 2

attributes #0 = { 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 #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"_ZTSN7maliput3api5rules9BulbColorE", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass