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

; 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.PWR_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local void @HAL_PWREx_WAKEUP_PIN_IRQHandler() #0 {
  %1 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 9), align 4, !tbaa !5
  %2 = zext i32 %1 to i64
  %3 = and i64 %2, 1
  %4 = icmp ne i64 %3, 0
  br i1 %4, label %5, label %10

5:                                                ; preds = %0
  %6 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %7 = zext i32 %6 to i64
  %8 = or i64 %7, 1
  %9 = trunc i64 %8 to i32
  store volatile i32 %9, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP1_Callback()
  br label %59

10:                                               ; preds = %0
  %11 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 9), align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = and i64 %12, 2
  %14 = icmp ne i64 %13, 0
  br i1 %14, label %15, label %20

15:                                               ; preds = %10
  %16 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %17 = zext i32 %16 to i64
  %18 = or i64 %17, 2
  %19 = trunc i64 %18 to i32
  store volatile i32 %19, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP2_Callback()
  br label %58

20:                                               ; preds = %10
  %21 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 9), align 4, !tbaa !5
  %22 = zext i32 %21 to i64
  %23 = and i64 %22, 4
  %24 = icmp ne i64 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %20
  %26 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %27 = zext i32 %26 to i64
  %28 = or i64 %27, 4
  %29 = trunc i64 %28 to i32
  store volatile i32 %29, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP3_Callback()
  br label %57

30:                                               ; preds = %20
  %31 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 9), align 4, !tbaa !5
  %32 = zext i32 %31 to i64
  %33 = and i64 %32, 8
  %34 = icmp ne i64 %33, 0
  br i1 %34, label %35, label %40

35:                                               ; preds = %30
  %36 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %37 = zext i32 %36 to i64
  %38 = or i64 %37, 8
  %39 = trunc i64 %38 to i32
  store volatile i32 %39, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP4_Callback()
  br label %56

40:                                               ; preds = %30
  %41 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 9), align 4, !tbaa !5
  %42 = zext i32 %41 to i64
  %43 = and i64 %42, 16
  %44 = icmp ne i64 %43, 0
  br i1 %44, label %45, label %50

45:                                               ; preds = %40
  %46 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %47 = zext i32 %46 to i64
  %48 = or i64 %47, 16
  %49 = trunc i64 %48 to i32
  store volatile i32 %49, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP5_Callback()
  br label %55

50:                                               ; preds = %40
  %51 = load volatile i32, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  %52 = zext i32 %51 to i64
  %53 = or i64 %52, 32
  %54 = trunc i64 %53 to i32
  store volatile i32 %54, ptr getelementptr inbounds (%struct.PWR_TypeDef, ptr inttoptr (i64 1476544512 to ptr), i32 0, i32 8), align 4, !tbaa !10
  call void @HAL_PWREx_WKUP6_Callback()
  br label %55

55:                                               ; preds = %50, %45
  br label %56

56:                                               ; preds = %55, %35
  br label %57

57:                                               ; preds = %56, %25
  br label %58

58:                                               ; preds = %57, %15
  br label %59

59:                                               ; preds = %58, %5
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP1_Callback() #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP2_Callback() #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP3_Callback() #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP4_Callback() #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP5_Callback() #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP6_Callback() #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" }

!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, !7, i64 36}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 32}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
define dso_local void @HAL_PWREx_WAKEUP_PIN_IRQHandler() local_unnamed_addr #0 {
  %1 = load volatile i32, ptr inttoptr (i64 1476544548 to ptr), align 4, !tbaa !5
  %2 = and i32 %1, 1
  %.not = icmp eq i32 %2, 0
  br i1 %.not, label %6, label %3

3:                                                ; preds = %0
  %4 = load volatile i32, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  %5 = or i32 %4, 1
  store volatile i32 %5, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP1_Callback()
  br label %32

6:                                                ; preds = %0
  %7 = load volatile i32, ptr inttoptr (i64 1476544548 to ptr), align 4, !tbaa !5
  %8 = and i32 %7, 2
  %.not1 = icmp eq i32 %8, 0
  br i1 %.not1, label %12, label %9

9:                                                ; preds = %6
  %10 = load volatile i32, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  %11 = or i32 %10, 2
  store volatile i32 %11, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP2_Callback()
  br label %32

12:                                               ; preds = %6
  %13 = load volatile i32, ptr inttoptr (i64 1476544548 to ptr), align 4, !tbaa !5
  %14 = and i32 %13, 4
  %.not2 = icmp eq i32 %14, 0
  br i1 %.not2, label %18, label %15

15:                                               ; preds = %12
  %16 = load volatile i32, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  %17 = or i32 %16, 4
  store volatile i32 %17, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP3_Callback()
  br label %32

18:                                               ; preds = %12
  %19 = load volatile i32, ptr inttoptr (i64 1476544548 to ptr), align 4, !tbaa !5
  %20 = and i32 %19, 8
  %.not3 = icmp eq i32 %20, 0
  br i1 %.not3, label %24, label %21

21:                                               ; preds = %18
  %22 = load volatile i32, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  %23 = or i32 %22, 8
  store volatile i32 %23, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP4_Callback()
  br label %32

24:                                               ; preds = %18
  %25 = load volatile i32, ptr inttoptr (i64 1476544548 to ptr), align 4, !tbaa !5
  %26 = and i32 %25, 16
  %.not4 = icmp eq i32 %26, 0
  %27 = load volatile i32, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  br i1 %.not4, label %30, label %28

28:                                               ; preds = %24
  %29 = or i32 %27, 16
  store volatile i32 %29, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP5_Callback()
  br label %32

30:                                               ; preds = %24
  %31 = or i32 %27, 32
  store volatile i32 %31, ptr inttoptr (i64 1476544544 to ptr), align 32, !tbaa !10
  tail call void @HAL_PWREx_WKUP6_Callback()
  br label %32

32:                                               ; preds = %9, %21, %30, %28, %15, %3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP1_Callback() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP2_Callback() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP3_Callback() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP4_Callback() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP5_Callback() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_PWREx_WKUP6_Callback() local_unnamed_addr #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" }

!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, !7, i64 36}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 32}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferAlignmentPass,InstCombinePass,SimplifyCFGPass,TailCallElimPass