; LLVM IR from HRI-EU/Rcs :: src/RcsCore (MotionControlLayer)

; 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.Rcs::MotionControlLayer" = type { ptr, ptr, ptr, %"class.std::vector", ptr, i8, i8, i8, i8, i32, i32, double, double, double, double }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Rcs::HardwareComponent *, std::allocator<Rcs::HardwareComponent *>>::_Vector_impl" }
%"struct.std::_Vector_base<Rcs::HardwareComponent *, std::allocator<Rcs::HardwareComponent *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Rcs::HardwareComponent *, std::allocator<Rcs::HardwareComponent *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Rcs::HardwareComponent *, std::allocator<Rcs::HardwareComponent *>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@RcsLogLevel = external global i32, align 4
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8
  %7 = load ptr, ptr %5, align 8, !tbaa !5
  %8 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = icmp eq ptr %7, %9
  br i1 %10, label %11, label %51

11:                                               ; preds = %2
  br label %12

12:                                               ; preds = %11
  %13 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %28

15:                                               ; preds = %12
  %16 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %25

19:                                               ; preds = %15
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %22 = getelementptr inbounds ptr, ptr %21, i64 5
  %23 = load ptr, ptr %22, align 8
  %24 = call noundef ptr %23(ptr noundef nonnull align 8 dereferenceable(25) %20)
  br label %26

25:                                               ; preds = %15
  br label %26

26:                                               ; preds = %25, %19
  %27 = phi ptr [ %24, %19 ], [ @.str.21, %25 ]
  call void (i32, ptr, ptr, i32, ptr, ...) %16(i32 noundef 1, ptr noundef @.str.1, ptr noundef @__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE, i32 noundef 264, ptr noundef @.str.20, ptr noundef %27)
  br label %28

28:                                               ; preds = %26, %12
  %29 = load i32, ptr @RcsLogLevel, align 4, !tbaa !20
  %30 = icmp sle i32 1, %29
  br i1 %30, label %31, label %49

31:                                               ; preds = %28
  %32 = load ptr, ptr @stderr, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef @.str.17, ptr noundef @.str.1, ptr noundef @__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE, i32 noundef 264) #2
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %43

37:                                               ; preds = %31
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = getelementptr inbounds ptr, ptr %39, i64 5
  %41 = load ptr, ptr %40, align 8
  %42 = call noundef ptr %41(ptr noundef nonnull align 8 dereferenceable(25) %38)
  br label %44

43:                                               ; preds = %31
  br label %44

44:                                               ; preds = %43, %37
  %45 = phi ptr [ %42, %37 ], [ @.str.21, %43 ]
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.20, ptr noundef %45) #2
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.6) #2
  br label %49

49:                                               ; preds = %44, %28
  br label %50

50:                                               ; preds = %49
  store i1 false, ptr %3, align 1
  br label %83

51:                                               ; preds = %2
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %61

54:                                               ; preds = %51
  %55 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  %58 = getelementptr inbounds ptr, ptr %57, i64 12
  %59 = load ptr, ptr %58, align 8
  call void %59(ptr noundef nonnull align 8 dereferenceable(25) %56, ptr noundef null, ptr noundef null)
  %60 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  store ptr null, ptr %60, align 8, !tbaa !9
  br label %82

61:                                               ; preds = %51
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %81

64:                                               ; preds = %61
  %65 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = icmp ne ptr %66, null
  br i1 %67, label %68, label %74

68:                                               ; preds = %64
  %69 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  %72 = getelementptr inbounds ptr, ptr %71, i64 12
  %73 = load ptr, ptr %72, align 8
  call void %73(ptr noundef nonnull align 8 dereferenceable(25) %70, ptr noundef null, ptr noundef null)
  br label %74

74:                                               ; preds = %68, %64
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = getelementptr inbounds ptr, ptr %76, i64 12
  %78 = load ptr, ptr %77, align 8
  call void %78(ptr noundef nonnull align 8 dereferenceable(25) %75, ptr noundef @_ZN3Rcs18MotionControlLayer14staticCallbackEPv, ptr noundef %6)
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %6, i32 0, i32 4
  store ptr %79, ptr %80, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %74, %61
  br label %82

82:                                               ; preds = %81, %54
  store i1 true, ptr %3, align 1
  br label %83

83:                                               ; preds = %82, %50
  %84 = load i1, ptr %3, align 1
  ret i1 %84
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Rcs18MotionControlLayer14staticCallbackEPv(ptr noundef) #1 align 2

attributes #0 = { 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 #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 = { 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, !6, i64 48}
!10 = !{!"_ZTSN3Rcs18MotionControlLayerE", !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 48, !15, i64 56, !15, i64 57, !15, i64 58, !15, i64 59, !16, i64 60, !16, i64 64, !17, i64 72, !17, i64 80, !17, i64 88, !17, i64 96}
!11 = !{!"_ZTSSt6vectorIPN3Rcs17HardwareComponentESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !8, i64 0}
!20 = !{!16, !16, i64 0}


; 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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.6 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [16 x i8], align 1
@__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE = external hidden unnamed_addr constant [28 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #1 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 48
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = icmp ne ptr %4, %1
  br i1 %5, label %33, label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !17
  %.not14 = icmp eq ptr %7, null
  br i1 %.not14, label %16, label %8

8:                                                ; preds = %6
  %.not15 = icmp eq ptr %1, null
  br i1 %.not15, label %14, label %9

9:                                                ; preds = %8
  %10 = load ptr, ptr %1, align 8, !tbaa !18
  %11 = getelementptr inbounds i8, ptr %10, i64 40
  %12 = load ptr, ptr %11, align 8
  %13 = tail call noundef ptr %12(ptr noundef nonnull align 8 dereferenceable(25) %1)
  br label %14

14:                                               ; preds = %8, %9
  %15 = phi ptr [ %13, %9 ], [ @.str.21, %8 ]
  tail call void (i32, ptr, ptr, i32, ptr, ...) %7(i32 noundef 1, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE, i32 noundef 264, ptr noundef nonnull @.str.20, ptr noundef %15)
  br label %16

16:                                               ; preds = %14, %6
  %17 = load i32, ptr @RcsLogLevel, align 4, !tbaa !20
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %19, label %49

19:                                               ; preds = %16
  %20 = load ptr, ptr @stderr, align 8, !tbaa !17
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__._ZN3Rcs18MotionControlLayer27setCallbackTriggerComponentEPNS_17HardwareComponentE, i32 noundef 264) #2
  %22 = load ptr, ptr @stderr, align 8, !tbaa !17
  %.not16 = icmp eq ptr %1, null
  br i1 %.not16, label %28, label %23

23:                                               ; preds = %19
  %24 = load ptr, ptr %1, align 8, !tbaa !18
  %25 = getelementptr inbounds i8, ptr %24, i64 40
  %26 = load ptr, ptr %25, align 8
  %27 = tail call noundef ptr %26(ptr noundef nonnull align 8 dereferenceable(25) %1)
  br label %28

28:                                               ; preds = %19, %23
  %29 = phi ptr [ %27, %23 ], [ @.str.21, %19 ]
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.20, ptr noundef %29) #2
  %31 = load ptr, ptr @stderr, align 8, !tbaa !17
  %32 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef nonnull @.str.6) #2
  br label %49

33:                                               ; preds = %2
  %34 = icmp eq ptr %1, null
  br i1 %34, label %35, label %39

35:                                               ; preds = %33
  %36 = load ptr, ptr %4, align 8, !tbaa !18
  %37 = getelementptr inbounds i8, ptr %36, i64 96
  %38 = load ptr, ptr %37, align 8
  tail call void %38(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef null, ptr noundef null)
  br label %48

39:                                               ; preds = %33
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %44, label %40

40:                                               ; preds = %39
  %41 = load ptr, ptr %4, align 8, !tbaa !18
  %42 = getelementptr inbounds i8, ptr %41, i64 96
  %43 = load ptr, ptr %42, align 8
  tail call void %43(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef null, ptr noundef null)
  br label %44

44:                                               ; preds = %40, %39
  %45 = load ptr, ptr %1, align 8, !tbaa !18
  %46 = getelementptr inbounds i8, ptr %45, i64 96
  %47 = load ptr, ptr %46, align 8
  tail call void %47(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull @_ZN3Rcs18MotionControlLayer14staticCallbackEPv, ptr noundef nonnull %0)
  br label %48

48:                                               ; preds = %44, %35
  store ptr %1, ptr %3, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %28, %16, %48
  ret i1 %5
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3Rcs18MotionControlLayer14staticCallbackEPv(ptr noundef) #1 align 2

attributes #0 = { nofree 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 #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 = { cold 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, !7, i64 48}
!6 = !{!"_ZTSN3Rcs18MotionControlLayerE", !7, i64 8, !7, i64 16, !10, i64 24, !7, i64 48, !14, i64 56, !14, i64 57, !14, i64 58, !14, i64 59, !15, i64 60, !15, i64 64, !16, i64 72, !16, i64 80, !16, i64 88, !16, i64 96}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIPN3Rcs17HardwareComponentESaIS2_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!"bool", !8, i64 0}
!15 = !{!"int", !8, i64 0}
!16 = !{!"double", !8, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !19, i64 0}
!19 = !{!"vtable pointer", !9, i64 0}
!20 = !{!15, !15, i64 0}


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