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

; 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_DeadTimeCfgTypeDef = type { 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 }

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

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

15:                                               ; preds = %3
  br label %16

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

21:                                               ; preds = %16
  store i32 2, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %139

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

25:                                               ; preds = %22
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %28, i32 0, i32 4
  store volatile i32 2, ptr %29, align 8, !tbaa !11
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 4, !tbaa !15
  %33 = zext i32 %32 to i64
  %34 = and i64 %33, 7168
  %35 = trunc i64 %34 to i32
  store i32 %35, ptr %8, align 4, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !17
  %39 = zext i32 %38 to i64
  %40 = and i64 %39, 511
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = or i64 %42, %40
  %44 = trunc i64 %43 to i32
  store i32 %44, ptr %8, align 4, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !18
  %48 = zext i32 %47 to i64
  %49 = and i64 %48, 512
  %50 = load i32, ptr %8, align 4, !tbaa !9
  %51 = zext i32 %50 to i64
  %52 = or i64 %51, %49
  %53 = trunc i64 %52 to i32
  store i32 %53, ptr %8, align 4, !tbaa !9
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %54, i32 0, i32 4
  %56 = load i32, ptr %55, align 4, !tbaa !19
  %57 = zext i32 %56 to i64
  %58 = and i64 %57, 16384
  %59 = load i32, ptr %8, align 4, !tbaa !9
  %60 = zext i32 %59 to i64
  %61 = or i64 %60, %58
  %62 = trunc i64 %61 to i32
  store i32 %62, ptr %8, align 4, !tbaa !9
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 4, !tbaa !20
  %66 = zext i32 %65 to i64
  %67 = and i64 %66, 32768
  %68 = load i32, ptr %8, align 4, !tbaa !9
  %69 = zext i32 %68 to i64
  %70 = or i64 %69, %67
  %71 = trunc i64 %70 to i32
  store i32 %71, ptr %8, align 4, !tbaa !9
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %72, i32 0, i32 5
  %74 = load i32, ptr %73, align 4, !tbaa !21
  %75 = shl i32 %74, 16
  %76 = zext i32 %75 to i64
  %77 = and i64 %76, 33488896
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = zext i32 %78 to i64
  %80 = or i64 %79, %77
  %81 = trunc i64 %80 to i32
  store i32 %81, ptr %8, align 4, !tbaa !9
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %83, align 4, !tbaa !22
  %85 = zext i32 %84 to i64
  %86 = and i64 %85, 33554432
  %87 = load i32, ptr %8, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = or i64 %88, %86
  %90 = trunc i64 %89 to i32
  store i32 %90, ptr %8, align 4, !tbaa !9
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %91, i32 0, i32 8
  %93 = load i32, ptr %92, align 4, !tbaa !23
  %94 = zext i32 %93 to i64
  %95 = and i64 %94, 1073741824
  %96 = load i32, ptr %8, align 4, !tbaa !9
  %97 = zext i32 %96 to i64
  %98 = or i64 %97, %95
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %8, align 4, !tbaa !9
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.HRTIM_DeadTimeCfgTypeDef, ptr %100, i32 0, i32 7
  %102 = load i32, ptr %101, align 4, !tbaa !24
  %103 = zext i32 %102 to i64
  %104 = and i64 %103, 2147483648
  %105 = load i32, ptr %8, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  %107 = or i64 %106, %104
  %108 = trunc i64 %107 to i32
  store i32 %108, ptr %8, align 4, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %109, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !25
  %112 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %111, i32 0, i32 1
  %113 = load i32, ptr %6, align 4, !tbaa !9
  %114 = zext i32 %113 to i64
  %115 = getelementptr inbounds [5 x %struct.HRTIM_Timerx_TypeDef], ptr %112, i64 0, i64 %114
  %116 = getelementptr inbounds %struct.HRTIM_Timerx_TypeDef, ptr %115, i32 0, i32 14
  %117 = load volatile i32, ptr %116, align 4, !tbaa !26
  %118 = zext i32 %117 to i64
  %119 = and i64 %118, -3288326144
  %120 = load i32, ptr %8, align 4, !tbaa !9
  %121 = zext i32 %120 to i64
  %122 = or i64 %119, %121
  %123 = trunc i64 %122 to i32
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %124, i32 0, i32 0
  %126 = load ptr, ptr %125, align 8, !tbaa !25
  %127 = getelementptr inbounds %struct.HRTIM_TypeDef, ptr %126, i32 0, i32 1
  %128 = load i32, ptr %6, align 4, !tbaa !9
  %129 = zext i32 %128 to i64
  %130 = getelementptr inbounds [5 x %struct.HRTIM_Timerx_TypeDef], ptr %127, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.HRTIM_Timerx_TypeDef, ptr %130, i32 0, i32 14
  store volatile i32 %123, ptr %131, align 4, !tbaa !26
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %132, i32 0, i32 4
  store volatile i32 1, ptr %133, align 8, !tbaa !11
  br label %134

134:                                              ; preds = %27
  %135 = load ptr, ptr %5, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.HRTIM_HandleTypeDef, ptr %135, i32 0, i32 3
  store i32 0, ptr %136, align 4, !tbaa !14
  br label %137

137:                                              ; preds = %134
  br label %138

138:                                              ; preds = %137
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %139

139:                                              ; preds = %138, %21, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #2
  %140 = load i32, ptr %4, align 4
  ret i32 %140
}

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, !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 0}
!16 = !{!"", !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}
!17 = !{!16, !10, i64 4}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !10, i64 16}
!20 = !{!16, !10, i64 12}
!21 = !{!16, !10, i64 20}
!22 = !{!16, !10, i64 24}
!23 = !{!16, !10, i64 32}
!24 = !{!16, !10, i64 28}
!25 = !{!12, !6, i64 0}
!26 = !{!27, !10, i64 56}
!27 = !{!"", !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}


; 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.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] }

; Function Attrs: nofree norecurse nounwind uwtable
define dso_local range(i32 0, 3) i32 @HAL_HRTIM_DeadTimeConfig(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 200
  %5 = load volatile i32, ptr %4, align 8, !tbaa !5
  %6 = icmp eq i32 %5, 2
  br i1 %6, label %54, label %7

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 196
  %9 = load i32, ptr %8, align 4, !tbaa !12
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %54, label %11

11:                                               ; preds = %7
  store volatile i32 2, ptr %4, align 8, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !13
  %13 = and i32 %12, 7168
  %14 = getelementptr inbounds i8, ptr %2, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !15
  %16 = and i32 %15, 511
  %17 = or disjoint i32 %16, %13
  %18 = getelementptr inbounds i8, ptr %2, i64 8
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = and i32 %19, 512
  %21 = or disjoint i32 %17, %20
  %22 = getelementptr inbounds i8, ptr %2, i64 16
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = and i32 %23, 16384
  %25 = or disjoint i32 %21, %24
  %26 = getelementptr inbounds i8, ptr %2, i64 12
  %27 = load i32, ptr %26, align 4, !tbaa !18
  %28 = and i32 %27, 32768
  %29 = or disjoint i32 %25, %28
  %30 = getelementptr inbounds i8, ptr %2, i64 20
  %31 = load i32, ptr %30, align 4, !tbaa !19
  %32 = shl i32 %31, 16
  %33 = and i32 %32, 33488896
  %34 = or disjoint i32 %29, %33
  %35 = getelementptr inbounds i8, ptr %2, i64 24
  %36 = load i32, ptr %35, align 4, !tbaa !20
  %37 = and i32 %36, 33554432
  %38 = or i32 %34, %37
  %39 = getelementptr inbounds i8, ptr %2, i64 32
  %40 = load i32, ptr %39, align 4, !tbaa !21
  %41 = and i32 %40, 1073741824
  %42 = or i32 %38, %41
  %43 = getelementptr inbounds i8, ptr %2, i64 28
  %44 = load i32, ptr %43, align 4, !tbaa !22
  %45 = and i32 %44, -2147483648
  %46 = or i32 %42, %45
  %47 = load ptr, ptr %0, align 8, !tbaa !23
  %48 = getelementptr inbounds i8, ptr %47, i64 128
  %49 = zext i32 %1 to i64
  %50 = getelementptr inbounds [5 x %struct.HRTIM_Timerx_TypeDef], ptr %48, i64 0, i64 %49, i32 14
  %51 = load volatile i32, ptr %50, align 4, !tbaa !24
  %52 = and i32 %51, 1006641152
  %53 = or i32 %46, %52
  store volatile i32 %53, ptr %50, align 4, !tbaa !24
  store volatile i32 1, ptr %4, align 8, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %54

54:                                               ; preds = %7, %3, %11
  %.0 = phi i32 [ 0, %11 ], [ 2, %3 ], [ 2, %7 ]
  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 = !{!14, !11, i64 0}
!14 = !{!"", !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}
!15 = !{!14, !11, i64 4}
!16 = !{!14, !11, i64 8}
!17 = !{!14, !11, i64 16}
!18 = !{!14, !11, i64 12}
!19 = !{!14, !11, i64 20}
!20 = !{!14, !11, i64 24}
!21 = !{!14, !11, i64 32}
!22 = !{!14, !11, i64 28}
!23 = !{!6, !7, i64 0}
!24 = !{!25, !11, i64 56}
!25 = !{!"", !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}


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