; LLVM IR from shupx/swarm_sync_sim :: src/px4_rotor_sim/src/mavros_px4_quadrotor_sim/px4_modules/mc_pos_control/Positi_1c42b862 (ZN11ControlMath11addIfNotNanERff)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11ControlMath11addIfNotNanERff(ptr noundef nonnull align 4 dereferenceable(4) %0, float noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = load float, ptr %5, align 4, !tbaa !9
  %7 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %6)
  br i1 %7, label %8, label %16

8:                                                ; preds = %2
  %9 = load float, ptr %4, align 4, !tbaa !9
  %10 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %9)
  br i1 %10, label %11, label %16

11:                                               ; preds = %8
  %12 = load float, ptr %4, align 4, !tbaa !9
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load float, ptr %13, align 4, !tbaa !9
  %15 = fadd float %14, %12
  store float %15, ptr %13, align 4, !tbaa !9
  br label %24

16:                                               ; preds = %8, %2
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = load float, ptr %17, align 4, !tbaa !9
  %19 = call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %18)
  br i1 %19, label %23, label %20

20:                                               ; preds = %16
  %21 = load float, ptr %4, align 4, !tbaa !9
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  store float %21, ptr %22, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %20, %16
  br label %24

24:                                               ; preds = %23, %11
  ret void
}

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

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

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


; 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: mustprogress nounwind uwtable
define dso_local void @_ZN11ControlMath11addIfNotNanERff(ptr nocapture noundef nonnull align 4 dereferenceable(4) %0, float noundef %1) local_unnamed_addr #0 {
  %3 = load float, ptr %0, align 4, !tbaa !5
  %4 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %3)
  br i1 %4, label %5, label %10

5:                                                ; preds = %2
  %6 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %1)
  br i1 %6, label %7, label %10

7:                                                ; preds = %5
  %8 = load float, ptr %0, align 4, !tbaa !5
  %9 = fadd float %8, %1
  br label %.sink.split

10:                                               ; preds = %5, %2
  %11 = load float, ptr %0, align 4, !tbaa !5
  %12 = tail call noundef zeroext i1 @_ZL12PX4_ISFINITEf(float noundef %11)
  br i1 %12, label %13, label %.sink.split

.sink.split:                                      ; preds = %10, %7
  %.sink = phi float [ %9, %7 ], [ %1, %10 ]
  store float %.sink, ptr %0, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %.sink.split, %10
  ret void
}

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

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass