; LLVM IR from ByungKwanLee/Adavanced-ECMS :: advanced_ecms/src/VehicleInfo.ll (ZN11VehicleInfo15velocity_updateEff)

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

@_ZN11VehicleInfo4massE = external dso_local global float, align 4
@_ZN11VehicleInfo11velocity_rtE = external dso_local global float, align 4
@_ZN11VehicleInfo8accel_rtE = external dso_local global float, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN11VehicleInfo3FrlEv() #0 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11VehicleInfo15velocity_updateEff(float noundef %0, float noundef %1) #0 align 2 {
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  store float %0, ptr %3, align 4, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !5
  %5 = load float, ptr %3, align 4, !tbaa !5
  %6 = call noundef float @_ZSt3absf(float noundef %5)
  %7 = fpext float %6 to double
  %8 = call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 10, i32 noundef -2)
  %9 = fcmp ole double %7, %8
  br i1 %9, label %10, label %23

10:                                               ; preds = %2
  %11 = load float, ptr %3, align 4, !tbaa !5
  store float %11, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  %12 = call noundef float @_ZN11VehicleInfo3FrlEv()
  %13 = load float, ptr @_ZN11VehicleInfo4massE, align 4, !tbaa !5
  %14 = fdiv float %12, %13
  %15 = load float, ptr %4, align 4, !tbaa !5
  %16 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %17 = fneg float %14
  %18 = call float @llvm.fmuladd.f32(float %17, float %15, float %16)
  store float %18, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %19 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %20 = fcmp ole float %19, 0.000000e+00
  br i1 %20, label %21, label %22

21:                                               ; preds = %10
  store float 0.000000e+00, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  store float 0.000000e+00, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %21, %10
  br label %38

23:                                               ; preds = %2
  %24 = load float, ptr %3, align 4, !tbaa !5
  store float %24, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  %25 = load float, ptr %3, align 4, !tbaa !5
  %26 = load float, ptr %4, align 4, !tbaa !5
  %27 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %28 = call float @llvm.fmuladd.f32(float %25, float %26, float %27)
  store float %28, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %29 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %30 = fcmp ole float %29, 0.000000e+00
  br i1 %30, label %31, label %32

31:                                               ; preds = %23
  store float 0.000000e+00, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  store float 0.000000e+00, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %31, %23
  %33 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %34 = fpext float %33 to double
  %35 = fcmp oge double %34, 0x403BC71C71C71C72
  br i1 %35, label %36, label %37

36:                                               ; preds = %32
  store float 0x403BC71C80000000, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  store float 0.000000e+00, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %36, %32
  br label %38

38:                                               ; preds = %37, %22
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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"}


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

@_ZN11VehicleInfo4massE = external dso_local local_unnamed_addr global float, align 4
@_ZN11VehicleInfo11velocity_rtE = external dso_local local_unnamed_addr global float, align 4
@_ZN11VehicleInfo8accel_rtE = external dso_local local_unnamed_addr global float, align 4

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZN11VehicleInfo3FrlEv() local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN11VehicleInfo15velocity_updateEff(float noundef %0, float noundef %1) local_unnamed_addr #0 align 2 {
  %3 = tail call noundef float @_ZSt3absf(float noundef %0)
  %4 = fpext float %3 to double
  %5 = tail call noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef 10, i32 noundef -2)
  %6 = fcmp ult double %5, %4
  store float %0, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  br i1 %6, label %16, label %7

7:                                                ; preds = %2
  %8 = tail call noundef float @_ZN11VehicleInfo3FrlEv()
  %9 = load float, ptr @_ZN11VehicleInfo4massE, align 4, !tbaa !5
  %10 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %11 = fneg float %8
  %12 = fdiv float %11, %9
  %13 = tail call float @llvm.fmuladd.f32(float %12, float %1, float %10)
  store float %13, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %14 = fcmp ugt float %13, 0.000000e+00
  br i1 %14, label %26, label %15

15:                                               ; preds = %7
  store float 0.000000e+00, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  br label %.sink.split

16:                                               ; preds = %2
  %17 = load float, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %18 = tail call float @llvm.fmuladd.f32(float %0, float %1, float %17)
  store float %18, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  %19 = fcmp ugt float %18, 0.000000e+00
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store float 0.000000e+00, ptr @_ZN11VehicleInfo8accel_rtE, align 4, !tbaa !5
  store float 0.000000e+00, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %20, %16
  %22 = phi float [ 0.000000e+00, %20 ], [ %18, %16 ]
  %23 = fpext float %22 to double
  %24 = fcmp ult double %23, 0x403BC71C71C71C72
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store float 0x403BC71C80000000, ptr @_ZN11VehicleInfo11velocity_rtE, align 4, !tbaa !5
  br label %.sink.split

.sink.split:                                      ; preds = %15, %25
  %_ZN11VehicleInfo8accel_rtE.sink = phi ptr [ @_ZN11VehicleInfo8accel_rtE, %25 ], [ @_ZN11VehicleInfo11velocity_rtE, %15 ]
  store float 0.000000e+00, ptr %_ZN11VehicleInfo8accel_rtE.sink, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %.sink.split, %21, %7
  ret void
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef float @_ZSt3absf(float noundef) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZSt3powIiiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(i32 noundef, i32 noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass