; LLVM IR from reazon-research/OpenArm :: control/canfd_control/Drivers/STM32H7xx_HAL_Driver/Src (stm32h7xx_hal_i2c)

; 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, 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 void @I2C_Enable_IRQ(ptr noundef, i16 noundef zeroext) #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
declare hidden void @I2C_DMAMasterReceiveCplt(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_I2C_Mem_Read_DMA(ptr noundef %0, i16 noundef zeroext %1, i16 noundef zeroext %2, i16 noundef zeroext %3, ptr noundef %4, i16 noundef zeroext %5) #1 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i16, align 2
  %10 = alloca i16, align 2
  %11 = alloca i16, align 2
  %12 = alloca ptr, align 8
  %13 = alloca i16, align 2
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i16 %1, ptr %9, align 2, !tbaa !9
  store i16 %2, ptr %10, align 2, !tbaa !9
  store i16 %3, ptr %11, align 2, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store i16 %5, ptr %13, align 2, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %16, i32 0, i32 11
  %18 = load volatile i32, ptr %17, align 4, !tbaa !11
  %19 = icmp eq i32 %18, 32
  br i1 %19, label %20, label %209

20:                                               ; preds = %6
  %21 = load ptr, ptr %12, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %27, label %23

23:                                               ; preds = %20
  %24 = load i16, ptr %13, align 2, !tbaa !9
  %25 = zext i16 %24 to i32
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %30

27:                                               ; preds = %23, %20
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %28, i32 0, i32 13
  store volatile i32 512, ptr %29, align 4, !tbaa !15
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

30:                                               ; preds = %23
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !16
  %34 = getelementptr inbounds %struct.I2C_TypeDef, ptr %33, i32 0, i32 6
  %35 = load volatile i32, ptr %34, align 4, !tbaa !17
  %36 = zext i32 %35 to i64
  %37 = and i64 %36, 32768
  %38 = icmp eq i64 %37, 32768
  %39 = zext i1 %38 to i64
  %40 = select i1 %38, i32 1, i32 0
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %42, label %43

42:                                               ; preds = %30
  store i32 2, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

43:                                               ; preds = %30
  br label %44

44:                                               ; preds = %43
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %45, i32 0, i32 10
  %47 = load i32, ptr %46, align 8, !tbaa !19
  %48 = icmp eq i32 %47, 1
  br i1 %48, label %49, label %50

49:                                               ; preds = %44
  store i32 2, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

50:                                               ; preds = %44
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %51, i32 0, i32 10
  store i32 1, ptr %52, align 8, !tbaa !19
  br label %53

53:                                               ; preds = %50
  br label %54

54:                                               ; preds = %53
  br label %55

55:                                               ; preds = %54
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %56, i32 0, i32 11
  store volatile i32 34, ptr %57, align 4, !tbaa !11
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %58, i32 0, i32 12
  store volatile i32 64, ptr %59, align 8, !tbaa !20
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %60, i32 0, i32 13
  store volatile i32 0, ptr %61, align 4, !tbaa !15
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %63, i32 0, i32 2
  store ptr %62, ptr %64, align 8, !tbaa !21
  %65 = load i16, ptr %13, align 2, !tbaa !9
  %66 = load ptr, ptr %8, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %66, i32 0, i32 4
  store volatile i16 %65, ptr %67, align 2, !tbaa !22
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %68, i32 0, i32 5
  store volatile i32 -65536, ptr %69, align 4, !tbaa !23
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %70, i32 0, i32 7
  store ptr @I2C_Mem_ISR_DMA, ptr %71, align 8, !tbaa !24
  %72 = load i16, ptr %9, align 2, !tbaa !9
  %73 = zext i16 %72 to i32
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %74, i32 0, i32 15
  store volatile i32 %73, ptr %75, align 4, !tbaa !25
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %76, i32 0, i32 4
  %78 = load volatile i16, ptr %77, align 2, !tbaa !22
  %79 = zext i16 %78 to i32
  %80 = icmp ugt i32 %79, 255
  br i1 %80, label %81, label %84

81:                                               ; preds = %55
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %82, i32 0, i32 3
  store i16 255, ptr %83, align 8, !tbaa !26
  br label %90

84:                                               ; preds = %55
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %85, i32 0, i32 4
  %87 = load volatile i16, ptr %86, align 2, !tbaa !22
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %88, i32 0, i32 3
  store i16 %87, ptr %89, align 8, !tbaa !26
  br label %90

90:                                               ; preds = %84, %81
  %91 = load i16, ptr %11, align 2, !tbaa !9
  %92 = zext i16 %91 to i32
  %93 = icmp eq i32 %92, 1
  br i1 %93, label %94, label %107

94:                                               ; preds = %90
  %95 = load i16, ptr %10, align 2, !tbaa !9
  %96 = zext i16 %95 to i32
  %97 = and i32 %96, 255
  %98 = trunc i32 %97 to i16
  %99 = trunc i16 %98 to i8
  %100 = zext i8 %99 to i32
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !16
  %104 = getelementptr inbounds %struct.I2C_TypeDef, ptr %103, i32 0, i32 10
  store volatile i32 %100, ptr %104, align 4, !tbaa !27
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %105, i32 0, i32 16
  store volatile i32 -1, ptr %106, align 8, !tbaa !28
  br label %129

107:                                              ; preds = %90
  %108 = load i16, ptr %10, align 2, !tbaa !9
  %109 = zext i16 %108 to i32
  %110 = and i32 %109, 65280
  %111 = trunc i32 %110 to i16
  %112 = zext i16 %111 to i32
  %113 = ashr i32 %112, 8
  %114 = trunc i32 %113 to i16
  %115 = trunc i16 %114 to i8
  %116 = zext i8 %115 to i32
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !16
  %120 = getelementptr inbounds %struct.I2C_TypeDef, ptr %119, i32 0, i32 10
  store volatile i32 %116, ptr %120, align 4, !tbaa !27
  %121 = load i16, ptr %10, align 2, !tbaa !9
  %122 = zext i16 %121 to i32
  %123 = and i32 %122, 255
  %124 = trunc i32 %123 to i16
  %125 = trunc i16 %124 to i8
  %126 = zext i8 %125 to i32
  %127 = load ptr, ptr %8, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %127, i32 0, i32 16
  store volatile i32 %126, ptr %128, align 8, !tbaa !28
  br label %129

129:                                              ; preds = %107, %94
  %130 = load ptr, ptr %8, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %130, i32 0, i32 9
  %132 = load ptr, ptr %131, align 8, !tbaa !29
  %133 = icmp ne ptr %132, null
  br i1 %133, label %134, label %166

134:                                              ; preds = %129
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %135, i32 0, i32 9
  %137 = load ptr, ptr %136, align 8, !tbaa !29
  %138 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %137, i32 0, i32 5
  store ptr @I2C_DMAMasterReceiveCplt, ptr %138, align 8, !tbaa !30
  %139 = load ptr, ptr %8, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %139, i32 0, i32 9
  %141 = load ptr, ptr %140, align 8, !tbaa !29
  %142 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %141, i32 0, i32 9
  store ptr @I2C_DMAError, ptr %142, align 8, !tbaa !33
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %143, i32 0, i32 9
  %145 = load ptr, ptr %144, align 8, !tbaa !29
  %146 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %145, i32 0, i32 6
  store ptr null, ptr %146, align 8, !tbaa !34
  %147 = load ptr, ptr %8, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %147, i32 0, i32 9
  %149 = load ptr, ptr %148, align 8, !tbaa !29
  %150 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %149, i32 0, i32 10
  store ptr null, ptr %150, align 8, !tbaa !35
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %151, i32 0, i32 9
  %153 = load ptr, ptr %152, align 8, !tbaa !29
  %154 = load ptr, ptr %8, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !16
  %157 = getelementptr inbounds %struct.I2C_TypeDef, ptr %156, i32 0, i32 9
  %158 = ptrtoint ptr %157 to i32
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  %160 = ptrtoint ptr %159 to i32
  %161 = load ptr, ptr %8, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %161, i32 0, i32 3
  %163 = load i16, ptr %162, align 8, !tbaa !26
  %164 = zext i16 %163 to i32
  %165 = call i32 @HAL_DMA_Start_IT(ptr noundef %153, i32 noundef %158, i32 noundef %160, i32 noundef %164)
  store i32 %165, ptr %14, align 4, !tbaa !36
  br label %180

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

175:                                              ; preds = %166
  %176 = load ptr, ptr %8, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %176, i32 0, i32 10
  store i32 0, ptr %177, align 8, !tbaa !19
  br label %178

178:                                              ; preds = %175
  br label %179

179:                                              ; preds = %178
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

180:                                              ; preds = %134
  %181 = load i32, ptr %14, align 4, !tbaa !36
  %182 = icmp eq i32 %181, 0
  br i1 %182, label %183, label %194

183:                                              ; preds = %180
  %184 = load ptr, ptr %8, align 8, !tbaa !5
  %185 = load i16, ptr %9, align 2, !tbaa !9
  %186 = load i16, ptr %11, align 2, !tbaa !9
  %187 = trunc i16 %186 to i8
  call void @I2C_TransferConfig(ptr noundef %184, i16 noundef zeroext %185, i8 noundef zeroext %187, i32 noundef 0, i32 noundef -2147475456)
  br label %188

188:                                              ; preds = %183
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %189, i32 0, i32 10
  store i32 0, ptr %190, align 8, !tbaa !19
  br label %191

191:                                              ; preds = %188
  br label %192

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

194:                                              ; preds = %180
  %195 = load ptr, ptr %8, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %195, i32 0, i32 11
  store volatile i32 32, ptr %196, align 4, !tbaa !11
  %197 = load ptr, ptr %8, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %197, i32 0, i32 12
  store volatile i32 0, ptr %198, align 8, !tbaa !20
  %199 = load ptr, ptr %8, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %199, i32 0, i32 13
  %201 = load volatile i32, ptr %200, align 4, !tbaa !15
  %202 = or i32 %201, 16
  store volatile i32 %202, ptr %200, align 4, !tbaa !15
  br label %203

203:                                              ; preds = %194
  %204 = load ptr, ptr %8, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %204, i32 0, i32 10
  store i32 0, ptr %205, align 8, !tbaa !19
  br label %206

206:                                              ; preds = %203
  br label %207

207:                                              ; preds = %206
  store i32 1, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

208:                                              ; preds = %192
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

209:                                              ; preds = %6
  store i32 2, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %210

210:                                              ; preds = %209, %208, %207, %179, %49, %42, %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %211 = load i32, ptr %7, align 4
  ret i32 %211
}

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, !14, i64 108, !14, i64 112}
!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, !14, i64 100}
!16 = !{!12, !6, i64 0}
!17 = !{!18, !14, i64 24}
!18 = !{!"", !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}
!19 = !{!12, !14, i64 88}
!20 = !{!12, !14, i64 96}
!21 = !{!12, !6, i64 40}
!22 = !{!12, !10, i64 50}
!23 = !{!12, !14, i64 52}
!24 = !{!12, !6, i64 64}
!25 = !{!12, !14, i64 108}
!26 = !{!12, !10, i64 48}
!27 = !{!18, !14, i64 40}
!28 = !{!12, !14, i64 112}
!29 = !{!12, !6, i64 80}
!30 = !{!31, !6, i64 72}
!31 = !{!"__DMA_HandleTypeDef", !6, i64 0, !32, 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}
!32 = !{!"", !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}
!33 = !{!31, !6, i64 104}
!34 = !{!31, !6, i64 80}
!35 = !{!31, !6, i64 112}
!36 = !{!14, !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 void @I2C_Enable_IRQ(ptr noundef, i16 noundef zeroext) local_unnamed_addr #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
declare hidden void @I2C_DMAMasterReceiveCplt(ptr noundef) #0

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

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

10:                                               ; preds = %6
  %11 = icmp eq ptr %4, null
  %12 = icmp eq i16 %5, 0
  %or.cond = or i1 %11, %12
  br i1 %or.cond, label %13, label %15

13:                                               ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 512, ptr %14, align 4, !tbaa !13
  br label %75

15:                                               ; preds = %10
  %16 = load ptr, ptr %0, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %16, i64 24
  %18 = load volatile i32, ptr %17, align 4, !tbaa !15
  %19 = and i32 %18, 32768
  %.not = icmp eq i32 %19, 0
  br i1 %.not, label %20, label %75

20:                                               ; preds = %15
  %21 = getelementptr inbounds i8, ptr %0, i64 88
  %22 = load i32, ptr %21, align 8, !tbaa !17
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %75, label %24

24:                                               ; preds = %20
  store i32 1, ptr %21, align 8, !tbaa !17
  store volatile i32 34, ptr %7, align 4, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %0, i64 96
  store volatile i32 64, ptr %25, align 8, !tbaa !18
  %26 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %26, align 4, !tbaa !13
  %27 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %4, ptr %27, align 8, !tbaa !19
  %28 = getelementptr inbounds i8, ptr %0, i64 50
  store volatile i16 %5, ptr %28, align 2, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 -65536, ptr %29, align 4, !tbaa !21
  %30 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr @I2C_Mem_ISR_DMA, ptr %30, align 8, !tbaa !22
  %31 = zext i16 %1 to i32
  %32 = getelementptr inbounds i8, ptr %0, i64 108
  store volatile i32 %31, ptr %32, align 4, !tbaa !23
  %33 = load volatile i16, ptr %28, align 2, !tbaa !20
  %34 = icmp ugt i16 %33, 255
  br i1 %34, label %37, label %35

35:                                               ; preds = %24
  %36 = load volatile i16, ptr %28, align 2, !tbaa !20
  br label %37

37:                                               ; preds = %24, %35
  %38 = phi i16 [ %36, %35 ], [ 255, %24 ]
  %39 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 %38, ptr %39, align 8
  %40 = icmp eq i16 %3, 1
  %41 = getelementptr inbounds i8, ptr %16, i64 40
  br i1 %40, label %42, label %45

42:                                               ; preds = %37
  %43 = and i16 %2, 255
  %44 = zext nneg i16 %43 to i32
  store volatile i32 %44, ptr %41, align 4, !tbaa !24
  br label %50

45:                                               ; preds = %37
  %46 = lshr i16 %2, 8
  %47 = zext nneg i16 %46 to i32
  store volatile i32 %47, ptr %41, align 4, !tbaa !24
  %48 = and i16 %2, 255
  %49 = zext nneg i16 %48 to i32
  br label %50

50:                                               ; preds = %45, %42
  %.sink = phi i32 [ %49, %45 ], [ -1, %42 ]
  %51 = getelementptr inbounds i8, ptr %0, i64 112
  store volatile i32 %.sink, ptr %51, align 8, !tbaa !25
  %52 = getelementptr inbounds i8, ptr %0, i64 80
  %53 = load ptr, ptr %52, align 8, !tbaa !26
  %.not57 = icmp eq ptr %53, null
  br i1 %.not57, label %67, label %54

54:                                               ; preds = %50
  %55 = getelementptr inbounds i8, ptr %53, i64 72
  store ptr @I2C_DMAMasterReceiveCplt, ptr %55, align 8, !tbaa !27
  %56 = getelementptr inbounds i8, ptr %53, i64 104
  store ptr @I2C_DMAError, ptr %56, align 8, !tbaa !30
  %57 = getelementptr inbounds i8, ptr %53, i64 80
  store ptr null, ptr %57, align 8, !tbaa !31
  %58 = getelementptr inbounds i8, ptr %53, i64 112
  store ptr null, ptr %58, align 8, !tbaa !32
  %59 = getelementptr inbounds i8, ptr %16, i64 36
  %60 = ptrtoint ptr %59 to i64
  %61 = trunc i64 %60 to i32
  %62 = ptrtoint ptr %4 to i64
  %63 = trunc i64 %62 to i32
  %64 = zext i16 %38 to i32
  %65 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %53, i32 noundef %61, i32 noundef %63, i32 noundef %64) #2
  %66 = icmp eq i32 %65, 0
  br i1 %66, label %70, label %72

67:                                               ; preds = %50
  store volatile i32 32, ptr %7, align 4, !tbaa !5
  store volatile i32 0, ptr %25, align 8, !tbaa !18
  %68 = load volatile i32, ptr %26, align 4, !tbaa !13
  %69 = or i32 %68, 128
  store volatile i32 %69, ptr %26, align 4, !tbaa !13
  store i32 0, ptr %21, align 8, !tbaa !17
  br label %75

70:                                               ; preds = %54
  %71 = trunc i16 %3 to i8
  tail call void @I2C_TransferConfig(ptr noundef nonnull %0, i16 noundef zeroext %1, i8 noundef zeroext %71, i32 noundef 0, i32 noundef -2147475456)
  store i32 0, ptr %21, align 8, !tbaa !17
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext 1)
  br label %75

72:                                               ; preds = %54
  store volatile i32 32, ptr %7, align 4, !tbaa !5
  store volatile i32 0, ptr %25, align 8, !tbaa !18
  %73 = load volatile i32, ptr %26, align 4, !tbaa !13
  %74 = or i32 %73, 16
  store volatile i32 %74, ptr %26, align 4, !tbaa !13
  store i32 0, ptr %21, align 8, !tbaa !17
  br label %75

75:                                               ; preds = %6, %20, %15, %70, %72, %67, %13
  %.0 = phi i32 [ 1, %13 ], [ 0, %70 ], [ 1, %72 ], [ 1, %67 ], [ 2, %15 ], [ 2, %20 ], [ 2, %6 ]
  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 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, !11, i64 108, !11, i64 112}
!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, !11, i64 100}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !11, i64 24}
!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, !11, i64 36, !11, i64 40}
!17 = !{!6, !11, i64 88}
!18 = !{!6, !11, i64 96}
!19 = !{!6, !7, i64 40}
!20 = !{!6, !12, i64 50}
!21 = !{!6, !11, i64 52}
!22 = !{!6, !7, i64 64}
!23 = !{!6, !11, i64 108}
!24 = !{!16, !11, i64 40}
!25 = !{!6, !11, i64 112}
!26 = !{!6, !7, i64 80}
!27 = !{!28, !7, i64 72}
!28 = !{!"__DMA_HandleTypeDef", !7, i64 0, !29, 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}
!29 = !{!"", !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}
!30 = !{!28, !7, i64 104}
!31 = !{!28, !7, i64 80}
!32 = !{!28, !7, i64 112}


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