; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Drivers/STM32H7xx_HAL_Driver/Src (GetOperationStatus)

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

%struct.FDCAN_HandleTypeDef = type { ptr, ptr, %struct.FDCAN_InitTypeDef, %struct.FDCAN_MsgRamAddressTypeDef, i32, i32, i32, i32 }
%struct.FDCAN_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.FDCAN_MsgRamAddressTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.TTCAN_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [111 x i32], i32 }
%struct.FDCAN_TTOperationStatusTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

; 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: nounwind uwtable
define dso_local i32 @HAL_FDCAN_TT_GetOperationStatus(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.FDCAN_HandleTypeDef, ptr %6, i32 0, i32 1
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.TTCAN_TypeDef, ptr %8, i32 0, i32 11
  %10 = load volatile i32, ptr %9, align 4, !tbaa !14
  store i32 %10, ptr %5, align 4, !tbaa !16
  %11 = load i32, ptr %5, align 4, !tbaa !16
  %12 = zext i32 %11 to i64
  %13 = and i64 %12, 3
  %14 = trunc i64 %13 to i32
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %15, i32 0, i32 0
  store i32 %14, ptr %16, align 4, !tbaa !17
  %17 = load i32, ptr %5, align 4, !tbaa !16
  %18 = zext i32 %17 to i64
  %19 = and i64 %18, 12
  %20 = trunc i64 %19 to i32
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %21, i32 0, i32 1
  store i32 %20, ptr %22, align 4, !tbaa !19
  %23 = load i32, ptr %5, align 4, !tbaa !16
  %24 = zext i32 %23 to i64
  %25 = and i64 %24, 48
  %26 = trunc i64 %25 to i32
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %27, i32 0, i32 2
  store i32 %26, ptr %28, align 4, !tbaa !20
  %29 = load i32, ptr %5, align 4, !tbaa !16
  %30 = zext i32 %29 to i64
  %31 = and i64 %30, 64
  %32 = lshr i64 %31, 6
  %33 = trunc i64 %32 to i32
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %34, i32 0, i32 3
  store i32 %33, ptr %35, align 4, !tbaa !21
  %36 = load i32, ptr %5, align 4, !tbaa !16
  %37 = zext i32 %36 to i64
  %38 = and i64 %37, 128
  %39 = lshr i64 %38, 7
  %40 = trunc i64 %39 to i32
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %41, i32 0, i32 4
  store i32 %40, ptr %42, align 4, !tbaa !22
  %43 = load i32, ptr %5, align 4, !tbaa !16
  %44 = zext i32 %43 to i64
  %45 = and i64 %44, 65280
  %46 = lshr i64 %45, 8
  %47 = trunc i64 %46 to i32
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %48, i32 0, i32 5
  store i32 %47, ptr %49, align 4, !tbaa !23
  %50 = load i32, ptr %5, align 4, !tbaa !16
  %51 = zext i32 %50 to i64
  %52 = and i64 %51, 4194304
  %53 = lshr i64 %52, 22
  %54 = trunc i64 %53 to i32
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %55, i32 0, i32 6
  store i32 %54, ptr %56, align 4, !tbaa !24
  %57 = load i32, ptr %5, align 4, !tbaa !16
  %58 = zext i32 %57 to i64
  %59 = and i64 %58, 8388608
  %60 = lshr i64 %59, 23
  %61 = trunc i64 %60 to i32
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %62, i32 0, i32 7
  store i32 %61, ptr %63, align 4, !tbaa !25
  %64 = load i32, ptr %5, align 4, !tbaa !16
  %65 = zext i32 %64 to i64
  %66 = and i64 %65, 117440512
  %67 = lshr i64 %66, 24
  %68 = trunc i64 %67 to i32
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %69, i32 0, i32 8
  store i32 %68, ptr %70, align 4, !tbaa !26
  %71 = load i32, ptr %5, align 4, !tbaa !16
  %72 = zext i32 %71 to i64
  %73 = and i64 %72, 134217728
  %74 = lshr i64 %73, 27
  %75 = trunc i64 %74 to i32
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %76, i32 0, i32 9
  store i32 %75, ptr %77, align 4, !tbaa !27
  %78 = load i32, ptr %5, align 4, !tbaa !16
  %79 = zext i32 %78 to i64
  %80 = and i64 %79, 268435456
  %81 = lshr i64 %80, 28
  %82 = trunc i64 %81 to i32
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %83, i32 0, i32 10
  store i32 %82, ptr %84, align 4, !tbaa !28
  %85 = load i32, ptr %5, align 4, !tbaa !16
  %86 = zext i32 %85 to i64
  %87 = and i64 %86, 536870912
  %88 = lshr i64 %87, 29
  %89 = trunc i64 %88 to i32
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %90, i32 0, i32 11
  store i32 %89, ptr %91, align 4, !tbaa !29
  %92 = load i32, ptr %5, align 4, !tbaa !16
  %93 = zext i32 %92 to i64
  %94 = and i64 %93, 1073741824
  %95 = lshr i64 %94, 30
  %96 = trunc i64 %95 to i32
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %97, i32 0, i32 12
  store i32 %96, ptr %98, align 4, !tbaa !30
  %99 = load i32, ptr %5, align 4, !tbaa !16
  %100 = zext i32 %99 to i64
  %101 = and i64 %100, 2147483648
  %102 = lshr i64 %101, 31
  %103 = trunc i64 %102 to i32
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.FDCAN_TTOperationStatusTypeDef, ptr %104, i32 0, i32 13
  store i32 %103, ptr %105, align 4, !tbaa !31
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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/C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"", !6, i64 0, !6, i64 8, !11, i64 16, !13, i64 124, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36}
!14 = !{!15, !12, i64 44}
!15 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !7, i64 68, !12, i64 512}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52}
!19 = !{!18, !12, i64 4}
!20 = !{!18, !12, i64 8}
!21 = !{!18, !12, i64 12}
!22 = !{!18, !12, i64 16}
!23 = !{!18, !12, i64 20}
!24 = !{!18, !12, i64 24}
!25 = !{!18, !12, i64 28}
!26 = !{!18, !12, i64 32}
!27 = !{!18, !12, i64 36}
!28 = !{!18, !12, i64 40}
!29 = !{!18, !12, i64 44}
!30 = !{!18, !12, i64 48}
!31 = !{!18, !12, i64 52}


; 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 nounwind willreturn uwtable
define dso_local noundef i32 @HAL_FDCAN_TT_GetOperationStatus(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 44
  %6 = load volatile i32, ptr %5, align 4, !tbaa !13
  %7 = insertelement <2 x i32> poison, i32 %6, i64 0
  %8 = shufflevector <2 x i32> %7, <2 x i32> poison, <2 x i32> zeroinitializer
  %9 = and <2 x i32> %8, <i32 3, i32 12>
  store <2 x i32> %9, ptr %1, align 4, !tbaa !15
  %10 = and i32 %6, 48
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 %10, ptr %11, align 4, !tbaa !16
  %12 = lshr i32 %6, 6
  %13 = and i32 %12, 1
  %14 = getelementptr inbounds i8, ptr %1, i64 12
  store i32 %13, ptr %14, align 4, !tbaa !18
  %15 = lshr i32 %6, 7
  %16 = and i32 %15, 1
  %17 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 %16, ptr %17, align 4, !tbaa !19
  %18 = lshr i32 %6, 8
  %19 = and i32 %18, 255
  %20 = getelementptr inbounds i8, ptr %1, i64 20
  store i32 %19, ptr %20, align 4, !tbaa !20
  %21 = lshr i32 %6, 22
  %22 = and i32 %21, 1
  %23 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 %22, ptr %23, align 4, !tbaa !21
  %24 = lshr i32 %6, 23
  %25 = and i32 %24, 1
  %26 = getelementptr inbounds i8, ptr %1, i64 28
  store i32 %25, ptr %26, align 4, !tbaa !22
  %27 = lshr i32 %6, 24
  %28 = and i32 %27, 7
  %29 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 %28, ptr %29, align 4, !tbaa !23
  %30 = lshr i32 %6, 27
  %31 = and i32 %30, 1
  %32 = getelementptr inbounds i8, ptr %1, i64 36
  store i32 %31, ptr %32, align 4, !tbaa !24
  %33 = lshr i32 %6, 28
  %34 = and i32 %33, 1
  %35 = getelementptr inbounds i8, ptr %1, i64 40
  store i32 %34, ptr %35, align 4, !tbaa !25
  %36 = lshr i32 %6, 29
  %37 = and i32 %36, 1
  %38 = getelementptr inbounds i8, ptr %1, i64 44
  store i32 %37, ptr %38, align 4, !tbaa !26
  %39 = lshr i32 %6, 30
  %40 = and i32 %39, 1
  %41 = getelementptr inbounds i8, ptr %1, i64 48
  store i32 %40, ptr %41, align 4, !tbaa !27
  %42 = lshr i32 %6, 31
  %43 = getelementptr inbounds i8, ptr %1, i64 52
  store i32 %42, ptr %43, align 4, !tbaa !28
  ret i32 0
}

attributes #0 = { mustprogress nofree norecurse nounwind willreturn 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, !7, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 124, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36}
!13 = !{!14, !11, i64 44}
!14 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !8, i64 68, !11, i64 512}
!15 = !{!11, !11, i64 0}
!16 = !{!17, !11, i64 8}
!17 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52}
!18 = !{!17, !11, i64 12}
!19 = !{!17, !11, i64 16}
!20 = !{!17, !11, i64 20}
!21 = !{!17, !11, i64 24}
!22 = !{!17, !11, i64 28}
!23 = !{!17, !11, i64 32}
!24 = !{!17, !11, i64 36}
!25 = !{!17, !11, i64 40}
!26 = !{!17, !11, i64 44}
!27 = !{!17, !11, i64 48}
!28 = !{!17, !11, i64 52}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass