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

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

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

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

declare i32 @HAL_DMA_Abort_IT(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_I2C_Slave_Seq_Receive_DMA(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2, i32 noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i16, align 2
  %9 = alloca i32, align 4
  %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 ptr %1, ptr %7, align 8, !tbaa !5
  store i16 %2, ptr %8, align 2, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  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 !13
  %16 = and i32 %15, 40
  %17 = icmp eq i32 %16, 40
  br i1 %17, label %18, label %298

18:                                               ; preds = %4
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %18
  %22 = load i16, ptr %8, align 2, !tbaa !9
  %23 = zext i16 %22 to i32
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %21, %18
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %26, i32 0, i32 13
  store volatile i32 512, ptr %27, align 4, !tbaa !16
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

28:                                               ; preds = %21
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  call void @I2C_Disable_IRQ(ptr noundef %29, i16 noundef zeroext -32766)
  br label %30

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

35:                                               ; preds = %30
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

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

39:                                               ; preds = %36
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %42, i32 0, i32 11
  %44 = load volatile i32, ptr %43, align 4, !tbaa !13
  %45 = icmp eq i32 %44, 41
  br i1 %45, label %46, label %91

46:                                               ; preds = %41
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  call void @I2C_Disable_IRQ(ptr noundef %47, i16 noundef zeroext 1)
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !18
  %51 = getelementptr inbounds %struct.I2C_TypeDef, ptr %50, i32 0, i32 0
  %52 = load volatile i32, ptr %51, align 4, !tbaa !19
  %53 = zext i32 %52 to i64
  %54 = and i64 %53, 16384
  %55 = icmp eq i64 %54, 16384
  br i1 %55, label %56, label %90

56:                                               ; preds = %46
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %57, i32 0, i32 8
  %59 = load ptr, ptr %58, align 8, !tbaa !21
  %60 = icmp ne ptr %59, null
  br i1 %60, label %61, label %89

61:                                               ; preds = %56
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %62, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8, !tbaa !18
  %65 = getelementptr inbounds %struct.I2C_TypeDef, ptr %64, i32 0, i32 0
  %66 = load volatile i32, ptr %65, align 4, !tbaa !19
  %67 = zext i32 %66 to i64
  %68 = and i64 %67, -16385
  %69 = trunc i64 %68 to i32
  store volatile i32 %69, ptr %65, align 4, !tbaa !19
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %70, i32 0, i32 8
  %72 = load ptr, ptr %71, align 8, !tbaa !21
  %73 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %72, i32 0, i32 10
  store ptr @I2C_DMAAbort, ptr %73, align 8, !tbaa !22
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %74, i32 0, i32 8
  %76 = load ptr, ptr %75, align 8, !tbaa !21
  %77 = call i32 @HAL_DMA_Abort_IT(ptr noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %88

79:                                               ; preds = %61
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %80, i32 0, i32 8
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  %83 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %82, i32 0, i32 10
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %85, i32 0, i32 8
  %87 = load ptr, ptr %86, align 8, !tbaa !21
  call void %84(ptr noundef %87)
  br label %88

88:                                               ; preds = %79, %61
  br label %89

89:                                               ; preds = %88, %56
  br label %90

90:                                               ; preds = %89, %46
  br label %142

91:                                               ; preds = %41
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %92, i32 0, i32 11
  %94 = load volatile i32, ptr %93, align 4, !tbaa !13
  %95 = icmp eq i32 %94, 42
  br i1 %95, label %96, label %140

96:                                               ; preds = %91
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !18
  %100 = getelementptr inbounds %struct.I2C_TypeDef, ptr %99, i32 0, i32 0
  %101 = load volatile i32, ptr %100, align 4, !tbaa !19
  %102 = zext i32 %101 to i64
  %103 = and i64 %102, 32768
  %104 = icmp eq i64 %103, 32768
  br i1 %104, label %105, label %139

105:                                              ; preds = %96
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %106, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8, !tbaa !18
  %109 = getelementptr inbounds %struct.I2C_TypeDef, ptr %108, i32 0, i32 0
  %110 = load volatile i32, ptr %109, align 4, !tbaa !19
  %111 = zext i32 %110 to i64
  %112 = and i64 %111, -32769
  %113 = trunc i64 %112 to i32
  store volatile i32 %113, ptr %109, align 4, !tbaa !19
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %114, i32 0, i32 9
  %116 = load ptr, ptr %115, align 8, !tbaa !25
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %138

118:                                              ; preds = %105
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %119, i32 0, i32 9
  %121 = load ptr, ptr %120, align 8, !tbaa !25
  %122 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %121, i32 0, i32 10
  store ptr @I2C_DMAAbort, ptr %122, align 8, !tbaa !22
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %123, i32 0, i32 9
  %125 = load ptr, ptr %124, align 8, !tbaa !25
  %126 = call i32 @HAL_DMA_Abort_IT(ptr noundef %125)
  %127 = icmp ne i32 %126, 0
  br i1 %127, label %128, label %137

128:                                              ; preds = %118
  %129 = load ptr, ptr %6, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %129, i32 0, i32 9
  %131 = load ptr, ptr %130, align 8, !tbaa !25
  %132 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %131, i32 0, i32 10
  %133 = load ptr, ptr %132, align 8, !tbaa !22
  %134 = load ptr, ptr %6, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %134, i32 0, i32 9
  %136 = load ptr, ptr %135, align 8, !tbaa !25
  call void %133(ptr noundef %136)
  br label %137

137:                                              ; preds = %128, %118
  br label %138

138:                                              ; preds = %137, %105
  br label %139

139:                                              ; preds = %138, %96
  br label %141

140:                                              ; preds = %91
  br label %141

141:                                              ; preds = %140, %139
  br label %142

142:                                              ; preds = %141, %90
  %143 = load ptr, ptr %6, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %143, i32 0, i32 11
  store volatile i32 42, ptr %144, align 4, !tbaa !13
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %145, i32 0, i32 12
  store volatile i32 32, ptr %146, align 8, !tbaa !26
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %147, i32 0, i32 13
  store volatile i32 0, ptr %148, align 4, !tbaa !16
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %149, i32 0, i32 0
  %151 = load ptr, ptr %150, align 8, !tbaa !18
  %152 = getelementptr inbounds %struct.I2C_TypeDef, ptr %151, i32 0, i32 1
  %153 = load volatile i32, ptr %152, align 4, !tbaa !27
  %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 !27
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %158, i32 0, i32 2
  store ptr %157, ptr %159, align 8, !tbaa !28
  %160 = load i16, ptr %8, align 2, !tbaa !9
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %161, i32 0, i32 4
  store volatile i16 %160, ptr %162, align 2, !tbaa !29
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %163, i32 0, i32 4
  %165 = load volatile i16, ptr %164, align 2, !tbaa !29
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %166, i32 0, i32 3
  store i16 %165, ptr %167, align 8, !tbaa !30
  %168 = load i32, ptr %9, align 4, !tbaa !11
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %169, i32 0, i32 5
  store volatile i32 %168, ptr %170, align 4, !tbaa !31
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %171, i32 0, i32 7
  store ptr @I2C_Slave_ISR_DMA, ptr %172, align 8, !tbaa !32
  %173 = load ptr, ptr %6, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %173, i32 0, i32 9
  %175 = load ptr, ptr %174, align 8, !tbaa !25
  %176 = icmp ne ptr %175, null
  br i1 %176, label %177, label %209

177:                                              ; preds = %142
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %178, i32 0, i32 9
  %180 = load ptr, ptr %179, align 8, !tbaa !25
  %181 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %180, i32 0, i32 5
  store ptr @I2C_DMASlaveReceiveCplt, ptr %181, align 8, !tbaa !33
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %182, i32 0, i32 9
  %184 = load ptr, ptr %183, align 8, !tbaa !25
  %185 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %184, i32 0, i32 9
  store ptr @I2C_DMAError, ptr %185, align 8, !tbaa !34
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %186, i32 0, i32 9
  %188 = load ptr, ptr %187, align 8, !tbaa !25
  %189 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %188, i32 0, i32 6
  store ptr null, ptr %189, align 8, !tbaa !35
  %190 = load ptr, ptr %6, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %190, i32 0, i32 9
  %192 = load ptr, ptr %191, align 8, !tbaa !25
  %193 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %192, i32 0, i32 10
  store ptr null, ptr %193, align 8, !tbaa !22
  %194 = load ptr, ptr %6, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %194, i32 0, i32 9
  %196 = load ptr, ptr %195, align 8, !tbaa !25
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %197, i32 0, i32 0
  %199 = load ptr, ptr %198, align 8, !tbaa !18
  %200 = getelementptr inbounds %struct.I2C_TypeDef, ptr %199, i32 0, i32 9
  %201 = ptrtoint ptr %200 to i32
  %202 = load ptr, ptr %7, align 8, !tbaa !5
  %203 = ptrtoint ptr %202 to i32
  %204 = load ptr, ptr %6, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %204, i32 0, i32 3
  %206 = load i16, ptr %205, align 8, !tbaa !30
  %207 = zext i16 %206 to i32
  %208 = call i32 @HAL_DMA_Start_IT(ptr noundef %196, i32 noundef %201, i32 noundef %203, i32 noundef %207)
  store i32 %208, ptr %11, align 4, !tbaa !11
  br label %223

209:                                              ; preds = %142
  %210 = load ptr, ptr %6, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %210, i32 0, i32 11
  store volatile i32 40, ptr %211, align 4, !tbaa !13
  %212 = load ptr, ptr %6, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %212, i32 0, i32 12
  store volatile i32 0, ptr %213, align 8, !tbaa !26
  %214 = load ptr, ptr %6, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %214, i32 0, i32 13
  %216 = load volatile i32, ptr %215, align 4, !tbaa !16
  %217 = or i32 %216, 128
  store volatile i32 %217, ptr %215, align 4, !tbaa !16
  br label %218

218:                                              ; preds = %209
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %219, i32 0, i32 10
  store i32 0, ptr %220, align 8, !tbaa !17
  br label %221

221:                                              ; preds = %218
  br label %222

222:                                              ; preds = %221
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

223:                                              ; preds = %177
  %224 = load i32, ptr %11, align 4, !tbaa !11
  %225 = icmp eq i32 %224, 0
  br i1 %225, label %226, label %239

226:                                              ; preds = %223
  %227 = load ptr, ptr %6, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %227, i32 0, i32 3
  %229 = load i16, ptr %228, align 8, !tbaa !30
  %230 = zext i16 %229 to i32
  %231 = load ptr, ptr %6, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %231, i32 0, i32 4
  %233 = load volatile i16, ptr %232, align 2, !tbaa !29
  %234 = zext i16 %233 to i32
  %235 = sub nsw i32 %234, %230
  %236 = trunc i32 %235 to i16
  store volatile i16 %236, ptr %232, align 2, !tbaa !29
  %237 = load ptr, ptr %6, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %237, i32 0, i32 3
  store i16 0, ptr %238, align 8, !tbaa !30
  br label %253

239:                                              ; preds = %223
  %240 = load ptr, ptr %6, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %240, i32 0, i32 11
  store volatile i32 40, ptr %241, align 4, !tbaa !13
  %242 = load ptr, ptr %6, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %242, i32 0, i32 12
  store volatile i32 0, ptr %243, align 8, !tbaa !26
  %244 = load ptr, ptr %6, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %244, i32 0, i32 13
  %246 = load volatile i32, ptr %245, align 4, !tbaa !16
  %247 = or i32 %246, 16
  store volatile i32 %247, ptr %245, align 4, !tbaa !16
  br label %248

248:                                              ; preds = %239
  %249 = load ptr, ptr %6, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %249, i32 0, i32 10
  store i32 0, ptr %250, align 8, !tbaa !17
  br label %251

251:                                              ; preds = %248
  br label %252

252:                                              ; preds = %251
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

253:                                              ; preds = %226
  %254 = load ptr, ptr %6, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %254, i32 0, i32 0
  %256 = load ptr, ptr %255, align 8, !tbaa !18
  %257 = getelementptr inbounds %struct.I2C_TypeDef, ptr %256, i32 0, i32 6
  %258 = load volatile i32, ptr %257, align 4, !tbaa !36
  %259 = zext i32 %258 to i64
  %260 = and i64 %259, 8
  %261 = icmp eq i64 %260, 8
  %262 = zext i1 %261 to i64
  %263 = select i1 %261, i32 1, i32 0
  store i32 %263, ptr %10, align 4, !tbaa !11
  %264 = load ptr, ptr %6, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %264, i32 0, i32 0
  %266 = load ptr, ptr %265, align 8, !tbaa !18
  %267 = getelementptr inbounds %struct.I2C_TypeDef, ptr %266, i32 0, i32 6
  %268 = load volatile i32, ptr %267, align 4, !tbaa !36
  %269 = zext i32 %268 to i64
  %270 = and i64 %269, 65536
  %271 = lshr i64 %270, 16
  %272 = trunc i64 %271 to i8
  %273 = zext i8 %272 to i32
  %274 = icmp eq i32 %273, 0
  br i1 %274, label %275, label %283

275:                                              ; preds = %253
  %276 = load i32, ptr %10, align 4, !tbaa !11
  %277 = icmp ne i32 %276, 0
  br i1 %277, label %278, label %283

278:                                              ; preds = %275
  %279 = load ptr, ptr %6, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %279, i32 0, i32 0
  %281 = load ptr, ptr %280, align 8, !tbaa !18
  %282 = getelementptr inbounds %struct.I2C_TypeDef, ptr %281, i32 0, i32 7
  store volatile i32 8, ptr %282, align 4, !tbaa !37
  br label %283

283:                                              ; preds = %278, %275, %253
  br label %284

284:                                              ; preds = %283
  %285 = load ptr, ptr %6, align 8, !tbaa !5
  %286 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %285, i32 0, i32 10
  store i32 0, ptr %286, align 8, !tbaa !17
  br label %287

287:                                              ; preds = %284
  br label %288

288:                                              ; preds = %287
  %289 = load ptr, ptr %6, align 8, !tbaa !5
  %290 = getelementptr inbounds %struct.__I2C_HandleTypeDef, ptr %289, i32 0, i32 0
  %291 = load ptr, ptr %290, align 8, !tbaa !18
  %292 = getelementptr inbounds %struct.I2C_TypeDef, ptr %291, i32 0, i32 0
  %293 = load volatile i32, ptr %292, align 4, !tbaa !19
  %294 = zext i32 %293 to i64
  %295 = or i64 %294, 32768
  %296 = trunc i64 %295 to i32
  store volatile i32 %296, ptr %292, align 4, !tbaa !19
  %297 = load ptr, ptr %6, align 8, !tbaa !5
  call void @I2C_Enable_IRQ(ptr noundef %297, i16 noundef zeroext -32766)
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

298:                                              ; preds = %4
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %299

299:                                              ; preds = %298, %288, %252, %222, %35, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %300 = load i32, ptr %5, align 4
  ret i32 %300
}

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


; 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
declare hidden i32 @I2C_Slave_ISR_DMA(ptr noundef, i32 noundef, i32 noundef) #0

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

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

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

declare i32 @HAL_DMA_Abort_IT(ptr noundef) local_unnamed_addr #1

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

9:                                                ; preds = %4
  %10 = icmp eq ptr %1, null
  %11 = icmp eq i16 %2, 0
  %or.cond = or i1 %10, %11
  br i1 %or.cond, label %12, label %14

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

14:                                               ; preds = %9
  tail call void @I2C_Disable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext -32766)
  %15 = getelementptr inbounds i8, ptr %0, i64 88
  %16 = load i32, ptr %15, align 8, !tbaa !14
  %17 = icmp eq i32 %16, 1
  br i1 %17, label %102, label %18

18:                                               ; preds = %14
  store i32 1, ptr %15, align 8, !tbaa !14
  %19 = load volatile i32, ptr %5, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 41
  br i1 %20, label %21, label %33

21:                                               ; preds = %18
  tail call void @I2C_Disable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext 1)
  %22 = load ptr, ptr %0, align 8, !tbaa !15
  %23 = load volatile i32, ptr %22, align 4, !tbaa !16
  %24 = and i32 %23, 16384
  %.not74 = icmp eq i32 %24, 0
  br i1 %.not74, label %51, label %25

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 72
  %27 = load ptr, ptr %26, align 8, !tbaa !18
  %.not75 = icmp eq ptr %27, null
  br i1 %.not75, label %51, label %28

28:                                               ; preds = %25
  %29 = load volatile i32, ptr %22, align 4, !tbaa !16
  %30 = and i32 %29, -16385
  store volatile i32 %30, ptr %22, align 4, !tbaa !16
  %31 = getelementptr inbounds i8, ptr %27, i64 112
  store ptr @I2C_DMAAbort, ptr %31, align 8, !tbaa !19
  %32 = tail call i32 @HAL_DMA_Abort_IT(ptr noundef nonnull %27) #2
  %.not76 = icmp eq i32 %32, 0
  br i1 %.not76, label %51, label %.sink.split

33:                                               ; preds = %18
  %34 = load volatile i32, ptr %5, align 4, !tbaa !5
  %35 = icmp eq i32 %34, 42
  br i1 %35, label %36, label %51

36:                                               ; preds = %33
  %37 = load ptr, ptr %0, align 8, !tbaa !15
  %38 = load volatile i32, ptr %37, align 4, !tbaa !16
  %39 = and i32 %38, 32768
  %.not = icmp eq i32 %39, 0
  br i1 %.not, label %51, label %40

40:                                               ; preds = %36
  %41 = load volatile i32, ptr %37, align 4, !tbaa !16
  %42 = and i32 %41, -32769
  store volatile i32 %42, ptr %37, align 4, !tbaa !16
  %43 = getelementptr inbounds i8, ptr %0, i64 80
  %44 = load ptr, ptr %43, align 8, !tbaa !22
  %.not72 = icmp eq ptr %44, null
  br i1 %.not72, label %51, label %45

45:                                               ; preds = %40
  %46 = getelementptr inbounds i8, ptr %44, i64 112
  store ptr @I2C_DMAAbort, ptr %46, align 8, !tbaa !19
  %47 = tail call i32 @HAL_DMA_Abort_IT(ptr noundef nonnull %44) #2
  %.not73 = icmp eq i32 %47, 0
  br i1 %.not73, label %51, label %.sink.split

.sink.split:                                      ; preds = %45, %28
  %.sink81 = phi ptr [ %26, %28 ], [ %43, %45 ]
  %48 = load ptr, ptr %.sink81, align 8, !tbaa !23
  %49 = getelementptr inbounds i8, ptr %48, i64 112
  %50 = load ptr, ptr %49, align 8, !tbaa !19
  tail call void %50(ptr noundef %48) #2
  br label %51

51:                                               ; preds = %.sink.split, %40, %45, %36, %33, %21, %28, %25
  store volatile i32 42, ptr %5, align 4, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %0, i64 96
  store volatile i32 32, ptr %52, align 8, !tbaa !24
  %53 = getelementptr inbounds i8, ptr %0, i64 100
  store volatile i32 0, ptr %53, align 4, !tbaa !13
  %54 = load ptr, ptr %0, align 8, !tbaa !15
  %55 = getelementptr inbounds i8, ptr %54, i64 4
  %56 = load volatile i32, ptr %55, align 4, !tbaa !25
  %57 = and i32 %56, -32769
  store volatile i32 %57, ptr %55, align 4, !tbaa !25
  %58 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr %1, ptr %58, align 8, !tbaa !26
  %59 = getelementptr inbounds i8, ptr %0, i64 50
  store volatile i16 %2, ptr %59, align 2, !tbaa !27
  %60 = load volatile i16, ptr %59, align 2, !tbaa !27
  %61 = getelementptr inbounds i8, ptr %0, i64 48
  store i16 %60, ptr %61, align 8, !tbaa !28
  %62 = getelementptr inbounds i8, ptr %0, i64 52
  store volatile i32 %3, ptr %62, align 4, !tbaa !29
  %63 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr @I2C_Slave_ISR_DMA, ptr %63, align 8, !tbaa !30
  %64 = getelementptr inbounds i8, ptr %0, i64 80
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  %.not77 = icmp eq ptr %65, null
  br i1 %.not77, label %79, label %66

66:                                               ; preds = %51
  %67 = getelementptr inbounds i8, ptr %65, i64 72
  store ptr @I2C_DMASlaveReceiveCplt, ptr %67, align 8, !tbaa !31
  %68 = getelementptr inbounds i8, ptr %65, i64 104
  store ptr @I2C_DMAError, ptr %68, align 8, !tbaa !32
  %69 = getelementptr inbounds i8, ptr %65, i64 80
  store ptr null, ptr %69, align 8, !tbaa !33
  %70 = getelementptr inbounds i8, ptr %65, i64 112
  store ptr null, ptr %70, align 8, !tbaa !19
  %71 = getelementptr inbounds i8, ptr %54, i64 36
  %72 = ptrtoint ptr %71 to i64
  %73 = trunc i64 %72 to i32
  %74 = ptrtoint ptr %1 to i64
  %75 = trunc i64 %74 to i32
  %76 = zext i16 %60 to i32
  %77 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %65, i32 noundef %73, i32 noundef %75, i32 noundef %76) #2
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %82, label %94

79:                                               ; preds = %51
  store volatile i32 40, ptr %5, align 4, !tbaa !5
  store volatile i32 0, ptr %52, align 8, !tbaa !24
  %80 = load volatile i32, ptr %53, align 4, !tbaa !13
  %81 = or i32 %80, 128
  store volatile i32 %81, ptr %53, align 4, !tbaa !13
  store i32 0, ptr %15, align 8, !tbaa !14
  br label %102

82:                                               ; preds = %66
  %83 = load i16, ptr %61, align 8, !tbaa !28
  %84 = load volatile i16, ptr %59, align 2, !tbaa !27
  %85 = sub i16 %84, %83
  store volatile i16 %85, ptr %59, align 2, !tbaa !27
  store i16 0, ptr %61, align 8, !tbaa !28
  %86 = load ptr, ptr %0, align 8, !tbaa !15
  %87 = getelementptr inbounds i8, ptr %86, i64 24
  %88 = load volatile i32, ptr %87, align 4, !tbaa !34
  %89 = and i32 %88, 8
  %90 = icmp ne i32 %89, 0
  %91 = load volatile i32, ptr %87, align 4, !tbaa !34
  %92 = and i32 %91, 65536
  %93 = icmp eq i32 %92, 0
  %or.cond4 = select i1 %93, i1 %90, i1 false
  br i1 %or.cond4, label %97, label %99

94:                                               ; preds = %66
  store volatile i32 40, ptr %5, align 4, !tbaa !5
  store volatile i32 0, ptr %52, align 8, !tbaa !24
  %95 = load volatile i32, ptr %53, align 4, !tbaa !13
  %96 = or i32 %95, 16
  store volatile i32 %96, ptr %53, align 4, !tbaa !13
  store i32 0, ptr %15, align 8, !tbaa !14
  br label %102

97:                                               ; preds = %82
  %98 = getelementptr inbounds i8, ptr %86, i64 28
  store volatile i32 8, ptr %98, align 4, !tbaa !35
  br label %99

99:                                               ; preds = %82, %97
  store i32 0, ptr %15, align 8, !tbaa !14
  %100 = load volatile i32, ptr %86, align 4, !tbaa !16
  %101 = or i32 %100, 32768
  store volatile i32 %101, ptr %86, align 4, !tbaa !16
  tail call void @I2C_Enable_IRQ(ptr noundef nonnull %0, i16 noundef zeroext -32766)
  br label %102

102:                                              ; preds = %4, %14, %99, %94, %79, %12
  %.0 = phi i32 [ 1, %12 ], [ 0, %99 ], [ 1, %94 ], [ 1, %79 ], [ 2, %14 ], [ 1, %4 ]
  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, !11, i64 88}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !11, i64 0}
!17 = !{!"", !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}
!18 = !{!6, !7, i64 72}
!19 = !{!20, !7, i64 112}
!20 = !{!"__DMA_HandleTypeDef", !7, i64 0, !21, 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}
!21 = !{!"", !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}
!22 = !{!6, !7, i64 80}
!23 = !{!7, !7, i64 0}
!24 = !{!6, !11, i64 96}
!25 = !{!17, !11, i64 4}
!26 = !{!6, !7, i64 40}
!27 = !{!6, !12, i64 50}
!28 = !{!6, !12, i64 48}
!29 = !{!6, !11, i64 52}
!30 = !{!6, !7, i64 64}
!31 = !{!20, !7, i64 72}
!32 = !{!20, !7, i64 104}
!33 = !{!20, !7, i64 80}
!34 = !{!17, !11, i64 24}
!35 = !{!17, !11, i64 28}


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