; 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

declare i32 @HAL_GetTick() #1

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

; 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) #2

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

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

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @I2C_RequestMemoryRead(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i32 noundef, i32 noundef) #2

; 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) #2 {
  %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
  %16 = alloca i32, align 4
  %17 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %18, i32 0, i32 11
  %20 = load volatile i32, ptr %19, align 4, !tbaa !11
  %21 = icmp eq i32 %20, 32
  br i1 %21, label %22, label %204

22:                                               ; preds = %6
  %23 = load ptr, ptr %12, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %29, label %25

25:                                               ; preds = %22
  %26 = load i16, ptr %13, align 2, !tbaa !9
  %27 = zext i16 %26 to i32
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %32

29:                                               ; preds = %25, %22
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %30, i32 0, i32 13
  store volatile i32 512, ptr %31, align 4, !tbaa !15
  store i32 1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

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

44:                                               ; preds = %32
  store i32 2, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

45:                                               ; preds = %32
  br label %46

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

51:                                               ; preds = %46
  store i32 2, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

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

55:                                               ; preds = %52
  br label %56

56:                                               ; preds = %55
  br label %57

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

80:                                               ; preds = %57
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %81, i32 0, i32 3
  store i16 255, ptr %82, align 8, !tbaa !26
  store i32 16777216, ptr %15, align 4, !tbaa !20
  br label %89

83:                                               ; preds = %57
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %84, i32 0, i32 4
  %86 = load volatile i16, ptr %85, align 2, !tbaa !23
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %87, i32 0, i32 3
  store i16 %86, ptr %88, align 8, !tbaa !26
  store i32 33554432, ptr %15, align 4, !tbaa !20
  br label %89

89:                                               ; preds = %83, %80
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = load i16, ptr %9, align 2, !tbaa !9
  %92 = load i16, ptr %10, align 2, !tbaa !9
  %93 = load i16, ptr %11, align 2, !tbaa !9
  %94 = load i32, ptr %14, align 4, !tbaa !20
  %95 = call i32 @I2C_RequestMemoryRead(ptr noundef %90, i16 noundef zeroext %91, i16 noundef zeroext %92, i16 noundef zeroext %93, i32 noundef 25, i32 noundef %94)
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %103

97:                                               ; preds = %89
  br label %98

98:                                               ; preds = %97
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %99, i32 0, i32 10
  store i32 0, ptr %100, align 8, !tbaa !19
  br label %101

101:                                              ; preds = %98
  br label %102

102:                                              ; preds = %101
  store i32 1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

103:                                              ; preds = %89
  %104 = load ptr, ptr %8, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %104, i32 0, i32 9
  %106 = load ptr, ptr %105, align 8, !tbaa !27
  %107 = icmp ne ptr %106, null
  br i1 %107, label %108, label %140

108:                                              ; preds = %103
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %109, i32 0, i32 9
  %111 = load ptr, ptr %110, align 8, !tbaa !27
  %112 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %111, i32 0, i32 5
  store ptr @I2C_DMAMasterReceiveCplt, ptr %112, align 8, !tbaa !28
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %113, i32 0, i32 9
  %115 = load ptr, ptr %114, align 8, !tbaa !27
  %116 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %115, i32 0, i32 9
  store ptr @I2C_DMAError, ptr %116, align 8, !tbaa !31
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %117, i32 0, i32 9
  %119 = load ptr, ptr %118, align 8, !tbaa !27
  %120 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %119, i32 0, i32 6
  store ptr null, ptr %120, align 8, !tbaa !32
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %121, i32 0, i32 9
  %123 = load ptr, ptr %122, align 8, !tbaa !27
  %124 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %123, i32 0, i32 10
  store ptr null, ptr %124, align 8, !tbaa !33
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %125, i32 0, i32 9
  %127 = load ptr, ptr %126, align 8, !tbaa !27
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !16
  %131 = getelementptr inbounds %struct.I2C_TypeDef, ptr %130, i32 0, i32 9
  %132 = ptrtoint ptr %131 to i32
  %133 = load ptr, ptr %12, align 8, !tbaa !5
  %134 = ptrtoint ptr %133 to i32
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %135, i32 0, i32 3
  %137 = load i16, ptr %136, align 8, !tbaa !26
  %138 = zext i16 %137 to i32
  %139 = call i32 @HAL_DMA_Start_IT(ptr noundef %127, i32 noundef %132, i32 noundef %134, i32 noundef %138)
  store i32 %139, ptr %16, align 4, !tbaa !20
  br label %154

140:                                              ; preds = %103
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %141, i32 0, i32 11
  store volatile i32 32, ptr %142, align 4, !tbaa !11
  %143 = load ptr, ptr %8, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %143, i32 0, i32 12
  store volatile i32 0, ptr %144, align 8, !tbaa !21
  %145 = load ptr, ptr %8, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %145, i32 0, i32 13
  %147 = load volatile i32, ptr %146, align 4, !tbaa !15
  %148 = or i32 %147, 128
  store volatile i32 %148, ptr %146, align 4, !tbaa !15
  br label %149

149:                                              ; preds = %140
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %150, i32 0, i32 10
  store i32 0, ptr %151, align 8, !tbaa !19
  br label %152

152:                                              ; preds = %149
  br label %153

153:                                              ; preds = %152
  store i32 1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

154:                                              ; preds = %108
  %155 = load i32, ptr %16, align 4, !tbaa !20
  %156 = icmp eq i32 %155, 0
  br i1 %156, label %157, label %189

157:                                              ; preds = %154
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = load i16, ptr %9, align 2, !tbaa !9
  %160 = load ptr, ptr %8, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %160, i32 0, i32 3
  %162 = load i16, ptr %161, align 8, !tbaa !26
  %163 = trunc i16 %162 to i8
  %164 = load i32, ptr %15, align 4, !tbaa !20
  call void @I2C_TransferConfig(ptr noundef %158, i16 noundef zeroext %159, i8 noundef zeroext %163, i32 noundef %164, i32 noundef -2147474432)
  %165 = load ptr, ptr %8, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %165, i32 0, i32 3
  %167 = load i16, ptr %166, align 8, !tbaa !26
  %168 = zext i16 %167 to i32
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %169, i32 0, i32 4
  %171 = load volatile i16, ptr %170, align 2, !tbaa !23
  %172 = zext i16 %171 to i32
  %173 = sub nsw i32 %172, %168
  %174 = trunc i32 %173 to i16
  store volatile i16 %174, ptr %170, align 2, !tbaa !23
  br label %175

175:                                              ; preds = %157
  %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
  %180 = load ptr, ptr %8, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %180, i16 noundef zeroext 17)
  %181 = load ptr, ptr %8, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %181, i32 0, i32 0
  %183 = load ptr, ptr %182, align 8, !tbaa !16
  %184 = getelementptr inbounds %struct.I2C_TypeDef, ptr %183, i32 0, i32 0
  %185 = load volatile i32, ptr %184, align 4, !tbaa !34
  %186 = zext i32 %185 to i64
  %187 = or i64 %186, 32768
  %188 = trunc i64 %187 to i32
  store volatile i32 %188, ptr %184, align 4, !tbaa !34
  br label %203

189:                                              ; preds = %154
  %190 = load ptr, ptr %8, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %190, i32 0, i32 11
  store volatile i32 32, ptr %191, align 4, !tbaa !11
  %192 = load ptr, ptr %8, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %192, i32 0, i32 12
  store volatile i32 0, ptr %193, align 8, !tbaa !21
  %194 = load ptr, ptr %8, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %194, i32 0, i32 13
  %196 = load volatile i32, ptr %195, align 4, !tbaa !15
  %197 = or i32 %196, 16
  store volatile i32 %197, ptr %195, align 4, !tbaa !15
  br label %198

198:                                              ; preds = %189
  %199 = load ptr, ptr %8, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %199, i32 0, i32 10
  store i32 0, ptr %200, align 8, !tbaa !19
  br label %201

201:                                              ; preds = %198
  br label %202

202:                                              ; preds = %201
  store i32 1, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

203:                                              ; preds = %179
  store i32 0, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

204:                                              ; preds = %6
  store i32 2, ptr %7, align 4
  store i32 1, ptr %17, align 4
  br label %205

205:                                              ; preds = %204, %203, %202, %153, %102, %51, %44, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %206 = load i32, ptr %7, align 4
  ret i32 %206
}

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 = !{!"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, !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 = !{!14, !14, i64 0}
!21 = !{!12, !14, i64 96}
!22 = !{!12, !6, i64 40}
!23 = !{!12, !10, i64 50}
!24 = !{!12, !14, i64 52}
!25 = !{!12, !6, i64 64}
!26 = !{!12, !10, i64 48}
!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 = !{!18, !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"

declare i32 @HAL_GetTick() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @I2C_Enable_IRQ(ptr noundef, i16 noundef zeroext) local_unnamed_addr #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) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden i32 @I2C_RequestMemoryRead(ptr noundef, i16 noundef zeroext, i16 noundef zeroext, i16 noundef zeroext, i32 noundef, i32 noundef) local_unnamed_addr #1

; 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 #1 {
  %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 %73

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

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

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 %73, label %24

24:                                               ; preds = %20
  store i32 1, ptr %21, align 8, !tbaa !17
  %25 = tail call i32 @HAL_GetTick() #2
  store volatile i32 34, ptr %7, align 4, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %0, i64 96
  store volatile i32 64, ptr %26, align 8, !tbaa !18
  %27 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %27, align 4, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %4, ptr %28, align 8, !tbaa !19
  %29 = getelementptr inbounds i8, ptr %0, i64 50
  store volatile i16 %5, ptr %29, align 2, !tbaa !20
  %30 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 -65536, ptr %30, align 4, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr @I2C_Master_ISR_DMA, ptr %31, align 8, !tbaa !22
  %32 = load volatile i16, ptr %29, align 2, !tbaa !20
  %33 = icmp ugt i16 %32, 255
  br i1 %33, label %36, label %34

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

36:                                               ; preds = %24, %34
  %.sink = phi i16 [ %35, %34 ], [ 255, %24 ]
  %.055 = phi i32 [ 33554432, %34 ], [ 16777216, %24 ]
  %37 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 %.sink, ptr %37, align 8
  %38 = tail call i32 @I2C_RequestMemoryRead(ptr noundef nonnull %0, i16 noundef zeroext %1, i16 noundef zeroext %2, i16 noundef zeroext %3, i32 noundef 25, i32 noundef %25)
  %.not58 = icmp eq i32 %38, 0
  br i1 %.not58, label %40, label %39

39:                                               ; preds = %36
  store i32 0, ptr %21, align 8, !tbaa !17
  br label %73

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %0, i64 80
  %42 = load ptr, ptr %41, align 8, !tbaa !23
  %.not59 = icmp eq ptr %42, null
  br i1 %.not59, label %58, label %43

43:                                               ; preds = %40
  %44 = getelementptr inbounds i8, ptr %42, i64 72
  store ptr @I2C_DMAMasterReceiveCplt, ptr %44, align 8, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %42, i64 104
  store ptr @I2C_DMAError, ptr %45, align 8, !tbaa !27
  %46 = getelementptr inbounds i8, ptr %42, i64 80
  store ptr null, ptr %46, align 8, !tbaa !28
  %47 = getelementptr inbounds i8, ptr %42, i64 112
  store ptr null, ptr %47, align 8, !tbaa !29
  %48 = load ptr, ptr %0, align 8, !tbaa !14
  %49 = getelementptr inbounds i8, ptr %48, i64 36
  %50 = ptrtoint ptr %49 to i64
  %51 = trunc i64 %50 to i32
  %52 = ptrtoint ptr %4 to i64
  %53 = trunc i64 %52 to i32
  %54 = load i16, ptr %37, align 8, !tbaa !30
  %55 = zext i16 %54 to i32
  %56 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %42, i32 noundef %51, i32 noundef %53, i32 noundef %55) #2
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %61, label %70

58:                                               ; preds = %40
  store volatile i32 32, ptr %7, align 4, !tbaa !5
  store volatile i32 0, ptr %26, align 8, !tbaa !18
  %59 = load volatile i32, ptr %27, align 4, !tbaa !13
  %60 = or i32 %59, 128
  store volatile i32 %60, ptr %27, align 4, !tbaa !13
  store i32 0, ptr %21, align 8, !tbaa !17
  br label %73

61:                                               ; preds = %43
  %62 = load i16, ptr %37, align 8, !tbaa !30
  %63 = trunc i16 %62 to i8
  tail call void @I2C_TransferConfig(ptr noundef nonnull %0, i16 noundef zeroext %1, i8 noundef zeroext %63, i32 noundef %.055, i32 noundef -2147474432)
  %64 = load i16, ptr %37, align 8, !tbaa !30
  %65 = load volatile i16, ptr %29, align 2, !tbaa !20
  %66 = sub i16 %65, %64
  store volatile i16 %66, ptr %29, align 2, !tbaa !20
  store i32 0, ptr %21, align 8, !tbaa !17
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext 17)
  %67 = load ptr, ptr %0, align 8, !tbaa !14
  %68 = load volatile i32, ptr %67, align 4, !tbaa !31
  %69 = or i32 %68, 32768
  store volatile i32 %69, ptr %67, align 4, !tbaa !31
  br label %73

70:                                               ; preds = %43
  store volatile i32 32, ptr %7, align 4, !tbaa !5
  store volatile i32 0, ptr %26, align 8, !tbaa !18
  %71 = load volatile i32, ptr %27, align 4, !tbaa !13
  %72 = or i32 %71, 16
  store volatile i32 %72, ptr %27, align 4, !tbaa !13
  store i32 0, ptr %21, align 8, !tbaa !17
  br label %73

73:                                               ; preds = %6, %20, %15, %61, %70, %58, %39, %13
  %.0 = phi i32 [ 1, %13 ], [ 1, %39 ], [ 0, %61 ], [ 1, %70 ], [ 1, %58 ], [ 2, %15 ], [ 2, %20 ], [ 2, %6 ]
  ret i32 %.0
}

attributes #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 = { 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 = { 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, !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, !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 = !{!16, !11, i64 0}


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