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

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

@_ZTVN3Rcs18MotionControlLayerE = external dso_local unnamed_addr constant { [29 x ptr] }, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [43 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@__func__._ZN3Rcs18MotionControlLayerC2EPKc = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs18MotionControlLayerC2EPKc(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  store ptr getelementptr inbounds inrange(-16, 216) ({ [29 x ptr] }, ptr @_ZTVN3Rcs18MotionControlLayerE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 1
  store ptr null, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 2
  store ptr null, ptr %9, align 8, !tbaa !20
  %10 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 3
  call void @_ZNSt6vectorIPN3Rcs17HardwareComponentESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %11 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 4
  store ptr null, ptr %11, align 8, !tbaa !21
  %12 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 5
  store i8 1, ptr %12, align 8, !tbaa !22
  %13 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 6
  store i8 0, ptr %13, align 1, !tbaa !23
  %14 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 7
  store i8 1, ptr %14, align 2, !tbaa !24
  %15 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 8
  store i8 0, ptr %15, align 1, !tbaa !25
  %16 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 9
  store i32 0, ptr %16, align 4, !tbaa !26
  %17 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 10
  store i32 0, ptr %17, align 8, !tbaa !27
  %18 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 11
  store double 1.000000e+00, ptr %18, align 8, !tbaa !28
  %19 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 12
  store double 0.000000e+00, ptr %19, align 8, !tbaa !29
  %20 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 13
  store double 0.000000e+00, ptr %20, align 8, !tbaa !30
  %21 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 14
  store double 0.000000e+00, ptr %21, align 8, !tbaa !31
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = invoke ptr @RcsGraph_create(ptr noundef %22)
          to label %24 unwind label %34

24:                                               ; preds = %2
  %25 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 1
  store ptr %23, ptr %25, align 8, !tbaa !11
  br label %26

26:                                               ; preds = %24
  %27 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = icmp ne ptr %28, null
  br i1 %29, label %38, label %30

30:                                               ; preds = %26
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__._ZN3Rcs18MotionControlLayerC2EPKc, i32 noundef 73, ptr noundef @.str.2) #5
  invoke void @print_trace()
          to label %33 unwind label %34

33:                                               ; preds = %30
  call void @abort() #6
  unreachable

34:                                               ; preds = %50, %40, %30, %2
  %35 = landingpad { ptr, i32 }
          cleanup
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %5, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %6, align 4
  call void @_ZNSt6vectorIPN3Rcs17HardwareComponentESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  br label %57

38:                                               ; preds = %26
  br label %39

39:                                               ; preds = %38
  br label %40

40:                                               ; preds = %39
  %41 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !11
  %43 = invoke ptr @RcsGraph_clone(ptr noundef %42)
          to label %44 unwind label %34

44:                                               ; preds = %40
  %45 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 2
  store ptr %43, ptr %45, align 8, !tbaa !20
  br label %46

46:                                               ; preds = %44
  %47 = getelementptr inbounds %"class.Rcs::MotionControlLayer", ptr %7, i32 0, i32 2
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = icmp ne ptr %48, null
  br i1 %49, label %54, label %50

50:                                               ; preds = %46
  %51 = load ptr, ptr @stderr, align 8, !tbaa !5
  %52 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %51, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @__func__._ZN3Rcs18MotionControlLayerC2EPKc, i32 noundef 75, ptr noundef @.str.3) #5
  invoke void @print_trace()
          to label %53 unwind label %34

53:                                               ; preds = %50
  call void @abort() #6
  unreachable

54:                                               ; preds = %46
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  ret void

57:                                               ; preds = %34
  %58 = load ptr, ptr %5, align 8
  %59 = load i32, ptr %6, align 4
  %60 = insertvalue { ptr, i32 } poison, ptr %58, 0
  %61 = insertvalue { ptr, i32 } %60, i32 %59, 1
  resume { ptr, i32 } %61
}

declare ptr @RcsGraph_create(ptr noundef) #2

declare i32 @__gxx_personality_v0(...)

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

declare void @print_trace() #2

; Function Attrs: noreturn nounwind
declare void @abort() #4

declare ptr @RcsGraph_clone(ptr noundef) #2

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

attributes #0 = { 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 #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 = { "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 = { noreturn 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 #5 = { nounwind }
attributes #6 = { noreturn 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, !6, i64 8}
!12 = !{!"_ZTSN3Rcs18MotionControlLayerE", !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 48, !17, i64 56, !17, i64 57, !17, i64 58, !17, i64 59, !18, i64 60, !18, i64 64, !19, i64 72, !19, i64 80, !19, i64 88, !19, i64 96}
!13 = !{!"_ZTSSt6vectorIPN3Rcs17HardwareComponentESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!"bool", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"double", !7, i64 0}
!20 = !{!12, !6, i64 16}
!21 = !{!12, !6, i64 48}
!22 = !{!12, !17, i64 56}
!23 = !{!12, !17, i64 57}
!24 = !{!12, !17, i64 58}
!25 = !{!12, !17, i64 59}
!26 = !{!12, !18, i64 60}
!27 = !{!12, !18, i64 64}
!28 = !{!12, !19, i64 72}
!29 = !{!12, !19, i64 80}
!30 = !{!12, !19, i64 88}
!31 = !{!12, !19, i64 96}


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

@_ZTVN3Rcs18MotionControlLayerE = external dso_local unnamed_addr constant { [29 x ptr] }, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [43 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [79 x i8], align 1
@__func__._ZN3Rcs18MotionControlLayerC2EPKc = external hidden unnamed_addr constant [19 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs18MotionControlLayerC2EPKc(ptr noundef nonnull align 8 dereferenceable(104) %0, ptr noundef %1) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  store ptr getelementptr inbounds inrange(-16, 216) (i8, ptr @_ZTVN3Rcs18MotionControlLayerE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  tail call void @_ZNSt6vectorIPN3Rcs17HardwareComponentESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr null, ptr %6, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  store i8 1, ptr %7, align 8, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %0, i64 57
  store i8 0, ptr %8, align 1, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %0, i64 58
  store i8 1, ptr %9, align 2, !tbaa !21
  %10 = getelementptr inbounds i8, ptr %0, i64 59
  %11 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(9) %10, i8 0, i64 9, i1 false)
  store double 1.000000e+00, ptr %11, align 8, !tbaa !22
  %12 = getelementptr inbounds i8, ptr %0, i64 80
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %12, i8 0, i64 24, i1 false)
  %13 = invoke ptr @RcsGraph_create(ptr noundef %1)
          to label %14 unwind label %19

14:                                               ; preds = %2
  store ptr %13, ptr %3, align 8, !tbaa !23
  %.not = icmp eq ptr %13, null
  br i1 %.not, label %15, label %21

15:                                               ; preds = %14
  %16 = load ptr, ptr @stderr, align 8, !tbaa !24
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__._ZN3Rcs18MotionControlLayerC2EPKc, i32 noundef 73, ptr noundef nonnull @.str.2) #7
  invoke void @print_trace()
          to label %18 unwind label %19

18:                                               ; preds = %15
  tail call void @abort() #8
  unreachable

19:                                               ; preds = %24, %21, %15, %2
  %20 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZNSt6vectorIPN3Rcs17HardwareComponentESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #6
  resume { ptr, i32 } %20

21:                                               ; preds = %14
  %22 = invoke ptr @RcsGraph_clone(ptr noundef nonnull %13)
          to label %23 unwind label %19

23:                                               ; preds = %21
  store ptr %22, ptr %4, align 8, !tbaa !25
  %.not3 = icmp eq ptr %22, null
  br i1 %.not3, label %24, label %28

24:                                               ; preds = %23
  %25 = load ptr, ptr @stderr, align 8, !tbaa !24
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__._ZN3Rcs18MotionControlLayerC2EPKc, i32 noundef 75, ptr noundef nonnull @.str.3) #7
  invoke void @print_trace()
          to label %27 unwind label %19

27:                                               ; preds = %24
  tail call void @abort() #8
  unreachable

28:                                               ; preds = %23
  ret void
}

declare ptr @RcsGraph_create(ptr noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

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

declare void @print_trace() local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #4

declare ptr @RcsGraph_clone(ptr noundef) local_unnamed_addr #2

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

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

attributes #0 = { 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 #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 = { "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 = { 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 #4 = { noreturn 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { nounwind }
attributes #7 = { cold nounwind }
attributes #8 = { noreturn 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 48}
!9 = !{!"_ZTSN3Rcs18MotionControlLayerE", !10, i64 8, !10, i64 16, !12, i64 24, !10, i64 48, !16, i64 56, !16, i64 57, !16, i64 58, !16, i64 59, !17, i64 60, !17, i64 64, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"_ZTSSt6vectorIPN3Rcs17HardwareComponentESaIS2_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN3Rcs17HardwareComponentESaIS2_EE17_Vector_impl_dataE", !10, i64 0, !10, i64 8, !10, i64 16}
!16 = !{!"bool", !11, i64 0}
!17 = !{!"int", !11, i64 0}
!18 = !{!"double", !11, i64 0}
!19 = !{!9, !16, i64 56}
!20 = !{!9, !16, i64 57}
!21 = !{!9, !16, i64 58}
!22 = !{!9, !18, i64 72}
!23 = !{!9, !10, i64 8}
!24 = !{!10, !10, i64 0}
!25 = !{!9, !10, i64 16}


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