; LLVM IR from FedericaPaoli1/stm32-speech-recognition-and-traduction :: Drivers/BSP/Components/lis3dsh (lis3dsh)

; 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: nounwind uwtable
define dso_local void @LIS3DSH_ReadACC(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca [6 x i8], align 1
  %4 = alloca i8, align 1
  %5 = alloca i8, align 1
  %6 = alloca float, align 4
  %7 = alloca float, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 6, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  store i8 0, ptr %5, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store float 0x3FAEB851E0000000, ptr %6, align 4, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store float 0.000000e+00, ptr %7, align 4, !tbaa !10
  call void @ACCELERO_IO_Read(ptr noundef %4, i8 noundef zeroext 36, i16 noundef zeroext 1)
  %8 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 0
  call void @ACCELERO_IO_Read(ptr noundef %8, i8 noundef zeroext 40, i16 noundef zeroext 1)
  %9 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 1
  call void @ACCELERO_IO_Read(ptr noundef %9, i8 noundef zeroext 41, i16 noundef zeroext 1)
  %10 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 2
  call void @ACCELERO_IO_Read(ptr noundef %10, i8 noundef zeroext 42, i16 noundef zeroext 1)
  %11 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 3
  call void @ACCELERO_IO_Read(ptr noundef %11, i8 noundef zeroext 43, i16 noundef zeroext 1)
  %12 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 4
  call void @ACCELERO_IO_Read(ptr noundef %12, i8 noundef zeroext 44, i16 noundef zeroext 1)
  %13 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 5
  call void @ACCELERO_IO_Read(ptr noundef %13, i8 noundef zeroext 45, i16 noundef zeroext 1)
  %14 = load i8, ptr %4, align 1, !tbaa !9
  %15 = zext i8 %14 to i32
  %16 = and i32 %15, 56
  switch i32 %16, label %22 [
    i32 0, label %17
    i32 8, label %18
    i32 16, label %19
    i32 24, label %20
    i32 32, label %21
  ]

17:                                               ; preds = %1
  store float 0x3FAEB851E0000000, ptr %6, align 4, !tbaa !10
  br label %23

18:                                               ; preds = %1
  store float 0x3FBEB851E0000000, ptr %6, align 4, !tbaa !10
  br label %23

19:                                               ; preds = %1
  store float 0x3FC70A3D80000000, ptr %6, align 4, !tbaa !10
  br label %23

20:                                               ; preds = %1
  store float 0x3FCEB851E0000000, ptr %6, align 4, !tbaa !10
  br label %23

21:                                               ; preds = %1
  store float 0x3FE75C2900000000, ptr %6, align 4, !tbaa !10
  br label %23

22:                                               ; preds = %1
  br label %23

23:                                               ; preds = %22, %21, %20, %19, %18, %17
  store i8 0, ptr %5, align 1, !tbaa !9
  br label %24

24:                                               ; preds = %55, %23
  %25 = load i8, ptr %5, align 1, !tbaa !9
  %26 = zext i8 %25 to i32
  %27 = icmp slt i32 %26, 3
  br i1 %27, label %28, label %58

28:                                               ; preds = %24
  %29 = load i8, ptr %5, align 1, !tbaa !9
  %30 = zext i8 %29 to i32
  %31 = mul nsw i32 2, %30
  %32 = add nsw i32 %31, 1
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = sext i8 %35 to i32
  %37 = shl i32 %36, 8
  %38 = load i8, ptr %5, align 1, !tbaa !9
  %39 = zext i8 %38 to i32
  %40 = mul nsw i32 2, %39
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [6 x i8], ptr %3, i64 0, i64 %41
  %43 = load i8, ptr %42, align 1, !tbaa !9
  %44 = sext i8 %43 to i32
  %45 = add nsw i32 %37, %44
  %46 = sitofp i32 %45 to float
  %47 = load float, ptr %6, align 4, !tbaa !10
  %48 = fmul float %46, %47
  store float %48, ptr %7, align 4, !tbaa !10
  %49 = load float, ptr %7, align 4, !tbaa !10
  %50 = fptosi float %49 to i16
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = load i8, ptr %5, align 1, !tbaa !9
  %53 = zext i8 %52 to i64
  %54 = getelementptr inbounds i16, ptr %51, i64 %53
  store i16 %50, ptr %54, align 2, !tbaa !12
  br label %55

55:                                               ; preds = %28
  %56 = load i8, ptr %5, align 1, !tbaa !9
  %57 = add i8 %56, 1
  store i8 %57, ptr %5, align 1, !tbaa !9
  br label %24, !llvm.loop !14

58:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 6, ptr %3) #3
  ret void
}

; 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

declare void @ACCELERO_IO_Read(ptr noundef, i8 noundef zeroext, i16 noundef zeroext) #2

attributes #0 = { 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 = { "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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"float", !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}


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

@switch.table.LIS3DSH_ReadACC = private unnamed_addr constant [4 x float] [float 0x3FBEB851E0000000, float 0x3FC70A3D80000000, float 0x3FCEB851E0000000, float 0x3FE75C2900000000], align 4

; Function Attrs: nounwind uwtable
define dso_local void @LIS3DSH_ReadACC(ptr nocapture noundef writeonly %0) local_unnamed_addr #0 {
  %2 = alloca [6 x i8], align 1
  %3 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #3
  call void @ACCELERO_IO_Read(ptr noundef nonnull %3, i8 noundef zeroext 36, i16 noundef zeroext 1) #3
  call void @ACCELERO_IO_Read(ptr noundef nonnull %2, i8 noundef zeroext 40, i16 noundef zeroext 1) #3
  %4 = getelementptr inbounds i8, ptr %2, i64 1
  call void @ACCELERO_IO_Read(ptr noundef nonnull %4, i8 noundef zeroext 41, i16 noundef zeroext 1) #3
  %5 = getelementptr inbounds i8, ptr %2, i64 2
  call void @ACCELERO_IO_Read(ptr noundef nonnull %5, i8 noundef zeroext 42, i16 noundef zeroext 1) #3
  %6 = getelementptr inbounds i8, ptr %2, i64 3
  call void @ACCELERO_IO_Read(ptr noundef nonnull %6, i8 noundef zeroext 43, i16 noundef zeroext 1) #3
  %7 = getelementptr inbounds i8, ptr %2, i64 4
  call void @ACCELERO_IO_Read(ptr noundef nonnull %7, i8 noundef zeroext 44, i16 noundef zeroext 1) #3
  %8 = getelementptr inbounds i8, ptr %2, i64 5
  call void @ACCELERO_IO_Read(ptr noundef nonnull %8, i8 noundef zeroext 45, i16 noundef zeroext 1) #3
  %9 = load i8, ptr %3, align 1, !tbaa !5
  %10 = lshr i8 %9, 3
  %11 = and i8 %10, 7
  %switch.tableidx = add nsw i8 %11, -1
  %12 = icmp ult i8 %switch.tableidx, 4
  br i1 %12, label %switch.lookup, label %14

switch.lookup:                                    ; preds = %1
  %13 = zext nneg i8 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [4 x float], ptr @switch.table.LIS3DSH_ReadACC, i64 0, i64 %13
  %switch.load = load float, ptr %switch.gep, align 4
  br label %14

14:                                               ; preds = %switch.lookup, %1
  %.0 = phi float [ 0x3FAEB851E0000000, %1 ], [ %switch.load, %switch.lookup ]
  %15 = load i8, ptr %4, align 1, !tbaa !5
  %16 = sext i8 %15 to i32
  %17 = shl nsw i32 %16, 8
  %18 = load i8, ptr %2, align 1, !tbaa !5
  %19 = sext i8 %18 to i32
  %20 = add nsw i32 %17, %19
  %21 = sitofp i32 %20 to float
  %22 = fmul float %.0, %21
  %23 = fptosi float %22 to i16
  store i16 %23, ptr %0, align 2, !tbaa !8
  %24 = load i8, ptr %6, align 1, !tbaa !5
  %25 = sext i8 %24 to i32
  %26 = shl nsw i32 %25, 8
  %27 = load i8, ptr %5, align 1, !tbaa !5
  %28 = sext i8 %27 to i32
  %29 = add nsw i32 %26, %28
  %30 = sitofp i32 %29 to float
  %31 = fmul float %.0, %30
  %32 = fptosi float %31 to i16
  %33 = getelementptr inbounds i8, ptr %0, i64 2
  store i16 %32, ptr %33, align 2, !tbaa !8
  %34 = load i8, ptr %8, align 1, !tbaa !5
  %35 = sext i8 %34 to i32
  %36 = shl nsw i32 %35, 8
  %37 = load i8, ptr %7, align 1, !tbaa !5
  %38 = sext i8 %37 to i32
  %39 = add nsw i32 %36, %38
  %40 = sitofp i32 %39 to float
  %41 = fmul float %.0, %40
  %42 = fptosi float %41 to i16
  %43 = getelementptr inbounds i8, ptr %0, i64 4
  store i16 %42, ptr %43, align 2, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %2) #3
  ret void
}

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

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

declare void @ACCELERO_IO_Read(ptr noundef, i8 noundef zeroext, i16 noundef zeroext) local_unnamed_addr #2

attributes #0 = { 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"short", !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass