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

; 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.__USART_HandleTypeDef = type { ptr, %struct.USART_InitTypeDef, ptr, i16, i16, ptr, i16, i16, i16, i16, i16, i32, i32, ptr, ptr, ptr, ptr, i32, i32, i32 }
%struct.USART_InitTypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.USART_TypeDef = type { 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

declare i32 @HAL_GetTick() #1

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

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

19:                                               ; preds = %4
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %26, label %22

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

26:                                               ; preds = %22, %19
  store i32 1, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

27:                                               ; preds = %22
  br label %28

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

33:                                               ; preds = %28
  store i32 2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

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

37:                                               ; preds = %34
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %40, i32 0, i32 19
  store volatile i32 0, ptr %41, align 8, !tbaa !17
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %42, i32 0, i32 18
  store volatile i32 34, ptr %43, align 4, !tbaa !13
  %44 = call i32 @HAL_GetTick()
  store i32 %44, ptr %13, align 4, !tbaa !11
  %45 = load i16, ptr %8, align 2, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %46, i32 0, i32 6
  store i16 %45, ptr %47, align 8, !tbaa !18
  %48 = load i16, ptr %8, align 2, !tbaa !9
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %49, i32 0, i32 7
  store volatile i16 %48, ptr %50, align 2, !tbaa !19
  br label %51

51:                                               ; preds = %39
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %52, i32 0, i32 1
  %54 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %53, i32 0, i32 1
  %55 = load i32, ptr %54, align 4, !tbaa !20
  %56 = icmp eq i32 %55, 4096
  br i1 %56, label %57, label %70

57:                                               ; preds = %51
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %58, i32 0, i32 1
  %60 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %59, i32 0, i32 3
  %61 = load i32, ptr %60, align 4, !tbaa !21
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %66

63:                                               ; preds = %57
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %64, i32 0, i32 8
  store i16 511, ptr %65, align 4, !tbaa !22
  br label %69

66:                                               ; preds = %57
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %67, i32 0, i32 8
  store i16 255, ptr %68, align 4, !tbaa !22
  br label %69

69:                                               ; preds = %66, %63
  br label %113

70:                                               ; preds = %51
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %71, i32 0, i32 1
  %73 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %72, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !20
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %89

76:                                               ; preds = %70
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %77, i32 0, i32 1
  %79 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %78, i32 0, i32 3
  %80 = load i32, ptr %79, align 4, !tbaa !21
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %85

82:                                               ; preds = %76
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %83, i32 0, i32 8
  store i16 255, ptr %84, align 4, !tbaa !22
  br label %88

85:                                               ; preds = %76
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %86, i32 0, i32 8
  store i16 127, ptr %87, align 4, !tbaa !22
  br label %88

88:                                               ; preds = %85, %82
  br label %112

89:                                               ; preds = %70
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %90, i32 0, i32 1
  %92 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %91, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !20
  %94 = icmp eq i32 %93, 268435456
  br i1 %94, label %95, label %108

95:                                               ; preds = %89
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %97, i32 0, i32 3
  %99 = load i32, ptr %98, align 4, !tbaa !21
  %100 = icmp eq i32 %99, 0
  br i1 %100, label %101, label %104

101:                                              ; preds = %95
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %102, i32 0, i32 8
  store i16 127, ptr %103, align 4, !tbaa !22
  br label %107

104:                                              ; preds = %95
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %105, i32 0, i32 8
  store i16 63, ptr %106, align 4, !tbaa !22
  br label %107

107:                                              ; preds = %104, %101
  br label %111

108:                                              ; preds = %89
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %109, i32 0, i32 8
  store i16 0, ptr %110, align 4, !tbaa !22
  br label %111

111:                                              ; preds = %108, %107
  br label %112

112:                                              ; preds = %111, %88
  br label %113

113:                                              ; preds = %112, %69
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %6, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %116, i32 0, i32 8
  %118 = load i16, ptr %117, align 4, !tbaa !22
  store i16 %118, ptr %12, align 2, !tbaa !9
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %119, i32 0, i32 1
  %121 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %120, i32 0, i32 1
  %122 = load i32, ptr %121, align 4, !tbaa !20
  %123 = icmp eq i32 %122, 4096
  br i1 %123, label %124, label %132

124:                                              ; preds = %115
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %125, i32 0, i32 1
  %127 = getelementptr inbounds %struct.USART_InitTypeDef, ptr %126, i32 0, i32 3
  %128 = load i32, ptr %127, align 4, !tbaa !21
  %129 = icmp eq i32 %128, 0
  br i1 %129, label %130, label %132

130:                                              ; preds = %124
  store ptr null, ptr %10, align 8, !tbaa !5
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %131, ptr %11, align 8, !tbaa !5
  br label %134

132:                                              ; preds = %124, %115
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %133, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %11, align 8, !tbaa !5
  br label %134

134:                                              ; preds = %132, %130
  br label %135

135:                                              ; preds = %197, %134
  %136 = load ptr, ptr %6, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %136, i32 0, i32 7
  %138 = load volatile i16, ptr %137, align 2, !tbaa !19
  %139 = zext i16 %138 to i32
  %140 = icmp ugt i32 %139, 0
  br i1 %140, label %141, label %202

141:                                              ; preds = %135
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %142, i32 0, i32 11
  %144 = load i32, ptr %143, align 4, !tbaa !23
  %145 = icmp eq i32 %144, 0
  br i1 %145, label %146, label %158

146:                                              ; preds = %141
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = load i32, ptr %13, align 4, !tbaa !11
  %149 = load i32, ptr %9, align 4, !tbaa !11
  %150 = call i32 @USART_WaitOnFlagUntilTimeout(ptr noundef %147, i32 noundef 128, i32 noundef 0, i32 noundef %148, i32 noundef %149)
  %151 = icmp ne i32 %150, 0
  br i1 %151, label %152, label %153

152:                                              ; preds = %146
  store i32 3, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

153:                                              ; preds = %146
  %154 = load ptr, ptr %6, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %154, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !24
  %157 = getelementptr inbounds %struct.USART_TypeDef, ptr %156, i32 0, i32 10
  store volatile i32 255, ptr %157, align 4, !tbaa !25
  br label %158

158:                                              ; preds = %153, %141
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = load i32, ptr %13, align 4, !tbaa !11
  %161 = load i32, ptr %9, align 4, !tbaa !11
  %162 = call i32 @USART_WaitOnFlagUntilTimeout(ptr noundef %159, i32 noundef 32, i32 noundef 0, i32 noundef %160, i32 noundef %161)
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %164, label %165

164:                                              ; preds = %158
  store i32 3, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

165:                                              ; preds = %158
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = icmp eq ptr %166, null
  br i1 %167, label %168, label %181

168:                                              ; preds = %165
  %169 = load ptr, ptr %6, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !24
  %172 = getelementptr inbounds %struct.USART_TypeDef, ptr %171, i32 0, i32 9
  %173 = load volatile i32, ptr %172, align 4, !tbaa !27
  %174 = load i16, ptr %12, align 2, !tbaa !9
  %175 = zext i16 %174 to i32
  %176 = and i32 %173, %175
  %177 = trunc i32 %176 to i16
  %178 = load ptr, ptr %11, align 8, !tbaa !5
  store i16 %177, ptr %178, align 2, !tbaa !9
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = getelementptr inbounds i16, ptr %179, i32 1
  store ptr %180, ptr %11, align 8, !tbaa !5
  br label %197

181:                                              ; preds = %165
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !24
  %185 = getelementptr inbounds %struct.USART_TypeDef, ptr %184, i32 0, i32 9
  %186 = load volatile i32, ptr %185, align 4, !tbaa !27
  %187 = load i16, ptr %12, align 2, !tbaa !9
  %188 = zext i16 %187 to i32
  %189 = and i32 %188, 255
  %190 = trunc i32 %189 to i8
  %191 = zext i8 %190 to i32
  %192 = and i32 %186, %191
  %193 = trunc i32 %192 to i8
  %194 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 %193, ptr %194, align 1, !tbaa !28
  %195 = load ptr, ptr %10, align 8, !tbaa !5
  %196 = getelementptr inbounds i8, ptr %195, i32 1
  store ptr %196, ptr %10, align 8, !tbaa !5
  br label %197

197:                                              ; preds = %181, %168
  %198 = load ptr, ptr %6, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %198, i32 0, i32 7
  %200 = load volatile i16, ptr %199, align 2, !tbaa !19
  %201 = add i16 %200, -1
  store volatile i16 %201, ptr %199, align 2, !tbaa !19
  br label %135, !llvm.loop !29

202:                                              ; preds = %135
  %203 = load ptr, ptr %6, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %203, i32 0, i32 11
  %205 = load i32, ptr %204, align 4, !tbaa !23
  %206 = zext i32 %205 to i64
  %207 = icmp eq i64 %206, 1
  br i1 %207, label %208, label %219

208:                                              ; preds = %202
  %209 = load ptr, ptr %6, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %209, i32 0, i32 0
  %211 = load ptr, ptr %210, align 8, !tbaa !24
  %212 = getelementptr inbounds %struct.USART_TypeDef, ptr %211, i32 0, i32 8
  store volatile i32 8192, ptr %212, align 4, !tbaa !31
  %213 = load ptr, ptr %6, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %213, i32 0, i32 0
  %215 = load ptr, ptr %214, align 8, !tbaa !24
  %216 = getelementptr inbounds %struct.USART_TypeDef, ptr %215, i32 0, i32 6
  %217 = load volatile i32, ptr %216, align 4, !tbaa !32
  %218 = or i32 %217, 16
  store volatile i32 %218, ptr %216, align 4, !tbaa !32
  br label %219

219:                                              ; preds = %208, %202
  %220 = load ptr, ptr %6, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %220, i32 0, i32 18
  store volatile i32 1, ptr %221, align 4, !tbaa !13
  br label %222

222:                                              ; preds = %219
  %223 = load ptr, ptr %6, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.__USART_HandleTypeDef, ptr %223, i32 0, i32 17
  store i32 0, ptr %224, align 8, !tbaa !16
  br label %225

225:                                              ; preds = %222
  br label %226

226:                                              ; preds = %225
  store i32 0, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

227:                                              ; preds = %4
  store i32 2, ptr %5, align 4
  store i32 1, ptr %14, align 4
  br label %228

228:                                              ; preds = %227, %226, %164, %152, %33, %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %229 = load i32, ptr %5, align 4
  ret i32 %229
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #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 132}
!14 = !{!"__USART_HandleTypeDef", !6, i64 0, !15, i64 8, !6, i64 48, !10, i64 56, !10, i64 58, !6, i64 64, !10, i64 72, !10, i64 74, !10, i64 76, !10, i64 78, !10, i64 80, !12, i64 84, !12, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !12, i64 128, !12, i64 132, !12, i64 136}
!15 = !{!"", !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}
!16 = !{!14, !12, i64 128}
!17 = !{!14, !12, i64 136}
!18 = !{!14, !10, i64 72}
!19 = !{!14, !10, i64 74}
!20 = !{!14, !12, i64 12}
!21 = !{!14, !12, i64 20}
!22 = !{!14, !10, i64 76}
!23 = !{!14, !12, i64 84}
!24 = !{!14, !6, i64 0}
!25 = !{!26, !12, i64 40}
!26 = !{!"", !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}
!27 = !{!26, !12, i64 36}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!26, !12, i64 32}
!32 = !{!26, !12, i64 24}


; 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_GetTick() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @USART_WaitOnFlagUntilTimeout(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 4) i32 @HAL_USART_Receive(ptr noundef %0, ptr noundef writeonly %1, i16 noundef zeroext %2, i32 noundef %3) local_unnamed_addr #1 {
  %5 = getelementptr inbounds i8, ptr %0, i64 132
  %6 = load volatile i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 1
  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 128
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %.loopexit, label %15

15:                                               ; preds = %11
  store i32 1, ptr %12, align 8, !tbaa !13
  %16 = getelementptr inbounds i8, ptr %0, i64 136
  store volatile i32 0, ptr %16, align 8, !tbaa !14
  store volatile i32 34, ptr %5, align 4, !tbaa !5
  %17 = tail call i32 @HAL_GetTick() #2
  %18 = getelementptr inbounds i8, ptr %0, i64 72
  store i16 %2, ptr %18, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %0, i64 74
  store volatile i16 %2, ptr %19, align 2, !tbaa !16
  %20 = getelementptr inbounds i8, ptr %0, i64 12
  %21 = load i32, ptr %20, align 4, !tbaa !17
  switch i32 %21, label %40 [
    i32 4096, label %.thread64
    i32 0, label %26
    i32 268435456, label %33
  ]

.thread64:                                        ; preds = %15
  %22 = getelementptr inbounds i8, ptr %0, i64 20
  %23 = load i32, ptr %22, align 4, !tbaa !18
  %24 = icmp eq i32 %23, 0
  %spec.select65 = select i1 %24, ptr null, ptr %1
  %spec.select = select i1 %24, ptr %1, ptr null
  %.sink = select i1 %24, i16 511, i16 255
  %25 = getelementptr inbounds i8, ptr %0, i64 76
  store i16 %.sink, ptr %25, align 4
  br label %.thread

26:                                               ; preds = %15
  %27 = getelementptr inbounds i8, ptr %0, i64 20
  %28 = load i32, ptr %27, align 4, !tbaa !18
  %29 = icmp eq i32 %28, 0
  %30 = getelementptr inbounds i8, ptr %0, i64 76
  br i1 %29, label %31, label %32

31:                                               ; preds = %26
  store i16 255, ptr %30, align 4, !tbaa !19
  br label %.thread

32:                                               ; preds = %26
  store i16 127, ptr %30, align 4, !tbaa !19
  br label %.thread

33:                                               ; preds = %15
  %34 = getelementptr inbounds i8, ptr %0, i64 20
  %35 = load i32, ptr %34, align 4, !tbaa !18
  %36 = icmp eq i32 %35, 0
  %37 = getelementptr inbounds i8, ptr %0, i64 76
  br i1 %36, label %38, label %39

38:                                               ; preds = %33
  store i16 127, ptr %37, align 4, !tbaa !19
  br label %.thread

39:                                               ; preds = %33
  store i16 63, ptr %37, align 4, !tbaa !19
  br label %.thread

40:                                               ; preds = %15
  %41 = getelementptr inbounds i8, ptr %0, i64 76
  store i16 0, ptr %41, align 4, !tbaa !19
  br label %.thread

.thread:                                          ; preds = %39, %38, %31, %32, %.thread64, %40
  %42 = phi i16 [ 0, %40 ], [ %.sink, %.thread64 ], [ 127, %32 ], [ 255, %31 ], [ 127, %38 ], [ 63, %39 ]
  %.056 = phi ptr [ null, %40 ], [ %spec.select, %.thread64 ], [ null, %32 ], [ null, %31 ], [ null, %38 ], [ null, %39 ]
  %.055 = phi ptr [ %1, %40 ], [ %spec.select65, %.thread64 ], [ %1, %32 ], [ %1, %31 ], [ %1, %38 ], [ %1, %39 ]
  %43 = load volatile i16, ptr %19, align 2, !tbaa !16
  %.not66 = icmp eq i16 %43, 0
  br i1 %.not66, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.thread
  %44 = getelementptr inbounds i8, ptr %0, i64 84
  %45 = zext nneg i16 %42 to i32
  br label %46

46:                                               ; preds = %.lr.ph, %69
  %.168 = phi ptr [ %.055, %.lr.ph ], [ %.2, %69 ]
  %.15767 = phi ptr [ %.056, %.lr.ph ], [ %.258, %69 ]
  %47 = load i32, ptr %44, align 4, !tbaa !20
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = tail call i32 @USART_WaitOnFlagUntilTimeout(ptr noundef nonnull %0, i32 noundef 128, i32 noundef 0, i32 noundef %17, i32 noundef %3)
  %.not61 = icmp eq i32 %50, 0
  br i1 %.not61, label %51, label %.loopexit

51:                                               ; preds = %49
  %52 = load ptr, ptr %0, align 8, !tbaa !21
  %53 = getelementptr inbounds i8, ptr %52, i64 40
  store volatile i32 255, ptr %53, align 4, !tbaa !22
  br label %54

54:                                               ; preds = %51, %46
  %55 = tail call i32 @USART_WaitOnFlagUntilTimeout(ptr noundef nonnull %0, i32 noundef 32, i32 noundef 0, i32 noundef %17, i32 noundef %3)
  %.not62 = icmp eq i32 %55, 0
  br i1 %.not62, label %56, label %.loopexit

56:                                               ; preds = %54
  %57 = icmp eq ptr %.168, null
  %58 = load ptr, ptr %0, align 8, !tbaa !21
  %59 = getelementptr inbounds i8, ptr %58, i64 36
  %60 = load volatile i32, ptr %59, align 4, !tbaa !24
  br i1 %57, label %61, label %65

61:                                               ; preds = %56
  %62 = trunc i32 %60 to i16
  %63 = and i16 %42, %62
  store i16 %63, ptr %.15767, align 2, !tbaa !25
  %64 = getelementptr inbounds i8, ptr %.15767, i64 2
  br label %69

65:                                               ; preds = %56
  %66 = and i32 %60, %45
  %67 = trunc i32 %66 to i8
  store i8 %67, ptr %.168, align 1, !tbaa !26
  %68 = getelementptr inbounds i8, ptr %.168, i64 1
  br label %69

69:                                               ; preds = %65, %61
  %.258 = phi ptr [ %64, %61 ], [ %.15767, %65 ]
  %.2 = phi ptr [ null, %61 ], [ %68, %65 ]
  %70 = load volatile i16, ptr %19, align 2, !tbaa !16
  %71 = add i16 %70, -1
  store volatile i16 %71, ptr %19, align 2, !tbaa !16
  %72 = load volatile i16, ptr %19, align 2, !tbaa !16
  %.not = icmp eq i16 %72, 0
  br i1 %.not, label %._crit_edge, label %46, !llvm.loop !27

._crit_edge:                                      ; preds = %69, %.thread
  %73 = getelementptr inbounds i8, ptr %0, i64 84
  %74 = load i32, ptr %73, align 4, !tbaa !20
  %75 = icmp eq i32 %74, 1
  br i1 %75, label %76, label %82

76:                                               ; preds = %._crit_edge
  %77 = load ptr, ptr %0, align 8, !tbaa !21
  %78 = getelementptr inbounds i8, ptr %77, i64 32
  store volatile i32 8192, ptr %78, align 4, !tbaa !29
  %79 = getelementptr inbounds i8, ptr %77, i64 24
  %80 = load volatile i32, ptr %79, align 4, !tbaa !30
  %81 = or i32 %80, 16
  store volatile i32 %81, ptr %79, align 4, !tbaa !30
  br label %82

82:                                               ; preds = %76, %._crit_edge
  store volatile i32 1, ptr %5, align 4, !tbaa !5
  store i32 0, ptr %12, align 8, !tbaa !13
  br label %.loopexit

.loopexit:                                        ; preds = %54, %49, %4, %11, %8, %82
  %.0 = phi i32 [ 0, %82 ], [ 1, %8 ], [ 2, %11 ], [ 2, %4 ], [ 3, %49 ], [ 3, %54 ]
  ret i32 %.0
}

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, !11, i64 132}
!6 = !{!"__USART_HandleTypeDef", !7, i64 0, !10, i64 8, !7, i64 48, !12, i64 56, !12, i64 58, !7, i64 64, !12, i64 72, !12, i64 74, !12, i64 76, !12, i64 78, !12, i64 80, !11, i64 84, !11, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !11, i64 128, !11, i64 132, !11, i64 136}
!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, i64 20, !11, i64 24, !11, i64 28, !11, i64 32}
!11 = !{!"int", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !11, i64 128}
!14 = !{!6, !11, i64 136}
!15 = !{!6, !12, i64 72}
!16 = !{!6, !12, i64 74}
!17 = !{!6, !11, i64 12}
!18 = !{!6, !11, i64 20}
!19 = !{!6, !12, i64 76}
!20 = !{!6, !11, i64 84}
!21 = !{!6, !7, i64 0}
!22 = !{!23, !11, i64 40}
!23 = !{!"", !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}
!24 = !{!23, !11, i64 36}
!25 = !{!12, !12, i64 0}
!26 = !{!8, !8, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!23, !11, i64 32}
!30 = !{!23, !11, i64 24}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass