; LLVM IR from lichen-community-systems/signaletic :: hosts/daisy/vendor/libDaisy/Drivers/STM32H7xx_HAL_Driver/Src (DMA)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.HRTIM_HandleTypeDef = type { ptr, %struct.HRTIM_InitTypeDef, [6 x %struct.HRTIM_TimerParamTypeDef], i32, i32, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.HRTIM_InitTypeDef = type { i32, i32, i32, i32, i32 }
%struct.HRTIM_TimerParamTypeDef = type { 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 }
%struct.HRTIM_TypeDef = type { %struct.HRTIM_Master_TypeDef, [5 x %struct.HRTIM_Timerx_TypeDef], [32 x i32], %struct.HRTIM_Common_TypeDef }
%struct.HRTIM_Master_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [20 x i32] }
%struct.HRTIM_Timerx_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [5 x i32] }
%struct.HRTIM_Common_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

@TimerIdxToTimerId = external hidden global [6 x i32], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @HRTIM_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_HRTIM_WaveformCountStart_DMA(ptr noundef %0, i32 noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %9, i32 0, i32 4
  %11 = load volatile i32, ptr %10, align 8, !tbaa !11
  %12 = icmp eq i32 %11, 2
  br i1 %12, label %13, label %14

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

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %15, i32 0, i32 4
  store volatile i32 2, ptr %16, align 8, !tbaa !11
  br label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  store i32 2, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %202

23:                                               ; preds = %17
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %24, i32 0, i32 3
  store i32 1, ptr %25, align 4, !tbaa !14
  br label %26

26:                                               ; preds = %23
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = and i64 %30, 65536
  %32 = icmp ne i64 %31, 0
  br i1 %32, label %33, label %90

33:                                               ; preds = %28
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %34, i32 0, i32 2
  %36 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %35, i64 0, i64 5
  %37 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %36, i32 0, i32 3
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %90

40:                                               ; preds = %33
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %41, i32 0, i32 5
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  %44 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %43, i32 0, i32 9
  store ptr @HRTIM_DMAError, ptr %44, align 8, !tbaa !18
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %45, i32 0, i32 5
  %47 = load ptr, ptr %46, align 8, !tbaa !17
  %48 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %47, i32 0, i32 5
  store ptr @HRTIM_DMAMasterCplt, ptr %48, align 8, !tbaa !21
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %49, i32 0, i32 5
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %52, i32 0, i32 2
  %54 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %53, i64 0, i64 5
  %55 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %54, i32 0, i32 4
  %56 = load i32, ptr %55, align 4, !tbaa !22
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %57, i32 0, i32 2
  %59 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %58, i64 0, i64 5
  %60 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %59, i32 0, i32 5
  %61 = load i32, ptr %60, align 4, !tbaa !23
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %62, i32 0, i32 2
  %64 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %63, i64 0, i64 5
  %65 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %64, i32 0, i32 6
  %66 = load i32, ptr %65, align 4, !tbaa !24
  %67 = call i32 @HAL_DMA_Start_IT(ptr noundef %51, i32 noundef %56, i32 noundef %61, i32 noundef %66)
  %68 = icmp ne i32 %67, 0
  br i1 %68, label %69, label %77

69:                                               ; preds = %40
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %70, i32 0, i32 4
  store volatile i32 7, ptr %71, align 8, !tbaa !11
  br label %72

72:                                               ; preds = %69
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %73, i32 0, i32 3
  store i32 0, ptr %74, align 4, !tbaa !14
  br label %75

75:                                               ; preds = %72
  br label %76

76:                                               ; preds = %75
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %202

77:                                               ; preds = %40
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %78, i32 0, i32 2
  %80 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %79, i64 0, i64 5
  %81 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %80, i32 0, i32 3
  %82 = load i32, ptr %81, align 4, !tbaa !15
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !25
  %86 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %struct.HRTIM_Master_TypeDef, ptr %86, i32 0, i32 3
  %88 = load volatile i32, ptr %87, align 4, !tbaa !26
  %89 = or i32 %88, %82
  store volatile i32 %89, ptr %87, align 4, !tbaa !26
  br label %90

90:                                               ; preds = %77, %33, %28
  store i8 0, ptr %6, align 1, !tbaa !30
  br label %91

91:                                               ; preds = %183, %90
  %92 = load i8, ptr %6, align 1, !tbaa !30
  %93 = zext i8 %92 to i32
  %94 = icmp ult i32 %93, 5
  br i1 %94, label %95, label %186

95:                                               ; preds = %91
  %96 = load i32, ptr %5, align 4, !tbaa !9
  %97 = load i8, ptr %6, align 1, !tbaa !30
  %98 = zext i8 %97 to i64
  %99 = getelementptr inbounds [6 x i32], ptr @TimerIdxToTimerId, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !9
  %101 = and i32 %96, %100
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %182

103:                                              ; preds = %95
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %104, i32 0, i32 2
  %106 = load i8, ptr %6, align 1, !tbaa !30
  %107 = zext i8 %106 to i64
  %108 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %105, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %108, i32 0, i32 3
  %110 = load i32, ptr %109, align 4, !tbaa !15
  %111 = icmp ne i32 %110, 0
  br i1 %111, label %112, label %182

112:                                              ; preds = %103
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = load i8, ptr %6, align 1, !tbaa !30
  %115 = zext i8 %114 to i32
  %116 = call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef %113, i32 noundef %115)
  store ptr %116, ptr %7, align 8, !tbaa !5
  %117 = load ptr, ptr %7, align 8, !tbaa !5
  %118 = icmp eq ptr %117, null
  br i1 %118, label %119, label %127

119:                                              ; preds = %112
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %120, i32 0, i32 4
  store volatile i32 7, ptr %121, align 8, !tbaa !11
  br label %122

122:                                              ; preds = %119
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %123, i32 0, i32 3
  store i32 0, ptr %124, align 4, !tbaa !14
  br label %125

125:                                              ; preds = %122
  br label %126

126:                                              ; preds = %125
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %202

127:                                              ; preds = %112
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %128, i32 0, i32 9
  store ptr @HRTIM_DMAError, ptr %129, align 8, !tbaa !18
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %130, i32 0, i32 5
  store ptr @HRTIM_DMATimerxCplt, ptr %131, align 8, !tbaa !21
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %133, i32 0, i32 2
  %135 = load i8, ptr %6, align 1, !tbaa !30
  %136 = zext i8 %135 to i64
  %137 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %134, i64 0, i64 %136
  %138 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %137, i32 0, i32 4
  %139 = load i32, ptr %138, align 4, !tbaa !22
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %140, i32 0, i32 2
  %142 = load i8, ptr %6, align 1, !tbaa !30
  %143 = zext i8 %142 to i64
  %144 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %141, i64 0, i64 %143
  %145 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %144, i32 0, i32 5
  %146 = load i32, ptr %145, align 4, !tbaa !23
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %147, i32 0, i32 2
  %149 = load i8, ptr %6, align 1, !tbaa !30
  %150 = zext i8 %149 to i64
  %151 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %148, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %151, i32 0, i32 6
  %153 = load i32, ptr %152, align 4, !tbaa !24
  %154 = call i32 @HAL_DMA_Start_IT(ptr noundef %132, i32 noundef %139, i32 noundef %146, i32 noundef %153)
  %155 = icmp ne i32 %154, 0
  br i1 %155, label %156, label %164

156:                                              ; preds = %127
  %157 = load ptr, ptr %4, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %157, i32 0, i32 4
  store volatile i32 7, ptr %158, align 8, !tbaa !11
  br label %159

159:                                              ; preds = %156
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %160, i32 0, i32 3
  store i32 0, ptr %161, align 4, !tbaa !14
  br label %162

162:                                              ; preds = %159
  br label %163

163:                                              ; preds = %162
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %202

164:                                              ; preds = %127
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %165, i32 0, i32 2
  %167 = load i8, ptr %6, align 1, !tbaa !30
  %168 = zext i8 %167 to i64
  %169 = getelementptr inbounds [6 x %struct.HRTIM_TimerParamTypeDef], ptr %166, i64 0, i64 %168
  %170 = getelementptr inbounds %struct.HRTIM_TimerParamTypeDef, ptr %169, i32 0, i32 3
  %171 = load i32, ptr %170, align 4, !tbaa !15
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %172, i32 0, i32 0
  %174 = load ptr, ptr %173, align 8, !tbaa !25
  %175 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %174, i32 0, i32 1
  %176 = load i8, ptr %6, align 1, !tbaa !30
  %177 = zext i8 %176 to i64
  %178 = getelementptr inbounds [5 x %struct.HRTIM_Timerx_TypeDef], ptr %175, i64 0, i64 %177
  %179 = getelementptr inbounds %struct.HRTIM_Timerx_TypeDef, ptr %178, i32 0, i32 3
  %180 = load volatile i32, ptr %179, align 4, !tbaa !31
  %181 = or i32 %180, %171
  store volatile i32 %181, ptr %179, align 4, !tbaa !31
  br label %182

182:                                              ; preds = %164, %103, %95
  br label %183

183:                                              ; preds = %182
  %184 = load i8, ptr %6, align 1, !tbaa !30
  %185 = add i8 %184, 1
  store i8 %185, ptr %6, align 1, !tbaa !30
  br label %91, !llvm.loop !33

186:                                              ; preds = %91
  %187 = load i32, ptr %5, align 4, !tbaa !9
  %188 = load ptr, ptr %4, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %188, i32 0, i32 0
  %190 = load ptr, ptr %189, align 8, !tbaa !25
  %191 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %190, i32 0, i32 0
  %192 = getelementptr inbounds %struct.HRTIM_Master_TypeDef, ptr %191, i32 0, i32 0
  %193 = load volatile i32, ptr %192, align 4, !tbaa !35
  %194 = or i32 %193, %187
  store volatile i32 %194, ptr %192, align 4, !tbaa !35
  %195 = load ptr, ptr %4, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %195, i32 0, i32 4
  store volatile i32 1, ptr %196, align 8, !tbaa !11
  br label %197

197:                                              ; preds = %186
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %198, i32 0, i32 3
  store i32 0, ptr %199, align 4, !tbaa !14
  br label %200

200:                                              ; preds = %197
  br label %201

201:                                              ; preds = %200
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %202

202:                                              ; preds = %201, %163, %126, %76, %22, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  %203 = load i32, ptr %3, align 4
  ret i32 %203
}

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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 200}
!12 = !{!"", !6, i64 0, !13, i64 8, !7, i64 28, !10, i64 196, !10, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248}
!13 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!14 = !{!12, !10, i64 196}
!15 = !{!16, !10, i64 12}
!16 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!17 = !{!12, !6, i64 208}
!18 = !{!19, !6, i64 104}
!19 = !{!"__DMA_HandleTypeDef", !6, i64 0, !20, 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}
!20 = !{!"", !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}
!21 = !{!19, !6, i64 72}
!22 = !{!16, !10, i64 16}
!23 = !{!16, !10, i64 20}
!24 = !{!16, !10, i64 24}
!25 = !{!12, !6, i64 0}
!26 = !{!27, !10, i64 12}
!27 = !{!"", !28, i64 0, !7, i64 128, !7, i64 768, !29, i64 896}
!28 = !{!"", !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, !7, i64 48}
!29 = !{!"", !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, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112}
!30 = !{!7, !7, i64 0}
!31 = !{!32, !10, i64 12}
!32 = !{!"", !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, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !7, i64 108}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!27, !10, 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"

@TimerIdxToTimerId = external hidden local_unnamed_addr global [6 x i32], align 16

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

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

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

; Function Attrs: nounwind uwtable
declare hidden void @HRTIM_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_HRTIM_WaveformCountStart_DMA(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 200
  %4 = load volatile i32, ptr %3, align 8, !tbaa !5
  %5 = icmp eq i32 %4, 2
  br i1 %5, label %162, label %6

6:                                                ; preds = %2
  store volatile i32 2, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 196
  %8 = load i32, ptr %7, align 4, !tbaa !12
  %9 = icmp eq i32 %8, 1
  br i1 %9, label %162, label %10

10:                                               ; preds = %6
  store i32 1, ptr %7, align 4, !tbaa !12
  %11 = and i32 %1, 65536
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %33, label %12

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 180
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %.not49 = icmp eq i32 %14, 0
  br i1 %.not49, label %33, label %15

15:                                               ; preds = %12
  %16 = getelementptr inbounds i8, ptr %0, i64 208
  %17 = load ptr, ptr %16, align 8, !tbaa !15
  %18 = getelementptr inbounds i8, ptr %17, i64 104
  store ptr @HRTIM_DMAError, ptr %18, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %17, i64 72
  store ptr @HRTIM_DMAMasterCplt, ptr %19, align 8, !tbaa !19
  %20 = getelementptr inbounds i8, ptr %0, i64 184
  %21 = load i32, ptr %20, align 4, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %0, i64 188
  %23 = load i32, ptr %22, align 4, !tbaa !21
  %24 = getelementptr inbounds i8, ptr %0, i64 192
  %25 = load i32, ptr %24, align 4, !tbaa !22
  %26 = tail call i32 @HAL_DMA_Start_IT(ptr noundef %17, i32 noundef %21, i32 noundef %23, i32 noundef %25) #2
  %.not50 = icmp eq i32 %26, 0
  br i1 %.not50, label %27, label %.sink.split

27:                                               ; preds = %15
  %28 = load i32, ptr %13, align 4, !tbaa !13
  %29 = load ptr, ptr %0, align 8, !tbaa !23
  %30 = getelementptr inbounds i8, ptr %29, i64 12
  %31 = load volatile i32, ptr %30, align 4, !tbaa !24
  %32 = or i32 %31, %28
  store volatile i32 %32, ptr %30, align 4, !tbaa !24
  br label %33

33:                                               ; preds = %27, %12, %10
  %34 = load i32, ptr @TimerIdxToTimerId, align 16, !tbaa !28
  %35 = and i32 %34, %1
  %.not51 = icmp eq i32 %35, 0
  br i1 %.not51, label %58, label %36

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %0, i64 40
  %38 = load i32, ptr %37, align 4, !tbaa !13
  %.not52 = icmp eq i32 %38, 0
  br i1 %.not52, label %58, label %39

39:                                               ; preds = %36
  %40 = tail call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef nonnull %0, i32 noundef 0)
  %41 = icmp eq ptr %40, null
  br i1 %41, label %.sink.split, label %42

42:                                               ; preds = %39
  %43 = getelementptr inbounds i8, ptr %40, i64 104
  store ptr @HRTIM_DMAError, ptr %43, align 8, !tbaa !16
  %44 = getelementptr inbounds i8, ptr %40, i64 72
  store ptr @HRTIM_DMATimerxCplt, ptr %44, align 8, !tbaa !19
  %45 = getelementptr inbounds i8, ptr %0, i64 44
  %46 = load i32, ptr %45, align 4, !tbaa !20
  %47 = getelementptr inbounds i8, ptr %0, i64 48
  %48 = load i32, ptr %47, align 4, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %0, i64 52
  %50 = load i32, ptr %49, align 4, !tbaa !22
  %51 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %40, i32 noundef %46, i32 noundef %48, i32 noundef %50) #2
  %.not53 = icmp eq i32 %51, 0
  br i1 %.not53, label %52, label %.sink.split

52:                                               ; preds = %42
  %53 = load i32, ptr %37, align 4, !tbaa !13
  %54 = load ptr, ptr %0, align 8, !tbaa !23
  %55 = getelementptr inbounds i8, ptr %54, i64 140
  %56 = load volatile i32, ptr %55, align 4, !tbaa !29
  %57 = or i32 %56, %53
  store volatile i32 %57, ptr %55, align 4, !tbaa !29
  br label %58

58:                                               ; preds = %33, %36, %52
  %59 = load i32, ptr getelementptr inbounds (i8, ptr @TimerIdxToTimerId, i64 4), align 4, !tbaa !28
  %60 = and i32 %59, %1
  %.not51.1 = icmp eq i32 %60, 0
  br i1 %.not51.1, label %83, label %61

61:                                               ; preds = %58
  %62 = getelementptr inbounds i8, ptr %0, i64 68
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %.not52.1 = icmp eq i32 %63, 0
  br i1 %.not52.1, label %83, label %64

64:                                               ; preds = %61
  %65 = tail call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef nonnull %0, i32 noundef 1)
  %66 = icmp eq ptr %65, null
  br i1 %66, label %.sink.split, label %67

67:                                               ; preds = %64
  %68 = getelementptr inbounds i8, ptr %65, i64 104
  store ptr @HRTIM_DMAError, ptr %68, align 8, !tbaa !16
  %69 = getelementptr inbounds i8, ptr %65, i64 72
  store ptr @HRTIM_DMATimerxCplt, ptr %69, align 8, !tbaa !19
  %70 = getelementptr inbounds i8, ptr %0, i64 72
  %71 = load i32, ptr %70, align 4, !tbaa !20
  %72 = getelementptr inbounds i8, ptr %0, i64 76
  %73 = load i32, ptr %72, align 4, !tbaa !21
  %74 = getelementptr inbounds i8, ptr %0, i64 80
  %75 = load i32, ptr %74, align 4, !tbaa !22
  %76 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %65, i32 noundef %71, i32 noundef %73, i32 noundef %75) #2
  %.not53.1 = icmp eq i32 %76, 0
  br i1 %.not53.1, label %77, label %.sink.split

77:                                               ; preds = %67
  %78 = load i32, ptr %62, align 4, !tbaa !13
  %79 = load ptr, ptr %0, align 8, !tbaa !23
  %80 = getelementptr inbounds i8, ptr %79, i64 268
  %81 = load volatile i32, ptr %80, align 4, !tbaa !29
  %82 = or i32 %81, %78
  store volatile i32 %82, ptr %80, align 4, !tbaa !29
  br label %83

83:                                               ; preds = %77, %61, %58
  %84 = load i32, ptr getelementptr inbounds (i8, ptr @TimerIdxToTimerId, i64 8), align 8, !tbaa !28
  %85 = and i32 %84, %1
  %.not51.2 = icmp eq i32 %85, 0
  br i1 %.not51.2, label %108, label %86

86:                                               ; preds = %83
  %87 = getelementptr inbounds i8, ptr %0, i64 96
  %88 = load i32, ptr %87, align 4, !tbaa !13
  %.not52.2 = icmp eq i32 %88, 0
  br i1 %.not52.2, label %108, label %89

89:                                               ; preds = %86
  %90 = tail call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef nonnull %0, i32 noundef 2)
  %91 = icmp eq ptr %90, null
  br i1 %91, label %.sink.split, label %92

92:                                               ; preds = %89
  %93 = getelementptr inbounds i8, ptr %90, i64 104
  store ptr @HRTIM_DMAError, ptr %93, align 8, !tbaa !16
  %94 = getelementptr inbounds i8, ptr %90, i64 72
  store ptr @HRTIM_DMATimerxCplt, ptr %94, align 8, !tbaa !19
  %95 = getelementptr inbounds i8, ptr %0, i64 100
  %96 = load i32, ptr %95, align 4, !tbaa !20
  %97 = getelementptr inbounds i8, ptr %0, i64 104
  %98 = load i32, ptr %97, align 4, !tbaa !21
  %99 = getelementptr inbounds i8, ptr %0, i64 108
  %100 = load i32, ptr %99, align 4, !tbaa !22
  %101 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %90, i32 noundef %96, i32 noundef %98, i32 noundef %100) #2
  %.not53.2 = icmp eq i32 %101, 0
  br i1 %.not53.2, label %102, label %.sink.split

102:                                              ; preds = %92
  %103 = load i32, ptr %87, align 4, !tbaa !13
  %104 = load ptr, ptr %0, align 8, !tbaa !23
  %105 = getelementptr inbounds i8, ptr %104, i64 396
  %106 = load volatile i32, ptr %105, align 4, !tbaa !29
  %107 = or i32 %106, %103
  store volatile i32 %107, ptr %105, align 4, !tbaa !29
  br label %108

108:                                              ; preds = %102, %86, %83
  %109 = load i32, ptr getelementptr inbounds (i8, ptr @TimerIdxToTimerId, i64 12), align 4, !tbaa !28
  %110 = and i32 %109, %1
  %.not51.3 = icmp eq i32 %110, 0
  br i1 %.not51.3, label %133, label %111

111:                                              ; preds = %108
  %112 = getelementptr inbounds i8, ptr %0, i64 124
  %113 = load i32, ptr %112, align 4, !tbaa !13
  %.not52.3 = icmp eq i32 %113, 0
  br i1 %.not52.3, label %133, label %114

114:                                              ; preds = %111
  %115 = tail call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef nonnull %0, i32 noundef 3)
  %116 = icmp eq ptr %115, null
  br i1 %116, label %.sink.split, label %117

117:                                              ; preds = %114
  %118 = getelementptr inbounds i8, ptr %115, i64 104
  store ptr @HRTIM_DMAError, ptr %118, align 8, !tbaa !16
  %119 = getelementptr inbounds i8, ptr %115, i64 72
  store ptr @HRTIM_DMATimerxCplt, ptr %119, align 8, !tbaa !19
  %120 = getelementptr inbounds i8, ptr %0, i64 128
  %121 = load i32, ptr %120, align 4, !tbaa !20
  %122 = getelementptr inbounds i8, ptr %0, i64 132
  %123 = load i32, ptr %122, align 4, !tbaa !21
  %124 = getelementptr inbounds i8, ptr %0, i64 136
  %125 = load i32, ptr %124, align 4, !tbaa !22
  %126 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %115, i32 noundef %121, i32 noundef %123, i32 noundef %125) #2
  %.not53.3 = icmp eq i32 %126, 0
  br i1 %.not53.3, label %127, label %.sink.split

127:                                              ; preds = %117
  %128 = load i32, ptr %112, align 4, !tbaa !13
  %129 = load ptr, ptr %0, align 8, !tbaa !23
  %130 = getelementptr inbounds i8, ptr %129, i64 524
  %131 = load volatile i32, ptr %130, align 4, !tbaa !29
  %132 = or i32 %131, %128
  store volatile i32 %132, ptr %130, align 4, !tbaa !29
  br label %133

133:                                              ; preds = %127, %111, %108
  %134 = load i32, ptr getelementptr inbounds (i8, ptr @TimerIdxToTimerId, i64 16), align 16, !tbaa !28
  %135 = and i32 %134, %1
  %.not51.4 = icmp eq i32 %135, 0
  br i1 %.not51.4, label %158, label %136

136:                                              ; preds = %133
  %137 = getelementptr inbounds i8, ptr %0, i64 152
  %138 = load i32, ptr %137, align 4, !tbaa !13
  %.not52.4 = icmp eq i32 %138, 0
  br i1 %.not52.4, label %158, label %139

139:                                              ; preds = %136
  %140 = tail call ptr @HRTIM_GetDMAHandleFromTimerIdx(ptr noundef nonnull %0, i32 noundef 4)
  %141 = icmp eq ptr %140, null
  br i1 %141, label %.sink.split, label %142

142:                                              ; preds = %139
  %143 = getelementptr inbounds i8, ptr %140, i64 104
  store ptr @HRTIM_DMAError, ptr %143, align 8, !tbaa !16
  %144 = getelementptr inbounds i8, ptr %140, i64 72
  store ptr @HRTIM_DMATimerxCplt, ptr %144, align 8, !tbaa !19
  %145 = getelementptr inbounds i8, ptr %0, i64 156
  %146 = load i32, ptr %145, align 4, !tbaa !20
  %147 = getelementptr inbounds i8, ptr %0, i64 160
  %148 = load i32, ptr %147, align 4, !tbaa !21
  %149 = getelementptr inbounds i8, ptr %0, i64 164
  %150 = load i32, ptr %149, align 4, !tbaa !22
  %151 = tail call i32 @HAL_DMA_Start_IT(ptr noundef nonnull %140, i32 noundef %146, i32 noundef %148, i32 noundef %150) #2
  %.not53.4 = icmp eq i32 %151, 0
  br i1 %.not53.4, label %152, label %.sink.split

152:                                              ; preds = %142
  %153 = load i32, ptr %137, align 4, !tbaa !13
  %154 = load ptr, ptr %0, align 8, !tbaa !23
  %155 = getelementptr inbounds i8, ptr %154, i64 652
  %156 = load volatile i32, ptr %155, align 4, !tbaa !29
  %157 = or i32 %156, %153
  store volatile i32 %157, ptr %155, align 4, !tbaa !29
  br label %158

158:                                              ; preds = %152, %136, %133
  %159 = load ptr, ptr %0, align 8, !tbaa !23
  %160 = load volatile i32, ptr %159, align 4, !tbaa !31
  %161 = or i32 %160, %1
  store volatile i32 %161, ptr %159, align 4, !tbaa !31
  br label %.sink.split

.sink.split:                                      ; preds = %42, %67, %92, %117, %142, %39, %64, %89, %114, %139, %15, %158
  %.sink = phi i32 [ 1, %158 ], [ 7, %15 ], [ 7, %139 ], [ 7, %114 ], [ 7, %89 ], [ 7, %64 ], [ 7, %39 ], [ 7, %142 ], [ 7, %117 ], [ 7, %92 ], [ 7, %67 ], [ 7, %42 ]
  %.0.ph = phi i32 [ 0, %158 ], [ 1, %15 ], [ 1, %139 ], [ 1, %114 ], [ 1, %89 ], [ 1, %64 ], [ 1, %39 ], [ 1, %142 ], [ 1, %117 ], [ 1, %92 ], [ 1, %67 ], [ 1, %42 ]
  store volatile i32 %.sink, ptr %3, align 8, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %162

162:                                              ; preds = %.sink.split, %6, %2
  %.0 = phi i32 [ 2, %2 ], [ 2, %6 ], [ %.0.ph, %.sink.split ]
  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 200}
!6 = !{!"", !7, i64 0, !10, i64 8, !8, i64 28, !11, i64 196, !11, i64 200, !7, i64 208, !7, i64 216, !7, i64 224, !7, i64 232, !7, i64 240, !7, i64 248}
!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 = !{!"int", !8, i64 0}
!12 = !{!6, !11, i64 196}
!13 = !{!14, !11, i64 12}
!14 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24}
!15 = !{!6, !7, i64 208}
!16 = !{!17, !7, i64 104}
!17 = !{!"__DMA_HandleTypeDef", !7, i64 0, !18, 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}
!18 = !{!"", !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}
!19 = !{!17, !7, i64 72}
!20 = !{!14, !11, i64 16}
!21 = !{!14, !11, i64 20}
!22 = !{!14, !11, i64 24}
!23 = !{!6, !7, i64 0}
!24 = !{!25, !11, i64 12}
!25 = !{!"", !26, i64 0, !8, i64 128, !8, i64 768, !27, i64 896}
!26 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !8, i64 48}
!27 = !{!"", !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, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112}
!28 = !{!11, !11, i64 0}
!29 = !{!30, !11, i64 12}
!30 = !{!"", !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, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !8, i64 108}
!31 = !{!25, !11, i64 0}


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