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

; 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.5" = type { i8 }
%"class.Rcs::ViaPointSequencePlotter" = type { ptr, ptr, i8, [3 x double], [3 x double], double, double }

@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [1 x i8], align 1
@RcsLogLevel = external global i32, align 4
@.str.25 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZTVN3Rcs23ViaPointSequencePlotterE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8
@.str.89 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [2 x i8], align 1
@__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev = external hidden unnamed_addr constant [24 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [30 x i8], align 1
@_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE = external dso_local constant { ptr, ptr }, align 8

; 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

; 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs23ViaPointSequencePlotterC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.std::allocator.5", align 1
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i1, align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %2, align 8
  store ptr getelementptr inbounds inrange(-16, 56) ({ [9 x ptr] }, ptr @_ZTVN3Rcs23ViaPointSequencePlotterE, i32 0, i32 0, i32 2), ptr %7, align 8, !tbaa !9
  %8 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 1
  store ptr null, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 2
  store i8 0, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 5
  store double 0.000000e+00, ptr %10, align 8, !tbaa !16
  %11 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 6
  store double 0.000000e+00, ptr %11, align 8, !tbaa !17
  %12 = call noalias ptr @popen(ptr noundef @.str.89, ptr noundef @.str.90)
  %13 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 1
  store ptr %12, ptr %13, align 8, !tbaa !11
  %14 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 3
  %15 = getelementptr inbounds [3 x double], ptr %14, i64 0, i64 0
  call void @Vec3d_setZero(ptr noundef %15)
  %16 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 4
  %17 = getelementptr inbounds [3 x double], ptr %16, i64 0, i64 0
  call void @Vec3d_setZero(ptr noundef %17)
  %18 = getelementptr inbounds %"class.Rcs::ViaPointSequencePlotter", ptr %7, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %48

21:                                               ; preds = %1
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %27

25:                                               ; preds = %22
  %26 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  call void (i32, ptr, ptr, i32, ptr, ...) %26(i32 noundef 1, ptr noundef @.str.23, ptr noundef @__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev, i32 noundef 2198, ptr noundef @.str.91)
  br label %27

27:                                               ; preds = %25, %22
  %28 = load i32, ptr @RcsLogLevel, align 4, !tbaa !18
  %29 = icmp sle i32 1, %28
  br i1 %29, label %30, label %37

30:                                               ; preds = %27
  %31 = load ptr, ptr @stderr, align 8, !tbaa !5
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.25, ptr noundef @__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev, i32 noundef 2198) #5
  %33 = load ptr, ptr @stderr, align 8, !tbaa !5
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.91) #5
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.4) #5
  br label %37

37:                                               ; preds = %30, %27
  br label %38

38:                                               ; preds = %37
  store i1 true, ptr %6, align 1
  %39 = call ptr @__cxa_allocate_exception(i64 32) #5
  call void @llvm.lifetime.start.p0(i64 1, ptr %3) #5
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %39, ptr noundef @.str.91, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %40 unwind label %41

40:                                               ; preds = %38
  store i1 false, ptr %6, align 1
  invoke void @__cxa_throw(ptr %39, ptr @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev) #6
          to label %54 unwind label %41

41:                                               ; preds = %40, %38
  %42 = landingpad { ptr, i32 }
          cleanup
  %43 = extractvalue { ptr, i32 } %42, 0
  store ptr %43, ptr %4, align 8
  %44 = extractvalue { ptr, i32 } %42, 1
  store i32 %44, ptr %5, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %3) #5
  %45 = load i1, ptr %6, align 1
  br i1 %45, label %46, label %47

46:                                               ; preds = %41
  call void @__cxa_free_exception(ptr %39) #5
  br label %47

47:                                               ; preds = %46, %41
  br label %49

48:                                               ; preds = %1
  ret void

49:                                               ; preds = %47
  %50 = load ptr, ptr %4, align 8
  %51 = load i32, ptr %5, align 4
  %52 = insertvalue { ptr, i32 } poison, ptr %50, 0
  %53 = insertvalue { ptr, i32 } %52, i32 %51, 1
  resume { ptr, i32 } %53

54:                                               ; preds = %40
  unreachable
}

declare noalias ptr @popen(ptr noundef, ptr noundef) #4

declare void @Vec3d_setZero(ptr noundef) #4

declare ptr @__cxa_allocate_exception(i64)

declare void @__cxa_throw(ptr, ptr, ptr)

declare void @__cxa_free_exception(ptr)

; 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 = { 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 #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 = { 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 #4 = { "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 }

!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 = !{!"_ZTSN3Rcs23ViaPointSequencePlotterE", !6, i64 8, !13, i64 16, !7, i64 24, !7, i64 48, !14, i64 72, !14, i64 80}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!12, !13, i64 16}
!16 = !{!12, !14, i64 72}
!17 = !{!12, !14, i64 80}
!18 = !{!19, !19, i64 0}
!19 = !{!"int", !7, 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"

%"class.std::allocator.5" = type { i8 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [1 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@.str.25 = external hidden unnamed_addr constant [11 x i8], align 1
@_ZTVN3Rcs23ViaPointSequencePlotterE = external dso_local unnamed_addr constant { [9 x ptr] }, align 8
@.str.89 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [2 x i8], align 1
@__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev = external hidden unnamed_addr constant [24 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [30 x i8], align 1
@_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE = external dso_local constant { ptr, ptr }, align 8

; 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: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; 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 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 #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Rcs23ViaPointSequencePlotterC2Ev(ptr noundef nonnull align 8 dereferenceable(88) %0) unnamed_addr #3 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::allocator.5", align 1
  store ptr getelementptr inbounds inrange(-16, 56) (i8, ptr @_ZTVN3Rcs23ViaPointSequencePlotterE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr null, ptr %3, align 8, !tbaa !8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  store i8 0, ptr %4, align 8, !tbaa !14
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  %6 = tail call noalias ptr @popen(ptr noundef nonnull @.str.89, ptr noundef nonnull @.str.90)
  store ptr %6, ptr %3, align 8, !tbaa !8
  %7 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @Vec3d_setZero(ptr noundef nonnull %7)
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  tail call void @Vec3d_setZero(ptr noundef nonnull %8)
  %9 = load ptr, ptr %3, align 8, !tbaa !8
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %31

11:                                               ; preds = %1
  %12 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !15
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %14, label %13

13:                                               ; preds = %11
  tail call void (i32, ptr, ptr, i32, ptr, ...) %12(i32 noundef 1, ptr noundef nonnull @.str.23, ptr noundef nonnull @__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev, i32 noundef 2198, ptr noundef nonnull @.str.91)
  br label %14

14:                                               ; preds = %13, %11
  %15 = load i32, ptr @RcsLogLevel, align 4, !tbaa !16
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !15
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.25, ptr noundef nonnull @__func__._ZN3Rcs23ViaPointSequencePlotterC2Ev, i32 noundef 2198) #6
  %20 = load ptr, ptr @stderr, align 8, !tbaa !15
  %21 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.91) #6
  %22 = load ptr, ptr @stderr, align 8, !tbaa !15
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.4) #6
  br label %24

24:                                               ; preds = %14, %17
  %25 = tail call ptr @__cxa_allocate_exception(i64 32) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %2) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %25, ptr noundef nonnull @.str.91, ptr noundef nonnull align 1 dereferenceable(1) %2)
          to label %26 unwind label %29

26:                                               ; preds = %24
  invoke void @__cxa_throw(ptr nonnull %25, ptr nonnull @_ZTINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE, ptr nonnull @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev) #8
          to label %34 unwind label %27

27:                                               ; preds = %26
  %28 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #7
  br label %32

29:                                               ; preds = %24
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %2) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %2) #7
  call void @__cxa_free_exception(ptr %25) #7
  br label %32

31:                                               ; preds = %1
  ret void

32:                                               ; preds = %27, %29
  %33 = phi { ptr, i32 } [ %28, %27 ], [ %30, %29 ]
  resume { ptr, i32 } %33

34:                                               ; preds = %26
  unreachable
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @popen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

declare void @Vec3d_setZero(ptr noundef) local_unnamed_addr #4

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; 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) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 #4 = { "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 = { cold nounwind }
attributes #7 = { nounwind }
attributes #8 = { noreturn }

!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 = !{!"_ZTSN3Rcs23ViaPointSequencePlotterE", !10, i64 8, !12, i64 16, !11, i64 24, !11, i64 48, !13, i64 72, !13, i64 80}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !7, i64 0}
!12 = !{!"bool", !11, i64 0}
!13 = !{!"double", !11, i64 0}
!14 = !{!9, !12, i64 16}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !11, i64 0}


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