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

; 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.DCMI_HandleTypeDef = type { ptr, %struct.DCMI_InitTypeDef, i32, i32, i32, i32, i32, i32, ptr, i32 }
%struct.DCMI_InitTypeDef = type { i32, i32, i32, i32, i32, i32, %struct.DCMI_CodesInitTypeDef, i32, i32, i32, i32, i32 }
%struct.DCMI_CodesInitTypeDef = type { i8, i8, i8, i8 }
%struct.DCMI_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: nounwind uwtable
define dso_local i32 @HAL_DCMI_Start_DMA(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  br label %12

12:                                               ; preds = %4
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 8, !tbaa !11
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %17, label %18

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

18:                                               ; preds = %12
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %19, i32 0, i32 2
  store i32 1, ptr %20, align 8, !tbaa !11
  br label %21

21:                                               ; preds = %18
  br label %22

22:                                               ; preds = %21
  br label %23

23:                                               ; preds = %22
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %24, i32 0, i32 3
  store volatile i32 2, ptr %25, align 4, !tbaa !15
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %28, i32 0, i32 0
  %30 = load volatile i32, ptr %29, align 4, !tbaa !17
  %31 = zext i32 %30 to i64
  %32 = or i64 %31, 16384
  %33 = trunc i64 %32 to i32
  store volatile i32 %33, ptr %29, align 4, !tbaa !17
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %37 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %36, i32 0, i32 0
  %38 = load volatile i32, ptr %37, align 4, !tbaa !17
  %39 = zext i32 %38 to i64
  %40 = and i64 %39, -3
  %41 = trunc i64 %40 to i32
  store volatile i32 %41, ptr %37, align 4, !tbaa !17
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  %46 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %45, i32 0, i32 0
  %47 = load volatile i32, ptr %46, align 4, !tbaa !17
  %48 = or i32 %47, %42
  store volatile i32 %48, ptr %46, align 4, !tbaa !17
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %49, i32 0, i32 8
  %51 = load ptr, ptr %50, align 8, !tbaa !19
  %52 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %51, i32 0, i32 5
  store ptr @DCMI_DMAXferCplt, ptr %52, align 8, !tbaa !20
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %53, i32 0, i32 8
  %55 = load ptr, ptr %54, align 8, !tbaa !19
  %56 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %55, i32 0, i32 9
  store ptr @DCMI_DMAError, ptr %56, align 8, !tbaa !23
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %57, i32 0, i32 8
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %59, i32 0, i32 10
  store ptr null, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %61, i32 0, i32 4
  store volatile i32 0, ptr %62, align 8, !tbaa !25
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %63, i32 0, i32 6
  store i32 0, ptr %64, align 8, !tbaa !26
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %65, i32 0, i32 5
  store volatile i32 0, ptr %66, align 4, !tbaa !27
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %67, i32 0, i32 7
  store i32 0, ptr %68, align 4, !tbaa !28
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = icmp ule i32 %69, 65535
  br i1 %70, label %71, label %95

71:                                               ; preds = %23
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %72, i32 0, i32 8
  %74 = load ptr, ptr %73, align 8, !tbaa !19
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  %78 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %77, i32 0, i32 10
  %79 = ptrtoint ptr %78 to i32
  %80 = load i32, ptr %8, align 4, !tbaa !9
  %81 = load i32, ptr %9, align 4, !tbaa !9
  %82 = call i32 @HAL_DMA_Start_IT(ptr noundef %74, i32 noundef %79, i32 noundef %80, i32 noundef %81)
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %94

84:                                               ; preds = %71
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %85, i32 0, i32 9
  store volatile i32 64, ptr %86, align 8, !tbaa !29
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %87, i32 0, i32 3
  store volatile i32 1, ptr %88, align 4, !tbaa !15
  br label %89

89:                                               ; preds = %84
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %90, i32 0, i32 2
  store i32 0, ptr %91, align 8, !tbaa !11
  br label %92

92:                                               ; preds = %89
  br label %93

93:                                               ; preds = %92
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %184

94:                                               ; preds = %71
  br label %170

95:                                               ; preds = %23
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %96, i32 0, i32 8
  %98 = load ptr, ptr %97, align 8, !tbaa !19
  %99 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %98, i32 0, i32 7
  store ptr @DCMI_DMAXferCplt, ptr %99, align 8, !tbaa !30
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %100, i32 0, i32 4
  store volatile i32 1, ptr %101, align 8, !tbaa !25
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = load ptr, ptr %6, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %103, i32 0, i32 5
  store volatile i32 %102, ptr %104, align 4, !tbaa !27
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %106, i32 0, i32 7
  store i32 %105, ptr %107, align 4, !tbaa !28
  br label %108

108:                                              ; preds = %113, %95
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %109, i32 0, i32 5
  %111 = load volatile i32, ptr %110, align 4, !tbaa !27
  %112 = icmp ugt i32 %111, 65535
  br i1 %112, label %113, label %126

113:                                              ; preds = %108
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %114, i32 0, i32 5
  %116 = load volatile i32, ptr %115, align 4, !tbaa !27
  %117 = udiv i32 %116, 2
  %118 = load ptr, ptr %6, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %118, i32 0, i32 5
  store volatile i32 %117, ptr %119, align 4, !tbaa !27
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %120, i32 0, i32 4
  %122 = load volatile i32, ptr %121, align 8, !tbaa !25
  %123 = mul i32 %122, 2
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %124, i32 0, i32 4
  store volatile i32 %123, ptr %125, align 8, !tbaa !25
  br label %108, !llvm.loop !31

126:                                              ; preds = %108
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %127, i32 0, i32 4
  %129 = load volatile i32, ptr %128, align 8, !tbaa !25
  %130 = sub i32 %129, 2
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %131, i32 0, i32 4
  store volatile i32 %130, ptr %132, align 8, !tbaa !25
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %133, i32 0, i32 4
  %135 = load volatile i32, ptr %134, align 8, !tbaa !25
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %136, i32 0, i32 6
  store i32 %135, ptr %137, align 8, !tbaa !26
  %138 = load i32, ptr %8, align 4, !tbaa !9
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %139, i32 0, i32 5
  %141 = load volatile i32, ptr %140, align 4, !tbaa !27
  %142 = mul i32 4, %141
  %143 = add i32 %138, %142
  store i32 %143, ptr %10, align 4, !tbaa !9
  %144 = load ptr, ptr %6, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %144, i32 0, i32 8
  %146 = load ptr, ptr %145, align 8, !tbaa !19
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !16
  %150 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %149, i32 0, i32 10
  %151 = ptrtoint ptr %150 to i32
  %152 = load i32, ptr %8, align 4, !tbaa !9
  %153 = load i32, ptr %10, align 4, !tbaa !9
  %154 = load ptr, ptr %6, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %154, i32 0, i32 5
  %156 = load volatile i32, ptr %155, align 4, !tbaa !27
  %157 = call i32 @HAL_DMAEx_MultiBufferStart_IT(ptr noundef %146, i32 noundef %151, i32 noundef %152, i32 noundef %153, i32 noundef %156)
  %158 = icmp ne i32 %157, 0
  br i1 %158, label %159, label %169

159:                                              ; preds = %126
  %160 = load ptr, ptr %6, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %160, i32 0, i32 9
  store volatile i32 64, ptr %161, align 8, !tbaa !29
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %162, i32 0, i32 3
  store volatile i32 1, ptr %163, align 4, !tbaa !15
  br label %164

164:                                              ; preds = %159
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %165, i32 0, i32 2
  store i32 0, ptr %166, align 8, !tbaa !11
  br label %167

167:                                              ; preds = %164
  br label %168

168:                                              ; preds = %167
  store i32 1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %184

169:                                              ; preds = %126
  br label %170

170:                                              ; preds = %169, %94
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %171, i32 0, i32 0
  %173 = load ptr, ptr %172, align 8, !tbaa !16
  %174 = getelementptr inbounds %struct.DCMI_TypeDef, ptr %173, i32 0, i32 0
  %175 = load volatile i32, ptr %174, align 4, !tbaa !17
  %176 = zext i32 %175 to i64
  %177 = or i64 %176, 1
  %178 = trunc i64 %177 to i32
  store volatile i32 %178, ptr %174, align 4, !tbaa !17
  br label %179

179:                                              ; preds = %170
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.DCMI_HandleTypeDef, ptr %180, i32 0, i32 2
  store i32 0, ptr %181, align 8, !tbaa !11
  br label %182

182:                                              ; preds = %179
  br label %183

183:                                              ; preds = %182
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %184

184:                                              ; preds = %183, %168, %93, %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %185 = load i32, ptr %5, align 4
  ret i32 %185
}

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

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

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

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

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 56}
!12 = !{!"", !6, i64 0, !13, i64 8, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !6, i64 80, !10, i64 88}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !14, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!14 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3}
!15 = !{!12, !10, i64 60}
!16 = !{!12, !6, i64 0}
!17 = !{!18, !10, i64 0}
!18 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40}
!19 = !{!12, !6, i64 80}
!20 = !{!21, !6, i64 72}
!21 = !{!"__DMA_HandleTypeDef", !6, i64 0, !22, i64 8, !10, i64 56, !10, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136, !6, i64 144, !10, i64 152, !6, i64 160, !6, i64 168, !10, i64 176}
!22 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!23 = !{!21, !6, i64 104}
!24 = !{!21, !6, i64 112}
!25 = !{!12, !10, i64 64}
!26 = !{!12, !10, i64 72}
!27 = !{!12, !10, i64 68}
!28 = !{!12, !10, i64 76}
!29 = !{!12, !10, i64 88}
!30 = !{!21, !6, i64 88}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}


; 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
define dso_local range(i32 0, 3) i32 @HAL_DCMI_Start_DMA(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = getelementptr inbounds i8, ptr %0, i64 56
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %61, label %8

8:                                                ; preds = %4
  store i32 1, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 60
  store volatile i32 2, ptr %9, align 4, !tbaa !13
  %10 = load ptr, ptr %0, align 8, !tbaa !14
  %11 = load volatile i32, ptr %10, align 4, !tbaa !15
  %12 = or i32 %11, 16384
  store volatile i32 %12, ptr %10, align 4, !tbaa !15
  %13 = load volatile i32, ptr %10, align 4, !tbaa !15
  %14 = and i32 %13, -3
  store volatile i32 %14, ptr %10, align 4, !tbaa !15
  %15 = load volatile i32, ptr %10, align 4, !tbaa !15
  %16 = or i32 %15, %1
  store volatile i32 %16, ptr %10, align 4, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 80
  %18 = load ptr, ptr %17, align 8, !tbaa !17
  %19 = getelementptr inbounds i8, ptr %18, i64 72
  store ptr @DCMI_DMAXferCplt, ptr %19, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %18, i64 104
  store ptr @DCMI_DMAError, ptr %20, align 8, !tbaa !21
  %21 = getelementptr inbounds i8, ptr %18, i64 112
  store ptr null, ptr %21, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %0, i64 64
  store volatile i32 0, ptr %22, align 8, !tbaa !23
  %23 = getelementptr inbounds i8, ptr %0, i64 72
  store i32 0, ptr %23, align 8, !tbaa !24
  %24 = getelementptr inbounds i8, ptr %0, i64 68
  store volatile i32 0, ptr %24, align 4, !tbaa !25
  %25 = getelementptr inbounds i8, ptr %0, i64 76
  store i32 0, ptr %25, align 4, !tbaa !26
  %26 = icmp ult i32 %3, 65536
  br i1 %26, label %27, label %34

27:                                               ; preds = %8
  %28 = getelementptr inbounds i8, ptr %10, i64 40
  %29 = ptrtoint ptr %28 to i64
  %30 = trunc i64 %29 to i32
  %31 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %18, i32 noundef %30, i32 noundef %2, i32 noundef %3) #2
  %.not50 = icmp eq i32 %31, 0
  br i1 %.not50, label %57, label %32

32:                                               ; preds = %27
  %33 = getelementptr inbounds i8, ptr %0, i64 88
  store volatile i32 64, ptr %33, align 8, !tbaa !27
  store volatile i32 1, ptr %9, align 4, !tbaa !13
  br label %.sink.split

34:                                               ; preds = %8
  %35 = getelementptr inbounds i8, ptr %18, i64 88
  store ptr @DCMI_DMAXferCplt, ptr %35, align 8, !tbaa !28
  store volatile i32 1, ptr %22, align 8, !tbaa !23
  store volatile i32 %3, ptr %24, align 4, !tbaa !25
  store i32 %2, ptr %25, align 4, !tbaa !26
  %36 = load volatile i32, ptr %24, align 4, !tbaa !25
  %37 = icmp ugt i32 %36, 65535
  br i1 %37, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %34, %.lr.ph
  %38 = load volatile i32, ptr %24, align 4, !tbaa !25
  %39 = lshr i32 %38, 1
  store volatile i32 %39, ptr %24, align 4, !tbaa !25
  %40 = load volatile i32, ptr %22, align 8, !tbaa !23
  %41 = shl i32 %40, 1
  store volatile i32 %41, ptr %22, align 8, !tbaa !23
  %42 = load volatile i32, ptr %24, align 4, !tbaa !25
  %43 = icmp ugt i32 %42, 65535
  br i1 %43, label %.lr.ph, label %._crit_edge, !llvm.loop !29

._crit_edge:                                      ; preds = %.lr.ph, %34
  %44 = load volatile i32, ptr %22, align 8, !tbaa !23
  %45 = add i32 %44, -2
  store volatile i32 %45, ptr %22, align 8, !tbaa !23
  %46 = load volatile i32, ptr %22, align 8, !tbaa !23
  store i32 %46, ptr %23, align 8, !tbaa !24
  %47 = load volatile i32, ptr %24, align 4, !tbaa !25
  %48 = shl i32 %47, 2
  %49 = add i32 %48, %2
  %50 = getelementptr inbounds i8, ptr %10, i64 40
  %51 = ptrtoint ptr %50 to i64
  %52 = trunc i64 %51 to i32
  %53 = load volatile i32, ptr %24, align 4, !tbaa !25
  %54 = tail call i32 @HAL_DMAEx_MultiBufferStart_IT(ptr noundef %18, i32 noundef %52, i32 noundef %2, i32 noundef %49, i32 noundef %53) #2
  %.not = icmp eq i32 %54, 0
  br i1 %.not, label %57, label %55

55:                                               ; preds = %._crit_edge
  %56 = getelementptr inbounds i8, ptr %0, i64 88
  store volatile i32 64, ptr %56, align 8, !tbaa !27
  store volatile i32 1, ptr %9, align 4, !tbaa !13
  br label %.sink.split

57:                                               ; preds = %._crit_edge, %27
  %58 = load ptr, ptr %0, align 8, !tbaa !14
  %59 = load volatile i32, ptr %58, align 4, !tbaa !15
  %60 = or i32 %59, 1
  store volatile i32 %60, ptr %58, align 4, !tbaa !15
  br label %.sink.split

.sink.split:                                      ; preds = %32, %55, %57
  %.0.ph = phi i32 [ 1, %55 ], [ 0, %57 ], [ 1, %32 ]
  store i32 0, ptr %5, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %.sink.split, %4
  %.0 = phi i32 [ 2, %4 ], [ %.0.ph, %.sink.split ]
  ret i32 %.0
}

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

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

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

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

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 56}
!6 = !{!"", !7, i64 0, !10, i64 8, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !7, i64 80, !11, i64 88}
!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, !12, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3}
!13 = !{!6, !11, i64 60}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !11, i64 0}
!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, !7, i64 80}
!18 = !{!19, !7, i64 72}
!19 = !{!"__DMA_HandleTypeDef", !7, i64 0, !20, 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}
!20 = !{!"", !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}
!21 = !{!19, !7, i64 104}
!22 = !{!19, !7, i64 112}
!23 = !{!6, !11, i64 64}
!24 = !{!6, !11, i64 72}
!25 = !{!6, !11, i64 68}
!26 = !{!6, !11, i64 76}
!27 = !{!6, !11, i64 88}
!28 = !{!19, !7, i64 88}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass