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

; 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 }
%struct.__GyroSensor_Data = type <{ i64, %union.anon.0 }>
%union.anon.0 = type { [3 x float] }
%struct.anon = type { i16, i16, i16 }
%struct.anon.1 = type { float, float, float }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN10GyroSensor4ReadER17__GyroSensor_Data(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef nonnull align 1 dereferenceable(20) %1) unnamed_addr #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  %6 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %7 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %6, i32 0, i32 0
  %8 = load i64, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.__GyroSensor_Data, ptr %9, i32 0, i32 0
  store i64 %8, ptr %10, align 1, !tbaa !21
  %11 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %12 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %11, i32 0, i32 3
  %13 = getelementptr inbounds %struct.anon, ptr %12, i32 0, i32 0
  %14 = load i16, ptr %13, align 4, !tbaa !23
  %15 = sitofp i16 %14 to float
  %16 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %17 = getelementptr inbounds [3 x [3 x float]], ptr %16, i64 0, i64 0
  %18 = getelementptr inbounds [3 x float], ptr %17, i64 0, i64 0
  %19 = load float, ptr %18, align 8, !tbaa !24
  %20 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %21 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %20, i32 0, i32 3
  %22 = getelementptr inbounds %struct.anon, ptr %21, i32 0, i32 1
  %23 = load i16, ptr %22, align 2, !tbaa !23
  %24 = sext i16 %23 to i32
  %25 = sitofp i32 %24 to float
  %26 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %27 = getelementptr inbounds [3 x [3 x float]], ptr %26, i64 0, i64 1
  %28 = getelementptr inbounds [3 x float], ptr %27, i64 0, i64 0
  %29 = load float, ptr %28, align 4, !tbaa !24
  %30 = fmul float %25, %29
  %31 = call float @llvm.fmuladd.f32(float %15, float %19, float %30)
  %32 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %33 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %32, i32 0, i32 3
  %34 = getelementptr inbounds %struct.anon, ptr %33, i32 0, i32 2
  %35 = load i16, ptr %34, align 4, !tbaa !23
  %36 = sext i16 %35 to i32
  %37 = sitofp i32 %36 to float
  %38 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %39 = getelementptr inbounds [3 x [3 x float]], ptr %38, i64 0, i64 2
  %40 = getelementptr inbounds [3 x float], ptr %39, i64 0, i64 0
  %41 = load float, ptr %40, align 8, !tbaa !24
  %42 = call float @llvm.fmuladd.f32(float %37, float %41, float %31)
  %43 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 4
  %44 = getelementptr inbounds [3 x float], ptr %43, i64 0, i64 0
  %45 = load float, ptr %44, align 4, !tbaa !24
  %46 = fadd float %42, %45
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__GyroSensor_Data, ptr %47, i32 0, i32 1
  %49 = getelementptr inbounds %struct.anon.1, ptr %48, i32 0, i32 0
  store float %46, ptr %49, align 1, !tbaa !23
  %50 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %51 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %50, i32 0, i32 3
  %52 = getelementptr inbounds %struct.anon, ptr %51, i32 0, i32 0
  %53 = load i16, ptr %52, align 4, !tbaa !23
  %54 = sitofp i16 %53 to float
  %55 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %56 = getelementptr inbounds [3 x [3 x float]], ptr %55, i64 0, i64 0
  %57 = getelementptr inbounds [3 x float], ptr %56, i64 0, i64 1
  %58 = load float, ptr %57, align 4, !tbaa !24
  %59 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %60 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %59, i32 0, i32 3
  %61 = getelementptr inbounds %struct.anon, ptr %60, i32 0, i32 1
  %62 = load i16, ptr %61, align 2, !tbaa !23
  %63 = sext i16 %62 to i32
  %64 = sitofp i32 %63 to float
  %65 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %66 = getelementptr inbounds [3 x [3 x float]], ptr %65, i64 0, i64 1
  %67 = getelementptr inbounds [3 x float], ptr %66, i64 0, i64 1
  %68 = load float, ptr %67, align 4, !tbaa !24
  %69 = fmul float %64, %68
  %70 = call float @llvm.fmuladd.f32(float %54, float %58, float %69)
  %71 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %72 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %71, i32 0, i32 3
  %73 = getelementptr inbounds %struct.anon, ptr %72, i32 0, i32 2
  %74 = load i16, ptr %73, align 4, !tbaa !23
  %75 = sext i16 %74 to i32
  %76 = sitofp i32 %75 to float
  %77 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %78 = getelementptr inbounds [3 x [3 x float]], ptr %77, i64 0, i64 2
  %79 = getelementptr inbounds [3 x float], ptr %78, i64 0, i64 1
  %80 = load float, ptr %79, align 4, !tbaa !24
  %81 = call float @llvm.fmuladd.f32(float %76, float %80, float %70)
  %82 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 4
  %83 = getelementptr inbounds [3 x float], ptr %82, i64 0, i64 1
  %84 = load float, ptr %83, align 4, !tbaa !24
  %85 = fadd float %81, %84
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.__GyroSensor_Data, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds %struct.anon.1, ptr %87, i32 0, i32 1
  store float %85, ptr %88, align 1, !tbaa !23
  %89 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %90 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %89, i32 0, i32 3
  %91 = getelementptr inbounds %struct.anon, ptr %90, i32 0, i32 0
  %92 = load i16, ptr %91, align 4, !tbaa !23
  %93 = sitofp i16 %92 to float
  %94 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %95 = getelementptr inbounds [3 x [3 x float]], ptr %94, i64 0, i64 0
  %96 = getelementptr inbounds [3 x float], ptr %95, i64 0, i64 2
  %97 = load float, ptr %96, align 8, !tbaa !24
  %98 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %99 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %98, i32 0, i32 3
  %100 = getelementptr inbounds %struct.anon, ptr %99, i32 0, i32 1
  %101 = load i16, ptr %100, align 2, !tbaa !23
  %102 = sext i16 %101 to i32
  %103 = sitofp i32 %102 to float
  %104 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %105 = getelementptr inbounds [3 x [3 x float]], ptr %104, i64 0, i64 1
  %106 = getelementptr inbounds [3 x float], ptr %105, i64 0, i64 2
  %107 = load float, ptr %106, align 4, !tbaa !24
  %108 = fmul float %103, %107
  %109 = call float @llvm.fmuladd.f32(float %93, float %97, float %108)
  %110 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 2
  %111 = getelementptr inbounds %struct.__GyroSensor_Raw_Data, ptr %110, i32 0, i32 3
  %112 = getelementptr inbounds %struct.anon, ptr %111, i32 0, i32 2
  %113 = load i16, ptr %112, align 4, !tbaa !23
  %114 = sext i16 %113 to i32
  %115 = sitofp i32 %114 to float
  %116 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 3
  %117 = getelementptr inbounds [3 x [3 x float]], ptr %116, i64 0, i64 2
  %118 = getelementptr inbounds [3 x float], ptr %117, i64 0, i64 2
  %119 = load float, ptr %118, align 8, !tbaa !24
  %120 = call float @llvm.fmuladd.f32(float %115, float %119, float %109)
  %121 = getelementptr inbounds %class.GyroSensor, ptr %5, i32 0, i32 4
  %122 = getelementptr inbounds [3 x float], ptr %121, i64 0, i64 2
  %123 = load float, ptr %122, align 4, !tbaa !24
  %124 = fadd float %120, %123
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.__GyroSensor_Data, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds %struct.anon.1, ptr %126, i32 0, i32 2
  store float %124, ptr %127, align 1, !tbaa !23
  ret i1 true
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare float @llvm.fmuladd.f32(float, float, float) #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !15, i64 76}
!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 = !{!22, !15, i64 0}
!22 = !{!"_ZTS17__GyroSensor_Data", !15, i64 0, !7, i64 8}
!23 = !{!7, !7, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"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 noundef zeroext i1 @_ZN10GyroSensor4ReadER17__GyroSensor_Data(ptr nocapture noundef nonnull readonly align 8 dereferenceable(144) %0, ptr nocapture noundef nonnull writeonly align 1 dereferenceable(20) %1) unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 76
  %4 = load i64, ptr %3, align 4, !tbaa !5
  store i64 %4, ptr %1, align 1, !tbaa !19
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = load i16, ptr %5, align 8, !tbaa !21
  %7 = sitofp i16 %6 to float
  %8 = getelementptr inbounds i8, ptr %0, i64 96
  %9 = load float, ptr %8, align 8, !tbaa !22
  %10 = getelementptr inbounds i8, ptr %0, i64 90
  %11 = load i16, ptr %10, align 2, !tbaa !21
  %12 = sitofp i16 %11 to float
  %13 = getelementptr inbounds i8, ptr %0, i64 108
  %14 = load float, ptr %13, align 4, !tbaa !22
  %15 = fmul float %14, %12
  %16 = tail call float @llvm.fmuladd.f32(float %7, float %9, float %15)
  %17 = getelementptr inbounds i8, ptr %0, i64 92
  %18 = load i16, ptr %17, align 4, !tbaa !21
  %19 = sitofp i16 %18 to float
  %20 = getelementptr inbounds i8, ptr %0, i64 120
  %21 = load float, ptr %20, align 8, !tbaa !22
  %22 = tail call float @llvm.fmuladd.f32(float %19, float %21, float %16)
  %23 = getelementptr inbounds i8, ptr %0, i64 132
  %24 = load float, ptr %23, align 4, !tbaa !22
  %25 = fadd float %22, %24
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  store float %25, ptr %26, align 1, !tbaa !21
  %27 = load i16, ptr %5, align 8, !tbaa !21
  %28 = sitofp i16 %27 to float
  %29 = getelementptr inbounds i8, ptr %0, i64 100
  %30 = load float, ptr %29, align 4, !tbaa !22
  %31 = load i16, ptr %10, align 2, !tbaa !21
  %32 = sitofp i16 %31 to float
  %33 = getelementptr inbounds i8, ptr %0, i64 112
  %34 = load float, ptr %33, align 8, !tbaa !22
  %35 = fmul float %34, %32
  %36 = tail call float @llvm.fmuladd.f32(float %28, float %30, float %35)
  %37 = load i16, ptr %17, align 4, !tbaa !21
  %38 = sitofp i16 %37 to float
  %39 = getelementptr inbounds i8, ptr %0, i64 124
  %40 = load float, ptr %39, align 4, !tbaa !22
  %41 = tail call float @llvm.fmuladd.f32(float %38, float %40, float %36)
  %42 = getelementptr inbounds i8, ptr %0, i64 136
  %43 = load float, ptr %42, align 8, !tbaa !22
  %44 = fadd float %41, %43
  %45 = getelementptr inbounds i8, ptr %1, i64 12
  store float %44, ptr %45, align 1, !tbaa !21
  %46 = load i16, ptr %5, align 8, !tbaa !21
  %47 = sitofp i16 %46 to float
  %48 = getelementptr inbounds i8, ptr %0, i64 104
  %49 = load float, ptr %48, align 8, !tbaa !22
  %50 = load i16, ptr %10, align 2, !tbaa !21
  %51 = sitofp i16 %50 to float
  %52 = getelementptr inbounds i8, ptr %0, i64 116
  %53 = load float, ptr %52, align 4, !tbaa !22
  %54 = fmul float %53, %51
  %55 = tail call float @llvm.fmuladd.f32(float %47, float %49, float %54)
  %56 = load i16, ptr %17, align 4, !tbaa !21
  %57 = sitofp i16 %56 to float
  %58 = getelementptr inbounds i8, ptr %0, i64 128
  %59 = load float, ptr %58, align 8, !tbaa !22
  %60 = tail call float @llvm.fmuladd.f32(float %57, float %59, float %55)
  %61 = getelementptr inbounds i8, ptr %0, i64 140
  %62 = load float, ptr %61, align 4, !tbaa !22
  %63 = fadd float %60, %62
  %64 = getelementptr inbounds i8, ptr %1, i64 16
  store float %63, ptr %64, align 1, !tbaa !21
  ret i1 true
}

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

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

!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, !13, i64 76}
!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 = !{!20, !13, i64 0}
!20 = !{!"_ZTS17__GyroSensor_Data", !13, i64 0, !9, i64 8}
!21 = !{!9, !9, i64 0}
!22 = !{!23, !23, i64 0}
!23 = !{!"float", !9, i64 0}


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