; LLVM IR from shupx/swarm_sync_sim :: src/px4_rotor_sim/src/mavros_px4_quadrotor_sim/px4_modules/mc_pos_control/Positi_552892ab (ZN15PositionControl6updateEf)

; 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.PositionControl = type { %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", float, float, float, float, float, float, float, float, %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", float, %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", %"class.matrix::Vector3", float, float }
%"class.matrix::Vector3" = type { %"class.matrix::Vector" }
%"class.matrix::Vector" = type { %"class.matrix::Matrix" }
%"class.matrix::Matrix" = type { [3 x [1 x float]] }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) #0 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN15PositionControl6updateEf(ptr noundef nonnull align 4 dereferenceable(188) %0, float noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  %5 = alloca i8, align 1
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  %7 = call noundef zeroext i1 @_ZN15PositionControl11_inputValidEv(ptr noundef nonnull align 4 dereferenceable(188) %6)
  %8 = zext i1 %7 to i8
  store i8 %8, ptr %5, align 1, !tbaa !11
  %9 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %35

11:                                               ; preds = %2
  call void @_ZN15PositionControl16_positionControlEv(ptr noundef nonnull align 4 dereferenceable(188) %6)
  %12 = load float, ptr %4, align 4, !tbaa !9
  call void @_ZN15PositionControl16_velocityControlEf(ptr noundef nonnull align 4 dereferenceable(188) %6, float noundef %12)
  %13 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 22
  %14 = load float, ptr %13, align 4, !tbaa !15
  %15 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %14)
  br i1 %15, label %16, label %19

16:                                               ; preds = %11
  %17 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 22
  %18 = load float, ptr %17, align 4, !tbaa !15
  br label %20

19:                                               ; preds = %11
  br label %20

20:                                               ; preds = %19, %16
  %21 = phi float [ %18, %16 ], [ 0.000000e+00, %19 ]
  %22 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 22
  store float %21, ptr %22, align 4, !tbaa !15
  %23 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 21
  %24 = load float, ptr %23, align 4, !tbaa !20
  %25 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %24)
  br i1 %25, label %26, label %29

26:                                               ; preds = %20
  %27 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 21
  %28 = load float, ptr %27, align 4, !tbaa !20
  br label %32

29:                                               ; preds = %20
  %30 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 16
  %31 = load float, ptr %30, align 4, !tbaa !21
  br label %32

32:                                               ; preds = %29, %26
  %33 = phi float [ %28, %26 ], [ %31, %29 ]
  %34 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 21
  store float %33, ptr %34, align 4, !tbaa !20
  br label %35

35:                                               ; preds = %32, %2
  %36 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %53

38:                                               ; preds = %35
  %39 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 19
  %40 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %39, i64 noundef 0)
  %41 = load float, ptr %40, align 4, !tbaa !9
  %42 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %41)
  br i1 %42, label %43, label %53

43:                                               ; preds = %38
  %44 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 19
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %44, i64 noundef 1)
  %46 = load float, ptr %45, align 4, !tbaa !9
  %47 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %46)
  br i1 %47, label %48, label %53

48:                                               ; preds = %43
  %49 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 19
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %49, i64 noundef 2)
  %51 = load float, ptr %50, align 4, !tbaa !9
  %52 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %51)
  br label %53

53:                                               ; preds = %48, %43, %38, %35
  %54 = phi i1 [ false, %43 ], [ false, %38 ], [ false, %35 ], [ %52, %48 ]
  %55 = zext i1 %54 to i8
  store i8 %55, ptr %5, align 1, !tbaa !11
  %56 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %57 = trunc i8 %56 to i1
  br i1 %57, label %58, label %73

58:                                               ; preds = %53
  %59 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 20
  %60 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %59, i64 noundef 0)
  %61 = load float, ptr %60, align 4, !tbaa !9
  %62 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %61)
  br i1 %62, label %63, label %73

63:                                               ; preds = %58
  %64 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 20
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %64, i64 noundef 1)
  %66 = load float, ptr %65, align 4, !tbaa !9
  %67 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %66)
  br i1 %67, label %68, label %73

68:                                               ; preds = %63
  %69 = getelementptr inbounds %class.PositionControl, ptr %6, i32 0, i32 20
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %69, i64 noundef 2)
  %71 = load float, ptr %70, align 4, !tbaa !9
  %72 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %71)
  br label %73

73:                                               ; preds = %68, %63, %58, %53
  %74 = phi i1 [ false, %63 ], [ false, %58 ], [ false, %53 ], [ %72, %68 ]
  %75 = zext i1 %74 to i8
  store i8 %75, ptr %5, align 1, !tbaa !11
  %76 = load i8, ptr %5, align 1, !tbaa !11, !range !13, !noundef !14
  %77 = trunc i8 %76 to i1
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret i1 %77
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN15PositionControl11_inputValidEv(ptr noundef nonnull align 4 dereferenceable(188)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15PositionControl16_positionControlEv(ptr noundef nonnull align 4 dereferenceable(188)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15PositionControl16_velocityControlEf(ptr noundef nonnull align 4 dereferenceable(188), float noundef) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef) #0

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"float", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !10, i64 184}
!16 = !{!"_ZTS15PositionControl", !17, i64 0, !17, i64 12, !17, i64 24, !17, i64 36, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !17, i64 80, !17, i64 92, !17, i64 104, !17, i64 116, !10, i64 128, !17, i64 132, !17, i64 144, !17, i64 156, !17, i64 168, !10, i64 180, !10, i64 184}
!17 = !{!"_ZTSN6matrix7Vector3IfEE", !18, i64 0}
!18 = !{!"_ZTSN6matrix6VectorIfLm3EEE", !19, i64 0}
!19 = !{!"_ZTSN6matrix6MatrixIfLm3ELm1EEE", !7, i64 0}
!20 = !{!16, !10, i64 180}
!21 = !{!16, !10, i64 128}


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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN15PositionControl6updateEf(ptr noundef nonnull align 4 dereferenceable(188) %0, float noundef %1) local_unnamed_addr #1 align 2 {
  %3 = tail call noundef zeroext i1 @_ZN15PositionControl11_inputValidEv(ptr noundef nonnull align 4 dereferenceable(188) %0)
  br i1 %3, label %4, label %.critedge5

4:                                                ; preds = %2
  tail call void @_ZN15PositionControl16_positionControlEv(ptr noundef nonnull align 4 dereferenceable(188) %0)
  tail call void @_ZN15PositionControl16_velocityControlEf(ptr noundef nonnull align 4 dereferenceable(188) %0, float noundef %1)
  %5 = getelementptr inbounds i8, ptr %0, i64 184
  %6 = load float, ptr %5, align 4, !tbaa !5
  %7 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %6)
  %8 = load float, ptr %5, align 4
  %9 = select i1 %7, float %8, float 0.000000e+00
  store float %9, ptr %5, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 180
  %11 = load float, ptr %10, align 4, !tbaa !13
  %12 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %11)
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  %.val = load float, ptr %10, align 4
  %.val6 = load float, ptr %13, align 4
  %14 = select i1 %12, float %.val, float %.val6
  store float %14, ptr %10, align 4, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %0, i64 156
  %16 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %15, i64 noundef 0)
  %17 = load float, ptr %16, align 4, !tbaa !14
  %18 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %17)
  br i1 %18, label %19, label %.critedge5

19:                                               ; preds = %4
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %15, i64 noundef 1)
  %21 = load float, ptr %20, align 4, !tbaa !14
  %22 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %21)
  br i1 %22, label %.critedge, label %.critedge5

.critedge:                                        ; preds = %19
  %23 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %15, i64 noundef 2)
  %24 = load float, ptr %23, align 4, !tbaa !14
  %25 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %24)
  br i1 %25, label %26, label %.critedge5

26:                                               ; preds = %.critedge
  %27 = getelementptr inbounds i8, ptr %0, i64 168
  %28 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %27, i64 noundef 0)
  %29 = load float, ptr %28, align 4, !tbaa !14
  %30 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %29)
  br i1 %30, label %31, label %.critedge5

31:                                               ; preds = %26
  %32 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %27, i64 noundef 1)
  %33 = load float, ptr %32, align 4, !tbaa !14
  %34 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %33)
  br i1 %34, label %35, label %.critedge5

35:                                               ; preds = %31
  %36 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZN6matrix6VectorIfLm3EEclEm(ptr noundef nonnull align 4 dereferenceable(12) %27, i64 noundef 2)
  %37 = load float, ptr %36, align 4, !tbaa !14
  %38 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %37)
  br label %.critedge5

.critedge5:                                       ; preds = %19, %4, %2, %35, %31, %26, %.critedge
  %39 = phi i1 [ false, %31 ], [ false, %26 ], [ false, %.critedge ], [ %38, %35 ], [ false, %2 ], [ false, %4 ], [ false, %19 ]
  ret i1 %39
}

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN15PositionControl11_inputValidEv(ptr noundef nonnull align 4 dereferenceable(188)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15PositionControl16_positionControlEv(ptr noundef nonnull align 4 dereferenceable(188)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN15PositionControl16_velocityControlEf(ptr noundef nonnull align 4 dereferenceable(188), float noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef) local_unnamed_addr #0

attributes #0 = { 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 #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" }

!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, !12, i64 184}
!6 = !{!"_ZTS15PositionControl", !7, i64 0, !7, i64 12, !7, i64 24, !7, i64 36, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !7, i64 80, !7, i64 92, !7, i64 104, !7, i64 116, !12, i64 128, !7, i64 132, !7, i64 144, !7, i64 156, !7, i64 168, !12, i64 180, !12, i64 184}
!7 = !{!"_ZTSN6matrix7Vector3IfEE", !8, i64 0}
!8 = !{!"_ZTSN6matrix6VectorIfLm3EEE", !9, i64 0}
!9 = !{!"_ZTSN6matrix6MatrixIfLm3ELm1EEE", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"float", !10, i64 0}
!13 = !{!6, !12, i64 180}
!14 = !{!12, !12, i64 0}


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