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

; 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.__I2C_HandleTypeDef = type { ptr, %struct.I2C_InitTypeDef, ptr, i16, i16, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.I2C_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.I2C_TypeDef = type { i32, i32, i32, i32, i32, 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 }

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

; Function Attrs: nounwind uwtable
declare hidden void @I2C_TransferConfig(ptr noundef, i16 noundef zeroext, i8 noundef zeroext, i32 noundef, i32 noundef) #1

; 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 @I2C_Master_ISR_IT(ptr noundef, i32 noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @I2C_Enable_IRQ(ptr noundef, i16 noundef zeroext) #1

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

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

declare i32 @HAL_DMA_Start_IT(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_I2C_Master_Receive_DMA(ptr noundef %0, i16 noundef zeroext %1, ptr noundef %2, i16 noundef zeroext %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca ptr, align 8
  %9 = alloca i16, align 2
  %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 i16 %1, ptr %7, align 2, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i16 %3, ptr %9, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %13, i32 0, i32 11
  %15 = load volatile i32, ptr %14, align 4, !tbaa !11
  %16 = icmp eq i32 %15, 32
  br i1 %16, label %17, label %196

17:                                               ; preds = %4
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %21 = getelementptr inbounds %struct.I2C_TypeDef, ptr %20, i32 0, i32 6
  %22 = load volatile i32, ptr %21, align 4, !tbaa !16
  %23 = zext i32 %22 to i64
  %24 = and i64 %23, 32768
  %25 = icmp eq i64 %24, 32768
  %26 = zext i1 %25 to i64
  %27 = select i1 %25, i32 1, i32 0
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %29, label %30

29:                                               ; preds = %17
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

30:                                               ; preds = %17
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %32, i32 0, i32 10
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %37

36:                                               ; preds = %31
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

37:                                               ; preds = %31
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %38, i32 0, i32 10
  store i32 1, ptr %39, align 8, !tbaa !18
  br label %40

40:                                               ; preds = %37
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %43, i32 0, i32 11
  store volatile i32 34, ptr %44, align 4, !tbaa !11
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %45, i32 0, i32 12
  store volatile i32 16, ptr %46, align 8, !tbaa !19
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %47, i32 0, i32 13
  store volatile i32 0, ptr %48, align 4, !tbaa !20
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %50, i32 0, i32 2
  store ptr %49, ptr %51, align 8, !tbaa !21
  %52 = load i16, ptr %9, align 2, !tbaa !9
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %53, i32 0, i32 4
  store volatile i16 %52, ptr %54, align 2, !tbaa !22
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %55, i32 0, i32 5
  store volatile i32 -65536, ptr %56, align 4, !tbaa !23
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %57, i32 0, i32 7
  store ptr @I2C_Master_ISR_DMA, ptr %58, align 8, !tbaa !24
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %59, i32 0, i32 4
  %61 = load volatile i16, ptr %60, align 2, !tbaa !22
  %62 = zext i16 %61 to i32
  %63 = icmp ugt i32 %62, 255
  br i1 %63, label %64, label %67

64:                                               ; preds = %42
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %65, i32 0, i32 3
  store i16 255, ptr %66, align 8, !tbaa !25
  store i32 16777216, ptr %10, align 4, !tbaa !26
  br label %73

67:                                               ; preds = %42
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %68, i32 0, i32 4
  %70 = load volatile i16, ptr %69, align 2, !tbaa !22
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %71, i32 0, i32 3
  store i16 %70, ptr %72, align 8, !tbaa !25
  store i32 33554432, ptr %10, align 4, !tbaa !26
  br label %73

73:                                               ; preds = %67, %64
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %74, i32 0, i32 3
  %76 = load i16, ptr %75, align 8, !tbaa !25
  %77 = zext i16 %76 to i32
  %78 = icmp ugt i32 %77, 0
  br i1 %78, label %79, label %180

79:                                               ; preds = %73
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %80, i32 0, i32 9
  %82 = load ptr, ptr %81, align 8, !tbaa !27
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %116

84:                                               ; preds = %79
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %85, i32 0, i32 9
  %87 = load ptr, ptr %86, align 8, !tbaa !27
  %88 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %87, i32 0, i32 5
  store ptr @I2C_DMAMasterReceiveCplt, ptr %88, align 8, !tbaa !28
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %89, i32 0, i32 9
  %91 = load ptr, ptr %90, align 8, !tbaa !27
  %92 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %91, i32 0, i32 9
  store ptr @I2C_DMAError, ptr %92, align 8, !tbaa !31
  %93 = load ptr, ptr %6, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %93, i32 0, i32 9
  %95 = load ptr, ptr %94, align 8, !tbaa !27
  %96 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %95, i32 0, i32 6
  store ptr null, ptr %96, align 8, !tbaa !32
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %97, i32 0, i32 9
  %99 = load ptr, ptr %98, align 8, !tbaa !27
  %100 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %99, i32 0, i32 10
  store ptr null, ptr %100, align 8, !tbaa !33
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %101, i32 0, i32 9
  %103 = load ptr, ptr %102, align 8, !tbaa !27
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !15
  %107 = getelementptr inbounds %struct.I2C_TypeDef, ptr %106, i32 0, i32 9
  %108 = ptrtoint ptr %107 to i32
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = ptrtoint ptr %109 to i32
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %111, i32 0, i32 3
  %113 = load i16, ptr %112, align 8, !tbaa !25
  %114 = zext i16 %113 to i32
  %115 = call i32 @HAL_DMA_Start_IT(ptr noundef %103, i32 noundef %108, i32 noundef %110, i32 noundef %114)
  store i32 %115, ptr %11, align 4, !tbaa !26
  br label %130

116:                                              ; preds = %79
  %117 = load ptr, ptr %6, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %117, i32 0, i32 11
  store volatile i32 32, ptr %118, align 4, !tbaa !11
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %119, i32 0, i32 12
  store volatile i32 0, ptr %120, align 8, !tbaa !19
  %121 = load ptr, ptr %6, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %121, i32 0, i32 13
  %123 = load volatile i32, ptr %122, align 4, !tbaa !20
  %124 = or i32 %123, 128
  store volatile i32 %124, ptr %122, align 4, !tbaa !20
  br label %125

125:                                              ; preds = %116
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %126, i32 0, i32 10
  store i32 0, ptr %127, align 8, !tbaa !18
  br label %128

128:                                              ; preds = %125
  br label %129

129:                                              ; preds = %128
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

130:                                              ; preds = %84
  %131 = load i32, ptr %11, align 4, !tbaa !26
  %132 = icmp eq i32 %131, 0
  br i1 %132, label %133, label %165

133:                                              ; preds = %130
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = load i16, ptr %7, align 2, !tbaa !9
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %136, i32 0, i32 3
  %138 = load i16, ptr %137, align 8, !tbaa !25
  %139 = trunc i16 %138 to i8
  %140 = load i32, ptr %10, align 4, !tbaa !26
  call void @I2C_TransferConfig(ptr noundef %134, i16 noundef zeroext %135, i8 noundef zeroext %139, i32 noundef %140, i32 noundef -2147474432)
  %141 = load ptr, ptr %6, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %141, i32 0, i32 3
  %143 = load i16, ptr %142, align 8, !tbaa !25
  %144 = zext i16 %143 to i32
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %145, i32 0, i32 4
  %147 = load volatile i16, ptr %146, align 2, !tbaa !22
  %148 = zext i16 %147 to i32
  %149 = sub nsw i32 %148, %144
  %150 = trunc i32 %149 to i16
  store volatile i16 %150, ptr %146, align 2, !tbaa !22
  br label %151

151:                                              ; preds = %133
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %152, i32 0, i32 10
  store i32 0, ptr %153, align 8, !tbaa !18
  br label %154

154:                                              ; preds = %151
  br label %155

155:                                              ; preds = %154
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %156, i16 noundef zeroext 17)
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %157, i32 0, i32 0
  %159 = load ptr, ptr %158, align 8, !tbaa !15
  %160 = getelementptr inbounds %struct.I2C_TypeDef, ptr %159, i32 0, i32 0
  %161 = load volatile i32, ptr %160, align 4, !tbaa !34
  %162 = zext i32 %161 to i64
  %163 = or i64 %162, 32768
  %164 = trunc i64 %163 to i32
  store volatile i32 %164, ptr %160, align 4, !tbaa !34
  br label %179

165:                                              ; preds = %130
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %166, i32 0, i32 11
  store volatile i32 32, ptr %167, align 4, !tbaa !11
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %168, i32 0, i32 12
  store volatile i32 0, ptr %169, align 8, !tbaa !19
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %170, i32 0, i32 13
  %172 = load volatile i32, ptr %171, align 4, !tbaa !20
  %173 = or i32 %172, 16
  store volatile i32 %173, ptr %171, align 4, !tbaa !20
  br label %174

174:                                              ; preds = %165
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %175, i32 0, i32 10
  store i32 0, ptr %176, align 8, !tbaa !18
  br label %177

177:                                              ; preds = %174
  br label %178

178:                                              ; preds = %177
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

179:                                              ; preds = %155
  br label %195

180:                                              ; preds = %73
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %181, i32 0, i32 7
  store ptr @I2C_Master_ISR_IT, ptr %182, align 8, !tbaa !24
  %183 = load ptr, ptr %6, align 8, !tbaa !5
  %184 = load i16, ptr %7, align 2, !tbaa !9
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %185, i32 0, i32 3
  %187 = load i16, ptr %186, align 8, !tbaa !25
  %188 = trunc i16 %187 to i8
  call void @I2C_TransferConfig(ptr noundef %183, i16 noundef zeroext %184, i8 noundef zeroext %188, i32 noundef 33554432, i32 noundef -2147474432)
  br label %189

189:                                              ; preds = %180
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %190, i32 0, i32 10
  store i32 0, ptr %191, align 8, !tbaa !18
  br label %192

192:                                              ; preds = %189
  br label %193

193:                                              ; preds = %192
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %194, i16 noundef zeroext 1)
  br label %195

195:                                              ; preds = %193, %179
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

196:                                              ; preds = %4
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %197

197:                                              ; preds = %196, %195, %178, %129, %36, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %198 = load i32, ptr %5, align 4
  ret i32 %198
}

; Function Attrs: nounwind uwtable
declare hidden void @I2C_DMAMasterReceiveCplt(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, !14, i64 92}
!12 = !{!"__I2C_HandleTypeDef", !6, i64 0, !13, i64 8, !6, i64 40, !10, i64 48, !10, i64 50, !14, i64 52, !14, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !14, i64 88, !14, i64 92, !14, i64 96, !14, i64 100, !14, i64 104}
!13 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !14, i64 24}
!17 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40}
!18 = !{!12, !14, i64 88}
!19 = !{!12, !14, i64 96}
!20 = !{!12, !14, i64 100}
!21 = !{!12, !6, i64 40}
!22 = !{!12, !10, i64 50}
!23 = !{!12, !14, i64 52}
!24 = !{!12, !6, i64 64}
!25 = !{!12, !10, i64 48}
!26 = !{!14, !14, i64 0}
!27 = !{!12, !6, i64 80}
!28 = !{!29, !6, i64 72}
!29 = !{!"__DMA_HandleTypeDef", !6, i64 0, !30, i64 8, !14, i64 56, !14, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !14, i64 120, !14, i64 124, !14, i64 128, !6, i64 136, !6, i64 144, !14, i64 152, !6, i64 160, !6, i64 168, !14, i64 176}
!30 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40, !14, i64 44}
!31 = !{!29, !6, i64 104}
!32 = !{!29, !6, i64 80}
!33 = !{!29, !6, i64 112}
!34 = !{!17, !14, i64 0}


; 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 void @I2C_TransferConfig(ptr noundef, i16 noundef zeroext, i8 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @I2C_Enable_IRQ(ptr noundef, i16 noundef zeroext) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_I2C_Master_Receive_DMA(ptr noundef %0, i16 noundef zeroext %1, ptr noundef %2, i16 noundef zeroext %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 92
  %6 = load volatile i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 32
  br i1 %7, label %8, label %63

8:                                                ; preds = %4
  %9 = load ptr, ptr %0, align 8, !tbaa !13
  %10 = getelementptr inbounds i8, ptr %9, i64 24
  %11 = load volatile i32, ptr %10, align 4, !tbaa !14
  %12 = and i32 %11, 32768
  %.not = icmp eq i32 %12, 0
  br i1 %.not, label %13, label %63

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

17:                                               ; preds = %13
  store i32 1, ptr %14, align 8, !tbaa !16
  store volatile i32 34, ptr %5, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  store volatile i32 16, ptr %18, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %19, align 4, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %2, ptr %20, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %0, i64 50
  store volatile i16 %3, ptr %21, align 2, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 -65536, ptr %22, align 4, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr @I2C_Master_ISR_DMA, ptr %23, align 8, !tbaa !22
  %24 = load volatile i16, ptr %21, align 2, !tbaa !20
  %25 = icmp ugt i16 %24, 255
  br i1 %25, label %.thread, label %27

.thread:                                          ; preds = %17
  %26 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 255, ptr %26, align 8
  br label %30

27:                                               ; preds = %17
  %28 = load volatile i16, ptr %21, align 2, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 %28, ptr %29, align 8
  %.not53 = icmp eq i16 %28, 0
  br i1 %.not53, label %62, label %30

30:                                               ; preds = %.thread, %27
  %31 = phi ptr [ %26, %.thread ], [ %29, %27 ]
  %.05159 = phi i32 [ 16777216, %.thread ], [ 33554432, %27 ]
  %.sink58 = phi i16 [ 255, %.thread ], [ %28, %27 ]
  %32 = getelementptr inbounds i8, ptr %0, i64 80
  %33 = load ptr, ptr %32, align 8, !tbaa !23
  %.not54 = icmp eq ptr %33, null
  br i1 %.not54, label %47, label %34

34:                                               ; preds = %30
  %35 = getelementptr inbounds i8, ptr %33, i64 72
  store ptr @I2C_DMAMasterReceiveCplt, ptr %35, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %33, i64 104
  store ptr @I2C_DMAError, ptr %36, align 8, !tbaa !27
  %37 = getelementptr inbounds i8, ptr %33, i64 80
  store ptr null, ptr %37, align 8, !tbaa !28
  %38 = getelementptr inbounds i8, ptr %33, i64 112
  store ptr null, ptr %38, align 8, !tbaa !29
  %39 = getelementptr inbounds i8, ptr %9, i64 36
  %40 = ptrtoint ptr %39 to i64
  %41 = trunc i64 %40 to i32
  %42 = ptrtoint ptr %2 to i64
  %43 = trunc i64 %42 to i32
  %44 = zext i16 %.sink58 to i32
  %45 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %33, i32 noundef %41, i32 noundef %43, i32 noundef %44) #2
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %50, label %59

47:                                               ; preds = %30
  store volatile i32 32, ptr %5, align 4, !tbaa !5
  store volatile i32 0, ptr %18, align 8, !tbaa !17
  %48 = load volatile i32, ptr %19, align 4, !tbaa !18
  %49 = or i32 %48, 128
  store volatile i32 %49, ptr %19, align 4, !tbaa !18
  store i32 0, ptr %14, align 8, !tbaa !16
  br label %63

50:                                               ; preds = %34
  %51 = load i16, ptr %31, align 8, !tbaa !30
  %52 = trunc i16 %51 to i8
  tail call void @I2C_TransferConfig(ptr noundef nonnull %0, i16 noundef zeroext %1, i8 noundef zeroext %52, i32 noundef %.05159, i32 noundef -2147474432)
  %53 = load i16, ptr %31, align 8, !tbaa !30
  %54 = load volatile i16, ptr %21, align 2, !tbaa !20
  %55 = sub i16 %54, %53
  store volatile i16 %55, ptr %21, align 2, !tbaa !20
  store i32 0, ptr %14, align 8, !tbaa !16
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext 17)
  %56 = load ptr, ptr %0, align 8, !tbaa !13
  %57 = load volatile i32, ptr %56, align 4, !tbaa !31
  %58 = or i32 %57, 32768
  store volatile i32 %58, ptr %56, align 4, !tbaa !31
  br label %63

59:                                               ; preds = %34
  store volatile i32 32, ptr %5, align 4, !tbaa !5
  store volatile i32 0, ptr %18, align 8, !tbaa !17
  %60 = load volatile i32, ptr %19, align 4, !tbaa !18
  %61 = or i32 %60, 16
  store volatile i32 %61, ptr %19, align 4, !tbaa !18
  store i32 0, ptr %14, align 8, !tbaa !16
  br label %63

62:                                               ; preds = %27
  store ptr @I2C_Master_ISR_IT, ptr %23, align 8, !tbaa !22
  tail call void @I2C_TransferConfig(ptr noundef nonnull %0, i16 noundef zeroext %1, i8 noundef zeroext 0, i32 noundef 33554432, i32 noundef -2147474432)
  store i32 0, ptr %14, align 8, !tbaa !16
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext 1)
  br label %63

63:                                               ; preds = %4, %50, %62, %13, %8, %59, %47
  %.0 = phi i32 [ 1, %59 ], [ 1, %47 ], [ 2, %8 ], [ 2, %13 ], [ 0, %62 ], [ 0, %50 ], [ 2, %4 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @I2C_DMAMasterReceiveCplt(ptr noundef) #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 92}
!6 = !{!"__I2C_HandleTypeDef", !7, i64 0, !10, i64 8, !7, i64 40, !12, i64 48, !12, i64 50, !11, i64 52, !11, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104}
!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 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !7, i64 0}
!14 = !{!15, !11, i64 24}
!15 = !{!"", !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}
!16 = !{!6, !11, i64 88}
!17 = !{!6, !11, i64 96}
!18 = !{!6, !11, i64 100}
!19 = !{!6, !7, i64 40}
!20 = !{!6, !12, i64 50}
!21 = !{!6, !11, i64 52}
!22 = !{!6, !7, i64 64}
!23 = !{!6, !7, i64 80}
!24 = !{!25, !7, i64 72}
!25 = !{!"__DMA_HandleTypeDef", !7, i64 0, !26, 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}
!26 = !{!"", !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}
!27 = !{!25, !7, i64 104}
!28 = !{!25, !7, i64 80}
!29 = !{!25, !7, i64 112}
!30 = !{!6, !12, i64 48}
!31 = !{!15, !11, i64 0}


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