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

14:                                               ; preds = %3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp eq ptr %15, null
  br i1 %16, label %21, label %17

17:                                               ; preds = %14
  %18 = load i16, ptr %7, align 2, !tbaa !9
  %19 = zext i16 %18 to i32
  %20 = icmp eq i32 %19, 0
  br i1 %20, label %21, label %24

21:                                               ; preds = %17, %14
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %22, i32 0, i32 13
  store volatile i32 512, ptr %23, align 4, !tbaa !15
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

24:                                               ; preds = %17
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %26, i32 0, i32 10
  %28 = load i32, ptr %27, align 8, !tbaa !16
  %29 = icmp eq i32 %28, 1
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  store i32 2, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

31:                                               ; preds = %25
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %32, i32 0, i32 10
  store i32 1, ptr %33, align 8, !tbaa !16
  br label %34

34:                                               ; preds = %31
  br label %35

35:                                               ; preds = %34
  br label %36

36:                                               ; preds = %35
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %37, i32 0, i32 11
  store volatile i32 33, ptr %38, align 4, !tbaa !11
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %39, i32 0, i32 12
  store volatile i32 32, ptr %40, align 8, !tbaa !17
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %41, i32 0, i32 13
  store volatile i32 0, ptr %42, align 4, !tbaa !15
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %44, i32 0, i32 2
  store ptr %43, ptr %45, align 8, !tbaa !18
  %46 = load i16, ptr %7, align 2, !tbaa !9
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %47, i32 0, i32 4
  store volatile i16 %46, ptr %48, align 2, !tbaa !19
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %49, i32 0, i32 4
  %51 = load volatile i16, ptr %50, align 2, !tbaa !19
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %52, i32 0, i32 3
  store i16 %51, ptr %53, align 8, !tbaa !20
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %54, i32 0, i32 5
  store volatile i32 -65536, ptr %55, align 4, !tbaa !21
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %56, i32 0, i32 7
  store ptr @I2C_Slave_ISR_DMA, ptr %57, align 8, !tbaa !22
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds %struct.I2C_InitTypeDef, ptr %59, i32 0, i32 7
  %61 = load i32, ptr %60, align 4, !tbaa !23
  %62 = zext i32 %61 to i64
  %63 = icmp eq i64 %62, 131072
  br i1 %63, label %64, label %86

64:                                               ; preds = %36
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = load i8, ptr %67, align 1, !tbaa !24
  %69 = zext i8 %68 to i32
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !25
  %73 = getelementptr inbounds %struct.I2C_TypeDef, ptr %72, i32 0, i32 10
  store volatile i32 %69, ptr %73, align 4, !tbaa !26
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %74, i32 0, i32 2
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = getelementptr inbounds i8, ptr %76, i32 1
  store ptr %77, ptr %75, align 8, !tbaa !18
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %78, i32 0, i32 4
  %80 = load volatile i16, ptr %79, align 2, !tbaa !19
  %81 = add i16 %80, -1
  store volatile i16 %81, ptr %79, align 2, !tbaa !19
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %82, i32 0, i32 3
  %84 = load i16, ptr %83, align 8, !tbaa !20
  %85 = add i16 %84, -1
  store i16 %85, ptr %83, align 8, !tbaa !20
  br label %86

86:                                               ; preds = %64, %36
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %87, i32 0, i32 4
  %89 = load volatile i16, ptr %88, align 2, !tbaa !19
  %90 = zext i16 %89 to i32
  %91 = icmp ne i32 %90, 0
  br i1 %91, label %92, label %186

92:                                               ; preds = %86
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %93, i32 0, i32 8
  %95 = load ptr, ptr %94, align 8, !tbaa !28
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %131

97:                                               ; preds = %92
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %98, i32 0, i32 8
  %100 = load ptr, ptr %99, align 8, !tbaa !28
  %101 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %100, i32 0, i32 5
  store ptr @I2C_DMASlaveTransmitCplt, ptr %101, align 8, !tbaa !29
  %102 = load ptr, ptr %5, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %102, i32 0, i32 8
  %104 = load ptr, ptr %103, align 8, !tbaa !28
  %105 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %104, i32 0, i32 9
  store ptr @I2C_DMAError, ptr %105, align 8, !tbaa !32
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %106, i32 0, i32 8
  %108 = load ptr, ptr %107, align 8, !tbaa !28
  %109 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %108, i32 0, i32 6
  store ptr null, ptr %109, align 8, !tbaa !33
  %110 = load ptr, ptr %5, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %110, i32 0, i32 8
  %112 = load ptr, ptr %111, align 8, !tbaa !28
  %113 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %112, i32 0, i32 10
  store ptr null, ptr %113, align 8, !tbaa !34
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %114, i32 0, i32 8
  %116 = load ptr, ptr %115, align 8, !tbaa !28
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %117, i32 0, i32 2
  %119 = load ptr, ptr %118, align 8, !tbaa !18
  %120 = ptrtoint ptr %119 to i32
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %121, i32 0, i32 0
  %123 = load ptr, ptr %122, align 8, !tbaa !25
  %124 = getelementptr inbounds %struct.I2C_TypeDef, ptr %123, i32 0, i32 10
  %125 = ptrtoint ptr %124 to i32
  %126 = load ptr, ptr %5, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %126, i32 0, i32 3
  %128 = load i16, ptr %127, align 8, !tbaa !20
  %129 = zext i16 %128 to i32
  %130 = call i32 @HAL_DMA_Start_IT(ptr noundef %116, i32 noundef %120, i32 noundef %125, i32 noundef %129)
  store i32 %130, ptr %8, align 4, !tbaa !35
  br label %145

131:                                              ; preds = %92
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %132, i32 0, i32 11
  store volatile i32 40, ptr %133, align 4, !tbaa !11
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %134, i32 0, i32 12
  store volatile i32 0, ptr %135, align 8, !tbaa !17
  %136 = load ptr, ptr %5, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %136, i32 0, i32 13
  %138 = load volatile i32, ptr %137, align 4, !tbaa !15
  %139 = or i32 %138, 128
  store volatile i32 %139, ptr %137, align 4, !tbaa !15
  br label %140

140:                                              ; preds = %131
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %141, i32 0, i32 10
  store i32 0, ptr %142, align 8, !tbaa !16
  br label %143

143:                                              ; preds = %140
  br label %144

144:                                              ; preds = %143
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

145:                                              ; preds = %97
  %146 = load i32, ptr %8, align 4, !tbaa !35
  %147 = icmp eq i32 %146, 0
  br i1 %147, label %148, label %171

148:                                              ; preds = %145
  %149 = load ptr, ptr %5, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %149, i32 0, i32 0
  %151 = load ptr, ptr %150, align 8, !tbaa !25
  %152 = getelementptr inbounds %struct.I2C_TypeDef, ptr %151, i32 0, i32 1
  %153 = load volatile i32, ptr %152, align 4, !tbaa !36
  %154 = zext i32 %153 to i64
  %155 = and i64 %154, -32769
  %156 = trunc i64 %155 to i32
  store volatile i32 %156, ptr %152, align 4, !tbaa !36
  br label %157

157:                                              ; preds = %148
  %158 = load ptr, ptr %5, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %158, i32 0, i32 10
  store i32 0, ptr %159, align 8, !tbaa !16
  br label %160

160:                                              ; preds = %157
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %5, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %162, i16 noundef zeroext -32768)
  %163 = load ptr, ptr %5, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %163, i32 0, i32 0
  %165 = load ptr, ptr %164, align 8, !tbaa !25
  %166 = getelementptr inbounds %struct.I2C_TypeDef, ptr %165, i32 0, i32 0
  %167 = load volatile i32, ptr %166, align 4, !tbaa !37
  %168 = zext i32 %167 to i64
  %169 = or i64 %168, 16384
  %170 = trunc i64 %169 to i32
  store volatile i32 %170, ptr %166, align 4, !tbaa !37
  br label %185

171:                                              ; preds = %145
  %172 = load ptr, ptr %5, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %172, i32 0, i32 11
  store volatile i32 40, ptr %173, align 4, !tbaa !11
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %174, i32 0, i32 12
  store volatile i32 0, ptr %175, align 8, !tbaa !17
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %176, i32 0, i32 13
  %178 = load volatile i32, ptr %177, align 4, !tbaa !15
  %179 = or i32 %178, 16
  store volatile i32 %179, ptr %177, align 4, !tbaa !15
  br label %180

180:                                              ; preds = %171
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %181, i32 0, i32 10
  store i32 0, ptr %182, align 8, !tbaa !16
  br label %183

183:                                              ; preds = %180
  br label %184

184:                                              ; preds = %183
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

185:                                              ; preds = %161
  br label %201

186:                                              ; preds = %86
  %187 = load ptr, ptr %5, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !25
  %190 = getelementptr inbounds %struct.I2C_TypeDef, ptr %189, i32 0, i32 1
  %191 = load volatile i32, ptr %190, align 4, !tbaa !36
  %192 = zext i32 %191 to i64
  %193 = and i64 %192, -32769
  %194 = trunc i64 %193 to i32
  store volatile i32 %194, ptr %190, align 4, !tbaa !36
  br label %195

195:                                              ; preds = %186
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %196, i32 0, i32 10
  store i32 0, ptr %197, align 8, !tbaa !16
  br label %198

198:                                              ; preds = %195
  br label %199

199:                                              ; preds = %198
  %200 = load ptr, ptr %5, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %200, i16 noundef zeroext -32768)
  br label %201

201:                                              ; preds = %199, %185
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

202:                                              ; preds = %3
  store i32 2, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %203

203:                                              ; preds = %202, %201, %184, %144, %30, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %204 = load i32, ptr %4, align 4
  ret i32 %204
}

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

; Function Attrs: nounwind uwtable
declare hidden void @I2C_DMASlaveTransmitCplt(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, !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, !14, i64 88}
!17 = !{!12, !14, i64 96}
!18 = !{!12, !6, i64 40}
!19 = !{!12, !10, i64 50}
!20 = !{!12, !10, i64 48}
!21 = !{!12, !14, i64 52}
!22 = !{!12, !6, i64 64}
!23 = !{!12, !14, i64 36}
!24 = !{!7, !7, i64 0}
!25 = !{!12, !6, i64 0}
!26 = !{!27, !14, i64 40}
!27 = !{!"", !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}
!28 = !{!12, !6, i64 72}
!29 = !{!30, !6, i64 72}
!30 = !{!"__DMA_HandleTypeDef", !6, i64 0, !31, 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}
!31 = !{!"", !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}
!32 = !{!30, !6, i64 104}
!33 = !{!30, !6, i64 80}
!34 = !{!30, !6, i64 112}
!35 = !{!14, !14, i64 0}
!36 = !{!27, !14, i64 4}
!37 = !{!27, !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_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
define dso_local range(i32 0, 3) i32 @HAL_I2C_Slave_Transmit_DMA(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 92
  %5 = load volatile i32, ptr %4, align 4, !tbaa !5
  %6 = icmp eq i32 %5, 32
  br i1 %6, label %7, label %77

7:                                                ; preds = %3
  %8 = icmp eq ptr %1, null
  %9 = icmp eq i16 %2, 0
  %or.cond = or i1 %8, %9
  br i1 %or.cond, label %10, label %12

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

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

16:                                               ; preds = %12
  store i32 1, ptr %13, align 8, !tbaa !14
  store volatile i32 33, ptr %4, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 96
  store volatile i32 32, ptr %17, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %18, align 4, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %1, ptr %19, align 8, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %0, i64 50
  store volatile i16 %2, ptr %20, align 2, !tbaa !17
  %21 = load volatile i16, ptr %20, align 2, !tbaa !17
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 %21, ptr %22, align 8, !tbaa !18
  %23 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 -65536, ptr %23, align 4, !tbaa !19
  %24 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr @I2C_Slave_ISR_DMA, ptr %24, align 8, !tbaa !20
  %25 = getelementptr inbounds i8, ptr %0, i64 36
  %26 = load i32, ptr %25, align 4, !tbaa !21
  %27 = icmp eq i32 %26, 131072
  br i1 %27, label %28, label %37

28:                                               ; preds = %16
  %29 = load i8, ptr %1, align 1, !tbaa !22
  %30 = zext i8 %29 to i32
  %31 = load ptr, ptr %0, align 8, !tbaa !23
  %32 = getelementptr inbounds i8, ptr %31, i64 40
  store volatile i32 %30, ptr %32, align 4, !tbaa !24
  %33 = getelementptr inbounds i8, ptr %1, i64 1
  store ptr %33, ptr %19, align 8, !tbaa !16
  %34 = load volatile i16, ptr %20, align 2, !tbaa !17
  %35 = add i16 %34, -1
  store volatile i16 %35, ptr %20, align 2, !tbaa !17
  %36 = add i16 %21, -1
  store i16 %36, ptr %22, align 8, !tbaa !18
  br label %37

37:                                               ; preds = %28, %16
  %38 = phi i16 [ %36, %28 ], [ %21, %16 ]
  %39 = phi ptr [ %33, %28 ], [ %1, %16 ]
  %40 = load volatile i16, ptr %20, align 2, !tbaa !17
  %.not = icmp eq i16 %40, 0
  br i1 %.not, label %72, label %41

41:                                               ; preds = %37
  %42 = getelementptr inbounds i8, ptr %0, i64 72
  %43 = load ptr, ptr %42, align 8, !tbaa !26
  %.not53 = icmp eq ptr %43, null
  br i1 %.not53, label %58, label %44

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %43, i64 72
  store ptr @I2C_DMASlaveTransmitCplt, ptr %45, align 8, !tbaa !27
  %46 = getelementptr inbounds i8, ptr %43, i64 104
  store ptr @I2C_DMAError, ptr %46, align 8, !tbaa !30
  %47 = getelementptr inbounds i8, ptr %43, i64 80
  store ptr null, ptr %47, align 8, !tbaa !31
  %48 = getelementptr inbounds i8, ptr %43, i64 112
  store ptr null, ptr %48, align 8, !tbaa !32
  %49 = ptrtoint ptr %39 to i64
  %50 = trunc i64 %49 to i32
  %51 = load ptr, ptr %0, align 8, !tbaa !23
  %52 = getelementptr inbounds i8, ptr %51, i64 40
  %53 = ptrtoint ptr %52 to i64
  %54 = trunc i64 %53 to i32
  %55 = zext i16 %38 to i32
  %56 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %43, i32 noundef %50, i32 noundef %54, i32 noundef %55) #2
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %61, label %69

58:                                               ; preds = %41
  store volatile i32 40, ptr %4, align 4, !tbaa !5
  store volatile i32 0, ptr %17, align 8, !tbaa !15
  %59 = load volatile i32, ptr %18, align 4, !tbaa !13
  %60 = or i32 %59, 128
  store volatile i32 %60, ptr %18, align 4, !tbaa !13
  store i32 0, ptr %13, align 8, !tbaa !14
  br label %77

61:                                               ; preds = %44
  %62 = load ptr, ptr %0, align 8, !tbaa !23
  %63 = getelementptr inbounds i8, ptr %62, i64 4
  %64 = load volatile i32, ptr %63, align 4, !tbaa !33
  %65 = and i32 %64, -32769
  store volatile i32 %65, ptr %63, align 4, !tbaa !33
  store i32 0, ptr %13, align 8, !tbaa !14
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext -32768)
  %66 = load ptr, ptr %0, align 8, !tbaa !23
  %67 = load volatile i32, ptr %66, align 4, !tbaa !34
  %68 = or i32 %67, 16384
  store volatile i32 %68, ptr %66, align 4, !tbaa !34
  br label %77

69:                                               ; preds = %44
  store volatile i32 40, ptr %4, align 4, !tbaa !5
  store volatile i32 0, ptr %17, align 8, !tbaa !15
  %70 = load volatile i32, ptr %18, align 4, !tbaa !13
  %71 = or i32 %70, 16
  store volatile i32 %71, ptr %18, align 4, !tbaa !13
  store i32 0, ptr %13, align 8, !tbaa !14
  br label %77

72:                                               ; preds = %37
  %73 = load ptr, ptr %0, align 8, !tbaa !23
  %74 = getelementptr inbounds i8, ptr %73, i64 4
  %75 = load volatile i32, ptr %74, align 4, !tbaa !33
  %76 = and i32 %75, -32769
  store volatile i32 %76, ptr %74, align 4, !tbaa !33
  store i32 0, ptr %13, align 8, !tbaa !14
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext -32768)
  br label %77

77:                                               ; preds = %3, %61, %72, %12, %69, %58, %10
  %.0 = phi i32 [ 1, %10 ], [ 1, %69 ], [ 1, %58 ], [ 2, %12 ], [ 0, %72 ], [ 0, %61 ], [ 2, %3 ]
  ret i32 %.0
}

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

; Function Attrs: nounwind uwtable
declare hidden void @I2C_DMASlaveTransmitCplt(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, !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, !11, i64 88}
!15 = !{!6, !11, i64 96}
!16 = !{!6, !7, i64 40}
!17 = !{!6, !12, i64 50}
!18 = !{!6, !12, i64 48}
!19 = !{!6, !11, i64 52}
!20 = !{!6, !7, i64 64}
!21 = !{!6, !11, i64 36}
!22 = !{!8, !8, i64 0}
!23 = !{!6, !7, i64 0}
!24 = !{!25, !11, i64 40}
!25 = !{!"", !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}
!26 = !{!6, !7, i64 72}
!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}
!33 = !{!25, !11, i64 4}
!34 = !{!25, !11, i64 0}


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