; LLVM IR from HRI-EU/Rcs :: src/RcsCore/PeriodicCallback.ll (ZN3Rcs16PeriodicCallbackC2Ev)

; 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::allocator" = type { i8 }
%"class.Rcs::PeriodicCallback" = type { ptr, i8, i8, double, double, double, double, double, double, double, i64, i64, i32, i32, i64, %"class.std::__cxx11::basic_string", i32, %union.pthread_mutex_t }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@_ZTVN3Rcs16PeriodicCallbackE = external dso_local unnamed_addr constant { [23 x ptr] }, align 8
@.str.8 = external hidden unnamed_addr constant [22 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs16PeriodicCallbackC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 168) ({ [23 x ptr] }, ptr @_ZTVN3Rcs16PeriodicCallbackE, i32 0, i32 0, i32 2), ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 1
  store i8 0, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 2
  store i8 0, ptr %8, align 1, !tbaa !20
  %9 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 3
  store double 0.000000e+00, ptr %9, align 8, !tbaa !21
  %10 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 4
  store double 0.000000e+00, ptr %10, align 8, !tbaa !22
  %11 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 5
  store double 0.000000e+00, ptr %11, align 8, !tbaa !23
  %12 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 6
  store double 0x7FEFFFFFFFFFFFFF, ptr %12, align 8, !tbaa !24
  %13 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 7
  store double 0.000000e+00, ptr %13, align 8, !tbaa !25
  %14 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 8
  store double 0.000000e+00, ptr %14, align 8, !tbaa !26
  %15 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 9
  store double 0.000000e+00, ptr %15, align 8, !tbaa !27
  %16 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 10
  store i64 0, ptr %16, align 8, !tbaa !28
  %17 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 11
  store i64 0, ptr %17, align 8, !tbaa !29
  %18 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 12
  store i32 0, ptr %18, align 8, !tbaa !30
  %19 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 13
  store i32 50, ptr %19, align 4, !tbaa !31
  %20 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 15
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #4
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %20, ptr noundef @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %21 unwind label %26

21:                                               ; preds = %1
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #4
  %22 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 16
  store i32 1, ptr %22, align 8, !tbaa !32
  %23 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 17
  %24 = getelementptr inbounds %"class.Rcs::PeriodicCallback", ptr %6, i32 0, i32 17
  %25 = call i32 @pthread_mutex_init(ptr noundef %24, ptr noundef null) #4
  ret void

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

30:                                               ; preds = %26
  %31 = load ptr, ptr %4, align 8
  %32 = load i32, ptr %5, align 4
  %33 = insertvalue { ptr, i32 } poison, ptr %31, 0
  %34 = insertvalue { ptr, i32 } %33, i32 %32, 1
  resume { ptr, i32 } %34
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 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) #0

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 = { nounwind "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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 8}
!12 = !{!"_ZTSN3Rcs16PeriodicCallbackE", !13, i64 8, !13, i64 9, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !14, i64 48, !14, i64 56, !14, i64 64, !15, i64 72, !15, i64 80, !16, i64 88, !16, i64 92, !15, i64 96, !17, i64 104, !19, i64 136, !7, i64 144}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !18, i64 0, !15, i64 8, !7, i64 16}
!18 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!19 = !{!"_ZTSN3Rcs16PeriodicCallback15SynchronizeModeE", !7, i64 0}
!20 = !{!12, !13, i64 9}
!21 = !{!12, !14, i64 16}
!22 = !{!12, !14, i64 24}
!23 = !{!12, !14, i64 32}
!24 = !{!12, !14, i64 40}
!25 = !{!12, !14, i64 48}
!26 = !{!12, !14, i64 56}
!27 = !{!12, !14, i64 64}
!28 = !{!12, !15, i64 72}
!29 = !{!12, !15, i64 80}
!30 = !{!12, !16, i64 88}
!31 = !{!12, !16, i64 92}
!32 = !{!12, !19, i64 136}


; 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::allocator" = type { i8 }

@_ZTVN3Rcs16PeriodicCallbackE = external dso_local unnamed_addr constant { [23 x ptr] }, align 8
@.str.8 = external hidden unnamed_addr constant [22 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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs16PeriodicCallbackC2Ev(ptr noundef nonnull align 8 dereferenceable(184) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::allocator", align 1
  store ptr getelementptr inbounds inrange(-16, 168) (i8, ptr @_ZTVN3Rcs16PeriodicCallbackE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store i8 0, ptr %3, align 8, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 9
  store i8 0, ptr %4, align 1, !tbaa !19
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %5, i8 0, i64 24, i1 false)
  store double 0x7FEFFFFFFFFFFFFF, ptr %6, align 8, !tbaa !20
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = getelementptr inbounds i8, ptr %0, i64 92
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(44) %7, i8 0, i64 44, i1 false)
  store i32 50, ptr %8, align 4, !tbaa !21
  %9 = getelementptr inbounds i8, ptr %0, i64 104
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull @.str.8, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %10 unwind label %14

10:                                               ; preds = %1
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  %11 = getelementptr inbounds i8, ptr %0, i64 136
  store i32 1, ptr %11, align 8, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 144
  %13 = call i32 @pthread_mutex_init(ptr noundef nonnull %12, ptr noundef null) #5
  ret void

14:                                               ; preds = %1
  %15 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #5
  resume { ptr, i32 } %15
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 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) #0

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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 = { nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 8}
!9 = !{!"_ZTSN3Rcs16PeriodicCallbackE", !10, i64 8, !10, i64 9, !12, i64 16, !12, i64 24, !12, i64 32, !12, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !13, i64 72, !13, i64 80, !14, i64 88, !14, i64 92, !13, i64 96, !15, i64 104, !18, i64 136, !11, i64 144}
!10 = !{!"bool", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"double", !11, i64 0}
!13 = !{!"long", !11, i64 0}
!14 = !{!"int", !11, i64 0}
!15 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !16, i64 0, !13, i64 8, !11, i64 16}
!16 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !17, i64 0}
!17 = !{!"any pointer", !11, i64 0}
!18 = !{!"_ZTSN3Rcs16PeriodicCallback15SynchronizeModeE", !11, i64 0}
!19 = !{!9, !10, i64 9}
!20 = !{!9, !12, i64 40}
!21 = !{!9, !14, i64 92}
!22 = !{!9, !18, i64 136}


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