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

; 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.MMC_HandleTypeDef = type { ptr, %struct.SDMMC_InitTypeDef, i32, ptr, i32, ptr, i32, i32, i32, i32, %struct.HAL_MMC_CardInfoTypeDef, [4 x i32], [4 x i32], [128 x i32] }
%struct.SDMMC_InitTypeDef = type { i32, i32, i32, i32, i32 }
%struct.HAL_MMC_CardInfoTypeDef = type { i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_MMC_GetCardInfo(ptr noundef %0, ptr noundef %1) #0 {
  %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, !tbaa !5
  %6 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %5, i32 0, i32 10
  %7 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %6, i32 0, i32 0
  %8 = load i32, ptr %7, align 8, !tbaa !9
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %9, i32 0, i32 0
  store i32 %8, ptr %10, align 4, !tbaa !14
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %11, i32 0, i32 10
  %13 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %12, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !15
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %15, i32 0, i32 1
  store i32 %14, ptr %16, align 4, !tbaa !16
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %17, i32 0, i32 10
  %19 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 8, !tbaa !17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %21, i32 0, i32 2
  store i32 %20, ptr %22, align 4, !tbaa !18
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %23, i32 0, i32 10
  %25 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %24, i32 0, i32 3
  %26 = load i32, ptr %25, align 4, !tbaa !19
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %27, i32 0, i32 3
  store i32 %26, ptr %28, align 4, !tbaa !20
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %29, i32 0, i32 10
  %31 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %30, i32 0, i32 4
  %32 = load i32, ptr %31, align 8, !tbaa !21
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %33, i32 0, i32 4
  store i32 %32, ptr %34, align 4, !tbaa !22
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %35, i32 0, i32 10
  %37 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %36, i32 0, i32 5
  %38 = load i32, ptr %37, align 4, !tbaa !23
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %39, i32 0, i32 5
  store i32 %38, ptr %40, align 4, !tbaa !24
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %41, i32 0, i32 10
  %43 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %42, i32 0, i32 6
  %44 = load i32, ptr %43, align 8, !tbaa !25
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %45, i32 0, i32 6
  store i32 %44, ptr %46, align 4, !tbaa !26
  ret i32 0
}

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

!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, !12, i64 72}
!10 = !{!"", !6, i64 0, !11, i64 8, !12, i64 28, !6, i64 32, !12, i64 40, !6, i64 48, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !13, i64 72, !7, i64 100, !7, i64 116, !7, i64 132}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!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}
!14 = !{!13, !12, i64 0}
!15 = !{!10, !12, i64 76}
!16 = !{!13, !12, i64 4}
!17 = !{!10, !12, i64 80}
!18 = !{!13, !12, i64 8}
!19 = !{!10, !12, i64 84}
!20 = !{!13, !12, i64 12}
!21 = !{!10, !12, i64 88}
!22 = !{!13, !12, i64 16}
!23 = !{!10, !12, i64 92}
!24 = !{!13, !12, i64 20}
!25 = !{!10, !12, i64 96}
!26 = !{!13, !12, i64 24}


; 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 i32 @HAL_MMC_GetCardInfo(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 72
  %4 = load <4 x i32>, ptr %3, align 8, !tbaa !5
  store <4 x i32> %4, ptr %1, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 88
  %6 = getelementptr inbounds i8, ptr %1, i64 16
  %7 = load <2 x i32>, ptr %5, align 8, !tbaa !5
  store <2 x i32> %7, ptr %6, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 96
  %9 = load i32, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %1, i64 24
  store i32 %9, ptr %10, align 4, !tbaa !14
  ret i32 0
}

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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 96}
!10 = !{!"", !11, i64 0, !12, i64 8, !6, i64 28, !11, i64 32, !6, i64 40, !11, i64 48, !6, i64 56, !6, i64 60, !6, i64 64, !6, i64 68, !13, i64 72, !7, i64 100, !7, i64 116, !7, i64 132}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16}
!13 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!14 = !{!13, !6, i64 24}


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