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

; 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.2" = type { %"class.std::_Hashtable.3" }
%"class.std::_Hashtable.3" = 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.19" = type <{ %"struct.std::__detail::_Node_iterator.21", i8, [7 x i8] }>
%"struct.std::__detail::_Node_iterator.21" = type { %"struct.std::__detail::_Node_iterator_base.22" }
%"struct.std::__detail::_Node_iterator_base.22" = type { ptr }

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

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

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) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7maliput3api5rules14BulbTypeMapperEv(ptr dead_on_unwind noalias writable sret(%"class.std::unordered_map.2") align 8 %0) #1 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.19", align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair.19", align 8
  store ptr %0, ptr %2, align 8
  store i1 false, ptr %3, align 1
  call void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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
  %10 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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.3)
          to label %11 unwind label %23

11:                                               ; preds = %1
  %12 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 0
  %13 = extractvalue { ptr, i8 } %10, 0
  store ptr %13, ptr %12, align 8
  %14 = getelementptr inbounds { ptr, i8 }, ptr %7, i32 0, i32 1
  %15 = extractvalue { ptr, i8 } %10, 1
  store i8 %15, ptr %14, 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
  %16 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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) %8, ptr noundef nonnull align 1 dereferenceable(6) @.str.4)
          to label %17 unwind label %27

17:                                               ; preds = %11
  %18 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %19 = extractvalue { ptr, i8 } %16, 0
  store ptr %19, ptr %18, align 8
  %20 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %21 = extractvalue { ptr, i8 } %16, 1
  store i8 %21, ptr %20, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  store i1 true, ptr %3, align 1
  %22 = load i1, ptr %3, align 1
  br i1 %22, label %32, label %31

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

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

31:                                               ; preds = %17
  call void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  br label %32

32:                                               ; preds = %31, %17
  ret void

33:                                               ; preds = %27, %23
  call void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %0) #4
  br label %34

34:                                               ; preds = %33
  %35 = load ptr, ptr %5, align 8
  %36 = load i32, ptr %6, align 4
  %37 = insertvalue { ptr, i32 } poison, ptr %35, 0
  %38 = insertvalue { ptr, i32 } %37, i32 %36, 1
  resume { ptr, i32 } %38
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 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 = { 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 = !{!"_ZTSN7maliput3api5rules8BulbTypeE", !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.2" = type { %"class.std::_Hashtable.3" }
%"class.std::_Hashtable.3" = 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.3 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

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

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) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN7maliput3api5rules14BulbTypeMapperEv(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::unordered_map.2") align 8 %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  tail call void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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
  %4 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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) %2, ptr noundef nonnull align 1 dereferenceable(6) @.str.3)
          to label %5 unwind label %8

5:                                                ; 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
  %6 = invoke { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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) %3, ptr noundef nonnull align 1 dereferenceable(6) @.str.4)
          to label %7 unwind label %10

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

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

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

12:                                               ; preds = %10, %8
  %.pn = phi { ptr, i32 } [ %11, %10 ], [ %9, %8 ]
  call void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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_mapIN7maliput3api5rules8BulbTypeEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_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 #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIN7maliput3api5rules8BulbTypeEPKcNS0_6common5uhashINS6_8internal11FNV1aHasherEEESt8equal_toIS3_ESaISt4pairIKS3_S5_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 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 = { 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 = !{!"_ZTSN7maliput3api5rules8BulbTypeE", !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