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

; 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.__SAI_HandleTypeDef = type { ptr, %struct.SAI_InitTypeDef, %struct.SAI_FrameInitTypeDef, %struct.SAI_SlotInitTypeDef, ptr, i16, i16, ptr, ptr, ptr, ptr, i32, i32, i32 }
%struct.SAI_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.SAI_PdmInitTypeDef, i32, i32, i32, i32 }
%struct.SAI_PdmInitTypeDef = type { i32, i32, i32 }
%struct.SAI_FrameInitTypeDef = type { i32, i32, i32, i32, i32 }
%struct.SAI_SlotInitTypeDef = type { i32, i32, i32, i32 }
%struct.SAI_Block_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32 }

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @SAI_Disable(ptr noundef) #1

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

16:                                               ; preds = %4
  %17 = load i16, ptr %8, align 2, !tbaa !9
  %18 = zext i16 %17 to i32
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %21

20:                                               ; preds = %16, %4
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %253

21:                                               ; preds = %16
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %22, i32 0, i32 12
  %24 = load volatile i32, ptr %23, align 4, !tbaa !13
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %252

26:                                               ; preds = %21
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %28, i32 0, i32 11
  %30 = load i32, ptr %29, align 8, !tbaa !19
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %253

33:                                               ; preds = %27
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %34, i32 0, i32 11
  store i32 1, ptr %35, align 8, !tbaa !19
  br label %36

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  %39 = load i16, ptr %8, align 2, !tbaa !9
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %40, i32 0, i32 5
  store i16 %39, ptr %41, align 8, !tbaa !20
  %42 = load i16, ptr %8, align 2, !tbaa !9
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %43, i32 0, i32 6
  store i16 %42, ptr %44, align 2, !tbaa !21
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %46, i32 0, i32 4
  store ptr %45, ptr %47, align 8, !tbaa !22
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %48, i32 0, i32 12
  store volatile i32 18, ptr %49, align 4, !tbaa !13
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %50, i32 0, i32 13
  store volatile i32 0, ptr %51, align 8, !tbaa !23
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !24
  %55 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %54, i32 0, i32 0
  %56 = load volatile i32, ptr %55, align 4, !tbaa !25
  %57 = zext i32 %56 to i64
  %58 = and i64 %57, 65536
  %59 = icmp eq i64 %58, 0
  br i1 %59, label %60, label %70

60:                                               ; preds = %38
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  call void @SAI_FillFifo(ptr noundef %61)
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !24
  %65 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %64, i32 0, i32 0
  %66 = load volatile i32, ptr %65, align 4, !tbaa !25
  %67 = zext i32 %66 to i64
  %68 = or i64 %67, 65536
  %69 = trunc i64 %68 to i32
  store volatile i32 %69, ptr %65, align 4, !tbaa !25
  br label %70

70:                                               ; preds = %60, %38
  br label %71

71:                                               ; preds = %243, %70
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %72, i32 0, i32 6
  %74 = load i16, ptr %73, align 2, !tbaa !21
  %75 = zext i16 %74 to i32
  %76 = icmp ugt i32 %75, 0
  br i1 %76, label %77, label %244

77:                                               ; preds = %71
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !24
  %81 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %80, i32 0, i32 5
  %82 = load volatile i32, ptr %81, align 4, !tbaa !27
  %83 = zext i32 %82 to i64
  %84 = and i64 %83, 458752
  %85 = icmp ne i64 %84, 327680
  br i1 %85, label %86, label %204

86:                                               ; preds = %77
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %87, i32 0, i32 1
  %89 = getelementptr inbounds %struct.SAI_InitTypeDef, ptr %88, i32 0, i32 15
  %90 = load i32, ptr %89, align 4, !tbaa !28
  %91 = zext i32 %90 to i64
  %92 = icmp eq i64 %91, 64
  br i1 %92, label %93, label %113

93:                                               ; preds = %86
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %94, i32 0, i32 1
  %96 = getelementptr inbounds %struct.SAI_InitTypeDef, ptr %95, i32 0, i32 11
  %97 = load i32, ptr %96, align 4, !tbaa !29
  %98 = icmp eq i32 %97, 0
  br i1 %98, label %99, label %113

99:                                               ; preds = %93
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %100, i32 0, i32 4
  %102 = load ptr, ptr %101, align 8, !tbaa !22
  %103 = load i8, ptr %102, align 1, !tbaa !30
  %104 = zext i8 %103 to i32
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !24
  %108 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %107, i32 0, i32 7
  store volatile i32 %104, ptr %108, align 4, !tbaa !31
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %109, i32 0, i32 4
  %111 = load ptr, ptr %110, align 8, !tbaa !22
  %112 = getelementptr inbounds i8, ptr %111, i32 1
  store ptr %112, ptr %110, align 8, !tbaa !22
  br label %199

113:                                              ; preds = %93, %86
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %114, i32 0, i32 1
  %116 = getelementptr inbounds %struct.SAI_InitTypeDef, ptr %115, i32 0, i32 15
  %117 = load i32, ptr %116, align 4, !tbaa !28
  %118 = zext i32 %117 to i64
  %119 = icmp ule i64 %118, 128
  br i1 %119, label %120, label %147

120:                                              ; preds = %113
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %121, i32 0, i32 4
  %123 = load ptr, ptr %122, align 8, !tbaa !22
  %124 = load i8, ptr %123, align 1, !tbaa !30
  %125 = zext i8 %124 to i32
  store i32 %125, ptr %11, align 4, !tbaa !11
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %126, i32 0, i32 4
  %128 = load ptr, ptr %127, align 8, !tbaa !22
  %129 = getelementptr inbounds i8, ptr %128, i32 1
  store ptr %129, ptr %127, align 8, !tbaa !22
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %130, i32 0, i32 4
  %132 = load ptr, ptr %131, align 8, !tbaa !22
  %133 = load i8, ptr %132, align 1, !tbaa !30
  %134 = zext i8 %133 to i32
  %135 = shl i32 %134, 8
  %136 = load i32, ptr %11, align 4, !tbaa !11
  %137 = or i32 %136, %135
  store i32 %137, ptr %11, align 4, !tbaa !11
  %138 = load ptr, ptr %6, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %138, i32 0, i32 4
  %140 = load ptr, ptr %139, align 8, !tbaa !22
  %141 = getelementptr inbounds i8, ptr %140, i32 1
  store ptr %141, ptr %139, align 8, !tbaa !22
  %142 = load i32, ptr %11, align 4, !tbaa !11
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !24
  %146 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %145, i32 0, i32 7
  store volatile i32 %142, ptr %146, align 4, !tbaa !31
  br label %198

147:                                              ; preds = %113
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %148, i32 0, i32 4
  %150 = load ptr, ptr %149, align 8, !tbaa !22
  %151 = load i8, ptr %150, align 1, !tbaa !30
  %152 = zext i8 %151 to i32
  store i32 %152, ptr %11, align 4, !tbaa !11
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %153, i32 0, i32 4
  %155 = load ptr, ptr %154, align 8, !tbaa !22
  %156 = getelementptr inbounds i8, ptr %155, i32 1
  store ptr %156, ptr %154, align 8, !tbaa !22
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %157, i32 0, i32 4
  %159 = load ptr, ptr %158, align 8, !tbaa !22
  %160 = load i8, ptr %159, align 1, !tbaa !30
  %161 = zext i8 %160 to i32
  %162 = shl i32 %161, 8
  %163 = load i32, ptr %11, align 4, !tbaa !11
  %164 = or i32 %163, %162
  store i32 %164, ptr %11, align 4, !tbaa !11
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %165, i32 0, i32 4
  %167 = load ptr, ptr %166, align 8, !tbaa !22
  %168 = getelementptr inbounds i8, ptr %167, i32 1
  store ptr %168, ptr %166, align 8, !tbaa !22
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %169, i32 0, i32 4
  %171 = load ptr, ptr %170, align 8, !tbaa !22
  %172 = load i8, ptr %171, align 1, !tbaa !30
  %173 = zext i8 %172 to i32
  %174 = shl i32 %173, 16
  %175 = load i32, ptr %11, align 4, !tbaa !11
  %176 = or i32 %175, %174
  store i32 %176, ptr %11, align 4, !tbaa !11
  %177 = load ptr, ptr %6, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %177, i32 0, i32 4
  %179 = load ptr, ptr %178, align 8, !tbaa !22
  %180 = getelementptr inbounds i8, ptr %179, i32 1
  store ptr %180, ptr %178, align 8, !tbaa !22
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %181, i32 0, i32 4
  %183 = load ptr, ptr %182, align 8, !tbaa !22
  %184 = load i8, ptr %183, align 1, !tbaa !30
  %185 = zext i8 %184 to i32
  %186 = shl i32 %185, 24
  %187 = load i32, ptr %11, align 4, !tbaa !11
  %188 = or i32 %187, %186
  store i32 %188, ptr %11, align 4, !tbaa !11
  %189 = load ptr, ptr %6, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %189, i32 0, i32 4
  %191 = load ptr, ptr %190, align 8, !tbaa !22
  %192 = getelementptr inbounds i8, ptr %191, i32 1
  store ptr %192, ptr %190, align 8, !tbaa !22
  %193 = load i32, ptr %11, align 4, !tbaa !11
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !24
  %197 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %196, i32 0, i32 7
  store volatile i32 %193, ptr %197, align 4, !tbaa !31
  br label %198

198:                                              ; preds = %147, %120
  br label %199

199:                                              ; preds = %198, %99
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %200, i32 0, i32 6
  %202 = load i16, ptr %201, align 2, !tbaa !21
  %203 = add i16 %202, -1
  store i16 %203, ptr %201, align 2, !tbaa !21
  br label %243

204:                                              ; preds = %77
  %205 = call i32 @HAL_GetTick()
  %206 = load i32, ptr %10, align 4, !tbaa !11
  %207 = sub i32 %205, %206
  %208 = load i32, ptr %9, align 4, !tbaa !11
  %209 = icmp ugt i32 %207, %208
  br i1 %209, label %213, label %210

210:                                              ; preds = %204
  %211 = load i32, ptr %9, align 4, !tbaa !11
  %212 = icmp eq i32 %211, 0
  br i1 %212, label %213, label %242

213:                                              ; preds = %210, %204
  %214 = load i32, ptr %9, align 4, !tbaa !11
  %215 = icmp ne i32 %214, -1
  br i1 %215, label %216, label %242

216:                                              ; preds = %213
  %217 = load ptr, ptr %6, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %217, i32 0, i32 13
  %219 = load volatile i32, ptr %218, align 8, !tbaa !23
  %220 = or i32 %219, 64
  store volatile i32 %220, ptr %218, align 8, !tbaa !23
  %221 = load ptr, ptr %6, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %221, i32 0, i32 0
  %223 = load ptr, ptr %222, align 8, !tbaa !24
  %224 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %223, i32 0, i32 6
  store volatile i32 -1, ptr %224, align 4, !tbaa !32
  %225 = load ptr, ptr %6, align 8, !tbaa !5
  %226 = call i32 @SAI_Disable(ptr noundef %225)
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %227, i32 0, i32 0
  %229 = load ptr, ptr %228, align 8, !tbaa !24
  %230 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %229, i32 0, i32 1
  %231 = load volatile i32, ptr %230, align 4, !tbaa !33
  %232 = zext i32 %231 to i64
  %233 = or i64 %232, 8
  %234 = trunc i64 %233 to i32
  store volatile i32 %234, ptr %230, align 4, !tbaa !33
  %235 = load ptr, ptr %6, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %235, i32 0, i32 12
  store volatile i32 1, ptr %236, align 4, !tbaa !13
  br label %237

237:                                              ; preds = %216
  %238 = load ptr, ptr %6, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %238, i32 0, i32 11
  store i32 0, ptr %239, align 8, !tbaa !19
  br label %240

240:                                              ; preds = %237
  br label %241

241:                                              ; preds = %240
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %253

242:                                              ; preds = %213, %210
  br label %243

243:                                              ; preds = %242, %199
  br label %71, !llvm.loop !34

244:                                              ; preds = %71
  %245 = load ptr, ptr %6, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %245, i32 0, i32 12
  store volatile i32 1, ptr %246, align 4, !tbaa !13
  br label %247

247:                                              ; preds = %244
  %248 = load ptr, ptr %6, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %248, i32 0, i32 11
  store i32 0, ptr %249, align 8, !tbaa !19
  br label %250

250:                                              ; preds = %247
  br label %251

251:                                              ; preds = %250
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %253

252:                                              ; preds = %21
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %253

253:                                              ; preds = %252, %251, %241, %32, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %254 = load i32, ptr %5, align 4
  ret i32 %254
}

declare i32 @HAL_GetTick() #2

; Function Attrs: nounwind uwtable
declare hidden void @SAI_FillFifo(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 180}
!14 = !{!"__SAI_HandleTypeDef", !6, i64 0, !15, i64 8, !17, i64 88, !18, i64 108, !6, i64 128, !10, i64 136, !10, i64 138, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !12, i64 176, !12, i64 180, !12, i64 184}
!15 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !16, i64 52, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76}
!16 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!17 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!18 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!19 = !{!14, !12, i64 176}
!20 = !{!14, !10, i64 136}
!21 = !{!14, !10, i64 138}
!22 = !{!14, !6, i64 128}
!23 = !{!14, !12, i64 184}
!24 = !{!14, !6, i64 0}
!25 = !{!26, !12, i64 0}
!26 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28}
!27 = !{!26, !12, i64 20}
!28 = !{!14, !12, i64 76}
!29 = !{!14, !12, i64 52}
!30 = !{!7, !7, i64 0}
!31 = !{!26, !12, i64 28}
!32 = !{!26, !12, i64 24}
!33 = !{!26, !12, i64 4}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
declare hidden i32 @SAI_Disable(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_SAI_Transmit(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = tail call i32 @HAL_GetTick() #2
  %6 = icmp eq ptr %1, null
  %7 = icmp eq i16 %2, 0
  %or.cond = or i1 %6, %7
  br i1 %or.cond, label %100, label %8

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 180
  %10 = load volatile i32, ptr %9, align 4, !tbaa !5
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %12, label %100

12:                                               ; preds = %8
  %13 = getelementptr inbounds i8, ptr %0, i64 176
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = icmp eq i32 %14, 1
  br i1 %15, label %100, label %16

16:                                               ; preds = %12
  store i32 1, ptr %13, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 136
  store i16 %2, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %0, i64 138
  store i16 %2, ptr %18, align 2, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr %1, ptr %19, align 8, !tbaa !19
  store volatile i32 18, ptr %9, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 184
  store volatile i32 0, ptr %20, align 8, !tbaa !20
  %21 = load ptr, ptr %0, align 8, !tbaa !21
  %22 = load volatile i32, ptr %21, align 4, !tbaa !22
  %23 = and i32 %22, 65536
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %.lr.ph

25:                                               ; preds = %16
  tail call void @SAI_FillFifo(ptr noundef nonnull %0)
  %26 = load ptr, ptr %0, align 8, !tbaa !21
  %27 = load volatile i32, ptr %26, align 4, !tbaa !22
  %28 = or i32 %27, 65536
  store volatile i32 %28, ptr %26, align 4, !tbaa !22
  %.pre = load i16, ptr %18, align 2, !tbaa !18
  %.not65 = icmp eq i16 %.pre, 0
  br i1 %.not65, label %.sink.split, label %.lr.ph

.lr.ph:                                           ; preds = %16, %25
  %29 = phi i16 [ %.pre, %25 ], [ %2, %16 ]
  %30 = getelementptr inbounds i8, ptr %0, i64 76
  %31 = getelementptr inbounds i8, ptr %0, i64 52
  %32 = icmp eq i32 %3, 0
  br label %33

33:                                               ; preds = %.lr.ph, %98
  %34 = phi i16 [ %29, %.lr.ph ], [ %99, %98 ]
  %35 = load ptr, ptr %0, align 8, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %35, i64 20
  %37 = load volatile i32, ptr %36, align 4, !tbaa !24
  %38 = and i32 %37, 458752
  %.not64 = icmp eq i32 %38, 327680
  br i1 %.not64, label %84, label %39

39:                                               ; preds = %33
  %40 = load i32, ptr %30, align 4, !tbaa !25
  %41 = icmp eq i32 %40, 64
  br i1 %41, label %42, label %50

42:                                               ; preds = %39
  %43 = load i32, ptr %31, align 4, !tbaa !26
  %44 = icmp eq i32 %43, 0
  %.pre66 = load ptr, ptr %19, align 8, !tbaa !19
  br i1 %44, label %45, label %.thread

45:                                               ; preds = %42
  %46 = load i8, ptr %.pre66, align 1, !tbaa !27
  %47 = zext i8 %46 to i32
  %48 = getelementptr inbounds i8, ptr %35, i64 28
  store volatile i32 %47, ptr %48, align 4, !tbaa !28
  %49 = getelementptr inbounds i8, ptr %.pre66, i64 1
  store ptr %49, ptr %19, align 8, !tbaa !19
  br label %82

50:                                               ; preds = %39
  %51 = icmp ult i32 %40, 129
  %.pre67 = load ptr, ptr %19, align 8, !tbaa !19
  br i1 %51, label %.thread, label %62

.thread:                                          ; preds = %42, %50
  %52 = phi ptr [ %.pre66, %42 ], [ %.pre67, %50 ]
  %53 = load i8, ptr %52, align 1, !tbaa !27
  %54 = zext i8 %53 to i32
  %55 = getelementptr inbounds i8, ptr %52, i64 1
  store ptr %55, ptr %19, align 8, !tbaa !19
  %56 = load i8, ptr %55, align 1, !tbaa !27
  %57 = zext i8 %56 to i32
  %58 = shl nuw nsw i32 %57, 8
  %59 = or disjoint i32 %58, %54
  %60 = getelementptr inbounds i8, ptr %52, i64 2
  store ptr %60, ptr %19, align 8, !tbaa !19
  %61 = getelementptr inbounds i8, ptr %35, i64 28
  store volatile i32 %59, ptr %61, align 4, !tbaa !28
  br label %82

62:                                               ; preds = %50
  %63 = load i8, ptr %.pre67, align 1, !tbaa !27
  %64 = zext i8 %63 to i32
  %65 = getelementptr inbounds i8, ptr %.pre67, i64 1
  store ptr %65, ptr %19, align 8, !tbaa !19
  %66 = load i8, ptr %65, align 1, !tbaa !27
  %67 = zext i8 %66 to i32
  %68 = shl nuw nsw i32 %67, 8
  %69 = or disjoint i32 %68, %64
  %70 = getelementptr inbounds i8, ptr %.pre67, i64 2
  store ptr %70, ptr %19, align 8, !tbaa !19
  %71 = load i8, ptr %70, align 1, !tbaa !27
  %72 = zext i8 %71 to i32
  %73 = shl nuw nsw i32 %72, 16
  %74 = or disjoint i32 %69, %73
  %75 = getelementptr inbounds i8, ptr %.pre67, i64 3
  store ptr %75, ptr %19, align 8, !tbaa !19
  %76 = load i8, ptr %75, align 1, !tbaa !27
  %77 = zext i8 %76 to i32
  %78 = shl nuw i32 %77, 24
  %79 = or disjoint i32 %74, %78
  %80 = getelementptr inbounds i8, ptr %.pre67, i64 4
  store ptr %80, ptr %19, align 8, !tbaa !19
  %81 = getelementptr inbounds i8, ptr %35, i64 28
  store volatile i32 %79, ptr %81, align 4, !tbaa !28
  br label %82

82:                                               ; preds = %.thread, %62, %45
  %83 = add i16 %34, -1
  store i16 %83, ptr %18, align 2, !tbaa !18
  br label %98

84:                                               ; preds = %33
  %85 = tail call i32 @HAL_GetTick() #2
  %86 = sub i32 %85, %5
  %87 = icmp ugt i32 %86, %3
  %or.cond4 = or i1 %32, %87
  br i1 %or.cond4, label %88, label %._crit_edge68

._crit_edge68:                                    ; preds = %84
  %.pre69 = load i16, ptr %18, align 2, !tbaa !18
  br label %98

88:                                               ; preds = %84
  %89 = load volatile i32, ptr %20, align 8, !tbaa !20
  %90 = or i32 %89, 64
  store volatile i32 %90, ptr %20, align 8, !tbaa !20
  %91 = load ptr, ptr %0, align 8, !tbaa !21
  %92 = getelementptr inbounds i8, ptr %91, i64 24
  store volatile i32 -1, ptr %92, align 4, !tbaa !29
  %93 = tail call i32 @SAI_Disable(ptr noundef nonnull %0)
  %94 = load ptr, ptr %0, align 8, !tbaa !21
  %95 = getelementptr inbounds i8, ptr %94, i64 4
  %96 = load volatile i32, ptr %95, align 4, !tbaa !30
  %97 = or i32 %96, 8
  store volatile i32 %97, ptr %95, align 4, !tbaa !30
  br label %.sink.split

98:                                               ; preds = %._crit_edge68, %82
  %99 = phi i16 [ %.pre69, %._crit_edge68 ], [ %83, %82 ]
  %.not = icmp eq i16 %99, 0
  br i1 %.not, label %.sink.split, label %33, !llvm.loop !31

.sink.split:                                      ; preds = %98, %25, %88
  %.0.ph = phi i32 [ 1, %88 ], [ 0, %25 ], [ 0, %98 ]
  store volatile i32 1, ptr %9, align 4, !tbaa !5
  store i32 0, ptr %13, align 8, !tbaa !16
  br label %100

100:                                              ; preds = %.sink.split, %8, %12, %4
  %.0 = phi i32 [ 1, %4 ], [ 2, %12 ], [ 2, %8 ], [ %.0.ph, %.sink.split ]
  ret i32 %.0
}

declare i32 @HAL_GetTick() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @SAI_FillFifo(ptr noundef) local_unnamed_addr #0

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
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 }

!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 180}
!6 = !{!"__SAI_HandleTypeDef", !7, i64 0, !10, i64 8, !13, i64 88, !14, i64 108, !7, i64 128, !15, i64 136, !15, i64 138, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !11, i64 176, !11, i64 180, !11, i64 184}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !12, i64 52, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!13 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16}
!14 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!15 = !{!"short", !8, i64 0}
!16 = !{!6, !11, i64 176}
!17 = !{!6, !15, i64 136}
!18 = !{!6, !15, i64 138}
!19 = !{!6, !7, i64 128}
!20 = !{!6, !11, i64 184}
!21 = !{!6, !7, i64 0}
!22 = !{!23, !11, i64 0}
!23 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!24 = !{!23, !11, i64 20}
!25 = !{!6, !11, i64 76}
!26 = !{!6, !11, i64 52}
!27 = !{!8, !8, i64 0}
!28 = !{!23, !11, i64 28}
!29 = !{!23, !11, i64 24}
!30 = !{!23, !11, i64 4}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass