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

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

12:                                               ; preds = %2
  store i32 2, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %119

13:                                               ; preds = %2
  br label %14

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

19:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %119

20:                                               ; preds = %14
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %21, i32 0, i32 3
  store i32 1, ptr %22, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %20
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %26, i32 0, i32 4
  store volatile i32 2, ptr %27, align 8, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %30, i32 0, i32 3
  %32 = getelementptr inbounds %struct.HRTIM_Common_TypeDef, ptr %31, i32 0, i32 8
  %33 = load volatile i32, ptr %32, align 4, !tbaa !15
  store i32 %33, ptr %6, align 4, !tbaa !19
  %34 = load i32, ptr %6, align 4, !tbaa !19
  %35 = zext i32 %34 to i64
  %36 = and i64 %35, -3
  %37 = trunc i64 %36 to i32
  store i32 %37, ptr %6, align 4, !tbaa !19
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !20
  %41 = zext i32 %40 to i64
  %42 = and i64 %41, 2
  %43 = load i32, ptr %6, align 4, !tbaa !19
  %44 = zext i32 %43 to i64
  %45 = or i64 %44, %42
  %46 = trunc i64 %45 to i32
  store i32 %46, ptr %6, align 4, !tbaa !19
  %47 = load i32, ptr %6, align 4, !tbaa !19
  %48 = zext i32 %47 to i64
  %49 = and i64 %48, -61
  %50 = trunc i64 %49 to i32
  store i32 %50, ptr %6, align 4, !tbaa !19
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 4, !tbaa !22
  %54 = zext i32 %53 to i64
  %55 = and i64 %54, 60
  %56 = load i32, ptr %6, align 4, !tbaa !19
  %57 = zext i32 %56 to i64
  %58 = or i64 %57, %55
  %59 = trunc i64 %58 to i32
  store i32 %59, ptr %6, align 4, !tbaa !19
  %60 = load i32, ptr %6, align 4, !tbaa !19
  %61 = zext i32 %60 to i64
  %62 = and i64 %61, -961
  %63 = trunc i64 %62 to i32
  store i32 %63, ptr %6, align 4, !tbaa !19
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %64, i32 0, i32 2
  %66 = load i32, ptr %65, align 4, !tbaa !23
  %67 = load i32, ptr %6, align 4, !tbaa !19
  %68 = or i32 %67, %66
  store i32 %68, ptr %6, align 4, !tbaa !19
  %69 = load i32, ptr %6, align 4, !tbaa !19
  %70 = zext i32 %69 to i64
  %71 = and i64 %70, -1025
  %72 = trunc i64 %71 to i32
  store i32 %72, ptr %6, align 4, !tbaa !19
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %73, i32 0, i32 3
  %75 = load i32, ptr %74, align 4, !tbaa !24
  %76 = zext i32 %75 to i64
  %77 = and i64 %76, 1024
  %78 = load i32, ptr %6, align 4, !tbaa !19
  %79 = zext i32 %78 to i64
  %80 = or i64 %79, %77
  %81 = trunc i64 %80 to i32
  store i32 %81, ptr %6, align 4, !tbaa !19
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %82, i32 0, i32 4
  %84 = load i32, ptr %83, align 4, !tbaa !25
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  %88 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %87, i32 0, i32 3
  %89 = getelementptr inbounds %struct.HRTIM_Common_TypeDef, ptr %88, i32 0, i32 9
  store volatile i32 %84, ptr %89, align 4, !tbaa !26
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %90, i32 0, i32 5
  %92 = load i32, ptr %91, align 4, !tbaa !27
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %93, i32 0, i32 0
  %95 = load ptr, ptr %94, align 8, !tbaa !14
  %96 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %95, i32 0, i32 3
  %97 = getelementptr inbounds %struct.HRTIM_Common_TypeDef, ptr %96, i32 0, i32 10
  store volatile i32 %92, ptr %97, align 4, !tbaa !28
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.HRTIM_BurstModeCfgTypeDef, ptr %98, i32 0, i32 6
  %100 = load i32, ptr %99, align 4, !tbaa !29
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %102, align 8, !tbaa !14
  %104 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %103, i32 0, i32 3
  %105 = getelementptr inbounds %struct.HRTIM_Common_TypeDef, ptr %104, i32 0, i32 11
  store volatile i32 %100, ptr %105, align 4, !tbaa !30
  %106 = load i32, ptr %6, align 4, !tbaa !19
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !14
  %110 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %109, i32 0, i32 3
  %111 = getelementptr inbounds %struct.HRTIM_Common_TypeDef, ptr %110, i32 0, i32 8
  store volatile i32 %106, ptr %111, align 4, !tbaa !15
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %112, i32 0, i32 4
  store volatile i32 1, ptr %113, align 8, !tbaa !9
  br label %114

114:                                              ; preds = %25
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %115, i32 0, i32 3
  store i32 0, ptr %116, align 4, !tbaa !13
  br label %117

117:                                              ; preds = %114
  br label %118

118:                                              ; preds = %117
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %119

119:                                              ; preds = %118, %19, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  %120 = load i32, ptr %3, align 4
  ret i32 %120
}

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 = { 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 200}
!10 = !{!"", !6, i64 0, !11, i64 8, !7, i64 28, !12, i64 196, !12, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !12, i64 196}
!14 = !{!10, !6, i64 0}
!15 = !{!16, !12, i64 928}
!16 = !{!"", !17, i64 0, !7, i64 128, !7, i64 768, !18, i64 896}
!17 = !{!"", !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, !7, i64 48}
!18 = !{!"", !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, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112}
!19 = !{!12, !12, i64 0}
!20 = !{!21, !12, i64 0}
!21 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24}
!22 = !{!21, !12, i64 4}
!23 = !{!21, !12, i64 8}
!24 = !{!21, !12, i64 12}
!25 = !{!21, !12, i64 16}
!26 = !{!16, !12, i64 932}
!27 = !{!21, !12, i64 20}
!28 = !{!16, !12, i64 936}
!29 = !{!21, !12, i64 24}
!30 = !{!16, !12, i64 940}


; 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: nofree norecurse nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_HRTIM_BurstModeConfig(ptr noundef %0, ptr nocapture noundef readonly %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 %38, label %6

6:                                                ; preds = %2
  %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 %38, label %10

10:                                               ; preds = %6
  store volatile i32 2, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %0, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %11, i64 928
  %13 = load volatile i32, ptr %12, align 4, !tbaa !14
  %14 = and i32 %13, -2047
  %15 = load i32, ptr %1, align 4, !tbaa !18
  %16 = and i32 %15, 2
  %17 = or disjoint i32 %16, %14
  %18 = getelementptr inbounds i8, ptr %1, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !20
  %20 = and i32 %19, 60
  %21 = or disjoint i32 %17, %20
  %22 = getelementptr inbounds i8, ptr %1, i64 8
  %23 = load i32, ptr %22, align 4, !tbaa !21
  %.masked = and i32 %23, -1025
  %24 = or i32 %21, %.masked
  %25 = getelementptr inbounds i8, ptr %1, i64 12
  %26 = load i32, ptr %25, align 4, !tbaa !22
  %27 = and i32 %26, 1024
  %28 = or disjoint i32 %24, %27
  %29 = getelementptr inbounds i8, ptr %1, i64 16
  %30 = load i32, ptr %29, align 4, !tbaa !23
  %31 = getelementptr inbounds i8, ptr %11, i64 932
  store volatile i32 %30, ptr %31, align 4, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %1, i64 20
  %33 = load i32, ptr %32, align 4, !tbaa !25
  %34 = getelementptr inbounds i8, ptr %11, i64 936
  store volatile i32 %33, ptr %34, align 4, !tbaa !26
  %35 = getelementptr inbounds i8, ptr %1, i64 24
  %36 = load i32, ptr %35, align 4, !tbaa !27
  %37 = getelementptr inbounds i8, ptr %11, i64 940
  store volatile i32 %36, ptr %37, align 4, !tbaa !28
  store volatile i32 %28, ptr %12, align 4, !tbaa !14
  store volatile i32 1, ptr %3, align 8, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %38

38:                                               ; preds = %6, %2, %10
  %.0 = phi i32 [ 0, %10 ], [ 2, %2 ], [ 2, %6 ]
  ret i32 %.0
}

attributes #0 = { nofree norecurse 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" }

!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 = !{!6, !7, i64 0}
!14 = !{!15, !11, i64 928}
!15 = !{!"", !16, i64 0, !8, i64 128, !8, i64 768, !17, i64 896}
!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, !11, i64 44, !8, i64 48}
!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, !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}
!18 = !{!19, !11, i64 0}
!19 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24}
!20 = !{!19, !11, i64 4}
!21 = !{!19, !11, i64 8}
!22 = !{!19, !11, i64 12}
!23 = !{!19, !11, i64 16}
!24 = !{!15, !11, i64 932}
!25 = !{!19, !11, i64 20}
!26 = !{!15, !11, i64 936}
!27 = !{!19, !11, i64 24}
!28 = !{!15, !11, i64 940}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass