; LLVM IR from ctlst-tech/catpilot :: bsp/mcu/core/stm32/h753/hal/src (stm32h7xx_hal_adc_ex)

; 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.ADC_HandleTypeDef = type { ptr, %struct.ADC_InitTypeDef, ptr, i32, i32, i32, %struct.ADC_InjectionConfigTypeDef }
%struct.ADC_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ADC_OversamplingTypeDef }
%struct.ADC_OversamplingTypeDef = type { i32, i32, i32, i32 }
%struct.ADC_InjectionConfigTypeDef = type { i32, i32 }
%struct.ADC_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [4 x i32], i32, i32, i32, i32, [4 x i32], i32, i32, i32, i32, [4 x 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 @ADC_Disable(ptr noundef) #1

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

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

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

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

declare i32 @HAL_GetTick() #1

declare i32 @HAL_DMA_Abort(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_ADCEx_RegularMultiModeStop_DMA(ptr noundef %0) #3 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.ADC_HandleTypeDef, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 120, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  br label %9

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %10, i32 0, i32 3
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %15

14:                                               ; preds = %9
  store i32 2, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %184

15:                                               ; preds = %9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %16, i32 0, i32 3
  store i32 1, ptr %17, align 8, !tbaa !9
  br label %18

18:                                               ; preds = %15
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call i32 @ADC_ConversionStop(ptr noundef %21, i32 noundef 1)
  store i32 %22, ptr %4, align 4, !tbaa !15
  %23 = load i32, ptr %4, align 4, !tbaa !15
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %177

25:                                               ; preds = %20
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %26, i32 0, i32 4
  %28 = load volatile i32, ptr %27, align 4, !tbaa !16
  %29 = zext i32 %28 to i64
  %30 = and i64 %29, -257
  %31 = trunc i64 %30 to i32
  store volatile i32 %31, ptr %27, align 4, !tbaa !16
  %32 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 4
  store volatile i32 0, ptr %32, align 4, !tbaa !16
  %33 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 5
  store volatile i32 0, ptr %33, align 8, !tbaa !17
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !18
  %37 = icmp eq ptr %36, inttoptr (i64 1073881088 to ptr)
  br i1 %37, label %38, label %40

38:                                               ; preds = %25
  %39 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  store ptr inttoptr (i64 1073881344 to ptr), ptr %39, align 8, !tbaa !18
  br label %42

40:                                               ; preds = %25
  %41 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  store ptr null, ptr %41, align 8, !tbaa !18
  br label %42

42:                                               ; preds = %40, %38
  %43 = phi ptr [ inttoptr (i64 1073881344 to ptr), %38 ], [ null, %40 ]
  %44 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !18
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %59

47:                                               ; preds = %42
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %48, i32 0, i32 4
  %50 = load volatile i32, ptr %49, align 4, !tbaa !16
  %51 = zext i32 %50 to i64
  %52 = or i64 %51, 32
  %53 = trunc i64 %52 to i32
  store volatile i32 %53, ptr %49, align 4, !tbaa !16
  br label %54

54:                                               ; preds = %47
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %55, i32 0, i32 3
  store i32 0, ptr %56, align 8, !tbaa !9
  br label %57

57:                                               ; preds = %54
  br label %58

58:                                               ; preds = %57
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %184

59:                                               ; preds = %42
  %60 = call i32 @HAL_GetTick()
  store i32 %60, ptr %5, align 4, !tbaa !15
  %61 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  %63 = call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %62)
  store i32 %63, ptr %7, align 4, !tbaa !15
  br label %64

64:                                               ; preds = %110, %59
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %67)
  %69 = zext i32 %68 to i64
  %70 = icmp eq i64 %69, 1
  br i1 %70, label %75, label %71

71:                                               ; preds = %64
  %72 = load i32, ptr %7, align 4, !tbaa !15
  %73 = zext i32 %72 to i64
  %74 = icmp eq i64 %73, 1
  br label %75

75:                                               ; preds = %71, %64
  %76 = phi i1 [ true, %64 ], [ %74, %71 ]
  br i1 %76, label %77, label %114

77:                                               ; preds = %75
  %78 = call i32 @HAL_GetTick()
  %79 = load i32, ptr %5, align 4, !tbaa !15
  %80 = sub i32 %78, %79
  %81 = zext i32 %80 to i64
  %82 = icmp ugt i64 %81, 5
  br i1 %82, label %83, label %110

83:                                               ; preds = %77
  %84 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !18
  %86 = call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %85)
  store i32 %86, ptr %7, align 4, !tbaa !15
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !18
  %90 = call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %89)
  %91 = zext i32 %90 to i64
  %92 = icmp eq i64 %91, 1
  br i1 %92, label %97, label %93

93:                                               ; preds = %83
  %94 = load i32, ptr %7, align 4, !tbaa !15
  %95 = zext i32 %94 to i64
  %96 = icmp eq i64 %95, 1
  br i1 %96, label %97, label %109

97:                                               ; preds = %93, %83
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %98, i32 0, i32 4
  %100 = load volatile i32, ptr %99, align 4, !tbaa !16
  %101 = zext i32 %100 to i64
  %102 = or i64 %101, 16
  %103 = trunc i64 %102 to i32
  store volatile i32 %103, ptr %99, align 4, !tbaa !16
  br label %104

104:                                              ; preds = %97
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %105, i32 0, i32 3
  store i32 0, ptr %106, align 8, !tbaa !9
  br label %107

107:                                              ; preds = %104
  br label %108

108:                                              ; preds = %107
  store i32 1, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %184

109:                                              ; preds = %93
  br label %110

110:                                              ; preds = %109, %77
  %111 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !18
  %113 = call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %112)
  store i32 %113, ptr %7, align 4, !tbaa !15
  br label %64, !llvm.loop !19

114:                                              ; preds = %75
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %115, i32 0, i32 2
  %117 = load ptr, ptr %116, align 8, !tbaa !21
  %118 = call i32 @HAL_DMA_Abort(ptr noundef %117)
  store i32 %118, ptr %4, align 4, !tbaa !15
  %119 = load i32, ptr %4, align 4, !tbaa !15
  %120 = icmp ne i32 %119, 0
  br i1 %120, label %121, label %128

121:                                              ; preds = %114
  %122 = load ptr, ptr %3, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %122, i32 0, i32 4
  %124 = load volatile i32, ptr %123, align 4, !tbaa !16
  %125 = zext i32 %124 to i64
  %126 = or i64 %125, 64
  %127 = trunc i64 %126 to i32
  store volatile i32 %127, ptr %123, align 4, !tbaa !16
  br label %128

128:                                              ; preds = %121, %114
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %129, i32 0, i32 0
  %131 = load ptr, ptr %130, align 8, !tbaa !18
  %132 = getelementptr inbounds %struct.ADC_TypeDef, ptr %131, i32 0, i32 1
  %133 = load volatile i32, ptr %132, align 4, !tbaa !22
  %134 = zext i32 %133 to i64
  %135 = and i64 %134, -17
  %136 = trunc i64 %135 to i32
  store volatile i32 %136, ptr %132, align 4, !tbaa !22
  %137 = load i32, ptr %4, align 4, !tbaa !15
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %176

139:                                              ; preds = %128
  %140 = load ptr, ptr %3, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %140, i32 0, i32 0
  %142 = load ptr, ptr %141, align 8, !tbaa !18
  %143 = call i32 @LL_ADC_INJ_IsConversionOngoing(ptr noundef %142)
  %144 = zext i32 %143 to i64
  %145 = icmp eq i64 %144, 0
  br i1 %145, label %146, label %161

146:                                              ; preds = %139
  %147 = load ptr, ptr %3, align 8, !tbaa !5
  %148 = call i32 @ADC_Disable(ptr noundef %147)
  store i32 %148, ptr %4, align 4, !tbaa !15
  %149 = load i32, ptr %4, align 4, !tbaa !15
  %150 = icmp eq i32 %149, 0
  br i1 %150, label %151, label %160

151:                                              ; preds = %146
  %152 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %6, i32 0, i32 0
  %153 = load ptr, ptr %152, align 8, !tbaa !18
  %154 = call i32 @LL_ADC_INJ_IsConversionOngoing(ptr noundef %153)
  %155 = zext i32 %154 to i64
  %156 = icmp eq i64 %155, 0
  br i1 %156, label %157, label %159

157:                                              ; preds = %151
  %158 = call i32 @ADC_Disable(ptr noundef %6)
  store i32 %158, ptr %4, align 4, !tbaa !15
  br label %159

159:                                              ; preds = %157, %151
  br label %160

160:                                              ; preds = %159, %146
  br label %161

161:                                              ; preds = %160, %139
  %162 = load i32, ptr %4, align 4, !tbaa !15
  %163 = icmp eq i32 %162, 0
  br i1 %163, label %164, label %174

164:                                              ; preds = %161
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %165, i32 0, i32 4
  %167 = load volatile i32, ptr %166, align 4, !tbaa !16
  %168 = zext i32 %167 to i64
  %169 = and i64 %168, -4097
  %170 = or i64 %169, 1
  %171 = trunc i64 %170 to i32
  %172 = load ptr, ptr %3, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %172, i32 0, i32 4
  store volatile i32 %171, ptr %173, align 4, !tbaa !16
  br label %175

174:                                              ; preds = %161
  br label %175

175:                                              ; preds = %174, %164
  br label %176

176:                                              ; preds = %175, %128
  br label %177

177:                                              ; preds = %176, %20
  br label %178

178:                                              ; preds = %177
  %179 = load ptr, ptr %3, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.ADC_HandleTypeDef, ptr %179, i32 0, i32 3
  store i32 0, ptr %180, align 8, !tbaa !9
  br label %181

181:                                              ; preds = %178
  br label %182

182:                                              ; preds = %181
  %183 = load i32, ptr %4, align 4, !tbaa !15
  store i32 %183, ptr %2, align 4
  store i32 1, ptr %8, align 4
  br label %184

184:                                              ; preds = %182, %108, %58, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 120, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  %185 = load i32, ptr %2, align 4
  ret i32 %185
}

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 = { inlinehint 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 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 #4 = { 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, !12, i64 96}
!10 = !{!"", !6, i64 0, !11, i64 8, !6, i64 88, !12, i64 96, !12, i64 100, !12, i64 104, !14, i64 108}
!11 = !{!"", !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, !12, i64 48, !12, i64 52, !12, i64 56, !13, i64 60}
!12 = !{!"int", !7, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!14 = !{!"", !12, i64 0, !12, i64 4}
!15 = !{!12, !12, i64 0}
!16 = !{!10, !12, i64 100}
!17 = !{!10, !12, i64 104}
!18 = !{!10, !6, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!10, !6, i64 88}
!22 = !{!23, !12, i64 4}
!23 = !{!"", !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, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !7, i64 80, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !7, i64 112, !12, i64 128, !12, i64 132, !12, i64 136, !12, i64 140, !7, i64 144, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !12, i64 176, !12, i64 180, !12, i64 184, !12, i64 188, !12, i64 192, !12, i64 196, !12, i64 200}


; 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"

%struct.ADC_HandleTypeDef = type { ptr, %struct.ADC_InitTypeDef, ptr, i32, i32, i32, %struct.ADC_InjectionConfigTypeDef }
%struct.ADC_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.ADC_OversamplingTypeDef }
%struct.ADC_OversamplingTypeDef = type { i32, i32, i32, i32 }
%struct.ADC_InjectionConfigTypeDef = type { i32, i32 }

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

declare i32 @ADC_Disable(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @LL_ADC_INJ_IsConversionOngoing(ptr noundef) local_unnamed_addr #2

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

declare i32 @HAL_GetTick() local_unnamed_addr #1

declare i32 @HAL_DMA_Abort(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_ADCEx_RegularMultiModeStop_DMA(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca %struct.ADC_HandleTypeDef, align 8
  call void @llvm.lifetime.start.p0(i64 120, ptr nonnull %2) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 96
  %4 = load i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %76, label %6

6:                                                ; preds = %1
  store i32 1, ptr %3, align 8, !tbaa !5
  %7 = tail call i32 @ADC_ConversionStop(ptr noundef nonnull %0, i32 noundef 1) #4
  %8 = icmp eq i32 %7, 0
  br i1 %8, label %9, label %.sink.split

9:                                                ; preds = %6
  %10 = getelementptr inbounds i8, ptr %0, i64 100
  %11 = load volatile i32, ptr %10, align 4, !tbaa !14
  %12 = and i32 %11, -257
  store volatile i32 %12, ptr %10, align 4, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %2, i64 100
  store volatile i32 0, ptr %13, align 4, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %2, i64 104
  store volatile i32 0, ptr %14, align 8, !tbaa !15
  %15 = load ptr, ptr %0, align 8, !tbaa !16
  %.not = icmp eq ptr %15, inttoptr (i64 1073881088 to ptr)
  %. = select i1 %.not, ptr inttoptr (i64 1073881344 to ptr), ptr null
  store ptr %., ptr %2, align 8, !tbaa !16
  br i1 %.not, label %19, label %16

16:                                               ; preds = %9
  %17 = load volatile i32, ptr %10, align 4, !tbaa !14
  %18 = or i32 %17, 32
  store volatile i32 %18, ptr %10, align 4, !tbaa !14
  br label %.sink.split

19:                                               ; preds = %9
  %20 = tail call i32 @HAL_GetTick() #4
  %21 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef nonnull inttoptr (i64 1073881344 to ptr))
  %22 = load ptr, ptr %0, align 8, !tbaa !16
  %23 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %22)
  %24 = icmp eq i32 %23, 1
  %25 = icmp eq i32 %21, 1
  %26 = select i1 %24, i1 true, i1 %25
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %19, %39
  %27 = tail call i32 @HAL_GetTick() #4
  %28 = sub i32 %27, %20
  %29 = icmp ugt i32 %28, 5
  br i1 %29, label %30, label %39

30:                                               ; preds = %.lr.ph
  %31 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %.)
  %32 = load ptr, ptr %0, align 8, !tbaa !16
  %33 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %32)
  %34 = icmp eq i32 %33, 1
  %35 = icmp eq i32 %31, 1
  %or.cond = select i1 %34, i1 true, i1 %35
  br i1 %or.cond, label %36, label %39

36:                                               ; preds = %30
  %37 = load volatile i32, ptr %10, align 4, !tbaa !14
  %38 = or i32 %37, 16
  store volatile i32 %38, ptr %10, align 4, !tbaa !14
  br label %.sink.split

39:                                               ; preds = %30, %.lr.ph
  %40 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %.)
  %41 = load ptr, ptr %0, align 8, !tbaa !16
  %42 = tail call i32 @LL_ADC_REG_IsConversionOngoing(ptr noundef %41)
  %43 = icmp eq i32 %42, 1
  %44 = icmp eq i32 %40, 1
  %45 = select i1 %43, i1 true, i1 %44
  br i1 %45, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %39, %19
  %46 = getelementptr inbounds i8, ptr %0, i64 88
  %47 = load ptr, ptr %46, align 8, !tbaa !19
  %48 = tail call i32 @HAL_DMA_Abort(ptr noundef %47) #4
  %.not37 = icmp eq i32 %48, 0
  br i1 %.not37, label %56, label %49

49:                                               ; preds = %._crit_edge
  %50 = load volatile i32, ptr %10, align 4, !tbaa !14
  %51 = or i32 %50, 64
  store volatile i32 %51, ptr %10, align 4, !tbaa !14
  %52 = load ptr, ptr %0, align 8, !tbaa !16
  %53 = getelementptr inbounds i8, ptr %52, i64 4
  %54 = load volatile i32, ptr %53, align 4, !tbaa !20
  %55 = and i32 %54, -17
  store volatile i32 %55, ptr %53, align 4, !tbaa !20
  br label %.sink.split

56:                                               ; preds = %._crit_edge
  %57 = load ptr, ptr %0, align 8, !tbaa !16
  %58 = getelementptr inbounds i8, ptr %57, i64 4
  %59 = load volatile i32, ptr %58, align 4, !tbaa !20
  %60 = and i32 %59, -17
  store volatile i32 %60, ptr %58, align 4, !tbaa !20
  %61 = tail call i32 @LL_ADC_INJ_IsConversionOngoing(ptr noundef %57)
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %.thread38

63:                                               ; preds = %56
  %64 = tail call i32 @ADC_Disable(ptr noundef nonnull %0) #4
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %.sink.split

66:                                               ; preds = %63
  %67 = load ptr, ptr %2, align 8, !tbaa !16
  %68 = tail call i32 @LL_ADC_INJ_IsConversionOngoing(ptr noundef %67)
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %.thread38

70:                                               ; preds = %66
  %71 = call i32 @ADC_Disable(ptr noundef nonnull %2) #4
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %.thread38, label %.sink.split

.thread38:                                        ; preds = %56, %66, %70
  %73 = load volatile i32, ptr %10, align 4, !tbaa !14
  %74 = and i32 %73, -4098
  %75 = or disjoint i32 %74, 1
  store volatile i32 %75, ptr %10, align 4, !tbaa !14
  br label %.sink.split

.sink.split:                                      ; preds = %70, %.thread38, %6, %49, %63, %16, %36
  %.030.ph = phi i32 [ 1, %36 ], [ 1, %16 ], [ 0, %.thread38 ], [ %71, %70 ], [ %48, %49 ], [ %7, %6 ], [ %64, %63 ]
  store i32 0, ptr %3, align 8, !tbaa !5
  br label %76

76:                                               ; preds = %.sink.split, %1
  %.030 = phi i32 [ 2, %1 ], [ %.030.ph, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 120, ptr nonnull %2) #4
  ret i32 %.030
}

attributes #0 = { mustprogress 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 = { inlinehint 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 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 #4 = { 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 96}
!6 = !{!"", !7, i64 0, !10, i64 8, !7, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !13, i64 108}
!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, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !12, i64 60}
!11 = !{!"int", !8, i64 0}
!12 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!13 = !{!"", !11, i64 0, !11, i64 4}
!14 = !{!6, !11, i64 100}
!15 = !{!6, !11, i64 104}
!16 = !{!6, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!6, !7, i64 88}
!20 = !{!21, !11, i64 4}
!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, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !8, i64 80, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !8, i64 112, !11, i64 128, !11, i64 132, !11, i64 136, !11, i64 140, !8, i64 144, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172, !11, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200}


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