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

; 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.__SPI_HandleTypeDef = type { ptr, %struct.SPI_InitTypeDef, ptr, i16, i16, ptr, i16, i16, i32, ptr, ptr, ptr, ptr, i32, i32, i32 }
%struct.SPI_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.SPI_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], i32, [3 x i32], i32, i32, i32, i32, i32 }
%struct.__DMA_HandleTypeDef = type { ptr, %struct.DMA_InitTypeDef, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, ptr, ptr, i32, ptr, ptr, i32 }
%struct.DMA_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@SystemCoreClock = external global i32, align 4

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

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

declare i32 @HAL_DMA_GetError(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @SPI_AbortTransfer(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_SPI_Abort_IT(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 1, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %7, i32 0, i32 14
  store volatile i32 7, ptr %8, align 4, !tbaa !11
  store i32 0, ptr %3, align 4, !tbaa !9
  %9 = load i32, ptr @SystemCoreClock, align 4, !tbaa !9
  %10 = zext i32 %9 to i64
  %11 = udiv i64 %10, 24
  %12 = udiv i64 %11, 1000
  %13 = mul i64 100, %12
  %14 = trunc i64 %13 to i32
  store volatile i32 %14, ptr %4, align 4, !tbaa !9
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds %struct.SPI_TypeDef, ptr %17, i32 0, i32 0
  %19 = load volatile i32, ptr %18, align 4, !tbaa !16
  %20 = zext i32 %19 to i64
  %21 = and i64 %20, 512
  %22 = icmp eq i64 %21, 512
  br i1 %22, label %23, label %56

23:                                               ; preds = %1
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !15
  %27 = getelementptr inbounds %struct.SPI_TypeDef, ptr %26, i32 0, i32 0
  %28 = load volatile i32, ptr %27, align 4, !tbaa !16
  %29 = zext i32 %28 to i64
  %30 = or i64 %29, 1024
  %31 = trunc i64 %30 to i32
  store volatile i32 %31, ptr %27, align 4, !tbaa !16
  br label %32

32:                                               ; preds = %46, %23
  %33 = load volatile i32, ptr %4, align 4, !tbaa !9
  %34 = add i32 %33, -1
  store volatile i32 %34, ptr %4, align 4, !tbaa !9
  %35 = load volatile i32, ptr %4, align 4, !tbaa !9
  %36 = zext i32 %35 to i64
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %45

38:                                               ; preds = %32
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %39, i32 0, i32 15
  %41 = load volatile i32, ptr %40, align 8, !tbaa !18
  %42 = zext i32 %41 to i64
  %43 = or i64 %42, 64
  %44 = trunc i64 %43 to i32
  store volatile i32 %44, ptr %40, align 8, !tbaa !18
  br label %55

45:                                               ; preds = %32
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = getelementptr inbounds %struct.SPI_TypeDef, ptr %49, i32 0, i32 0
  %51 = load volatile i32, ptr %50, align 4, !tbaa !16
  %52 = zext i32 %51 to i64
  %53 = and i64 %52, 512
  %54 = icmp eq i64 %53, 512
  br i1 %54, label %32, label %55, !llvm.loop !19

55:                                               ; preds = %46, %38
  br label %56

56:                                               ; preds = %55, %1
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %57, i32 0, i32 11
  %59 = load ptr, ptr %58, align 8, !tbaa !21
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %99

61:                                               ; preds = %56
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds %struct.SPI_TypeDef, ptr %64, i32 0, i32 2
  %66 = load volatile i32, ptr %65, align 4, !tbaa !22
  %67 = zext i32 %66 to i64
  %68 = and i64 %67, 32768
  %69 = icmp eq i64 %68, 32768
  br i1 %69, label %70, label %93

70:                                               ; preds = %61
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %71, i32 0, i32 11
  %73 = load ptr, ptr %72, align 8, !tbaa !21
  %74 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %73, i32 0, i32 10
  store ptr @SPI_DMATxAbortCallback, ptr %74, align 8, !tbaa !23
  store i32 0, ptr %5, align 4, !tbaa !9
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %75, i32 0, i32 11
  %77 = load ptr, ptr %76, align 8, !tbaa !21
  %78 = call i32 @HAL_DMA_Abort_IT(ptr noundef %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %92

80:                                               ; preds = %70
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %81, i32 0, i32 11
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  %84 = call i32 @HAL_DMA_GetError(ptr noundef %83)
  %85 = icmp eq i32 %84, 128
  br i1 %85, label %86, label %91

86:                                               ; preds = %80
  store i32 1, ptr %5, align 4, !tbaa !9
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %87, i32 0, i32 11
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %89, i32 0, i32 10
  store ptr null, ptr %90, align 8, !tbaa !23
  br label %91

91:                                               ; preds = %86, %80
  br label %92

92:                                               ; preds = %91, %70
  br label %98

93:                                               ; preds = %61
  %94 = load ptr, ptr %2, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %94, i32 0, i32 11
  %96 = load ptr, ptr %95, align 8, !tbaa !21
  %97 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %96, i32 0, i32 10
  store ptr null, ptr %97, align 8, !tbaa !23
  br label %98

98:                                               ; preds = %93, %92
  br label %99

99:                                               ; preds = %98, %56
  %100 = load ptr, ptr %2, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %100, i32 0, i32 12
  %102 = load ptr, ptr %101, align 8, !tbaa !26
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %142

104:                                              ; preds = %99
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  %108 = getelementptr inbounds %struct.SPI_TypeDef, ptr %107, i32 0, i32 2
  %109 = load volatile i32, ptr %108, align 4, !tbaa !22
  %110 = zext i32 %109 to i64
  %111 = and i64 %110, 16384
  %112 = icmp eq i64 %111, 16384
  br i1 %112, label %113, label %136

113:                                              ; preds = %104
  %114 = load ptr, ptr %2, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %114, i32 0, i32 12
  %116 = load ptr, ptr %115, align 8, !tbaa !26
  %117 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %116, i32 0, i32 10
  store ptr @SPI_DMARxAbortCallback, ptr %117, align 8, !tbaa !23
  store i32 0, ptr %6, align 4, !tbaa !9
  %118 = load ptr, ptr %2, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %118, i32 0, i32 12
  %120 = load ptr, ptr %119, align 8, !tbaa !26
  %121 = call i32 @HAL_DMA_Abort_IT(ptr noundef %120)
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %123, label %135

123:                                              ; preds = %113
  %124 = load ptr, ptr %2, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %124, i32 0, i32 12
  %126 = load ptr, ptr %125, align 8, !tbaa !26
  %127 = call i32 @HAL_DMA_GetError(ptr noundef %126)
  %128 = icmp eq i32 %127, 128
  br i1 %128, label %129, label %134

129:                                              ; preds = %123
  store i32 1, ptr %6, align 4, !tbaa !9
  %130 = load ptr, ptr %2, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %130, i32 0, i32 12
  %132 = load ptr, ptr %131, align 8, !tbaa !26
  %133 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %132, i32 0, i32 10
  store ptr null, ptr %133, align 8, !tbaa !23
  br label %134

134:                                              ; preds = %129, %123
  br label %135

135:                                              ; preds = %134, %113
  br label %141

136:                                              ; preds = %104
  %137 = load ptr, ptr %2, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %137, i32 0, i32 12
  %139 = load ptr, ptr %138, align 8, !tbaa !26
  %140 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %139, i32 0, i32 10
  store ptr null, ptr %140, align 8, !tbaa !23
  br label %141

141:                                              ; preds = %136, %135
  br label %142

142:                                              ; preds = %141, %99
  %143 = load i32, ptr %5, align 4, !tbaa !9
  %144 = zext i32 %143 to i64
  %145 = icmp eq i64 %144, 1
  br i1 %145, label %146, label %165

146:                                              ; preds = %142
  %147 = load i32, ptr %6, align 4, !tbaa !9
  %148 = zext i32 %147 to i64
  %149 = icmp eq i64 %148, 1
  br i1 %149, label %150, label %165

150:                                              ; preds = %146
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  call void @SPI_AbortTransfer(ptr noundef %151)
  %152 = load ptr, ptr %2, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %152, i32 0, i32 15
  %154 = load volatile i32, ptr %153, align 8, !tbaa !18
  %155 = zext i32 %154 to i64
  %156 = icmp eq i64 %155, 64
  br i1 %156, label %157, label %158

157:                                              ; preds = %150
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %161

158:                                              ; preds = %150
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %159, i32 0, i32 15
  store volatile i32 0, ptr %160, align 8, !tbaa !18
  br label %161

161:                                              ; preds = %158, %157
  %162 = load ptr, ptr %2, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.__SPI_HandleTypeDef, ptr %162, i32 0, i32 14
  store volatile i32 1, ptr %163, align 4, !tbaa !11
  %164 = load ptr, ptr %2, align 8, !tbaa !5
  call void @HAL_SPI_AbortCpltCallback(ptr noundef %164)
  br label %165

165:                                              ; preds = %161, %146, %142
  %166 = load i32, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret i32 %166
}

; Function Attrs: nounwind uwtable
declare hidden void @SPI_DMATxAbortCallback(ptr noundef) #2

declare i32 @HAL_DMA_Abort_IT(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @SPI_DMARxAbortCallback(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_SPI_AbortCpltCallback(ptr noundef) #2

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 164}
!12 = !{!"__SPI_HandleTypeDef", !6, i64 0, !13, i64 8, !6, i64 96, !14, i64 104, !14, i64 106, !6, i64 112, !14, i64 120, !14, i64 122, !10, i64 124, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !10, i64 160, !10, i64 164, !10, i64 168}
!13 = !{!"", !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, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !10, i64 0}
!17 = !{!"", !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, !7, i64 36, !10, i64 48, !7, i64 52, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80}
!18 = !{!12, !10, i64 168}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !6, i64 144}
!22 = !{!17, !10, i64 8}
!23 = !{!24, !6, i64 112}
!24 = !{!"__DMA_HandleTypeDef", !6, i64 0, !25, i64 8, !10, i64 56, !10, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !10, i64 176}
!25 = !{!"", !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}
!26 = !{!12, !6, i64 152}


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

@SystemCoreClock = external local_unnamed_addr global i32, align 4

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

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

declare i32 @HAL_DMA_GetError(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @HAL_SPI_Abort_IT(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2)
  %3 = getelementptr inbounds i8, ptr %0, i64 164
  store volatile i32 7, ptr %3, align 4, !tbaa !5
  %4 = load i32, ptr @SystemCoreClock, align 4, !tbaa !13
  %5 = udiv i32 %4, 24000
  %narrow = mul nuw nsw i32 %5, 100
  store volatile i32 %narrow, ptr %2, align 4, !tbaa !13
  %6 = load ptr, ptr %0, align 8, !tbaa !14
  %7 = load volatile i32, ptr %6, align 4, !tbaa !15
  %8 = and i32 %7, 512
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.loopexit, label %9

9:                                                ; preds = %1
  %10 = load volatile i32, ptr %6, align 4, !tbaa !15
  %11 = or i32 %10, 1024
  store volatile i32 %11, ptr %6, align 4, !tbaa !15
  br label %12

12:                                               ; preds = %19, %9
  %.0..0..0..0. = load volatile i32, ptr %2, align 4, !tbaa !13
  %13 = add i32 %.0..0..0..0., -1
  store volatile i32 %13, ptr %2, align 4, !tbaa !13
  %.0..0..0..0.4 = load volatile i32, ptr %2, align 4, !tbaa !13
  %14 = icmp eq i32 %.0..0..0..0.4, 0
  br i1 %14, label %15, label %19

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 168
  %17 = load volatile i32, ptr %16, align 8, !tbaa !17
  %18 = or i32 %17, 64
  store volatile i32 %18, ptr %16, align 8, !tbaa !17
  br label %.loopexit

19:                                               ; preds = %12
  %20 = load volatile i32, ptr %6, align 4, !tbaa !15
  %21 = and i32 %20, 512
  %.not32 = icmp eq i32 %21, 0
  br i1 %.not32, label %.loopexit, label %12, !llvm.loop !18

.loopexit:                                        ; preds = %19, %15, %1
  %22 = getelementptr inbounds i8, ptr %0, i64 144
  %23 = load ptr, ptr %22, align 8, !tbaa !20
  %.not33 = icmp eq ptr %23, null
  br i1 %.not33, label %38, label %24

24:                                               ; preds = %.loopexit
  %25 = getelementptr inbounds i8, ptr %6, i64 8
  %26 = load volatile i32, ptr %25, align 4, !tbaa !21
  %27 = and i32 %26, 32768
  %.not34 = icmp eq i32 %27, 0
  %28 = getelementptr inbounds i8, ptr %23, i64 112
  br i1 %.not34, label %.sink.split, label %29

29:                                               ; preds = %24
  store ptr @SPI_DMATxAbortCallback, ptr %28, align 8, !tbaa !22
  %30 = tail call i32 @HAL_DMA_Abort_IT(ptr noundef nonnull %23) #3
  %.not35 = icmp eq i32 %30, 0
  br i1 %.not35, label %38, label %31

31:                                               ; preds = %29
  %32 = load ptr, ptr %22, align 8, !tbaa !20
  %33 = tail call i32 @HAL_DMA_GetError(ptr noundef %32) #3
  %34 = icmp eq i32 %33, 128
  br i1 %34, label %35, label %38

35:                                               ; preds = %31
  %36 = load ptr, ptr %22, align 8, !tbaa !20
  %37 = getelementptr inbounds i8, ptr %36, i64 112
  br label %.sink.split

.sink.split:                                      ; preds = %24, %35
  %.sink = phi ptr [ %37, %35 ], [ %28, %24 ]
  store ptr null, ptr %.sink, align 8, !tbaa !22
  br label %38

38:                                               ; preds = %.sink.split, %31, %29, %.loopexit
  %39 = phi i1 [ false, %31 ], [ false, %29 ], [ true, %.loopexit ], [ true, %.sink.split ]
  %40 = getelementptr inbounds i8, ptr %0, i64 152
  %41 = load ptr, ptr %40, align 8, !tbaa !25
  %.not36 = icmp eq ptr %41, null
  br i1 %.not36, label %57, label %42

42:                                               ; preds = %38
  %43 = load ptr, ptr %0, align 8, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  %45 = load volatile i32, ptr %44, align 4, !tbaa !21
  %46 = and i32 %45, 16384
  %.not37 = icmp eq i32 %46, 0
  %47 = getelementptr inbounds i8, ptr %41, i64 112
  br i1 %.not37, label %.sink.split40, label %48

48:                                               ; preds = %42
  store ptr @SPI_DMARxAbortCallback, ptr %47, align 8, !tbaa !22
  %49 = tail call i32 @HAL_DMA_Abort_IT(ptr noundef nonnull %41) #3
  %.not38 = icmp eq i32 %49, 0
  br i1 %.not38, label %.thread, label %50

50:                                               ; preds = %48
  %51 = load ptr, ptr %40, align 8, !tbaa !25
  %52 = tail call i32 @HAL_DMA_GetError(ptr noundef %51) #3
  %53 = icmp eq i32 %52, 128
  br i1 %53, label %54, label %.thread

54:                                               ; preds = %50
  %55 = load ptr, ptr %40, align 8, !tbaa !25
  %56 = getelementptr inbounds i8, ptr %55, i64 112
  br label %.sink.split40

.sink.split40:                                    ; preds = %42, %54
  %.sink41 = phi ptr [ %56, %54 ], [ %47, %42 ]
  store ptr null, ptr %.sink41, align 8, !tbaa !22
  br label %57

57:                                               ; preds = %.sink.split40, %38
  br i1 %39, label %58, label %.thread

58:                                               ; preds = %57
  tail call void @SPI_AbortTransfer(ptr noundef nonnull %0)
  %59 = getelementptr inbounds i8, ptr %0, i64 168
  %60 = load volatile i32, ptr %59, align 8, !tbaa !17
  %61 = icmp eq i32 %60, 64
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store volatile i32 0, ptr %59, align 8, !tbaa !17
  br label %63

63:                                               ; preds = %58, %62
  %.031 = phi i32 [ 0, %62 ], [ 1, %58 ]
  store volatile i32 1, ptr %3, align 4, !tbaa !5
  tail call void @HAL_SPI_AbortCpltCallback(ptr noundef nonnull %0)
  br label %.thread

.thread:                                          ; preds = %48, %50, %63, %57
  %.1 = phi i32 [ %.031, %63 ], [ 0, %57 ], [ 0, %50 ], [ 0, %48 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2)
  ret i32 %.1
}

; Function Attrs: nounwind uwtable
declare hidden void @SPI_DMATxAbortCallback(ptr noundef) #2

declare i32 @HAL_DMA_Abort_IT(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @SPI_DMARxAbortCallback(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_SPI_AbortCpltCallback(ptr noundef) local_unnamed_addr #2

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 164}
!6 = !{!"__SPI_HandleTypeDef", !7, i64 0, !10, i64 8, !7, i64 96, !12, i64 104, !12, i64 106, !7, i64 112, !12, i64 120, !12, i64 122, !11, i64 124, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !11, i64 160, !11, i64 164, !11, i64 168}
!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, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !11, i64 0}
!16 = !{!"", !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, !8, i64 36, !11, i64 48, !8, i64 52, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80}
!17 = !{!6, !11, i64 168}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 144}
!21 = !{!16, !11, i64 8}
!22 = !{!23, !7, i64 112}
!23 = !{!"__DMA_HandleTypeDef", !7, i64 0, !24, i64 8, !11, i64 56, !11, i64 60, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !11, i64 120, !11, i64 124, !11, i64 128, !7, i64 136, !7, i64 144, !11, i64 152, !7, i64 160, !7, i64 168, !11, i64 176}
!24 = !{!"", !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}
!25 = !{!6, !7, i64 152}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass