; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Drivers/STM32H7xx_HAL_Driver/Src (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_CmdBlockLength(ptr noundef, i32 noundef) #1

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 ptr, align 8
  %19 = 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
  %20 = call i32 @HAL_GetTick()
  store i32 %20, 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
  %21 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %21, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %22, ptr %18, align 8, !tbaa !5
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = icmp eq ptr null, %23
  br i1 %24, label %25, label %30

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

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

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

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

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

63:                                               ; preds = %51
  %64 = load i32, ptr %17, align 4, !tbaa !9
  %65 = mul i32 %64, 512
  store i32 %65, ptr %17, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %63, %51
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !17
  %70 = call i32 @SDMMC_CmdBlockLength(ptr noundef %69, i32 noundef 512)
  store i32 %70, ptr %13, align 4, !tbaa !9
  %71 = load i32, ptr %13, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %73, label %85

73:                                               ; preds = %66
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !17
  %77 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %76, i32 0, i32 14
  store volatile i32 534777855, ptr %77, align 4, !tbaa !21
  %78 = load i32, ptr %13, align 4, !tbaa !9
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %79, i32 0, i32 9
  %81 = load volatile i32, ptr %80, align 4, !tbaa !11
  %82 = or i32 %81, %78
  store volatile i32 %82, ptr %80, align 4, !tbaa !11
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %83, i32 0, i32 8
  store volatile i32 1, ptr %84, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

85:                                               ; preds = %66
  %86 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 0
  store i32 -1, ptr %86, align 4, !tbaa !22
  %87 = load i32, ptr %10, align 4, !tbaa !9
  %88 = mul i32 %87, 512
  %89 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 1
  store i32 %88, ptr %89, align 4, !tbaa !24
  %90 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 2
  store i32 144, ptr %90, align 4, !tbaa !25
  %91 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 3
  store i32 0, ptr %91, align 4, !tbaa !26
  %92 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 4
  store i32 0, ptr %92, align 4, !tbaa !27
  %93 = getelementptr inbounds %struct.SDMMC_DataInitTypeDef, ptr %12, i32 0, i32 5
  store i32 0, ptr %93, align 4, !tbaa !28
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %94, i32 0, i32 0
  %96 = load ptr, ptr %95, align 8, !tbaa !17
  %97 = call i32 @SDMMC_ConfigData(ptr noundef %96, ptr noundef %12)
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %98, i32 0, i32 0
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %100, i32 0, i32 3
  %102 = load volatile i32, ptr %101, align 4, !tbaa !29
  %103 = zext i32 %102 to i64
  %104 = or i64 %103, 64
  %105 = trunc i64 %104 to i32
  store volatile i32 %105, ptr %101, align 4, !tbaa !29
  %106 = load i32, ptr %10, align 4, !tbaa !9
  %107 = icmp ugt i32 %106, 1
  br i1 %107, label %108, label %116

108:                                              ; preds = %85
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %109, i32 0, i32 7
  store volatile i32 32, ptr %110, align 4, !tbaa !30
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !17
  %114 = load i32, ptr %17, align 4, !tbaa !9
  %115 = call i32 @SDMMC_CmdWriteMultiBlock(ptr noundef %113, i32 noundef %114)
  store i32 %115, ptr %13, align 4, !tbaa !9
  br label %124

116:                                              ; preds = %85
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %117, i32 0, i32 7
  store volatile i32 16, ptr %118, align 4, !tbaa !30
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %119, i32 0, i32 0
  %121 = load ptr, ptr %120, align 8, !tbaa !17
  %122 = load i32, ptr %17, align 4, !tbaa !9
  %123 = call i32 @SDMMC_CmdWriteSingleBlock(ptr noundef %121, i32 noundef %122)
  store i32 %123, ptr %13, align 4, !tbaa !9
  br label %124

124:                                              ; preds = %116, %108
  %125 = load i32, ptr %13, align 4, !tbaa !9
  %126 = icmp ne i32 %125, 0
  br i1 %126, label %127, label %139

127:                                              ; preds = %124
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !17
  %131 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %130, i32 0, i32 14
  store volatile i32 534777855, ptr %131, align 4, !tbaa !21
  %132 = load i32, ptr %13, align 4, !tbaa !9
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %133, i32 0, i32 9
  %135 = load volatile i32, ptr %134, align 4, !tbaa !11
  %136 = or i32 %135, %132
  store volatile i32 %136, ptr %134, align 4, !tbaa !11
  %137 = load ptr, ptr %7, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %137, i32 0, i32 8
  store volatile i32 1, ptr %138, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

139:                                              ; preds = %124
  br label %140

140:                                              ; preds = %222, %139
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %141, i32 0, i32 0
  %143 = load ptr, ptr %142, align 8, !tbaa !17
  %144 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %143, i32 0, i32 13
  %145 = load volatile i32, ptr %144, align 4, !tbaa !31
  %146 = zext i32 %145 to i64
  %147 = and i64 %146, 282
  %148 = icmp ne i64 %147, 0
  %149 = xor i1 %148, true
  br i1 %149, label %150, label %223

150:                                              ; preds = %140
  %151 = load ptr, ptr %7, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %151, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !17
  %154 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %153, i32 0, i32 13
  %155 = load volatile i32, ptr %154, align 4, !tbaa !31
  %156 = zext i32 %155 to i64
  %157 = and i64 %156, 16384
  %158 = icmp ne i64 %157, 0
  br i1 %158, label %159, label %201

159:                                              ; preds = %150
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %160

160:                                              ; preds = %197, %159
  %161 = load i32, ptr %15, align 4, !tbaa !9
  %162 = icmp ult i32 %161, 8
  br i1 %162, label %163, label %200

163:                                              ; preds = %160
  %164 = load ptr, ptr %18, align 8, !tbaa !5
  %165 = load i8, ptr %164, align 1, !tbaa !32
  %166 = zext i8 %165 to i32
  store i32 %166, ptr %16, align 4, !tbaa !9
  %167 = load ptr, ptr %18, align 8, !tbaa !5
  %168 = getelementptr inbounds i8, ptr %167, i32 1
  store ptr %168, ptr %18, align 8, !tbaa !5
  %169 = load ptr, ptr %18, align 8, !tbaa !5
  %170 = load i8, ptr %169, align 1, !tbaa !32
  %171 = zext i8 %170 to i32
  %172 = shl i32 %171, 8
  %173 = load i32, ptr %16, align 4, !tbaa !9
  %174 = or i32 %173, %172
  store i32 %174, ptr %16, align 4, !tbaa !9
  %175 = load ptr, ptr %18, align 8, !tbaa !5
  %176 = getelementptr inbounds i8, ptr %175, i32 1
  store ptr %176, ptr %18, align 8, !tbaa !5
  %177 = load ptr, ptr %18, align 8, !tbaa !5
  %178 = load i8, ptr %177, align 1, !tbaa !32
  %179 = zext i8 %178 to i32
  %180 = shl i32 %179, 16
  %181 = load i32, ptr %16, align 4, !tbaa !9
  %182 = or i32 %181, %180
  store i32 %182, ptr %16, align 4, !tbaa !9
  %183 = load ptr, ptr %18, align 8, !tbaa !5
  %184 = getelementptr inbounds i8, ptr %183, i32 1
  store ptr %184, ptr %18, align 8, !tbaa !5
  %185 = load ptr, ptr %18, align 8, !tbaa !5
  %186 = load i8, ptr %185, align 1, !tbaa !32
  %187 = zext i8 %186 to i32
  %188 = shl i32 %187, 24
  %189 = load i32, ptr %16, align 4, !tbaa !9
  %190 = or i32 %189, %188
  store i32 %190, ptr %16, align 4, !tbaa !9
  %191 = load ptr, ptr %18, align 8, !tbaa !5
  %192 = getelementptr inbounds i8, ptr %191, i32 1
  store ptr %192, ptr %18, align 8, !tbaa !5
  %193 = load ptr, ptr %7, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !17
  %196 = call i32 @SDMMC_WriteFIFO(ptr noundef %195, ptr noundef %16)
  br label %197

197:                                              ; preds = %163
  %198 = load i32, ptr %15, align 4, !tbaa !9
  %199 = add i32 %198, 1
  store i32 %199, ptr %15, align 4, !tbaa !9
  br label %160, !llvm.loop !33

200:                                              ; preds = %160
  br label %201

201:                                              ; preds = %200, %150
  %202 = call i32 @HAL_GetTick()
  %203 = load i32, ptr %14, align 4, !tbaa !9
  %204 = sub i32 %202, %203
  %205 = load i32, ptr %11, align 4, !tbaa !9
  %206 = icmp uge i32 %204, %205
  br i1 %206, label %210, label %207

207:                                              ; preds = %201
  %208 = load i32, ptr %11, align 4, !tbaa !9
  %209 = icmp eq i32 %208, 0
  br i1 %209, label %210, label %222

210:                                              ; preds = %207, %201
  %211 = load ptr, ptr %7, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %211, i32 0, i32 0
  %213 = load ptr, ptr %212, align 8, !tbaa !17
  %214 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %213, i32 0, i32 14
  store volatile i32 534777855, ptr %214, align 4, !tbaa !21
  %215 = load i32, ptr %13, align 4, !tbaa !9
  %216 = load ptr, ptr %7, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %216, i32 0, i32 9
  %218 = load volatile i32, ptr %217, align 4, !tbaa !11
  %219 = or i32 %218, %215
  store volatile i32 %219, ptr %217, align 4, !tbaa !11
  %220 = load ptr, ptr %7, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %220, i32 0, i32 8
  store volatile i32 1, ptr %221, align 8, !tbaa !15
  store i32 3, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

222:                                              ; preds = %207
  br label %140, !llvm.loop !35

223:                                              ; preds = %140
  %224 = load ptr, ptr %7, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %224, i32 0, i32 0
  %226 = load ptr, ptr %225, align 8, !tbaa !17
  %227 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %226, i32 0, i32 3
  %228 = load volatile i32, ptr %227, align 4, !tbaa !29
  %229 = zext i32 %228 to i64
  %230 = and i64 %229, -65
  %231 = trunc i64 %230 to i32
  store volatile i32 %231, ptr %227, align 4, !tbaa !29
  %232 = load ptr, ptr %7, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %232, i32 0, i32 0
  %234 = load ptr, ptr %233, align 8, !tbaa !17
  %235 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %234, i32 0, i32 13
  %236 = load volatile i32, ptr %235, align 4, !tbaa !31
  %237 = zext i32 %236 to i64
  %238 = and i64 %237, 256
  %239 = icmp ne i64 %238, 0
  br i1 %239, label %240, label %270

240:                                              ; preds = %223
  %241 = load i32, ptr %10, align 4, !tbaa !9
  %242 = icmp ugt i32 %241, 1
  br i1 %242, label %243, label %270

243:                                              ; preds = %240
  %244 = load ptr, ptr %7, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %244, i32 0, i32 10
  %246 = getelementptr inbounds %struct.HAL_SD_CardInfoTypeDef, ptr %245, i32 0, i32 0
  %247 = load i32, ptr %246, align 8, !tbaa !20
  %248 = icmp ne i32 %247, 3
  br i1 %248, label %249, label %269

249:                                              ; preds = %243
  %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 = call i32 @SDMMC_CmdStopTransfer(ptr noundef %252)
  store i32 %253, ptr %13, align 4, !tbaa !9
  %254 = load i32, ptr %13, align 4, !tbaa !9
  %255 = icmp ne i32 %254, 0
  br i1 %255, label %256, label %268

256:                                              ; preds = %249
  %257 = load ptr, ptr %7, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %257, i32 0, i32 0
  %259 = load ptr, ptr %258, align 8, !tbaa !17
  %260 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %259, i32 0, i32 14
  store volatile i32 534777855, ptr %260, align 4, !tbaa !21
  %261 = load i32, ptr %13, align 4, !tbaa !9
  %262 = load ptr, ptr %7, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %262, i32 0, i32 9
  %264 = load volatile i32, ptr %263, align 4, !tbaa !11
  %265 = or i32 %264, %261
  store volatile i32 %265, ptr %263, align 4, !tbaa !11
  %266 = load ptr, ptr %7, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %266, i32 0, i32 8
  store volatile i32 1, ptr %267, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

268:                                              ; preds = %249
  br label %269

269:                                              ; preds = %268, %243
  br label %270

270:                                              ; preds = %269, %240, %223
  %271 = load ptr, ptr %7, align 8, !tbaa !5
  %272 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %271, i32 0, i32 0
  %273 = load ptr, ptr %272, align 8, !tbaa !17
  %274 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %273, i32 0, i32 13
  %275 = load volatile i32, ptr %274, align 4, !tbaa !31
  %276 = zext i32 %275 to i64
  %277 = and i64 %276, 8
  %278 = icmp ne i64 %277, 0
  br i1 %278, label %279, label %290

279:                                              ; preds = %270
  %280 = load ptr, ptr %7, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %280, i32 0, i32 0
  %282 = load ptr, ptr %281, align 8, !tbaa !17
  %283 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %282, i32 0, i32 14
  store volatile i32 534777855, ptr %283, align 4, !tbaa !21
  %284 = load ptr, ptr %7, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %284, i32 0, i32 9
  %286 = load volatile i32, ptr %285, align 4, !tbaa !11
  %287 = or i32 %286, 8
  store volatile i32 %287, ptr %285, align 4, !tbaa !11
  %288 = load ptr, ptr %7, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %288, i32 0, i32 8
  store volatile i32 1, ptr %289, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

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

299:                                              ; preds = %290
  %300 = load ptr, ptr %7, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %300, i32 0, i32 0
  %302 = load ptr, ptr %301, align 8, !tbaa !17
  %303 = getelementptr inbounds %struct.SDMMC_TypeDef, ptr %302, i32 0, i32 14
  store volatile i32 534777855, ptr %303, align 4, !tbaa !21
  %304 = load ptr, ptr %7, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %304, i32 0, i32 9
  %306 = load volatile i32, ptr %305, align 4, !tbaa !11
  %307 = or i32 %306, 2
  store volatile i32 %307, ptr %305, align 4, !tbaa !11
  %308 = load ptr, ptr %7, align 8, !tbaa !5
  %309 = getelementptr inbounds %struct.SD_HandleTypeDef, ptr %308, i32 0, i32 8
  store volatile i32 1, ptr %309, align 8, !tbaa !15
  store i32 1, ptr %6, align 4
  store i32 1, ptr %19, align 4
  br label %345

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

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

330:                                              ; preds = %310
  br label %331

331:                                              ; preds = %330
  br label %332

332:                                              ; preds = %331
  br label %333

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

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

345:                                              ; preds = %340, %333, %319, %299, %279, %256, %210, %127, %73, %46, %25
  call void @llvm.lifetime.end.p0(i64 8, 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
  %346 = load i32, ptr %6, align 4
  ret i32 %346
}

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 = !{!19, !10, i64 56}
!22 = !{!23, !10, i64 0}
!23 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!24 = !{!23, !10, i64 4}
!25 = !{!23, !10, i64 8}
!26 = !{!23, !10, i64 12}
!27 = !{!23, !10, i64 16}
!28 = !{!23, !10, i64 20}
!29 = !{!19, !10, i64 12}
!30 = !{!12, !10, i64 60}
!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_CmdBlockLength(ptr noundef, i32 noundef) local_unnamed_addr #1

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 %275

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 %272

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 %275

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
  %33 = tail call i32 @SDMMC_CmdBlockLength(ptr noundef %29, i32 noundef 512) #3
  %.not90 = icmp eq i32 %33, 0
  br i1 %.not90, label %39, label %34

34:                                               ; preds = %28
  %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 !19
  %37 = load volatile i32, ptr %18, align 4, !tbaa !5
  %38 = or i32 %37, %33
  store volatile i32 %38, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

39:                                               ; preds = %28
  store i32 -1, ptr %6, align 4, !tbaa !20
  %40 = shl i32 %3, 9
  %41 = getelementptr inbounds i8, ptr %6, i64 4
  store i32 %40, ptr %41, align 4, !tbaa !22
  %42 = getelementptr inbounds i8, ptr %6, i64 8
  store <4 x i32> <i32 144, i32 0, i32 0, i32 0>, ptr %42, align 4, !tbaa !23
  %43 = load ptr, ptr %0, align 8, !tbaa !15
  %44 = call i32 @SDMMC_ConfigData(ptr noundef %43, ptr noundef nonnull %6) #3
  %45 = load ptr, ptr %0, align 8, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %45, i64 12
  %47 = load volatile i32, ptr %46, align 4, !tbaa !24
  %48 = or i32 %47, 64
  store volatile i32 %48, ptr %46, align 4, !tbaa !24
  %49 = icmp ugt i32 %3, 1
  %50 = getelementptr inbounds i8, ptr %0, i64 60
  br i1 %49, label %51, label %53

51:                                               ; preds = %39
  store volatile i32 32, ptr %50, align 4, !tbaa !25
  %52 = call i32 @SDMMC_CmdWriteMultiBlock(ptr noundef nonnull %45, i32 noundef %spec.select) #3
  br label %55

53:                                               ; preds = %39
  store volatile i32 16, ptr %50, align 4, !tbaa !25
  %54 = call i32 @SDMMC_CmdWriteSingleBlock(ptr noundef nonnull %45, i32 noundef %spec.select) #3
  br label %55

55:                                               ; preds = %53, %51
  %.086 = phi i32 [ %52, %51 ], [ %54, %53 ]
  %.not91 = icmp eq i32 %.086, 0
  br i1 %.not91, label %.preheader100, label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %0, align 8, !tbaa !15
  %58 = getelementptr inbounds i8, ptr %57, i64 56
  store volatile i32 534777855, ptr %58, align 4, !tbaa !19
  %59 = load volatile i32, ptr %18, align 4, !tbaa !5
  %60 = or i32 %59, %.086
  store volatile i32 %60, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

.preheader100:                                    ; preds = %55, %.loopexit
  %.0 = phi ptr [ %.2, %.loopexit ], [ %1, %55 ]
  %61 = load ptr, ptr %0, align 8, !tbaa !15
  %62 = getelementptr inbounds i8, ptr %61, i64 52
  %63 = load volatile i32, ptr %62, align 4, !tbaa !26
  %64 = and i32 %63, 282
  %.not92 = icmp eq i32 %64, 0
  br i1 %.not92, label %65, label %233

65:                                               ; preds = %.preheader100
  %66 = load volatile i32, ptr %62, align 4, !tbaa !26
  %67 = and i32 %66, 16384
  %.not98 = icmp eq i32 %67, 0
  br i1 %.not98, label %.loopexit, label %.preheader.preheader

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

.loopexit:                                        ; preds = %.preheader.preheader, %65
  %.2 = phi ptr [ %.0, %65 ], [ %224, %.preheader.preheader ]
  %227 = call i32 @HAL_GetTick() #3
  %228 = sub i32 %227, %8
  %.not99 = icmp ult i32 %228, %4
  br i1 %.not99, label %.preheader100, label %229, !llvm.loop !28

229:                                              ; preds = %.loopexit
  %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 !19
  %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
  br label %275

233:                                              ; preds = %.preheader100
  %234 = getelementptr inbounds i8, ptr %61, i64 12
  %235 = load volatile i32, ptr %234, align 4, !tbaa !24
  %236 = and i32 %235, -65
  store volatile i32 %236, ptr %234, align 4, !tbaa !24
  %237 = load volatile i32, ptr %62, align 4, !tbaa !26
  %238 = and i32 %237, 256
  %239 = icmp ne i32 %238, 0
  %or.cond3 = and i1 %49, %239
  br i1 %or.cond3, label %240, label %248

240:                                              ; preds = %233
  %241 = load i32, ptr %21, align 8, !tbaa !18
  %.not93 = icmp eq i32 %241, 3
  br i1 %.not93, label %248, label %242

242:                                              ; preds = %240
  %243 = call i32 @SDMMC_CmdStopTransfer(ptr noundef nonnull %61) #3
  %.not94 = icmp eq i32 %243, 0
  %.pre = load ptr, ptr %0, align 8, !tbaa !15
  br i1 %.not94, label %248, label %244

244:                                              ; preds = %242
  %245 = getelementptr inbounds i8, ptr %.pre, i64 56
  store volatile i32 534777855, ptr %245, align 4, !tbaa !19
  %246 = load volatile i32, ptr %18, align 4, !tbaa !5
  %247 = or i32 %246, %243
  store volatile i32 %247, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

248:                                              ; preds = %240, %242, %233
  %249 = phi ptr [ %61, %240 ], [ %.pre, %242 ], [ %61, %233 ]
  %250 = getelementptr inbounds i8, ptr %249, i64 52
  %251 = load volatile i32, ptr %250, align 4, !tbaa !26
  %252 = and i32 %251, 8
  %.not95 = icmp eq i32 %252, 0
  br i1 %.not95, label %257, label %253

253:                                              ; preds = %248
  %254 = getelementptr inbounds i8, ptr %249, i64 56
  store volatile i32 534777855, ptr %254, align 4, !tbaa !19
  %255 = load volatile i32, ptr %18, align 4, !tbaa !5
  %256 = or i32 %255, 8
  store volatile i32 %256, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

257:                                              ; preds = %248
  %258 = load volatile i32, ptr %250, align 4, !tbaa !26
  %259 = and i32 %258, 2
  %.not96 = icmp eq i32 %259, 0
  br i1 %.not96, label %264, label %260

260:                                              ; preds = %257
  %261 = getelementptr inbounds i8, ptr %249, i64 56
  store volatile i32 534777855, ptr %261, align 4, !tbaa !19
  %262 = load volatile i32, ptr %18, align 4, !tbaa !5
  %263 = or i32 %262, 2
  store volatile i32 %263, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

264:                                              ; preds = %257
  %265 = load volatile i32, ptr %250, align 4, !tbaa !26
  %266 = and i32 %265, 16
  %.not97 = icmp eq i32 %266, 0
  %267 = getelementptr inbounds i8, ptr %249, i64 56
  br i1 %.not97, label %271, label %268

268:                                              ; preds = %264
  store volatile i32 534777855, ptr %267, align 4, !tbaa !19
  %269 = load volatile i32, ptr %18, align 4, !tbaa !5
  %270 = or i32 %269, 16
  store volatile i32 %270, ptr %18, align 4, !tbaa !5
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

271:                                              ; preds = %264
  store volatile i32 402657082, ptr %267, align 4, !tbaa !19
  store volatile i32 1, ptr %15, align 8, !tbaa !13
  br label %275

272:                                              ; preds = %14
  %273 = load volatile i32, ptr %18, align 4, !tbaa !5
  %274 = or i32 %273, 536870912
  store volatile i32 %274, ptr %18, align 4, !tbaa !5
  br label %275

275:                                              ; preds = %272, %271, %268, %260, %253, %244, %229, %56, %34, %25, %10
  %.085 = phi i32 [ 1, %10 ], [ 1, %25 ], [ 1, %34 ], [ 1, %56 ], [ 3, %229 ], [ 1, %244 ], [ 1, %253 ], [ 1, %260 ], [ 1, %268 ], [ 0, %271 ], [ 1, %272 ]
  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 %.085
}

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 = !{!17, !11, i64 56}
!20 = !{!21, !11, i64 0}
!21 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!22 = !{!21, !11, i64 4}
!23 = !{!11, !11, i64 0}
!24 = !{!17, !11, i64 12}
!25 = !{!6, !11, i64 60}
!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