; LLVM IR from ctlst-tech/catpilot :: bsp/mcu/core/stm32/h753/hal/src (stm32h7xx_hal_sd)

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

declare i32 @HAL_GetTick() #1

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

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

declare i32 @SDMMC_CmdStopTransfer(ptr noundef) #1

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

26:                                               ; preds = %5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %27, i32 0, i32 9
  %29 = load volatile i32, ptr %28, align 4, !tbaa !11
  %30 = or i32 %29, 134217728
  store volatile i32 %30, ptr %28, align 4, !tbaa !11
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

31:                                               ; preds = %5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %32, i32 0, i32 8
  %34 = load volatile i32, ptr %33, align 8, !tbaa !15
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %341

36:                                               ; preds = %31
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %37, i32 0, i32 9
  store volatile i32 0, ptr %38, align 4, !tbaa !11
  %39 = load i32, ptr %18, align 4, !tbaa !9
  %40 = load i32, ptr %10, align 4, !tbaa !9
  %41 = add i32 %39, %40
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %42, i32 0, i32 10
  %44 = getelementptr inbounds %struct.HAL_SD_CardInfoTypeDef, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = icmp ugt i32 %41, %45
  br i1 %46, label %47, label %52

47:                                               ; preds = %36
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %48, i32 0, i32 9
  %50 = load volatile i32, ptr %49, align 4, !tbaa !11
  %51 = or i32 %50, 33554432
  store volatile i32 %51, ptr %49, align 4, !tbaa !11
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

52:                                               ; preds = %36
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %53, i32 0, i32 8
  store volatile i32 3, ptr %54, align 8, !tbaa !15
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !17
  %58 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %57, i32 0, i32 11
  store volatile i32 0, ptr %58, align 4, !tbaa !18
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %59, i32 0, i32 10
  %61 = getelementptr inbounds %struct.HAL_SD_CardInfoTypeDef, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !20
  %63 = icmp ne i32 %62, 1
  br i1 %63, label %64, label %67

64:                                               ; preds = %52
  %65 = load i32, ptr %18, align 4, !tbaa !9
  %66 = mul i32 %65, 512
  store i32 %66, ptr %18, align 4, !tbaa !9
  br label %67

67:                                               ; preds = %64, %52
  %68 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 0
  store i32 -1, ptr %68, align 4, !tbaa !21
  %69 = load i32, ptr %10, align 4, !tbaa !9
  %70 = mul i32 %69, 512
  %71 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 1
  store i32 %70, ptr %71, align 4, !tbaa !23
  %72 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 2
  store i32 144, ptr %72, align 4, !tbaa !24
  %73 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 3
  store i32 0, ptr %73, align 4, !tbaa !25
  %74 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 4
  store i32 0, ptr %74, align 4, !tbaa !26
  %75 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 5
  store i32 0, ptr %75, align 4, !tbaa !27
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %76, i32 0, i32 0
  %78 = load ptr, ptr %77, align 8, !tbaa !17
  %79 = call i32 @SDMMC_ConfigData(ptr noundef %78, ptr noundef %12)
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !17
  %83 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %82, i32 0, i32 3
  %84 = load volatile i32, ptr %83, align 4, !tbaa !28
  %85 = zext i32 %84 to i64
  %86 = or i64 %85, 64
  %87 = trunc i64 %86 to i32
  store volatile i32 %87, ptr %83, align 4, !tbaa !28
  %88 = load i32, ptr %10, align 4, !tbaa !9
  %89 = icmp ugt i32 %88, 1
  br i1 %89, label %90, label %98

90:                                               ; preds = %67
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %91, i32 0, i32 7
  store volatile i32 32, ptr %92, align 4, !tbaa !29
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !17
  %96 = load i32, ptr %18, align 4, !tbaa !9
  %97 = call i32 @SDMMC_CmdWriteMultiBlock(ptr noundef %95, i32 noundef %96)
  store i32 %97, ptr %13, align 4, !tbaa !9
  br label %106

98:                                               ; preds = %67
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %99, i32 0, i32 7
  store volatile i32 16, ptr %100, align 4, !tbaa !29
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !17
  %104 = load i32, ptr %18, align 4, !tbaa !9
  %105 = call i32 @SDMMC_CmdWriteSingleBlock(ptr noundef %103, i32 noundef %104)
  store i32 %105, ptr %13, align 4, !tbaa !9
  br label %106

106:                                              ; preds = %98, %90
  %107 = load i32, ptr %13, align 4, !tbaa !9
  %108 = icmp ne i32 %107, 0
  br i1 %108, label %109, label %123

109:                                              ; preds = %106
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !17
  %113 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %112, i32 0, i32 14
  store volatile i32 534777855, ptr %113, align 4, !tbaa !30
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %115, i32 0, i32 9
  %117 = load volatile i32, ptr %116, align 4, !tbaa !11
  %118 = or i32 %117, %114
  store volatile i32 %118, ptr %116, align 4, !tbaa !11
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %119, i32 0, i32 8
  store volatile i32 1, ptr %120, align 8, !tbaa !15
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %121, i32 0, i32 7
  store volatile i32 0, ptr %122, align 4, !tbaa !29
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

123:                                              ; preds = %106
  %124 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 1
  %125 = load i32, ptr %124, align 4, !tbaa !23
  store i32 %125, ptr %17, align 4, !tbaa !9
  br label %126

126:                                              ; preds = %215, %123
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %127, i32 0, i32 0
  %129 = load ptr, ptr %128, align 8, !tbaa !17
  %130 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %129, i32 0, i32 13
  %131 = load volatile i32, ptr %130, align 4, !tbaa !31
  %132 = zext i32 %131 to i64
  %133 = and i64 %132, 282
  %134 = icmp ne i64 %133, 0
  %135 = xor i1 %134, true
  br i1 %135, label %136, label %216

136:                                              ; preds = %126
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !17
  %140 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %139, i32 0, i32 13
  %141 = load volatile i32, ptr %140, align 4, !tbaa !31
  %142 = zext i32 %141 to i64
  %143 = and i64 %142, 16384
  %144 = icmp ne i64 %143, 0
  br i1 %144, label %145, label %192

145:                                              ; preds = %136
  %146 = load i32, ptr %17, align 4, !tbaa !9
  %147 = icmp uge i32 %146, 32
  br i1 %147, label %148, label %192

148:                                              ; preds = %145
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %149

149:                                              ; preds = %186, %148
  %150 = load i32, ptr %15, align 4, !tbaa !9
  %151 = icmp ult i32 %150, 8
  br i1 %151, label %152, label %189

152:                                              ; preds = %149
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = load i8, ptr %153, align 1, !tbaa !32
  %155 = zext i8 %154 to i32
  store i32 %155, ptr %16, align 4, !tbaa !9
  %156 = load ptr, ptr %19, align 8, !tbaa !5
  %157 = getelementptr inbounds i8, ptr %156, i32 1
  store ptr %157, ptr %19, align 8, !tbaa !5
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  %159 = load i8, ptr %158, align 1, !tbaa !32
  %160 = zext i8 %159 to i32
  %161 = shl i32 %160, 8
  %162 = load i32, ptr %16, align 4, !tbaa !9
  %163 = or i32 %162, %161
  store i32 %163, ptr %16, align 4, !tbaa !9
  %164 = load ptr, ptr %19, align 8, !tbaa !5
  %165 = getelementptr inbounds i8, ptr %164, i32 1
  store ptr %165, ptr %19, align 8, !tbaa !5
  %166 = load ptr, ptr %19, align 8, !tbaa !5
  %167 = load i8, ptr %166, align 1, !tbaa !32
  %168 = zext i8 %167 to i32
  %169 = shl i32 %168, 16
  %170 = load i32, ptr %16, align 4, !tbaa !9
  %171 = or i32 %170, %169
  store i32 %171, ptr %16, align 4, !tbaa !9
  %172 = load ptr, ptr %19, align 8, !tbaa !5
  %173 = getelementptr inbounds i8, ptr %172, i32 1
  store ptr %173, ptr %19, align 8, !tbaa !5
  %174 = load ptr, ptr %19, align 8, !tbaa !5
  %175 = load i8, ptr %174, align 1, !tbaa !32
  %176 = zext i8 %175 to i32
  %177 = shl i32 %176, 24
  %178 = load i32, ptr %16, align 4, !tbaa !9
  %179 = or i32 %178, %177
  store i32 %179, ptr %16, align 4, !tbaa !9
  %180 = load ptr, ptr %19, align 8, !tbaa !5
  %181 = getelementptr inbounds i8, ptr %180, i32 1
  store ptr %181, ptr %19, align 8, !tbaa !5
  %182 = load ptr, ptr %7, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !17
  %185 = call i32 @SDMMC_WriteFIFO(ptr noundef %184, ptr noundef %16)
  br label %186

186:                                              ; preds = %152
  %187 = load i32, ptr %15, align 4, !tbaa !9
  %188 = add i32 %187, 1
  store i32 %188, ptr %15, align 4, !tbaa !9
  br label %149, !llvm.loop !33

189:                                              ; preds = %149
  %190 = load i32, ptr %17, align 4, !tbaa !9
  %191 = sub i32 %190, 32
  store i32 %191, ptr %17, align 4, !tbaa !9
  br label %192

192:                                              ; preds = %189, %145, %136
  %193 = call i32 @HAL_GetTick()
  %194 = load i32, ptr %14, align 4, !tbaa !9
  %195 = sub i32 %193, %194
  %196 = load i32, ptr %11, align 4, !tbaa !9
  %197 = icmp uge i32 %195, %196
  br i1 %197, label %201, label %198

198:                                              ; preds = %192
  %199 = load i32, ptr %11, align 4, !tbaa !9
  %200 = icmp eq i32 %199, 0
  br i1 %200, label %201, label %215

201:                                              ; preds = %198, %192
  %202 = load ptr, ptr %7, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %202, i32 0, i32 0
  %204 = load ptr, ptr %203, align 8, !tbaa !17
  %205 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %204, i32 0, i32 14
  store volatile i32 534777855, ptr %205, align 4, !tbaa !30
  %206 = load i32, ptr %13, align 4, !tbaa !9
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %207, i32 0, i32 9
  %209 = load volatile i32, ptr %208, align 4, !tbaa !11
  %210 = or i32 %209, %206
  store volatile i32 %210, ptr %208, align 4, !tbaa !11
  %211 = load ptr, ptr %7, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %211, i32 0, i32 8
  store volatile i32 1, ptr %212, align 8, !tbaa !15
  %213 = load ptr, ptr %7, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %213, i32 0, i32 7
  store volatile i32 0, ptr %214, align 4, !tbaa !29
  store i32 3, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

215:                                              ; preds = %198
  br label %126, !llvm.loop !35

216:                                              ; preds = %126
  %217 = load ptr, ptr %7, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %217, i32 0, i32 0
  %219 = load ptr, ptr %218, align 8, !tbaa !17
  %220 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %219, i32 0, i32 3
  %221 = load volatile i32, ptr %220, align 4, !tbaa !28
  %222 = zext i32 %221 to i64
  %223 = and i64 %222, -65
  %224 = trunc i64 %223 to i32
  store volatile i32 %224, ptr %220, align 4, !tbaa !28
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %225, i32 0, i32 0
  %227 = load ptr, ptr %226, align 8, !tbaa !17
  %228 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %227, i32 0, i32 13
  %229 = load volatile i32, ptr %228, align 4, !tbaa !31
  %230 = zext i32 %229 to i64
  %231 = and i64 %230, 256
  %232 = icmp ne i64 %231, 0
  br i1 %232, label %233, label %265

233:                                              ; preds = %216
  %234 = load i32, ptr %10, align 4, !tbaa !9
  %235 = icmp ugt i32 %234, 1
  br i1 %235, label %236, label %265

236:                                              ; preds = %233
  %237 = load ptr, ptr %7, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %237, i32 0, i32 10
  %239 = getelementptr inbounds %struct.HAL_SD_CardInfoTypeDef, ptr %238, i32 0, i32 0
  %240 = load i32, ptr %239, align 8, !tbaa !20
  %241 = icmp ne i32 %240, 3
  br i1 %241, label %242, label %264

242:                                              ; preds = %236
  %243 = load ptr, ptr %7, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %243, i32 0, i32 0
  %245 = load ptr, ptr %244, align 8, !tbaa !17
  %246 = call i32 @SDMMC_CmdStopTransfer(ptr noundef %245)
  store i32 %246, ptr %13, align 4, !tbaa !9
  %247 = load i32, ptr %13, align 4, !tbaa !9
  %248 = icmp ne i32 %247, 0
  br i1 %248, label %249, label %263

249:                                              ; preds = %242
  %250 = load ptr, ptr %7, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %250, i32 0, i32 0
  %252 = load ptr, ptr %251, align 8, !tbaa !17
  %253 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %252, i32 0, i32 14
  store volatile i32 534777855, ptr %253, align 4, !tbaa !30
  %254 = load i32, ptr %13, align 4, !tbaa !9
  %255 = load ptr, ptr %7, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %255, i32 0, i32 9
  %257 = load volatile i32, ptr %256, align 4, !tbaa !11
  %258 = or i32 %257, %254
  store volatile i32 %258, ptr %256, align 4, !tbaa !11
  %259 = load ptr, ptr %7, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %259, i32 0, i32 8
  store volatile i32 1, ptr %260, align 8, !tbaa !15
  %261 = load ptr, ptr %7, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %261, i32 0, i32 7
  store volatile i32 0, ptr %262, align 4, !tbaa !29
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

263:                                              ; preds = %242
  br label %264

264:                                              ; preds = %263, %236
  br label %265

265:                                              ; preds = %264, %233, %216
  %266 = load ptr, ptr %7, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %266, i32 0, i32 0
  %268 = load ptr, ptr %267, align 8, !tbaa !17
  %269 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %268, i32 0, i32 13
  %270 = load volatile i32, ptr %269, align 4, !tbaa !31
  %271 = zext i32 %270 to i64
  %272 = and i64 %271, 8
  %273 = icmp ne i64 %272, 0
  br i1 %273, label %274, label %287

274:                                              ; preds = %265
  %275 = load ptr, ptr %7, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %275, i32 0, i32 0
  %277 = load ptr, ptr %276, align 8, !tbaa !17
  %278 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %277, i32 0, i32 14
  store volatile i32 534777855, ptr %278, align 4, !tbaa !30
  %279 = load ptr, ptr %7, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %279, i32 0, i32 9
  %281 = load volatile i32, ptr %280, align 4, !tbaa !11
  %282 = or i32 %281, 8
  store volatile i32 %282, ptr %280, align 4, !tbaa !11
  %283 = load ptr, ptr %7, align 8, !tbaa !5
  %284 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %283, i32 0, i32 8
  store volatile i32 1, ptr %284, align 8, !tbaa !15
  %285 = load ptr, ptr %7, align 8, !tbaa !5
  %286 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %285, i32 0, i32 7
  store volatile i32 0, ptr %286, align 4, !tbaa !29
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

287:                                              ; preds = %265
  %288 = load ptr, ptr %7, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %288, i32 0, i32 0
  %290 = load ptr, ptr %289, align 8, !tbaa !17
  %291 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %290, i32 0, i32 13
  %292 = load volatile i32, ptr %291, align 4, !tbaa !31
  %293 = zext i32 %292 to i64
  %294 = and i64 %293, 2
  %295 = icmp ne i64 %294, 0
  br i1 %295, label %296, label %309

296:                                              ; preds = %287
  %297 = load ptr, ptr %7, align 8, !tbaa !5
  %298 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %297, i32 0, i32 0
  %299 = load ptr, ptr %298, align 8, !tbaa !17
  %300 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %299, i32 0, i32 14
  store volatile i32 534777855, ptr %300, align 4, !tbaa !30
  %301 = load ptr, ptr %7, align 8, !tbaa !5
  %302 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %301, i32 0, i32 9
  %303 = load volatile i32, ptr %302, align 4, !tbaa !11
  %304 = or i32 %303, 2
  store volatile i32 %304, ptr %302, align 4, !tbaa !11
  %305 = load ptr, ptr %7, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %305, i32 0, i32 8
  store volatile i32 1, ptr %306, align 8, !tbaa !15
  %307 = load ptr, ptr %7, align 8, !tbaa !5
  %308 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %307, i32 0, i32 7
  store volatile i32 0, ptr %308, align 4, !tbaa !29
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

309:                                              ; preds = %287
  %310 = load ptr, ptr %7, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %310, i32 0, i32 0
  %312 = load ptr, ptr %311, align 8, !tbaa !17
  %313 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %312, i32 0, i32 13
  %314 = load volatile i32, ptr %313, align 4, !tbaa !31
  %315 = zext i32 %314 to i64
  %316 = and i64 %315, 16
  %317 = icmp ne i64 %316, 0
  br i1 %317, label %318, label %331

318:                                              ; preds = %309
  %319 = load ptr, ptr %7, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %319, i32 0, i32 0
  %321 = load ptr, ptr %320, align 8, !tbaa !17
  %322 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %321, i32 0, i32 14
  store volatile i32 534777855, ptr %322, align 4, !tbaa !30
  %323 = load ptr, ptr %7, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %323, i32 0, i32 9
  %325 = load volatile i32, ptr %324, align 4, !tbaa !11
  %326 = or i32 %325, 16
  store volatile i32 %326, ptr %324, align 4, !tbaa !11
  %327 = load ptr, ptr %7, align 8, !tbaa !5
  %328 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %327, i32 0, i32 8
  store volatile i32 1, ptr %328, align 8, !tbaa !15
  %329 = load ptr, ptr %7, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %329, i32 0, i32 7
  store volatile i32 0, ptr %330, align 4, !tbaa !29
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

331:                                              ; preds = %309
  br label %332

332:                                              ; preds = %331
  br label %333

333:                                              ; preds = %332
  br label %334

334:                                              ; preds = %333
  %335 = load ptr, ptr %7, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %335, i32 0, i32 0
  %337 = load ptr, ptr %336, align 8, !tbaa !17
  %338 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %337, i32 0, i32 14
  store volatile i32 402657082, ptr %338, align 4, !tbaa !30
  %339 = load ptr, ptr %7, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %339, i32 0, i32 8
  store volatile i32 1, ptr %340, align 8, !tbaa !15
  store i32 0, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

341:                                              ; preds = %31
  %342 = load ptr, ptr %7, align 8, !tbaa !5
  %343 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %342, i32 0, i32 9
  %344 = load volatile i32, ptr %343, align 4, !tbaa !11
  %345 = or i32 %344, 536870912
  store volatile i32 %345, ptr %343, align 4, !tbaa !11
  store i32 1, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %346

346:                                              ; preds = %341, %334, %318, %296, %274, %249, %201, %109, %47, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #3
  %347 = load i32, ptr %6, align 4
  ret i32 %347
}

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

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

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

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 108, !7, i64 124}
!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, !10, i64 28, !10, i64 32}
!15 = !{!12, !10, i64 64}
!16 = !{!12, !10, i64 96}
!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, !10, i64 72}
!21 = !{!22, !10, i64 0}
!22 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!23 = !{!22, !10, i64 4}
!24 = !{!22, !10, i64 8}
!25 = !{!22, !10, i64 12}
!26 = !{!22, !10, i64 16}
!27 = !{!22, !10, i64 20}
!28 = !{!19, !10, i64 12}
!29 = !{!12, !10, i64 60}
!30 = !{!19, !10, i64 56}
!31 = !{!19, !10, i64 52}
!32 = !{!7, !7, i64 0}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34}


; 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

declare i32 @HAL_GetTick() local_unnamed_addr #1

; 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_ConfigData(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @SDMMC_CmdStopTransfer(ptr noundef) local_unnamed_addr #1

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

10:                                               ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 68
  %12 = load volatile i32, ptr %11, align 4, !tbaa !5
  %13 = or i32 %12, 134217728
  store volatile i32 %13, ptr %11, align 4, !tbaa !5
  br label %280

14:                                               ; preds = %5
  %15 = getelementptr inbounds i8, ptr %0, i64 64
  %16 = load volatile i32, ptr %15, align 8, !tbaa !13
  %17 = icmp eq i32 %16, 1
  %18 = getelementptr inbounds i8, ptr %0, i64 68
  br i1 %17, label %19, label %277

19:                                               ; preds = %14
  store volatile i32 0, ptr %18, align 4, !tbaa !5
  %20 = add i32 %3, %2
  %21 = getelementptr inbounds i8, ptr %0, i64 72
  %22 = getelementptr inbounds i8, ptr %0, i64 96
  %23 = load i32, ptr %22, align 8, !tbaa !14
  %24 = icmp ugt i32 %20, %23
  br i1 %24, label %25, label %28

25:                                               ; preds = %19
  %26 = load volatile i32, ptr %18, align 4, !tbaa !5
  %27 = or i32 %26, 33554432
  store volatile i32 %27, ptr %18, align 4, !tbaa !5
  br label %280

28:                                               ; preds = %19
  store volatile i32 3, ptr %15, align 8, !tbaa !13
  %29 = load ptr, ptr %0, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %29, i64 44
  store volatile i32 0, ptr %30, align 4, !tbaa !16
  %31 = load i32, ptr %21, align 8, !tbaa !18
  %.not = icmp eq i32 %31, 1
  %32 = shl i32 %2, 9
  %spec.select = select i1 %.not, i32 %2, i32 %32
  store i32 -1, ptr %6, align 4, !tbaa !19
  %33 = shl i32 %3, 9
  %34 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 %33, ptr %34, align 4, !tbaa !21
  %35 = getelementptr inbounds i8, ptr %6, i64 8
  store <4 x i32> <i32 144, i32 0, i32 0, i32 0>, ptr %35, align 4, !tbaa !22
  %36 = call i32 @SDMMC_ConfigData(ptr noundef %29, ptr noundef nonnull %6) #3
  %37 = load ptr, ptr %0, align 8, !tbaa !15
  %38 = getelementptr inbounds i8, ptr %37, i64 12
  %39 = load volatile i32, ptr %38, align 4, !tbaa !23
  %40 = or i32 %39, 64
  store volatile i32 %40, ptr %38, align 4, !tbaa !23
  %41 = icmp ugt i32 %3, 1
  %42 = getelementptr inbounds i8, ptr %0, i64 60
  br i1 %41, label %43, label %45

43:                                               ; preds = %28
  store volatile i32 32, ptr %42, align 4, !tbaa !24
  %44 = call i32 @SDMMC_CmdWriteMultiBlock(ptr noundef nonnull %37, i32 noundef %spec.select) #3
  br label %47

45:                                               ; preds = %28
  store volatile i32 16, ptr %42, align 4, !tbaa !24
  %46 = call i32 @SDMMC_CmdWriteSingleBlock(ptr noundef nonnull %37, i32 noundef %spec.select) #3
  br label %47

47:                                               ; preds = %45, %43
  %.092 = phi i32 [ %44, %43 ], [ %46, %45 ]
  %.not95 = icmp eq i32 %.092, 0
  br i1 %.not95, label %54, label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %0, align 8, !tbaa !15
  %50 = getelementptr inbounds i8, ptr %49, i64 56
  store volatile i32 534777855, ptr %50, align 4, !tbaa !25
  %51 = load volatile i32, ptr %18, align 4, !tbaa !5
  %52 = or i32 %51, %.092
  store volatile i32 %52, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %53 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %53, align 4, !tbaa !24
  br label %280

54:                                               ; preds = %47
  %55 = load i32, ptr %34, align 4, !tbaa !21
  br label %56

56:                                               ; preds = %226, %54
  %.088 = phi i32 [ %55, %54 ], [ %.189, %226 ]
  %.0 = phi ptr [ %1, %54 ], [ %.2, %226 ]
  %57 = load ptr, ptr %0, align 8, !tbaa !15
  %58 = getelementptr inbounds i8, ptr %57, i64 52
  %59 = load volatile i32, ptr %58, align 4, !tbaa !26
  %60 = and i32 %59, 282
  %.not96 = icmp eq i32 %60, 0
  br i1 %.not96, label %61, label %234

61:                                               ; preds = %56
  %62 = load volatile i32, ptr %58, align 4, !tbaa !26
  %63 = and i32 %62, 16384
  %64 = icmp ne i32 %63, 0
  %65 = icmp ugt i32 %.088, 31
  %or.cond = select i1 %64, i1 %65, i1 false
  br i1 %or.cond, label %.preheader.preheader, label %226

.preheader.preheader:                             ; preds = %61
  %66 = load i8, ptr %.0, align 1, !tbaa !27
  %67 = zext i8 %66 to i32
  store i32 %67, ptr %7, align 4, !tbaa !22
  %68 = getelementptr inbounds i8, ptr %.0, i64 1
  %69 = load i8, ptr %68, align 1, !tbaa !27
  %70 = zext i8 %69 to i32
  %71 = shl nuw nsw i32 %70, 8
  %72 = or disjoint i32 %71, %67
  store i32 %72, ptr %7, align 4, !tbaa !22
  %73 = getelementptr inbounds i8, ptr %.0, i64 2
  %74 = load i8, ptr %73, align 1, !tbaa !27
  %75 = zext i8 %74 to i32
  %76 = shl nuw nsw i32 %75, 16
  %77 = or disjoint i32 %76, %72
  store i32 %77, ptr %7, align 4, !tbaa !22
  %78 = getelementptr inbounds i8, ptr %.0, i64 3
  %79 = load i8, ptr %78, align 1, !tbaa !27
  %80 = zext i8 %79 to i32
  %81 = shl nuw i32 %80, 24
  %82 = or disjoint i32 %81, %77
  store i32 %82, ptr %7, align 4, !tbaa !22
  %83 = getelementptr inbounds i8, ptr %.0, i64 4
  %84 = call i32 @SDMMC_WriteFIFO(ptr noundef nonnull %57, ptr noundef nonnull %7) #3
  %85 = load i8, ptr %83, align 1, !tbaa !27
  %86 = zext i8 %85 to i32
  %87 = getelementptr inbounds i8, ptr %.0, i64 5
  %88 = load i8, ptr %87, align 1, !tbaa !27
  %89 = zext i8 %88 to i32
  %90 = shl nuw nsw i32 %89, 8
  %91 = or disjoint i32 %90, %86
  %92 = getelementptr inbounds i8, ptr %.0, i64 6
  %93 = load i8, ptr %92, align 1, !tbaa !27
  %94 = zext i8 %93 to i32
  %95 = shl nuw nsw i32 %94, 16
  %96 = or disjoint i32 %95, %91
  %97 = getelementptr inbounds i8, ptr %.0, i64 7
  %98 = load i8, ptr %97, align 1, !tbaa !27
  %99 = zext i8 %98 to i32
  %100 = shl nuw i32 %99, 24
  %101 = or disjoint i32 %100, %96
  store i32 %101, ptr %7, align 4, !tbaa !22
  %102 = getelementptr inbounds i8, ptr %.0, i64 8
  %103 = load ptr, ptr %0, align 8, !tbaa !15
  %104 = call i32 @SDMMC_WriteFIFO(ptr noundef %103, ptr noundef nonnull %7) #3
  %105 = load i8, ptr %102, align 1, !tbaa !27
  %106 = zext i8 %105 to i32
  %107 = getelementptr inbounds i8, ptr %.0, i64 9
  %108 = load i8, ptr %107, align 1, !tbaa !27
  %109 = zext i8 %108 to i32
  %110 = shl nuw nsw i32 %109, 8
  %111 = or disjoint i32 %110, %106
  %112 = getelementptr inbounds i8, ptr %.0, i64 10
  %113 = load i8, ptr %112, align 1, !tbaa !27
  %114 = zext i8 %113 to i32
  %115 = shl nuw nsw i32 %114, 16
  %116 = or disjoint i32 %115, %111
  %117 = getelementptr inbounds i8, ptr %.0, i64 11
  %118 = load i8, ptr %117, align 1, !tbaa !27
  %119 = zext i8 %118 to i32
  %120 = shl nuw i32 %119, 24
  %121 = or disjoint i32 %120, %116
  store i32 %121, ptr %7, align 4, !tbaa !22
  %122 = getelementptr inbounds i8, ptr %.0, i64 12
  %123 = load ptr, ptr %0, align 8, !tbaa !15
  %124 = call i32 @SDMMC_WriteFIFO(ptr noundef %123, ptr noundef nonnull %7) #3
  %125 = load i8, ptr %122, align 1, !tbaa !27
  %126 = zext i8 %125 to i32
  %127 = getelementptr inbounds i8, ptr %.0, i64 13
  %128 = load i8, ptr %127, align 1, !tbaa !27
  %129 = zext i8 %128 to i32
  %130 = shl nuw nsw i32 %129, 8
  %131 = or disjoint i32 %130, %126
  %132 = getelementptr inbounds i8, ptr %.0, i64 14
  %133 = load i8, ptr %132, align 1, !tbaa !27
  %134 = zext i8 %133 to i32
  %135 = shl nuw nsw i32 %134, 16
  %136 = or disjoint i32 %135, %131
  %137 = getelementptr inbounds i8, ptr %.0, i64 15
  %138 = load i8, ptr %137, align 1, !tbaa !27
  %139 = zext i8 %138 to i32
  %140 = shl nuw i32 %139, 24
  %141 = or disjoint i32 %140, %136
  store i32 %141, ptr %7, align 4, !tbaa !22
  %142 = getelementptr inbounds i8, ptr %.0, i64 16
  %143 = load ptr, ptr %0, align 8, !tbaa !15
  %144 = call i32 @SDMMC_WriteFIFO(ptr noundef %143, ptr noundef nonnull %7) #3
  %145 = load i8, ptr %142, align 1, !tbaa !27
  %146 = zext i8 %145 to i32
  %147 = getelementptr inbounds i8, ptr %.0, i64 17
  %148 = load i8, ptr %147, align 1, !tbaa !27
  %149 = zext i8 %148 to i32
  %150 = shl nuw nsw i32 %149, 8
  %151 = or disjoint i32 %150, %146
  %152 = getelementptr inbounds i8, ptr %.0, i64 18
  %153 = load i8, ptr %152, align 1, !tbaa !27
  %154 = zext i8 %153 to i32
  %155 = shl nuw nsw i32 %154, 16
  %156 = or disjoint i32 %155, %151
  %157 = getelementptr inbounds i8, ptr %.0, i64 19
  %158 = load i8, ptr %157, align 1, !tbaa !27
  %159 = zext i8 %158 to i32
  %160 = shl nuw i32 %159, 24
  %161 = or disjoint i32 %160, %156
  store i32 %161, ptr %7, align 4, !tbaa !22
  %162 = getelementptr inbounds i8, ptr %.0, i64 20
  %163 = load ptr, ptr %0, align 8, !tbaa !15
  %164 = call i32 @SDMMC_WriteFIFO(ptr noundef %163, ptr noundef nonnull %7) #3
  %165 = load i8, ptr %162, align 1, !tbaa !27
  %166 = zext i8 %165 to i32
  %167 = getelementptr inbounds i8, ptr %.0, i64 21
  %168 = load i8, ptr %167, align 1, !tbaa !27
  %169 = zext i8 %168 to i32
  %170 = shl nuw nsw i32 %169, 8
  %171 = or disjoint i32 %170, %166
  %172 = getelementptr inbounds i8, ptr %.0, i64 22
  %173 = load i8, ptr %172, align 1, !tbaa !27
  %174 = zext i8 %173 to i32
  %175 = shl nuw nsw i32 %174, 16
  %176 = or disjoint i32 %175, %171
  %177 = getelementptr inbounds i8, ptr %.0, i64 23
  %178 = load i8, ptr %177, align 1, !tbaa !27
  %179 = zext i8 %178 to i32
  %180 = shl nuw i32 %179, 24
  %181 = or disjoint i32 %180, %176
  store i32 %181, ptr %7, align 4, !tbaa !22
  %182 = getelementptr inbounds i8, ptr %.0, i64 24
  %183 = load ptr, ptr %0, align 8, !tbaa !15
  %184 = call i32 @SDMMC_WriteFIFO(ptr noundef %183, ptr noundef nonnull %7) #3
  %185 = load i8, ptr %182, align 1, !tbaa !27
  %186 = zext i8 %185 to i32
  %187 = getelementptr inbounds i8, ptr %.0, i64 25
  %188 = load i8, ptr %187, align 1, !tbaa !27
  %189 = zext i8 %188 to i32
  %190 = shl nuw nsw i32 %189, 8
  %191 = or disjoint i32 %190, %186
  %192 = getelementptr inbounds i8, ptr %.0, i64 26
  %193 = load i8, ptr %192, align 1, !tbaa !27
  %194 = zext i8 %193 to i32
  %195 = shl nuw nsw i32 %194, 16
  %196 = or disjoint i32 %195, %191
  %197 = getelementptr inbounds i8, ptr %.0, i64 27
  %198 = load i8, ptr %197, align 1, !tbaa !27
  %199 = zext i8 %198 to i32
  %200 = shl nuw i32 %199, 24
  %201 = or disjoint i32 %200, %196
  store i32 %201, ptr %7, align 4, !tbaa !22
  %202 = getelementptr inbounds i8, ptr %.0, i64 28
  %203 = load ptr, ptr %0, align 8, !tbaa !15
  %204 = call i32 @SDMMC_WriteFIFO(ptr noundef %203, ptr noundef nonnull %7) #3
  %205 = load i8, ptr %202, align 1, !tbaa !27
  %206 = zext i8 %205 to i32
  %207 = getelementptr inbounds i8, ptr %.0, i64 29
  %208 = load i8, ptr %207, align 1, !tbaa !27
  %209 = zext i8 %208 to i32
  %210 = shl nuw nsw i32 %209, 8
  %211 = or disjoint i32 %210, %206
  %212 = getelementptr inbounds i8, ptr %.0, i64 30
  %213 = load i8, ptr %212, align 1, !tbaa !27
  %214 = zext i8 %213 to i32
  %215 = shl nuw nsw i32 %214, 16
  %216 = or disjoint i32 %215, %211
  %217 = getelementptr inbounds i8, ptr %.0, i64 31
  %218 = load i8, ptr %217, align 1, !tbaa !27
  %219 = zext i8 %218 to i32
  %220 = shl nuw i32 %219, 24
  %221 = or disjoint i32 %220, %216
  store i32 %221, ptr %7, align 4, !tbaa !22
  %222 = getelementptr inbounds i8, ptr %.0, i64 32
  %223 = load ptr, ptr %0, align 8, !tbaa !15
  %224 = call i32 @SDMMC_WriteFIFO(ptr noundef %223, ptr noundef nonnull %7) #3
  %225 = add i32 %.088, -32
  br label %226

226:                                              ; preds = %.preheader.preheader, %61
  %.189 = phi i32 [ %225, %.preheader.preheader ], [ %.088, %61 ]
  %.2 = phi ptr [ %222, %.preheader.preheader ], [ %.0, %61 ]
  %227 = call i32 @HAL_GetTick() #3
  %228 = sub i32 %227, %8
  %.not102 = icmp ult i32 %228, %4
  br i1 %.not102, label %56, label %229, !llvm.loop !28

229:                                              ; preds = %226
  %230 = load ptr, ptr %0, align 8, !tbaa !15
  %231 = getelementptr inbounds i8, ptr %230, i64 56
  store volatile i32 534777855, ptr %231, align 4, !tbaa !25
  %232 = load volatile i32, ptr %18, align 4, !tbaa !5
  store volatile i32 %232, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %233 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %233, align 4, !tbaa !24
  br label %280

234:                                              ; preds = %56
  %235 = getelementptr inbounds i8, ptr %57, i64 12
  %236 = load volatile i32, ptr %235, align 4, !tbaa !23
  %237 = and i32 %236, -65
  store volatile i32 %237, ptr %235, align 4, !tbaa !23
  %238 = load volatile i32, ptr %58, align 4, !tbaa !26
  %239 = and i32 %238, 256
  %240 = icmp ne i32 %239, 0
  %or.cond5 = and i1 %41, %240
  br i1 %or.cond5, label %241, label %250

241:                                              ; preds = %234
  %242 = load i32, ptr %21, align 8, !tbaa !18
  %.not97 = icmp eq i32 %242, 3
  br i1 %.not97, label %250, label %243

243:                                              ; preds = %241
  %244 = call i32 @SDMMC_CmdStopTransfer(ptr noundef nonnull %57) #3
  %.not98 = icmp eq i32 %244, 0
  %.pre = load ptr, ptr %0, align 8, !tbaa !15
  br i1 %.not98, label %250, label %245

245:                                              ; preds = %243
  %246 = getelementptr inbounds i8, ptr %.pre, i64 56
  store volatile i32 534777855, ptr %246, align 4, !tbaa !25
  %247 = load volatile i32, ptr %18, align 4, !tbaa !5
  %248 = or i32 %247, %244
  store volatile i32 %248, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %249 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %249, align 4, !tbaa !24
  br label %280

250:                                              ; preds = %241, %243, %234
  %251 = phi ptr [ %57, %241 ], [ %.pre, %243 ], [ %57, %234 ]
  %252 = getelementptr inbounds i8, ptr %251, i64 52
  %253 = load volatile i32, ptr %252, align 4, !tbaa !26
  %254 = and i32 %253, 8
  %.not99 = icmp eq i32 %254, 0
  br i1 %.not99, label %260, label %255

255:                                              ; preds = %250
  %256 = getelementptr inbounds i8, ptr %251, i64 56
  store volatile i32 534777855, ptr %256, align 4, !tbaa !25
  %257 = load volatile i32, ptr %18, align 4, !tbaa !5
  %258 = or i32 %257, 8
  store volatile i32 %258, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %259 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %259, align 4, !tbaa !24
  br label %280

260:                                              ; preds = %250
  %261 = load volatile i32, ptr %252, align 4, !tbaa !26
  %262 = and i32 %261, 2
  %.not100 = icmp eq i32 %262, 0
  br i1 %.not100, label %268, label %263

263:                                              ; preds = %260
  %264 = getelementptr inbounds i8, ptr %251, i64 56
  store volatile i32 534777855, ptr %264, align 4, !tbaa !25
  %265 = load volatile i32, ptr %18, align 4, !tbaa !5
  %266 = or i32 %265, 2
  store volatile i32 %266, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %267 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %267, align 4, !tbaa !24
  br label %280

268:                                              ; preds = %260
  %269 = load volatile i32, ptr %252, align 4, !tbaa !26
  %270 = and i32 %269, 16
  %.not101 = icmp eq i32 %270, 0
  %271 = getelementptr inbounds i8, ptr %251, i64 56
  br i1 %.not101, label %276, label %272

272:                                              ; preds = %268
  store volatile i32 534777855, ptr %271, align 4, !tbaa !25
  %273 = load volatile i32, ptr %18, align 4, !tbaa !5
  %274 = or i32 %273, 16
  store volatile i32 %274, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  %275 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 0, ptr %275, align 4, !tbaa !24
  br label %280

276:                                              ; preds = %268
  store volatile i32 402657082, ptr %271, align 4, !tbaa !25
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %280

277:                                              ; preds = %14
  %278 = load volatile i32, ptr %18, align 4, !tbaa !5
  %279 = or i32 %278, 536870912
  store volatile i32 %279, ptr %18, align 4, !tbaa !5
  br label %280

280:                                              ; preds = %277, %276, %272, %263, %255, %245, %229, %48, %25, %10
  %.091 = phi i32 [ 1, %10 ], [ 1, %25 ], [ 1, %48 ], [ 3, %229 ], [ 1, %245 ], [ 1, %255 ], [ 1, %263 ], [ 1, %272 ], [ 0, %276 ], [ 1, %277 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #3
  ret i32 %.091
}

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

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

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

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 108, !8, i64 124}
!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, !11, i64 28, !11, i64 32}
!13 = !{!6, !11, i64 64}
!14 = !{!6, !11, i64 96}
!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, !11, i64 72}
!19 = !{!20, !11, i64 0}
!20 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!21 = !{!20, !11, i64 4}
!22 = !{!11, !11, i64 0}
!23 = !{!17, !11, i64 12}
!24 = !{!6, !11, i64 60}
!25 = !{!17, !11, i64 56}
!26 = !{!17, !11, i64 52}
!27 = !{!8, !8, i64 0}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass