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

; 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.SDMMC_DataInitTypeDef = type { i32, i32, i32, i32, i32, i32 }
%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 }
%struct.SDMMC_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, i32, i32, i32, [8 x i32], i32, [222 x 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

declare i32 @SDMMC_CmdBlockLength(ptr noundef, i32 noundef) #1

declare i32 @SDMMC_ConfigData(ptr noundef, ptr noundef) #1

declare i32 @SDMMC_CmdReadMultiBlock(ptr noundef, i32 noundef) #1

declare i32 @SDMMC_CmdReadSingleBlock(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_MMC_ReadBlocks_DMA(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %struct.SDMMC_DataInitTypeDef, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %14 = load i32, ptr %8, align 4, !tbaa !9
  store i32 %14, ptr %12, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = icmp eq ptr null, %15
  br i1 %16, label %17, label %22

17:                                               ; preds = %4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %18, i32 0, i32 9
  %20 = load volatile i32, ptr %19, align 4, !tbaa !11
  %21 = or i32 %20, 134217728
  store volatile i32 %21, ptr %19, align 4, !tbaa !11
  store i32 1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

22:                                               ; preds = %4
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %23, i32 0, i32 8
  %25 = load volatile i32, ptr %24, align 8, !tbaa !15
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %161

27:                                               ; preds = %22
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %28, i32 0, i32 9
  store volatile i32 0, ptr %29, align 4, !tbaa !11
  %30 = load i32, ptr %8, align 4, !tbaa !9
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = add i32 %30, %31
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %33, i32 0, i32 10
  %35 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %34, i32 0, i32 5
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = icmp ugt i32 %32, %36
  br i1 %37, label %38, label %43

38:                                               ; preds = %27
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %39, i32 0, i32 9
  %41 = load volatile i32, ptr %40, align 4, !tbaa !11
  %42 = or i32 %41, 33554432
  store volatile i32 %42, ptr %40, align 4, !tbaa !11
  store i32 1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

43:                                               ; preds = %27
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %44, i32 0, i32 8
  store volatile i32 3, ptr %45, align 8, !tbaa !15
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %48, i32 0, i32 11
  store volatile i32 0, ptr %49, align 4, !tbaa !18
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %51, i32 0, i32 5
  store ptr %50, ptr %52, align 8, !tbaa !20
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = mul i32 512, %53
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %55, i32 0, i32 6
  store i32 %54, ptr %56, align 8, !tbaa !21
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %57, i32 0, i32 10
  %59 = getelementptr inbounds %struct.HAL_MMC_CardInfoTypeDef, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !22
  %61 = icmp ne i32 %60, 1
  br i1 %61, label %62, label %65

62:                                               ; preds = %43
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = mul i32 %63, 512
  store i32 %64, ptr %12, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %62, %43
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !17
  %69 = call i32 @SDMMC_CmdBlockLength(ptr noundef %68, i32 noundef 512)
  store i32 %69, ptr %11, align 4, !tbaa !9
  %70 = load i32, ptr %11, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %82

72:                                               ; preds = %65
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %73, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !17
  %76 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %75, i32 0, i32 14
  store volatile i32 534777855, ptr %76, align 4, !tbaa !23
  %77 = load i32, ptr %11, align 4, !tbaa !9
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %78, i32 0, i32 9
  store volatile i32 %77, ptr %79, align 4, !tbaa !11
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %80, i32 0, i32 8
  store volatile i32 1, ptr %81, align 8, !tbaa !15
  store i32 1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

82:                                               ; preds = %65
  %83 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 0
  store i32 -1, ptr %83, align 4, !tbaa !24
  %84 = load i32, ptr %9, align 4, !tbaa !9
  %85 = mul i32 512, %84
  %86 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 1
  store i32 %85, ptr %86, align 4, !tbaa !26
  %87 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 2
  store i32 144, ptr %87, align 4, !tbaa !27
  %88 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 3
  store i32 2, ptr %88, align 4, !tbaa !28
  %89 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 4
  store i32 0, ptr %89, align 4, !tbaa !29
  %90 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %10, i32 0, i32 5
  store i32 0, ptr %90, align 4, !tbaa !30
  %91 = load ptr, ptr %6, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !17
  %94 = call i32 @SDMMC_ConfigData(ptr noundef %93, ptr noundef %10)
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %97, i32 0, i32 15
  %99 = load volatile i32, ptr %98, align 4, !tbaa !31
  %100 = zext i32 %99 to i64
  %101 = or i64 %100, 298
  %102 = trunc i64 %101 to i32
  store volatile i32 %102, ptr %98, align 4, !tbaa !31
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %103, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  %106 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %105, i32 0, i32 3
  %107 = load volatile i32, ptr %106, align 4, !tbaa !32
  %108 = zext i32 %107 to i64
  %109 = or i64 %108, 64
  %110 = trunc i64 %109 to i32
  store volatile i32 %110, ptr %106, align 4, !tbaa !32
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = ptrtoint ptr %111 to i32
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %113, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !17
  %116 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %115, i32 0, i32 20
  store volatile i32 %112, ptr %116, align 4, !tbaa !33
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !17
  %120 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %119, i32 0, i32 18
  store volatile i32 1, ptr %120, align 4, !tbaa !34
  %121 = load i32, ptr %9, align 4, !tbaa !9
  %122 = icmp ugt i32 %121, 1
  br i1 %122, label %123, label %131

123:                                              ; preds = %82
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %124, i32 0, i32 7
  store volatile i32 130, ptr %125, align 4, !tbaa !35
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %126, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !17
  %129 = load i32, ptr %12, align 4, !tbaa !9
  %130 = call i32 @SDMMC_CmdReadMultiBlock(ptr noundef %128, i32 noundef %129)
  store i32 %130, ptr %11, align 4, !tbaa !9
  br label %139

131:                                              ; preds = %82
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %132, i32 0, i32 7
  store volatile i32 129, ptr %133, align 4, !tbaa !35
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %134, i32 0, i32 0
  %136 = load ptr, ptr %135, align 8, !tbaa !17
  %137 = load i32, ptr %12, align 4, !tbaa !9
  %138 = call i32 @SDMMC_CmdReadSingleBlock(ptr noundef %136, i32 noundef %137)
  store i32 %138, ptr %11, align 4, !tbaa !9
  br label %139

139:                                              ; preds = %131, %123
  %140 = load i32, ptr %11, align 4, !tbaa !9
  %141 = icmp ne i32 %140, 0
  br i1 %141, label %142, label %160

142:                                              ; preds = %139
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !17
  %146 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %145, i32 0, i32 14
  store volatile i32 534777855, ptr %146, align 4, !tbaa !23
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !17
  %150 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %149, i32 0, i32 15
  %151 = load volatile i32, ptr %150, align 4, !tbaa !31
  %152 = zext i32 %151 to i64
  %153 = and i64 %152, -299
  %154 = trunc i64 %153 to i32
  store volatile i32 %154, ptr %150, align 4, !tbaa !31
  %155 = load i32, ptr %11, align 4, !tbaa !9
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %156, i32 0, i32 9
  store volatile i32 %155, ptr %157, align 4, !tbaa !11
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.MMC_HandleTypeDef, ptr %158, i32 0, i32 8
  store volatile i32 1, ptr %159, align 8, !tbaa !15
  store i32 1, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

160:                                              ; preds = %139
  store i32 0, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

161:                                              ; preds = %22
  store i32 2, ptr %5, align 4
  store i32 1, ptr %13, align 4
  br label %162

162:                                              ; preds = %161, %160, %142, %72, %38, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %10) #3
  %163 = load i32, ptr %5, align 4
  ret i32 %163
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #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 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 68}
!12 = !{!"", !6, i64 0, !13, i64 8, !10, i64 28, !6, i64 32, !10, i64 40, !6, i64 48, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !14, i64 72, !7, i64 100, !7, i64 116, !7, i64 132}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!14 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!15 = !{!12, !10, i64 64}
!16 = !{!12, !10, i64 92}
!17 = !{!12, !6, i64 0}
!18 = !{!19, !10, i64 44}
!19 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !7, i64 68, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !7, i64 96, !10, i64 128, !7, i64 132, !10, i64 1020}
!20 = !{!12, !6, i64 48}
!21 = !{!12, !10, i64 56}
!22 = !{!12, !10, i64 72}
!23 = !{!19, !10, i64 56}
!24 = !{!25, !10, i64 0}
!25 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!26 = !{!25, !10, i64 4}
!27 = !{!25, !10, i64 8}
!28 = !{!25, !10, i64 12}
!29 = !{!25, !10, i64 16}
!30 = !{!25, !10, i64 20}
!31 = !{!19, !10, i64 60}
!32 = !{!19, !10, i64 12}
!33 = !{!19, !10, i64 88}
!34 = !{!19, !10, i64 80}
!35 = !{!12, !10, i64 60}


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

%struct.SDMMC_DataInitTypeDef = type { i32, i32, i32, i32, i32, i32 }

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

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

declare i32 @SDMMC_CmdBlockLength(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @SDMMC_ConfigData(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @SDMMC_CmdReadMultiBlock(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @SDMMC_CmdReadSingleBlock(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_MMC_ReadBlocks_DMA(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #2 {
  %5 = alloca %struct.SDMMC_DataInitTypeDef, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #3
  %6 = icmp eq ptr %1, null
  br i1 %6, label %7, label %11

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 68
  %9 = load volatile i32, ptr %8, align 4, !tbaa !5
  %10 = or i32 %9, 134217728
  store volatile i32 %10, ptr %8, align 4, !tbaa !5
  br label %66

11:                                               ; preds = %4
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = load volatile i32, ptr %12, align 8, !tbaa !13
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %15, label %66

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %0, i64 68
  store volatile i32 0, ptr %16, align 4, !tbaa !5
  %17 = add i32 %3, %2
  %18 = getelementptr inbounds i8, ptr %0, i64 92
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %20 = icmp ugt i32 %17, %19
  br i1 %20, label %21, label %24

21:                                               ; preds = %15
  %22 = load volatile i32, ptr %16, align 4, !tbaa !5
  %23 = or i32 %22, 33554432
  store volatile i32 %23, ptr %16, align 4, !tbaa !5
  br label %66

24:                                               ; preds = %15
  %25 = getelementptr inbounds i8, ptr %0, i64 72
  store volatile i32 3, ptr %12, align 8, !tbaa !13
  %26 = load ptr, ptr %0, align 8, !tbaa !15
  %27 = getelementptr inbounds i8, ptr %26, i64 44
  store volatile i32 0, ptr %27, align 4, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %1, ptr %28, align 8, !tbaa !18
  %29 = shl i32 %3, 9
  %30 = getelementptr inbounds i8, ptr %0, i64 56
  store i32 %29, ptr %30, align 8, !tbaa !19
  %31 = load i32, ptr %25, align 8, !tbaa !20
  %.not = icmp eq i32 %31, 1
  %32 = shl i32 %2, 9
  %spec.select = select i1 %.not, i32 %2, i32 %32
  %33 = tail call i32 @SDMMC_CmdBlockLength(ptr noundef %26, i32 noundef 512) #3
  %.not47 = icmp eq i32 %33, 0
  br i1 %.not47, label %37, label %34

34:                                               ; preds = %24
  %35 = load ptr, ptr %0, align 8, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %35, i64 56
  store volatile i32 534777855, ptr %36, align 4, !tbaa !21
  store volatile i32 %33, ptr %16, align 4, !tbaa !5
  store volatile i32 1, ptr %12, align 8, !tbaa !13
  br label %66

37:                                               ; preds = %24
  store i32 -1, ptr %5, align 4, !tbaa !22
  %38 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 %29, ptr %38, align 4, !tbaa !24
  %39 = getelementptr inbounds i8, ptr %5, i64 8
  store <4 x i32> <i32 144, i32 2, i32 0, i32 0>, ptr %39, align 4, !tbaa !25
  %40 = load ptr, ptr %0, align 8, !tbaa !15
  %41 = call i32 @SDMMC_ConfigData(ptr noundef %40, ptr noundef nonnull %5) #3
  %42 = load ptr, ptr %0, align 8, !tbaa !15
  %43 = getelementptr inbounds i8, ptr %42, i64 60
  %44 = load volatile i32, ptr %43, align 4, !tbaa !26
  %45 = or i32 %44, 298
  store volatile i32 %45, ptr %43, align 4, !tbaa !26
  %46 = getelementptr inbounds i8, ptr %42, i64 12
  %47 = load volatile i32, ptr %46, align 4, !tbaa !27
  %48 = or i32 %47, 64
  store volatile i32 %48, ptr %46, align 4, !tbaa !27
  %49 = ptrtoint ptr %1 to i64
  %50 = trunc i64 %49 to i32
  %51 = getelementptr inbounds i8, ptr %42, i64 88
  store volatile i32 %50, ptr %51, align 4, !tbaa !28
  %52 = getelementptr inbounds i8, ptr %42, i64 80
  store volatile i32 1, ptr %52, align 4, !tbaa !29
  %53 = icmp ugt i32 %3, 1
  %54 = getelementptr inbounds i8, ptr %0, i64 60
  br i1 %53, label %55, label %57

55:                                               ; preds = %37
  store volatile i32 130, ptr %54, align 4, !tbaa !30
  %56 = call i32 @SDMMC_CmdReadMultiBlock(ptr noundef nonnull %42, i32 noundef %spec.select) #3
  br label %59

57:                                               ; preds = %37
  store volatile i32 129, ptr %54, align 4, !tbaa !30
  %58 = call i32 @SDMMC_CmdReadSingleBlock(ptr noundef nonnull %42, i32 noundef %spec.select) #3
  br label %59

59:                                               ; preds = %57, %55
  %.043 = phi i32 [ %56, %55 ], [ %58, %57 ]
  %.not48 = icmp eq i32 %.043, 0
  br i1 %.not48, label %66, label %60

60:                                               ; preds = %59
  %61 = load ptr, ptr %0, align 8, !tbaa !15
  %62 = getelementptr inbounds i8, ptr %61, i64 56
  store volatile i32 534777855, ptr %62, align 4, !tbaa !21
  %63 = getelementptr inbounds i8, ptr %61, i64 60
  %64 = load volatile i32, ptr %63, align 4, !tbaa !26
  %65 = and i32 %64, -299
  store volatile i32 %65, ptr %63, align 4, !tbaa !26
  store volatile i32 %.043, ptr %16, align 4, !tbaa !5
  store volatile i32 1, ptr %12, align 8, !tbaa !13
  br label %66

66:                                               ; preds = %11, %59, %60, %34, %21, %7
  %.044 = phi i32 [ 1, %7 ], [ 1, %21 ], [ 1, %34 ], [ 1, %60 ], [ 0, %59 ], [ 2, %11 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  ret i32 %.044
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #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, !11, i64 68}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 28, !7, i64 32, !11, i64 40, !7, i64 48, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !12, i64 72, !8, i64 100, !8, i64 116, !8, i64 132}
!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 = !{!"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}
!13 = !{!6, !11, i64 64}
!14 = !{!6, !11, i64 92}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !11, i64 44}
!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, !11, i64 56, !11, i64 60, !11, i64 64, !8, i64 68, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !8, i64 96, !11, i64 128, !8, i64 132, !11, i64 1020}
!18 = !{!6, !7, i64 48}
!19 = !{!6, !11, i64 56}
!20 = !{!6, !11, i64 72}
!21 = !{!17, !11, i64 56}
!22 = !{!23, !11, i64 0}
!23 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!24 = !{!23, !11, i64 4}
!25 = !{!11, !11, i64 0}
!26 = !{!17, !11, i64 60}
!27 = !{!17, !11, i64 12}
!28 = !{!17, !11, i64 88}
!29 = !{!17, !11, i64 80}
!30 = !{!6, !11, i64 60}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass