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

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

18:                                               ; preds = %4
  %19 = load ptr, ptr %11, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %18
  %22 = load i16, ptr %8, align 2, !tbaa !9
  %23 = zext i16 %22 to i32
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %21, %18
  store i32 1, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

26:                                               ; preds = %21
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %28, i32 0, i32 16
  %30 = load i32, ptr %29, align 8, !tbaa !17
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %33

32:                                               ; preds = %27
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

33:                                               ; preds = %27
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %34, i32 0, i32 16
  store i32 1, ptr %35, align 8, !tbaa !17
  br label %36

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %39, i32 0, i32 17
  store volatile i32 33, ptr %40, align 4, !tbaa !13
  %41 = call i32 @HAL_GetTick()
  store i32 %41, ptr %10, align 4, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !18
  %45 = getelementptr inbounds %struct.USART_TypeDef, ptr %44, i32 0, i32 0
  %46 = load volatile i32, ptr %45, align 4, !tbaa !19
  %47 = zext i32 %46 to i64
  %48 = and i64 %47, -2
  %49 = trunc i64 %48 to i32
  store volatile i32 %49, ptr %45, align 4, !tbaa !19
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !18
  %53 = getelementptr inbounds %struct.USART_TypeDef, ptr %52, i32 0, i32 0
  %54 = load volatile i32, ptr %53, align 4, !tbaa !19
  %55 = zext i32 %54 to i64
  %56 = and i64 %55, -5
  %57 = trunc i64 %56 to i32
  store volatile i32 %57, ptr %53, align 4, !tbaa !19
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  %61 = getelementptr inbounds %struct.USART_TypeDef, ptr %60, i32 0, i32 6
  %62 = load volatile i32, ptr %61, align 4, !tbaa !21
  %63 = or i32 %62, 8
  store volatile i32 %63, ptr %61, align 4, !tbaa !21
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !18
  %67 = getelementptr inbounds %struct.USART_TypeDef, ptr %66, i32 0, i32 0
  %68 = load volatile i32, ptr %67, align 4, !tbaa !19
  %69 = zext i32 %68 to i64
  %70 = or i64 %69, 8
  %71 = trunc i64 %70 to i32
  store volatile i32 %71, ptr %67, align 4, !tbaa !19
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !18
  %75 = getelementptr inbounds %struct.USART_TypeDef, ptr %74, i32 0, i32 0
  %76 = load volatile i32, ptr %75, align 4, !tbaa !19
  %77 = zext i32 %76 to i64
  %78 = or i64 %77, 1
  %79 = trunc i64 %78 to i32
  store volatile i32 %79, ptr %75, align 4, !tbaa !19
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %80, i32 0, i32 19
  store volatile i32 0, ptr %81, align 4, !tbaa !22
  %82 = load i16, ptr %8, align 2, !tbaa !9
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %83, i32 0, i32 4
  store i16 %82, ptr %84, align 8, !tbaa !23
  %85 = load i16, ptr %8, align 2, !tbaa !9
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %86, i32 0, i32 5
  store volatile i16 %85, ptr %87, align 2, !tbaa !24
  br label %88

88:                                               ; preds = %105, %38
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %89, i32 0, i32 5
  %91 = load volatile i16, ptr %90, align 2, !tbaa !24
  %92 = zext i16 %91 to i32
  %93 = icmp ugt i32 %92, 0
  br i1 %93, label %94, label %118

94:                                               ; preds = %88
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %95, i32 0, i32 5
  %97 = load volatile i16, ptr %96, align 2, !tbaa !24
  %98 = add i16 %97, -1
  store volatile i16 %98, ptr %96, align 2, !tbaa !24
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load i32, ptr %10, align 4, !tbaa !11
  %101 = load i32, ptr %9, align 4, !tbaa !11
  %102 = call i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef %99, i32 noundef 128, i32 noundef 0, i32 noundef %100, i32 noundef %101)
  %103 = icmp ne i32 %102, 0
  br i1 %103, label %104, label %105

104:                                              ; preds = %94
  store i32 3, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

105:                                              ; preds = %94
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = load i8, ptr %106, align 1, !tbaa !25
  %108 = zext i8 %107 to i32
  %109 = and i32 %108, 255
  %110 = trunc i32 %109 to i8
  %111 = zext i8 %110 to i32
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %112, i32 0, i32 0
  %114 = load ptr, ptr %113, align 8, !tbaa !18
  %115 = getelementptr inbounds %struct.USART_TypeDef, ptr %114, i32 0, i32 10
  store volatile i32 %111, ptr %115, align 4, !tbaa !26
  %116 = load ptr, ptr %11, align 8, !tbaa !5
  %117 = getelementptr inbounds i8, ptr %116, i32 1
  store ptr %117, ptr %11, align 8, !tbaa !5
  br label %88, !llvm.loop !27

118:                                              ; preds = %88
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %120, i32 0, i32 2
  %122 = getelementptr inbounds %struct.SMARTCARD_AdvFeatureInitTypeDef, ptr %121, i32 0, i32 8
  %123 = load i16, ptr %122, align 4, !tbaa !29
  %124 = zext i16 %123 to i32
  %125 = icmp eq i32 %124, 1574
  %126 = zext i1 %125 to i64
  %127 = select i1 %125, i64 64, i64 33554432
  %128 = trunc i64 %127 to i32
  %129 = load i32, ptr %10, align 4, !tbaa !11
  %130 = load i32, ptr %9, align 4, !tbaa !11
  %131 = call i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef %119, i32 noundef %128, i32 noundef 0, i32 noundef %129, i32 noundef %130)
  %132 = icmp ne i32 %131, 0
  br i1 %132, label %133, label %134

133:                                              ; preds = %118
  store i32 3, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

134:                                              ; preds = %118
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %135, i32 0, i32 1
  %137 = getelementptr inbounds %struct.SMARTCARD_InitTypeDef, ptr %136, i32 0, i32 4
  %138 = load i16, ptr %137, align 2, !tbaa !30
  %139 = zext i16 %138 to i64
  %140 = icmp eq i64 %139, 12
  br i1 %140, label %141, label %166

141:                                              ; preds = %134
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %142, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !18
  %145 = getelementptr inbounds %struct.USART_TypeDef, ptr %144, i32 0, i32 0
  %146 = load volatile i32, ptr %145, align 4, !tbaa !19
  %147 = zext i32 %146 to i64
  %148 = and i64 %147, -2
  %149 = trunc i64 %148 to i32
  store volatile i32 %149, ptr %145, align 4, !tbaa !19
  %150 = load ptr, ptr %6, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %150, i32 0, i32 0
  %152 = load ptr, ptr %151, align 8, !tbaa !18
  %153 = getelementptr inbounds %struct.USART_TypeDef, ptr %152, i32 0, i32 0
  %154 = load volatile i32, ptr %153, align 4, !tbaa !19
  %155 = zext i32 %154 to i64
  %156 = or i64 %155, 4
  %157 = trunc i64 %156 to i32
  store volatile i32 %157, ptr %153, align 4, !tbaa !19
  %158 = load ptr, ptr %6, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !18
  %161 = getelementptr inbounds %struct.USART_TypeDef, ptr %160, i32 0, i32 0
  %162 = load volatile i32, ptr %161, align 4, !tbaa !19
  %163 = zext i32 %162 to i64
  %164 = or i64 %163, 1
  %165 = trunc i64 %164 to i32
  store volatile i32 %165, ptr %161, align 4, !tbaa !19
  br label %166

166:                                              ; preds = %141, %134
  %167 = load ptr, ptr %6, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %167, i32 0, i32 17
  store volatile i32 32, ptr %168, align 4, !tbaa !13
  br label %169

169:                                              ; preds = %166
  %170 = load ptr, ptr %6, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.__SMARTCARD_HandleTypeDef, ptr %170, i32 0, i32 16
  store i32 0, ptr %171, align 8, !tbaa !17
  br label %172

172:                                              ; preds = %169
  br label %173

173:                                              ; preds = %172
  store i32 0, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

174:                                              ; preds = %4
  store i32 2, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %175

175:                                              ; preds = %174, %173, %133, %104, %32, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %176 = load i32, ptr %5, align 4
  ret i32 %176
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i32 @HAL_GetTick() #2

; Function Attrs: nounwind uwtable
declare hidden i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { 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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 164}
!14 = !{!"__SMARTCARD_HandleTypeDef", !6, i64 0, !15, i64 8, !16, 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, !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}
!15 = !{!"", !12, i64 0, !12, i64 4, !12, 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, !12, i64 28, !12, i64 32, !7, i64 36, !7, i64 37, !12, i64 40}
!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, !10, i64 32}
!17 = !{!14, !12, i64 160}
!18 = !{!14, !6, i64 0}
!19 = !{!20, !12, i64 0}
!20 = !{!"", !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}
!21 = !{!20, !12, i64 24}
!22 = !{!14, !12, i64 172}
!23 = !{!14, !10, i64 96}
!24 = !{!14, !10, i64 98}
!25 = !{!7, !7, i64 0}
!26 = !{!20, !12, i64 40}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!14, !10, i64 84}
!30 = !{!14, !10, i64 22}


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

8:                                                ; preds = %4
  %9 = icmp eq ptr %1, null
  %10 = icmp eq i16 %2, 0
  %or.cond = or i1 %9, %10
  br i1 %or.cond, label %.loopexit, label %11

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

15:                                               ; preds = %11
  store i32 1, ptr %12, align 8, !tbaa !14
  store volatile i32 33, ptr %5, align 4, !tbaa !5
  %16 = tail call i32 @HAL_GetTick() #2
  %17 = load ptr, ptr %0, align 8, !tbaa !15
  %18 = load volatile i32, ptr %17, align 4, !tbaa !16
  %19 = and i32 %18, -2
  store volatile i32 %19, ptr %17, align 4, !tbaa !16
  %20 = load volatile i32, ptr %17, align 4, !tbaa !16
  %21 = and i32 %20, -5
  store volatile i32 %21, ptr %17, align 4, !tbaa !16
  %22 = getelementptr inbounds i8, ptr %17, i64 24
  %23 = load volatile i32, ptr %22, align 4, !tbaa !18
  %24 = or i32 %23, 8
  store volatile i32 %24, ptr %22, align 4, !tbaa !18
  %25 = load volatile i32, ptr %17, align 4, !tbaa !16
  %26 = or i32 %25, 8
  store volatile i32 %26, ptr %17, align 4, !tbaa !16
  %27 = load volatile i32, ptr %17, align 4, !tbaa !16
  %28 = or i32 %27, 1
  store volatile i32 %28, ptr %17, align 4, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %0, i64 172
  store volatile i32 0, ptr %29, align 4, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %0, i64 96
  store i16 %2, ptr %30, align 8, !tbaa !20
  %31 = getelementptr inbounds i8, ptr %0, i64 98
  store volatile i16 %2, ptr %31, align 2, !tbaa !21
  %32 = load volatile i16, ptr %31, align 2, !tbaa !21
  %.not41 = icmp eq i16 %32, 0
  br i1 %.not41, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %15, %36
  %.042 = phi ptr [ %41, %36 ], [ %1, %15 ]
  %33 = load volatile i16, ptr %31, align 2, !tbaa !21
  %34 = add i16 %33, -1
  store volatile i16 %34, ptr %31, align 2, !tbaa !21
  %35 = tail call i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef nonnull %0, i32 noundef 128, i32 noundef 0, i32 noundef %16, i32 noundef %3)
  %.not40 = icmp eq i32 %35, 0
  br i1 %.not40, label %36, label %.loopexit

36:                                               ; preds = %.lr.ph
  %37 = load i8, ptr %.042, align 1, !tbaa !22
  %38 = zext i8 %37 to i32
  %39 = load ptr, ptr %0, align 8, !tbaa !15
  %40 = getelementptr inbounds i8, ptr %39, i64 40
  store volatile i32 %38, ptr %40, align 4, !tbaa !23
  %41 = getelementptr inbounds i8, ptr %.042, i64 1
  %42 = load volatile i16, ptr %31, align 2, !tbaa !21
  %.not = icmp eq i16 %42, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %36, %15
  %43 = getelementptr inbounds i8, ptr %0, i64 84
  %44 = load i16, ptr %43, align 4, !tbaa !26
  %45 = icmp eq i16 %44, 1574
  %46 = select i1 %45, i32 64, i32 33554432
  %47 = tail call i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef nonnull %0, i32 noundef %46, i32 noundef 0, i32 noundef %16, i32 noundef %3)
  %.not39 = icmp eq i32 %47, 0
  br i1 %.not39, label %48, label %.loopexit

48:                                               ; preds = %._crit_edge
  %49 = getelementptr inbounds i8, ptr %0, i64 22
  %50 = load i16, ptr %49, align 2, !tbaa !27
  %51 = icmp eq i16 %50, 12
  br i1 %51, label %52, label %60

52:                                               ; preds = %48
  %53 = load ptr, ptr %0, align 8, !tbaa !15
  %54 = load volatile i32, ptr %53, align 4, !tbaa !16
  %55 = and i32 %54, -2
  store volatile i32 %55, ptr %53, align 4, !tbaa !16
  %56 = load volatile i32, ptr %53, align 4, !tbaa !16
  %57 = or i32 %56, 4
  store volatile i32 %57, ptr %53, align 4, !tbaa !16
  %58 = load volatile i32, ptr %53, align 4, !tbaa !16
  %59 = or i32 %58, 1
  store volatile i32 %59, ptr %53, align 4, !tbaa !16
  br label %60

60:                                               ; preds = %52, %48
  store volatile i32 32, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %12, align 8, !tbaa !14
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph, %4, %._crit_edge, %11, %8, %60
  %.037 = phi i32 [ 0, %60 ], [ 1, %8 ], [ 2, %11 ], [ 3, %._crit_edge ], [ 2, %4 ], [ 3, %.lr.ph ]
  ret i32 %.037
}

declare i32 @HAL_GetTick() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @SMARTCARD_WaitOnFlagUntilTimeout(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) 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" }
attributes #1 = { "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, !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, !7, i64 0}
!16 = !{!17, !11, i64 0}
!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}
!18 = !{!17, !11, i64 24}
!19 = !{!6, !11, i64 172}
!20 = !{!6, !12, i64 96}
!21 = !{!6, !12, i64 98}
!22 = !{!8, !8, i64 0}
!23 = !{!17, !11, i64 40}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!6, !12, i64 84}
!27 = !{!6, !12, i64 22}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass