; LLVM IR from IOsonata/IOsonata :: src/sensors/gyro_sensor.ll (ZN10GyroSensor20SetCalibrationOffsetERA3_f)

; 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.GyroSensor = type { %class.Sensor.base, i16, %struct.__GyroSensor_Raw_Data, [3 x [3 x float]], [3 x float], %class.Device }
%class.Sensor.base = type <{ ptr, i32, i32, i32, i32, i64, i8, [7 x i8], i64, i64, i32, i32, i32, i32, %"struct.std::atomic_flag" }>
%"struct.std::atomic_flag" = type { %"struct.std::__atomic_flag_base" }
%"struct.std::__atomic_flag_base" = type { i8 }
%struct.__GyroSensor_Raw_Data = type <{ i64, i16, i16, %union.anon }>
%union.anon = type { [3 x i16] }
%class.Device = type { ptr, i8, i32, ptr, ptr, i64, i8, ptr, i8, i32 }
%class.Sensor = type <{ ptr, i32, i32, i32, i32, i64, i8, [7 x i8], i64, i64, i32, i32, i32, i32, %"struct.std::atomic_flag", [7 x i8], %class.Device }>

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

; 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
define dso_local void @_ZN10GyroSensor20SetCalibrationOffsetERA3_f(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 4 dereferenceable(12) %1) unnamed_addr #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca float, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %7 = getelementptr inbounds %class.GyroSensor, ptr %6, i32 0, i32 1
  %8 = load i16, ptr %7, align 2, !tbaa !9
  %9 = uitofp i16 %8 to float
  %10 = getelementptr inbounds %class.Sensor, ptr %6, i32 0, i32 13
  %11 = load i32, ptr %10, align 4, !tbaa !21
  %12 = uitofp i32 %11 to float
  %13 = fdiv float %9, %12
  store float %13, ptr %5, align 4, !tbaa !22
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = getelementptr inbounds [3 x float], ptr %14, i64 0, i64 0
  %16 = load float, ptr %15, align 4, !tbaa !22
  %17 = load float, ptr %5, align 4, !tbaa !22
  %18 = fmul float %16, %17
  %19 = getelementptr inbounds %class.GyroSensor, ptr %6, i32 0, i32 4
  %20 = getelementptr inbounds [3 x float], ptr %19, i64 0, i64 0
  store float %18, ptr %20, align 4, !tbaa !22
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds [3 x float], ptr %21, i64 0, i64 1
  %23 = load float, ptr %22, align 4, !tbaa !22
  %24 = load float, ptr %5, align 4, !tbaa !22
  %25 = fmul float %23, %24
  %26 = getelementptr inbounds %class.GyroSensor, ptr %6, i32 0, i32 4
  %27 = getelementptr inbounds [3 x float], ptr %26, i64 0, i64 1
  store float %25, ptr %27, align 4, !tbaa !22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds [3 x float], ptr %28, i64 0, i64 2
  %30 = load float, ptr %29, align 4, !tbaa !22
  %31 = load float, ptr %5, align 4, !tbaa !22
  %32 = fmul float %30, %31
  %33 = getelementptr inbounds %class.GyroSensor, ptr %6, i32 0, i32 4
  %34 = getelementptr inbounds [3 x float], ptr %33, i64 0, i64 2
  store float %32, ptr %34, align 4, !tbaa !22
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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, !19, i64 74}
!10 = !{!"_ZTS10GyroSensor", !11, i64 0, !19, i64 74, !20, i64 76, !7, i64 96, !7, i64 132}
!11 = !{!"_ZTS6Sensor", !12, i64 8, !13, i64 12, !14, i64 16, !12, i64 20, !15, i64 24, !16, i64 32, !15, i64 40, !15, i64 48, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !17, i64 72}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTS14__Sensor_State", !7, i64 0}
!14 = !{!"_ZTS15__Sensor_OpMode", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{!"_ZTSSt11atomic_flag", !18, i64 0}
!18 = !{!"_ZTSSt18__atomic_flag_base", !16, i64 0}
!19 = !{!"short", !7, i64 0}
!20 = !{!"_ZTS21__GyroSensor_Raw_Data", !15, i64 0, !19, i64 8, !19, i64 10, !7, i64 12}
!21 = !{!11, !12, i64 68}
!22 = !{!23, !23, i64 0}
!23 = !{!"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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local void @_ZN10GyroSensor20SetCalibrationOffsetERA3_f(ptr nocapture noundef nonnull align 8 dereferenceable(144) %0, ptr nocapture noundef nonnull readonly align 4 dereferenceable(12) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 74
  %4 = load i16, ptr %3, align 2, !tbaa !5
  %5 = uitofp i16 %4 to float
  %6 = getelementptr inbounds i8, ptr %0, i64 68
  %7 = load i32, ptr %6, align 4, !tbaa !19
  %8 = uitofp i32 %7 to float
  %9 = fdiv float %5, %8
  %10 = load float, ptr %1, align 4, !tbaa !20
  %11 = fmul float %10, %9
  %12 = getelementptr inbounds i8, ptr %0, i64 132
  store float %11, ptr %12, align 4, !tbaa !20
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load float, ptr %13, align 4, !tbaa !20
  %15 = fmul float %9, %14
  %16 = getelementptr inbounds i8, ptr %0, i64 136
  store float %15, ptr %16, align 8, !tbaa !20
  %17 = getelementptr inbounds i8, ptr %1, i64 8
  %18 = load float, ptr %17, align 4, !tbaa !20
  %19 = fmul float %9, %18
  %20 = getelementptr inbounds i8, ptr %0, i64 140
  store float %19, ptr %20, align 4, !tbaa !20
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !17, i64 74}
!6 = !{!"_ZTS10GyroSensor", !7, i64 0, !17, i64 74, !18, i64 76, !9, i64 96, !9, i64 132}
!7 = !{!"_ZTS6Sensor", !8, i64 8, !11, i64 12, !12, i64 16, !8, i64 20, !13, i64 24, !14, i64 32, !13, i64 40, !13, i64 48, !8, i64 56, !8, i64 60, !8, i64 64, !8, i64 68, !15, i64 72}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS14__Sensor_State", !9, i64 0}
!12 = !{!"_ZTS15__Sensor_OpMode", !9, i64 0}
!13 = !{!"long", !9, i64 0}
!14 = !{!"bool", !9, i64 0}
!15 = !{!"_ZTSSt11atomic_flag", !16, i64 0}
!16 = !{!"_ZTSSt18__atomic_flag_base", !14, i64 0}
!17 = !{!"short", !9, i64 0}
!18 = !{!"_ZTS21__GyroSensor_Raw_Data", !13, i64 0, !17, i64 8, !17, i64 10, !9, i64 12}
!19 = !{!7, !8, i64 68}
!20 = !{!21, !21, i64 0}
!21 = !{!"float", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass