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

; 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

declare i32 @HAL_GetTick() #2

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_SAI_Receive(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 %244

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

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

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 ptr, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %40, i32 0, i32 4
  store ptr %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 5
  store i16 %42, ptr %44, align 8, !tbaa !21
  %45 = load i16, ptr %8, align 2, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %46, i32 0, i32 6
  store i16 %45, ptr %47, align 2, !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 34, 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 %69

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

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

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

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

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

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

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

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

119:                                              ; preds = %112
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !24
  %123 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %122, i32 0, i32 7
  %124 = load volatile i32, ptr %123, align 4, !tbaa !30
  store i32 %124, ptr %11, align 4, !tbaa !11
  %125 = load i32, ptr %11, align 4, !tbaa !11
  %126 = trunc i32 %125 to i8
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %127, i32 0, i32 4
  %129 = load ptr, ptr %128, align 8, !tbaa !20
  store i8 %126, ptr %129, align 1, !tbaa !31
  %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 !20
  %133 = getelementptr inbounds i8, ptr %132, i32 1
  store ptr %133, ptr %131, align 8, !tbaa !20
  %134 = load i32, ptr %11, align 4, !tbaa !11
  %135 = lshr i32 %134, 8
  %136 = trunc i32 %135 to i8
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %137, i32 0, i32 4
  %139 = load ptr, ptr %138, align 8, !tbaa !20
  store i8 %136, ptr %139, align 1, !tbaa !31
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %140, i32 0, i32 4
  %142 = load ptr, ptr %141, align 8, !tbaa !20
  %143 = getelementptr inbounds i8, ptr %142, i32 1
  store ptr %143, ptr %141, align 8, !tbaa !20
  br label %189

144:                                              ; preds = %112
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %145, i32 0, i32 0
  %147 = load ptr, ptr %146, align 8, !tbaa !24
  %148 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %147, i32 0, i32 7
  %149 = load volatile i32, ptr %148, align 4, !tbaa !30
  store i32 %149, ptr %11, align 4, !tbaa !11
  %150 = load i32, ptr %11, align 4, !tbaa !11
  %151 = trunc i32 %150 to i8
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %152, i32 0, i32 4
  %154 = load ptr, ptr %153, align 8, !tbaa !20
  store i8 %151, ptr %154, align 1, !tbaa !31
  %155 = load ptr, ptr %6, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %155, i32 0, i32 4
  %157 = load ptr, ptr %156, align 8, !tbaa !20
  %158 = getelementptr inbounds i8, ptr %157, i32 1
  store ptr %158, ptr %156, align 8, !tbaa !20
  %159 = load i32, ptr %11, align 4, !tbaa !11
  %160 = lshr i32 %159, 8
  %161 = trunc i32 %160 to i8
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %162, i32 0, i32 4
  %164 = load ptr, ptr %163, align 8, !tbaa !20
  store i8 %161, ptr %164, align 1, !tbaa !31
  %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 !20
  %168 = getelementptr inbounds i8, ptr %167, i32 1
  store ptr %168, ptr %166, align 8, !tbaa !20
  %169 = load i32, ptr %11, align 4, !tbaa !11
  %170 = lshr i32 %169, 16
  %171 = trunc i32 %170 to i8
  %172 = load ptr, ptr %6, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %172, i32 0, i32 4
  %174 = load ptr, ptr %173, align 8, !tbaa !20
  store i8 %171, ptr %174, align 1, !tbaa !31
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %175, i32 0, i32 4
  %177 = load ptr, ptr %176, align 8, !tbaa !20
  %178 = getelementptr inbounds i8, ptr %177, i32 1
  store ptr %178, ptr %176, align 8, !tbaa !20
  %179 = load i32, ptr %11, align 4, !tbaa !11
  %180 = lshr i32 %179, 24
  %181 = trunc i32 %180 to i8
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %182, i32 0, i32 4
  %184 = load ptr, ptr %183, align 8, !tbaa !20
  store i8 %181, ptr %184, align 1, !tbaa !31
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %185, i32 0, i32 4
  %187 = load ptr, ptr %186, align 8, !tbaa !20
  %188 = getelementptr inbounds i8, ptr %187, i32 1
  store ptr %188, ptr %186, align 8, !tbaa !20
  br label %189

189:                                              ; preds = %144, %119
  br label %190

190:                                              ; preds = %189, %98
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %191, i32 0, i32 6
  %193 = load i16, ptr %192, align 2, !tbaa !22
  %194 = add i16 %193, -1
  store i16 %194, ptr %192, align 2, !tbaa !22
  br label %234

195:                                              ; preds = %76
  %196 = call i32 @HAL_GetTick()
  %197 = load i32, ptr %10, align 4, !tbaa !11
  %198 = sub i32 %196, %197
  %199 = load i32, ptr %9, align 4, !tbaa !11
  %200 = icmp ugt i32 %198, %199
  br i1 %200, label %204, label %201

201:                                              ; preds = %195
  %202 = load i32, ptr %9, align 4, !tbaa !11
  %203 = icmp eq i32 %202, 0
  br i1 %203, label %204, label %233

204:                                              ; preds = %201, %195
  %205 = load i32, ptr %9, align 4, !tbaa !11
  %206 = icmp ne i32 %205, -1
  br i1 %206, label %207, label %233

207:                                              ; preds = %204
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %208, i32 0, i32 13
  %210 = load volatile i32, ptr %209, align 8, !tbaa !23
  %211 = or i32 %210, 64
  store volatile i32 %211, ptr %209, align 8, !tbaa !23
  %212 = load ptr, ptr %6, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %212, i32 0, i32 0
  %214 = load ptr, ptr %213, align 8, !tbaa !24
  %215 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %214, i32 0, i32 6
  store volatile i32 -1, ptr %215, align 4, !tbaa !32
  %216 = load ptr, ptr %6, align 8, !tbaa !5
  %217 = call i32 @SAI_Disable(ptr noundef %216)
  %218 = load ptr, ptr %6, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %218, i32 0, i32 0
  %220 = load ptr, ptr %219, align 8, !tbaa !24
  %221 = getelementptr inbounds %struct.SAI_Block_TypeDef, ptr %220, i32 0, i32 1
  %222 = load volatile i32, ptr %221, align 4, !tbaa !33
  %223 = zext i32 %222 to i64
  %224 = or i64 %223, 8
  %225 = trunc i64 %224 to i32
  store volatile i32 %225, ptr %221, align 4, !tbaa !33
  %226 = load ptr, ptr %6, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %226, i32 0, i32 12
  store volatile i32 1, ptr %227, align 4, !tbaa !13
  br label %228

228:                                              ; preds = %207
  %229 = load ptr, ptr %6, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %229, i32 0, i32 11
  store i32 0, ptr %230, align 8, !tbaa !19
  br label %231

231:                                              ; preds = %228
  br label %232

232:                                              ; preds = %231
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %244

233:                                              ; preds = %204, %201
  br label %234

234:                                              ; preds = %233, %190
  br label %70, !llvm.loop !34

235:                                              ; preds = %70
  %236 = load ptr, ptr %6, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.__SAI_HandleTypeDef, ptr %236, i32 0, i32 12
  store volatile i32 1, ptr %237, align 4, !tbaa !13
  br label %238

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

241:                                              ; preds = %238
  br label %242

242:                                              ; preds = %241
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %244

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

244:                                              ; preds = %243, %242, %232, %32, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %245 = load i32, ptr %5, align 4
  ret i32 %245
}

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, !6, i64 128}
!21 = !{!14, !10, i64 136}
!22 = !{!14, !10, i64 138}
!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 = !{!26, !12, i64 28}
!31 = !{!7, !7, i64 0}
!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

declare i32 @HAL_GetTick() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_SAI_Receive(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 %91, 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 %91

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 %91, label %16

16:                                               ; preds = %12
  store i32 1, ptr %13, align 8, !tbaa !16
  %17 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr %1, ptr %17, align 8, !tbaa !17
  %18 = getelementptr inbounds i8, ptr %0, i64 136
  store i16 %2, ptr %18, align 8, !tbaa !18
  %19 = getelementptr inbounds i8, ptr %0, i64 138
  store i16 %2, ptr %19, align 2, !tbaa !19
  store volatile i32 34, 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
  %26 = load volatile i32, ptr %21, align 4, !tbaa !22
  %27 = or i32 %26, 65536
  store volatile i32 %27, ptr %21, align 4, !tbaa !22
  br label %.lr.ph

.lr.ph:                                           ; preds = %16, %25
  %28 = getelementptr inbounds i8, ptr %0, i64 76
  %29 = getelementptr inbounds i8, ptr %0, i64 52
  %30 = icmp eq i32 %3, 0
  br label %31

31:                                               ; preds = %.lr.ph, %89
  %32 = load ptr, ptr %0, align 8, !tbaa !21
  %33 = getelementptr inbounds i8, ptr %32, i64 20
  %34 = load volatile i32, ptr %33, align 4, !tbaa !24
  %35 = and i32 %34, 458752
  %.not63 = icmp eq i32 %35, 0
  br i1 %.not63, label %75, label %36

36:                                               ; preds = %31
  %37 = load i32, ptr %28, align 4, !tbaa !25
  %38 = icmp eq i32 %37, 64
  br i1 %38, label %39, label %45

39:                                               ; preds = %36
  %40 = load i32, ptr %29, align 4, !tbaa !26
  %41 = icmp eq i32 %40, 0
  %.pre = load ptr, ptr %17, align 8, !tbaa !17
  br i1 %41, label %42, label %.thread

42:                                               ; preds = %39
  %43 = getelementptr inbounds i8, ptr %32, i64 28
  %44 = load volatile i32, ptr %43, align 4, !tbaa !27
  br label %69

45:                                               ; preds = %36
  %46 = icmp ult i32 %37, 129
  %.pre65 = load ptr, ptr %17, align 8, !tbaa !17
  br i1 %46, label %.thread, label %54

.thread:                                          ; preds = %39, %45
  %47 = phi ptr [ %.pre, %39 ], [ %.pre65, %45 ]
  %48 = getelementptr inbounds i8, ptr %32, i64 28
  %49 = load volatile i32, ptr %48, align 4, !tbaa !27
  %50 = trunc i32 %49 to i8
  store i8 %50, ptr %47, align 1, !tbaa !28
  %51 = load ptr, ptr %17, align 8, !tbaa !17
  %52 = getelementptr inbounds i8, ptr %51, i64 1
  store ptr %52, ptr %17, align 8, !tbaa !17
  %53 = lshr i32 %49, 8
  br label %69

54:                                               ; preds = %45
  %55 = getelementptr inbounds i8, ptr %32, i64 28
  %56 = load volatile i32, ptr %55, align 4, !tbaa !27
  %57 = trunc i32 %56 to i8
  store i8 %57, ptr %.pre65, align 1, !tbaa !28
  %58 = load ptr, ptr %17, align 8, !tbaa !17
  %59 = getelementptr inbounds i8, ptr %58, i64 1
  store ptr %59, ptr %17, align 8, !tbaa !17
  %60 = lshr i32 %56, 8
  %61 = trunc i32 %60 to i8
  store i8 %61, ptr %59, align 1, !tbaa !28
  %62 = load ptr, ptr %17, align 8, !tbaa !17
  %63 = getelementptr inbounds i8, ptr %62, i64 1
  store ptr %63, ptr %17, align 8, !tbaa !17
  %64 = lshr i32 %56, 16
  %65 = trunc i32 %64 to i8
  store i8 %65, ptr %63, align 1, !tbaa !28
  %66 = load ptr, ptr %17, align 8, !tbaa !17
  %67 = getelementptr inbounds i8, ptr %66, i64 1
  store ptr %67, ptr %17, align 8, !tbaa !17
  %68 = lshr i32 %56, 24
  br label %69

69:                                               ; preds = %.thread, %54, %42
  %.sink70 = phi i32 [ %53, %.thread ], [ %68, %54 ], [ %44, %42 ]
  %.sink69 = phi ptr [ %52, %.thread ], [ %67, %54 ], [ %.pre, %42 ]
  %70 = trunc i32 %.sink70 to i8
  store i8 %70, ptr %.sink69, align 1, !tbaa !28
  %71 = load ptr, ptr %17, align 8, !tbaa !17
  %72 = getelementptr inbounds i8, ptr %71, i64 1
  store ptr %72, ptr %17, align 8, !tbaa !17
  %73 = load i16, ptr %19, align 2, !tbaa !19
  %74 = add i16 %73, -1
  store i16 %74, ptr %19, align 2, !tbaa !19
  br label %89

75:                                               ; preds = %31
  %76 = tail call i32 @HAL_GetTick() #2
  %77 = sub i32 %76, %5
  %78 = icmp ugt i32 %77, %3
  %or.cond4 = or i1 %30, %78
  br i1 %or.cond4, label %79, label %._crit_edge66

._crit_edge66:                                    ; preds = %75
  %.pre67 = load i16, ptr %19, align 2, !tbaa !19
  br label %89

79:                                               ; preds = %75
  %80 = load volatile i32, ptr %20, align 8, !tbaa !20
  %81 = or i32 %80, 64
  store volatile i32 %81, ptr %20, align 8, !tbaa !20
  %82 = load ptr, ptr %0, align 8, !tbaa !21
  %83 = getelementptr inbounds i8, ptr %82, i64 24
  store volatile i32 -1, ptr %83, align 4, !tbaa !29
  %84 = tail call i32 @SAI_Disable(ptr noundef nonnull %0)
  %85 = load ptr, ptr %0, align 8, !tbaa !21
  %86 = getelementptr inbounds i8, ptr %85, i64 4
  %87 = load volatile i32, ptr %86, align 4, !tbaa !30
  %88 = or i32 %87, 8
  store volatile i32 %88, ptr %86, align 4, !tbaa !30
  br label %.sink.split

89:                                               ; preds = %._crit_edge66, %69
  %90 = phi i16 [ %.pre67, %._crit_edge66 ], [ %74, %69 ]
  %.not = icmp eq i16 %90, 0
  br i1 %.not, label %.sink.split, label %31, !llvm.loop !31

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
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, !7, i64 128}
!18 = !{!6, !15, i64 136}
!19 = !{!6, !15, i64 138}
!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 = !{!23, !11, i64 28}
!28 = !{!8, !8, i64 0}
!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,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass