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

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_SMARTCARD_Transmit_IT(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i16 %2, ptr %7, align 2, !tbaa !9
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %8, i32 0, i32 17
  %10 = load volatile i32, ptr %9, align 4, !tbaa !11
  %11 = icmp eq i32 %10, 32
  br i1 %11, label %12, label %137

12:                                               ; preds = %3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %19, label %15

15:                                               ; preds = %12
  %16 = load i16, ptr %7, align 2, !tbaa !9
  %17 = zext i16 %16 to i32
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %15, %12
  store i32 1, ptr %4, align 4
  br label %138

20:                                               ; preds = %15
  br label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %22, i32 0, i32 16
  %24 = load i32, ptr %23, align 8, !tbaa !16
  %25 = icmp eq i32 %24, 1
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  store i32 2, ptr %4, align 4
  br label %138

27:                                               ; preds = %21
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %28, i32 0, i32 16
  store i32 1, ptr %29, align 8, !tbaa !16
  br label %30

30:                                               ; preds = %27
  br label %31

31:                                               ; preds = %30
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %32, i32 0, i32 19
  store volatile i32 0, ptr %33, align 4, !tbaa !17
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %34, i32 0, i32 17
  store volatile i32 33, ptr %35, align 4, !tbaa !11
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %37, i32 0, i32 3
  store ptr %36, ptr %38, align 8, !tbaa !18
  %39 = load i16, ptr %7, align 2, !tbaa !9
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %40, i32 0, i32 4
  store i16 %39, ptr %41, align 8, !tbaa !19
  %42 = load i16, ptr %7, align 2, !tbaa !9
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %43, i32 0, i32 5
  store volatile i16 %42, ptr %44, align 2, !tbaa !20
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %45, i32 0, i32 13
  store ptr null, ptr %46, align 8, !tbaa !21
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  %50 = getelementptr inbounds %struct.USART_TypeDef, ptr %49, i32 0, i32 0
  %51 = load volatile i32, ptr %50, align 4, !tbaa !23
  %52 = zext i32 %51 to i64
  %53 = and i64 %52, -2
  %54 = trunc i64 %53 to i32
  store volatile i32 %54, ptr %50, align 4, !tbaa !23
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !22
  %58 = getelementptr inbounds %struct.USART_TypeDef, ptr %57, i32 0, i32 0
  %59 = load volatile i32, ptr %58, align 4, !tbaa !23
  %60 = zext i32 %59 to i64
  %61 = and i64 %60, -5
  %62 = trunc i64 %61 to i32
  store volatile i32 %62, ptr %58, align 4, !tbaa !23
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !22
  %66 = getelementptr inbounds %struct.USART_TypeDef, ptr %65, i32 0, i32 6
  %67 = load volatile i32, ptr %66, align 4, !tbaa !25
  %68 = or i32 %67, 8
  store volatile i32 %68, ptr %66, align 4, !tbaa !25
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !22
  %72 = getelementptr inbounds %struct.USART_TypeDef, ptr %71, i32 0, i32 0
  %73 = load volatile i32, ptr %72, align 4, !tbaa !23
  %74 = zext i32 %73 to i64
  %75 = or i64 %74, 8
  %76 = trunc i64 %75 to i32
  store volatile i32 %76, ptr %72, align 4, !tbaa !23
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !22
  %80 = getelementptr inbounds %struct.USART_TypeDef, ptr %79, i32 0, i32 0
  %81 = load volatile i32, ptr %80, align 4, !tbaa !23
  %82 = zext i32 %81 to i64
  %83 = or i64 %82, 1
  %84 = trunc i64 %83 to i32
  store volatile i32 %84, ptr %80, align 4, !tbaa !23
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %85, i32 0, i32 11
  %87 = load i32, ptr %86, align 8, !tbaa !26
  %88 = zext i32 %87 to i64
  %89 = icmp eq i64 %88, 536870912
  br i1 %89, label %90, label %113

90:                                               ; preds = %31
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %91, i32 0, i32 13
  store ptr @SMARTCARD_TxISR_FIFOEN, ptr %92, align 8, !tbaa !21
  br label %93

93:                                               ; preds = %90
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %94, i32 0, i32 16
  store i32 0, ptr %95, align 8, !tbaa !16
  br label %96

96:                                               ; preds = %93
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %97, i32 0, i32 0
  %99 = load ptr, ptr %98, align 8, !tbaa !22
  %100 = getelementptr inbounds %struct.USART_TypeDef, ptr %99, i32 0, i32 2
  %101 = load volatile i32, ptr %100, align 4, !tbaa !27
  %102 = zext i32 %101 to i64
  %103 = or i64 %102, 1
  %104 = trunc i64 %103 to i32
  store volatile i32 %104, ptr %100, align 4, !tbaa !27
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %105, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !22
  %108 = getelementptr inbounds %struct.USART_TypeDef, ptr %107, i32 0, i32 2
  %109 = load volatile i32, ptr %108, align 4, !tbaa !27
  %110 = zext i32 %109 to i64
  %111 = or i64 %110, 8388608
  %112 = trunc i64 %111 to i32
  store volatile i32 %112, ptr %108, align 4, !tbaa !27
  br label %136

113:                                              ; preds = %31
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %114, i32 0, i32 13
  store ptr @SMARTCARD_TxISR, ptr %115, align 8, !tbaa !21
  br label %116

116:                                              ; preds = %113
  %117 = load ptr, ptr %5, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %117, i32 0, i32 16
  store i32 0, ptr %118, align 8, !tbaa !16
  br label %119

119:                                              ; preds = %116
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !22
  %123 = getelementptr inbounds %struct.USART_TypeDef, ptr %122, i32 0, i32 2
  %124 = load volatile i32, ptr %123, align 4, !tbaa !27
  %125 = zext i32 %124 to i64
  %126 = or i64 %125, 1
  %127 = trunc i64 %126 to i32
  store volatile i32 %127, ptr %123, align 4, !tbaa !27
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %128, i32 0, i32 0
  %130 = load ptr, ptr %129, align 8, !tbaa !22
  %131 = getelementptr inbounds %struct.USART_TypeDef, ptr %130, i32 0, i32 0
  %132 = load volatile i32, ptr %131, align 4, !tbaa !23
  %133 = zext i32 %132 to i64
  %134 = or i64 %133, 128
  %135 = trunc i64 %134 to i32
  store volatile i32 %135, ptr %131, align 4, !tbaa !23
  br label %136

136:                                              ; preds = %119, %96
  store i32 0, ptr %4, align 4
  br label %138

137:                                              ; preds = %3
  store i32 2, ptr %4, align 4
  br label %138

138:                                              ; preds = %137, %136, %26, %19
  %139 = load i32, ptr %4, align 4
  ret i32 %139
}

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

; Function Attrs: nounwind uwtable
declare hidden void @SMARTCARD_TxISR(ptr noundef) #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, !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 = !{!"short", !7, i64 0}
!11 = !{!12, !14, i64 164}
!12 = !{!"__SMARTCARD_HandleTypeDef", !6, i64 0, !13, i64 8, !15, i64 52, !6, i64 88, !10, i64 96, !10, i64 98, !6, i64 104, !10, i64 112, !10, i64 114, !10, i64 116, !10, i64 118, !14, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !14, i64 160, !14, i64 164, !14, i64 168, !14, i64 172}
!13 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !10, i64 12, !10, i64 14, !10, i64 16, !10, i64 18, !10, i64 20, !10, i64 22, !7, i64 24, !7, i64 25, !10, i64 26, !14, i64 28, !14, i64 32, !7, i64 36, !7, i64 37, !14, i64 40}
!14 = !{!"int", !7, i64 0}
!15 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !10, i64 32}
!16 = !{!12, !14, i64 160}
!17 = !{!12, !14, i64 172}
!18 = !{!12, !6, i64 88}
!19 = !{!12, !10, i64 96}
!20 = !{!12, !10, i64 98}
!21 = !{!12, !6, i64 136}
!22 = !{!12, !6, i64 0}
!23 = !{!24, !14, i64 0}
!24 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !14, i64 40, !14, i64 44}
!25 = !{!24, !14, i64 24}
!26 = !{!12, !14, i64 120}
!27 = !{!24, !14, i64 8}


; 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_SMARTCARD_Transmit_IT(ptr noundef %0, ptr noundef %1, i16 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 164
  %5 = load volatile i32, ptr %4, align 4, !tbaa !5
  %6 = icmp eq i32 %5, 32
  br i1 %6, label %7, label %39

7:                                                ; preds = %3
  %8 = icmp eq ptr %1, null
  %9 = icmp eq i16 %2, 0
  %or.cond = or i1 %8, %9
  br i1 %or.cond, label %39, label %10

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 160
  %12 = load i32, ptr %11, align 8, !tbaa !14
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %39, label %.sink.split

.sink.split:                                      ; preds = %10
  %14 = getelementptr inbounds i8, ptr %0, i64 172
  store volatile i32 0, ptr %14, align 4, !tbaa !15
  store volatile i32 33, ptr %4, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 88
  store ptr %1, ptr %15, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 96
  store i16 %2, ptr %16, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 98
  store volatile i16 %2, ptr %17, align 2, !tbaa !18
  %18 = getelementptr inbounds i8, ptr %0, i64 136
  %19 = load ptr, ptr %0, align 8, !tbaa !19
  %20 = load volatile i32, ptr %19, align 4, !tbaa !20
  %21 = and i32 %20, -2
  store volatile i32 %21, ptr %19, align 4, !tbaa !20
  %22 = load volatile i32, ptr %19, align 4, !tbaa !20
  %23 = and i32 %22, -5
  store volatile i32 %23, ptr %19, align 4, !tbaa !20
  %24 = getelementptr inbounds i8, ptr %19, i64 24
  %25 = load volatile i32, ptr %24, align 4, !tbaa !22
  %26 = or i32 %25, 8
  store volatile i32 %26, ptr %24, align 4, !tbaa !22
  %27 = load volatile i32, ptr %19, align 4, !tbaa !20
  %28 = or i32 %27, 8
  store volatile i32 %28, ptr %19, align 4, !tbaa !20
  %29 = load volatile i32, ptr %19, align 4, !tbaa !20
  %30 = or i32 %29, 1
  store volatile i32 %30, ptr %19, align 4, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 120
  %32 = load i32, ptr %31, align 8, !tbaa !23
  %33 = icmp eq i32 %32, 536870912
  %34 = getelementptr inbounds i8, ptr %19, i64 8
  %SMARTCARD_TxISR_FIFOEN.SMARTCARD_TxISR = select i1 %33, ptr @SMARTCARD_TxISR_FIFOEN, ptr @SMARTCARD_TxISR
  %. = select i1 %33, ptr %34, ptr %19
  %.36 = select i1 %33, i32 8388608, i32 128
  store ptr %SMARTCARD_TxISR_FIFOEN.SMARTCARD_TxISR, ptr %18, align 8, !tbaa !24
  store i32 0, ptr %11, align 8, !tbaa !14
  %35 = load volatile i32, ptr %34, align 4, !tbaa !25
  %36 = or i32 %35, 1
  store volatile i32 %36, ptr %34, align 4, !tbaa !25
  %37 = load volatile i32, ptr %., align 4, !tbaa !26
  %38 = or i32 %37, %.36
  store volatile i32 %38, ptr %., align 4, !tbaa !26
  br label %39

39:                                               ; preds = %.sink.split, %3, %10, %7
  %.0 = phi i32 [ 1, %7 ], [ 2, %10 ], [ 2, %3 ], [ 0, %.sink.split ]
  ret i32 %.0
}

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

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

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" }
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, !11, i64 164}
!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 = !{!6, !11, i64 160}
!15 = !{!6, !11, i64 172}
!16 = !{!6, !7, i64 88}
!17 = !{!6, !12, i64 96}
!18 = !{!6, !12, i64 98}
!19 = !{!6, !7, i64 0}
!20 = !{!21, !11, i64 0}
!21 = !{!"", !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}
!22 = !{!21, !11, i64 24}
!23 = !{!6, !11, i64 120}
!24 = !{!6, !7, i64 136}
!25 = !{!21, !11, i64 8}
!26 = !{!11, !11, i64 0}


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