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

; 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.__SMARTCARD_HandleTypeDef = type { ptr, %struct.SMARTCARD_InitTypeDef, %struct.SMARTCARD_AdvFeatureInitTypeDef, ptr, i16, i16, ptr, i16, i16, i16, i16, i32, ptr, ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.SMARTCARD_InitTypeDef = type { i32, i32, i32, i16, i16, i16, i16, i16, i16, i8, i8, i16, i32, i32, i8, i8, i32 }
%struct.SMARTCARD_AdvFeatureInitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i16 }
%struct.USART_TypeDef = type { i32, i32, i32, i32, i32, 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 }

declare i32 @HAL_DMA_Abort_IT(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_SMARTCARD_AbortReceive_IT(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %3, i32 0, i32 0
  %5 = load ptr, ptr %4, align 8, !tbaa !9
  %6 = getelementptr inbounds %struct.USART_TypeDef, ptr %5, i32 0, i32 0
  %7 = load volatile i32, ptr %6, align 4, !tbaa !15
  %8 = zext i32 %7 to i64
  %9 = and i64 %8, -201326881
  %10 = trunc i64 %9 to i32
  store volatile i32 %10, ptr %6, align 4, !tbaa !15
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.USART_TypeDef, ptr %13, i32 0, i32 2
  %15 = load volatile i32, ptr %14, align 4, !tbaa !17
  %16 = zext i32 %15 to i64
  %17 = and i64 %16, -268435458
  %18 = trunc i64 %17 to i32
  store volatile i32 %18, ptr %14, align 4, !tbaa !17
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %19, i32 0, i32 17
  %21 = load volatile i32, ptr %20, align 4, !tbaa !18
  %22 = icmp eq i32 %21, 32
  br i1 %22, label %23, label %32

23:                                               ; preds = %1
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.USART_TypeDef, ptr %26, i32 0, i32 2
  %28 = load volatile i32, ptr %27, align 4, !tbaa !17
  %29 = zext i32 %28 to i64
  %30 = and i64 %29, -2
  %31 = trunc i64 %30 to i32
  store volatile i32 %31, ptr %27, align 4, !tbaa !17
  br label %32

32:                                               ; preds = %23, %1
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.USART_TypeDef, ptr %35, i32 0, i32 2
  %37 = load volatile i32, ptr %36, align 4, !tbaa !17
  %38 = zext i32 %37 to i64
  %39 = and i64 %38, 64
  %40 = icmp eq i64 %39, 64
  br i1 %40, label %41, label %87

41:                                               ; preds = %32
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.USART_TypeDef, ptr %44, i32 0, i32 2
  %46 = load volatile i32, ptr %45, align 4, !tbaa !17
  %47 = zext i32 %46 to i64
  %48 = and i64 %47, -65
  %49 = trunc i64 %48 to i32
  store volatile i32 %49, ptr %45, align 4, !tbaa !17
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %50, i32 0, i32 15
  %52 = load ptr, ptr %51, align 8, !tbaa !19
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %74

54:                                               ; preds = %41
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %55, i32 0, i32 15
  %57 = load ptr, ptr %56, align 8, !tbaa !19
  %58 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %57, i32 0, i32 10
  store ptr @SMARTCARD_DMARxOnlyAbortCallback, ptr %58, align 8, !tbaa !20
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %59, i32 0, i32 15
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = call i32 @HAL_DMA_Abort_IT(ptr noundef %61)
  %63 = icmp ne i32 %62, 0
  br i1 %63, label %64, label %73

64:                                               ; preds = %54
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %65, i32 0, i32 15
  %67 = load ptr, ptr %66, align 8, !tbaa !19
  %68 = getelementptr inbounds %struct.__DMA_HandleTypeDef, ptr %67, i32 0, i32 10
  %69 = load ptr, ptr %68, align 8, !tbaa !20
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %70, i32 0, i32 15
  %72 = load ptr, ptr %71, align 8, !tbaa !19
  call void %69(ptr noundef %72)
  br label %73

73:                                               ; preds = %64, %54
  br label %86

74:                                               ; preds = %41
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %75, i32 0, i32 8
  store volatile i16 0, ptr %76, align 2, !tbaa !22
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %77, i32 0, i32 12
  store ptr null, ptr %78, align 8, !tbaa !23
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.USART_TypeDef, ptr %81, i32 0, i32 8
  store volatile i32 6159, ptr %82, align 4, !tbaa !24
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %83, i32 0, i32 18
  store volatile i32 32, ptr %84, align 8, !tbaa !25
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  call void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef %85)
  br label %86

86:                                               ; preds = %74, %73
  br label %99

87:                                               ; preds = %32
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %88, i32 0, i32 8
  store volatile i16 0, ptr %89, align 2, !tbaa !22
  %90 = load ptr, ptr %2, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %90, i32 0, i32 12
  store ptr null, ptr %91, align 8, !tbaa !23
  %92 = load ptr, ptr %2, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %92, i32 0, i32 0
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.USART_TypeDef, ptr %94, i32 0, i32 8
  store volatile i32 6159, ptr %95, align 4, !tbaa !24
  %96 = load ptr, ptr %2, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %96, i32 0, i32 18
  store volatile i32 32, ptr %97, align 8, !tbaa !25
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  call void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef %98)
  br label %99

99:                                               ; preds = %87, %86
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef) #1

attributes #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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"__SMARTCARD_HandleTypeDef", !6, i64 0, !11, i64 8, !14, i64 52, !6, i64 88, !13, i64 96, !13, i64 98, !6, i64 104, !13, i64 112, !13, i64 114, !13, i64 116, !13, i64 118, !12, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172}
!11 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !13, i64 12, !13, i64 14, !13, i64 16, !13, i64 18, !13, i64 20, !13, i64 22, !7, i64 24, !7, i64 25, !13, i64 26, !12, i64 28, !12, i64 32, !7, i64 36, !7, i64 37, !12, i64 40}
!12 = !{!"int", !7, i64 0}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !13, i64 32}
!15 = !{!16, !12, i64 0}
!16 = !{!"", !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}
!17 = !{!16, !12, i64 8}
!18 = !{!10, !12, i64 164}
!19 = !{!10, !6, i64 152}
!20 = !{!21, !6, i64 112}
!21 = !{!"__DMA_HandleTypeDef", !6, i64 0, !16, i64 8, !12, i64 56, !12, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !12, i64 120, !12, i64 124, !12, i64 128, !6, i64 136, !6, i64 144, !12, i64 152, !6, i64 160, !6, i64 168, !12, i64 176}
!22 = !{!10, !13, i64 114}
!23 = !{!10, !6, i64 128}
!24 = !{!16, !12, i64 32}
!25 = !{!10, !12, i64 168}


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

declare i32 @HAL_DMA_Abort_IT(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @HAL_SMARTCARD_AbortReceive_IT(ptr noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = load volatile i32, ptr %2, align 4, !tbaa !14
  %4 = and i32 %3, -201326881
  store volatile i32 %4, ptr %2, align 4, !tbaa !14
  %5 = getelementptr inbounds i8, ptr %2, i64 8
  %6 = load volatile i32, ptr %5, align 4, !tbaa !16
  %7 = and i32 %6, -268435458
  store volatile i32 %7, ptr %5, align 4, !tbaa !16
  %8 = getelementptr inbounds i8, ptr %0, i64 164
  %9 = load volatile i32, ptr %8, align 4, !tbaa !17
  %10 = icmp eq i32 %9, 32
  br i1 %10, label %11, label %14

11:                                               ; preds = %1
  %12 = load volatile i32, ptr %5, align 4, !tbaa !16
  %13 = and i32 %12, -2
  store volatile i32 %13, ptr %5, align 4, !tbaa !16
  br label %14

14:                                               ; preds = %11, %1
  %15 = load volatile i32, ptr %5, align 4, !tbaa !16
  %16 = and i32 %15, 64
  %.not = icmp eq i32 %16, 0
  br i1 %.not, label %34, label %17

17:                                               ; preds = %14
  %18 = load volatile i32, ptr %5, align 4, !tbaa !16
  %19 = and i32 %18, -65
  store volatile i32 %19, ptr %5, align 4, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %0, i64 152
  %21 = load ptr, ptr %20, align 8, !tbaa !18
  %.not21 = icmp eq ptr %21, null
  br i1 %.not21, label %29, label %22

22:                                               ; preds = %17
  %23 = getelementptr inbounds i8, ptr %21, i64 112
  store ptr @SMARTCARD_DMARxOnlyAbortCallback, ptr %23, align 8, !tbaa !19
  %24 = tail call i32 @HAL_DMA_Abort_IT(ptr noundef nonnull %21) #2
  %.not22 = icmp eq i32 %24, 0
  br i1 %.not22, label %39, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr %20, align 8, !tbaa !18
  %27 = getelementptr inbounds i8, ptr %26, i64 112
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  tail call void %28(ptr noundef %26) #2
  br label %39

29:                                               ; preds = %17
  %30 = getelementptr inbounds i8, ptr %0, i64 114
  store volatile i16 0, ptr %30, align 2, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr null, ptr %31, align 8, !tbaa !22
  %32 = getelementptr inbounds i8, ptr %2, i64 32
  store volatile i32 6159, ptr %32, align 4, !tbaa !23
  %33 = getelementptr inbounds i8, ptr %0, i64 168
  store volatile i32 32, ptr %33, align 8, !tbaa !24
  tail call void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef nonnull %0)
  br label %39

34:                                               ; preds = %14
  %35 = getelementptr inbounds i8, ptr %0, i64 114
  store volatile i16 0, ptr %35, align 2, !tbaa !21
  %36 = getelementptr inbounds i8, ptr %0, i64 128
  store ptr null, ptr %36, align 8, !tbaa !22
  %37 = getelementptr inbounds i8, ptr %2, i64 32
  store volatile i32 6159, ptr %37, align 4, !tbaa !23
  %38 = getelementptr inbounds i8, ptr %0, i64 168
  store volatile i32 32, ptr %38, align 8, !tbaa !24
  tail call void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef nonnull %0)
  br label %39

39:                                               ; preds = %29, %25, %22, %34
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @HAL_SMARTCARD_AbortReceiveCpltCallback(ptr noundef) local_unnamed_addr #1

attributes #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 = { 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, !7, i64 0}
!6 = !{!"__SMARTCARD_HandleTypeDef", !7, i64 0, !10, i64 8, !13, i64 52, !7, i64 88, !12, i64 96, !12, i64 98, !7, i64 104, !12, i64 112, !12, i64 114, !12, i64 116, !12, i64 118, !11, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !11, i64 160, !11, i64 164, !11, i64 168, !11, i64 172}
!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, !12, i64 12, !12, i64 14, !12, i64 16, !12, i64 18, !12, i64 20, !12, i64 22, !8, i64 24, !8, i64 25, !12, i64 26, !11, i64 28, !11, i64 32, !8, i64 36, !8, i64 37, !11, i64 40}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !12, i64 32}
!14 = !{!15, !11, i64 0}
!15 = !{!"", !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}
!16 = !{!15, !11, i64 8}
!17 = !{!6, !11, i64 164}
!18 = !{!6, !7, i64 152}
!19 = !{!20, !7, i64 112}
!20 = !{!"__DMA_HandleTypeDef", !7, i64 0, !15, 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}
!21 = !{!6, !12, i64 114}
!22 = !{!6, !7, i64 128}
!23 = !{!15, !11, i64 32}
!24 = !{!6, !11, i64 168}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass