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

; 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.FLASH_ProcessTypeDef = type { i32, i32, i32, i32, i32, i32, i32 }
%struct.FLASH_EraseInitTypeDef = type { i32, i32, i32, i32, i32 }
%struct.FLASH_TypeDef = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [2 x i32], i32, i32, i32, i32, i32, [40 x i32], i32, i32, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [4 x i32], i32, i32, i32, i32, i32 }

@pFlash = external global %struct.FLASH_ProcessTypeDef, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_FLASHEx_Erase(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  br label %9

9:                                                ; preds = %2
  %10 = load i32, ptr getelementptr inbounds (%struct.FLASH_ProcessTypeDef, ptr @pFlash, i32 0, i32 5), align 4, !tbaa !11
  %11 = icmp eq i32 %10, 1
  br i1 %11, label %12, label %13

12:                                               ; preds = %9
  store i32 2, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %146

13:                                               ; preds = %9
  store i32 1, ptr getelementptr inbounds (%struct.FLASH_ProcessTypeDef, ptr @pFlash, i32 0, i32 5), align 4, !tbaa !11
  br label %14

14:                                               ; preds = %13
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  store volatile i32 0, ptr getelementptr inbounds (%struct.FLASH_ProcessTypeDef, ptr @pFlash, i32 0, i32 6), align 4, !tbaa !13
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %20 = and i32 %19, 1
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %27

22:                                               ; preds = %16
  %23 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %22
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %26

26:                                               ; preds = %25, %22
  br label %27

27:                                               ; preds = %26, %16
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !14
  %31 = and i32 %30, 2
  %32 = icmp eq i32 %31, 2
  br i1 %32, label %33, label %38

33:                                               ; preds = %27
  %34 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %36, label %37

36:                                               ; preds = %33
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %37

37:                                               ; preds = %36, %33
  br label %38

38:                                               ; preds = %37, %27
  %39 = load i32, ptr %6, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %141

41:                                               ; preds = %38
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %42, i32 0, i32 0
  %44 = load i32, ptr %43, align 4, !tbaa !16
  %45 = icmp eq i32 %44, 1
  br i1 %45, label %46, label %83

46:                                               ; preds = %41
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %47, i32 0, i32 4
  %49 = load i32, ptr %48, align 4, !tbaa !17
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %50, i32 0, i32 1
  %52 = load i32, ptr %51, align 4, !tbaa !14
  call void @FLASH_MassErase(i32 noundef %49, i32 noundef %52)
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %53, i32 0, i32 1
  %55 = load i32, ptr %54, align 4, !tbaa !14
  %56 = and i32 %55, 1
  %57 = icmp eq i32 %56, 1
  br i1 %57, label %58, label %67

58:                                               ; preds = %46
  %59 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1)
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %62

61:                                               ; preds = %58
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %62

62:                                               ; preds = %61, %58
  %63 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !18
  %64 = zext i32 %63 to i64
  %65 = and i64 %64, -9
  %66 = trunc i64 %65 to i32
  store volatile i32 %66, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !18
  br label %67

67:                                               ; preds = %62, %46
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %68, i32 0, i32 1
  %70 = load i32, ptr %69, align 4, !tbaa !14
  %71 = and i32 %70, 2
  %72 = icmp eq i32 %71, 2
  br i1 %72, label %73, label %82

73:                                               ; preds = %67
  %74 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2)
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %73
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %76, %73
  %78 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !20
  %79 = zext i32 %78 to i64
  %80 = and i64 %79, -9
  %81 = trunc i64 %80 to i32
  store volatile i32 %81, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !20
  br label %82

82:                                               ; preds = %77, %67
  br label %140

83:                                               ; preds = %41
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 -1, ptr %84, align 4, !tbaa !9
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %85, i32 0, i32 2
  %87 = load i32, ptr %86, align 4, !tbaa !21
  store i32 %87, ptr %7, align 4, !tbaa !9
  br label %88

88:                                               ; preds = %136, %83
  %89 = load i32, ptr %7, align 4, !tbaa !9
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %90, i32 0, i32 3
  %92 = load i32, ptr %91, align 4, !tbaa !22
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %93, i32 0, i32 2
  %95 = load i32, ptr %94, align 4, !tbaa !21
  %96 = add i32 %92, %95
  %97 = icmp ult i32 %89, %96
  br i1 %97, label %98, label %139

98:                                               ; preds = %88
  %99 = load i32, ptr %7, align 4, !tbaa !9
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %100, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !14
  %103 = load ptr, ptr %4, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %103, i32 0, i32 4
  %105 = load i32, ptr %104, align 4, !tbaa !17
  call void @FLASH_Erase_Sector(i32 noundef %99, i32 noundef %102, i32 noundef %105)
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %106, i32 0, i32 1
  %108 = load i32, ptr %107, align 4, !tbaa !14
  %109 = and i32 %108, 1
  %110 = icmp eq i32 %109, 1
  br i1 %110, label %111, label %117

111:                                              ; preds = %98
  %112 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1)
  store i32 %112, ptr %6, align 4, !tbaa !9
  %113 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !18
  %114 = zext i32 %113 to i64
  %115 = and i64 %114, -1797
  %116 = trunc i64 %115 to i32
  store volatile i32 %116, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !18
  br label %117

117:                                              ; preds = %111, %98
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.FLASH_EraseInitTypeDef, ptr %118, i32 0, i32 1
  %120 = load i32, ptr %119, align 4, !tbaa !14
  %121 = and i32 %120, 2
  %122 = icmp eq i32 %121, 2
  br i1 %122, label %123, label %129

123:                                              ; preds = %117
  %124 = call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2)
  store i32 %124, ptr %6, align 4, !tbaa !9
  %125 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !20
  %126 = zext i32 %125 to i64
  %127 = and i64 %126, -1797
  %128 = trunc i64 %127 to i32
  store volatile i32 %128, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !20
  br label %129

129:                                              ; preds = %123, %117
  %130 = load i32, ptr %6, align 4, !tbaa !9
  %131 = icmp ne i32 %130, 0
  br i1 %131, label %132, label %135

132:                                              ; preds = %129
  %133 = load i32, ptr %7, align 4, !tbaa !9
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  store i32 %133, ptr %134, align 4, !tbaa !9
  br label %139

135:                                              ; preds = %129
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %7, align 4, !tbaa !9
  %138 = add i32 %137, 1
  store i32 %138, ptr %7, align 4, !tbaa !9
  br label %88, !llvm.loop !23

139:                                              ; preds = %132, %88
  br label %140

140:                                              ; preds = %139, %82
  br label %141

141:                                              ; preds = %140, %38
  br label %142

142:                                              ; preds = %141
  store i32 0, ptr getelementptr inbounds (%struct.FLASH_ProcessTypeDef, ptr @pFlash, i32 0, i32 5), align 4, !tbaa !11
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %6, align 4, !tbaa !9
  store i32 %145, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %146

146:                                              ; preds = %144, %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %147 = load i32, ptr %3, align 4
  ret i32 %147
}

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

declare i32 @FLASH_WaitForLastOperation(i32 noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @FLASH_Erase_Sector(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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 20}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!13 = !{!12, !10, i64 24}
!14 = !{!15, !10, i64 4}
!15 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16}
!16 = !{!15, !10, i64 0}
!17 = !{!15, !10, i64 16}
!18 = !{!19, !10, i64 12}
!19 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !7, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !7, i64 100, !10, i64 260, !10, i64 264, !10, i64 268, !10, i64 272, !10, i64 276, !7, i64 280, !10, i64 296, !10, i64 300, !10, i64 304, !10, i64 308, !10, i64 312, !10, i64 316, !7, i64 320, !10, i64 336, !10, i64 340, !10, i64 344, !10, i64 348, !10, i64 352}
!20 = !{!19, !10, i64 268}
!21 = !{!15, !10, i64 8}
!22 = !{!15, !10, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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

%struct.FLASH_ProcessTypeDef = type { i32, i32, i32, i32, i32, i32, i32 }

@pFlash = external global %struct.FLASH_ProcessTypeDef, align 4

; Function Attrs: nounwind uwtable
define dso_local i32 @HAL_FLASHEx_Erase(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @pFlash, i64 20), align 4, !tbaa !5
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %66, label %5

5:                                                ; preds = %2
  store i32 1, ptr getelementptr inbounds (i8, ptr @pFlash, i64 20), align 4, !tbaa !5
  store volatile i32 0, ptr getelementptr inbounds (i8, ptr @pFlash, i64 24), align 4, !tbaa !10
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !11
  %8 = and i32 %7, 1
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %.thread45, label %9

9:                                                ; preds = %5
  %10 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1) #2
  %.not25.not = icmp eq i32 %10, 0
  %.pre = load i32, ptr %6, align 4, !tbaa !11
  %11 = and i32 %.pre, 2
  %.not26 = icmp eq i32 %11, 0
  br i1 %.not26, label %select.unfold, label %13

.thread45:                                        ; preds = %5
  %12 = and i32 %7, 2
  %.not2647 = icmp eq i32 %12, 0
  br i1 %.not2647, label %select.unfold.thread, label %13

13:                                               ; preds = %.thread45, %9
  %.02349 = phi i1 [ true, %.thread45 ], [ %.not25.not, %9 ]
  %14 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2) #2
  %.not27 = icmp eq i32 %14, 0
  %or.cond = select i1 %.not27, i1 %.02349, i1 false
  br i1 %or.cond, label %select.unfold.thread, label %.thread

select.unfold:                                    ; preds = %9
  br i1 %.not25.not, label %select.unfold.thread, label %.thread

select.unfold.thread:                             ; preds = %.thread45, %13, %select.unfold
  %15 = load i32, ptr %0, align 4, !tbaa !13
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %17, label %34

17:                                               ; preds = %select.unfold.thread
  %18 = getelementptr inbounds i8, ptr %0, i64 16
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %20 = load i32, ptr %6, align 4, !tbaa !11
  tail call void @FLASH_MassErase(i32 noundef %19, i32 noundef %20)
  %21 = load i32, ptr %6, align 4, !tbaa !11
  %22 = and i32 %21, 1
  %.not31 = icmp eq i32 %22, 0
  br i1 %.not31, label %27, label %23

23:                                               ; preds = %17
  %24 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1) #2
  %.not32 = icmp ne i32 %24, 0
  %spec.select36 = zext i1 %.not32 to i32
  %25 = load volatile i32, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !15
  %26 = and i32 %25, -9
  store volatile i32 %26, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !15
  %.pre44 = load i32, ptr %6, align 4, !tbaa !11
  br label %27

27:                                               ; preds = %23, %17
  %28 = phi i32 [ %.pre44, %23 ], [ %21, %17 ]
  %.3 = phi i32 [ %spec.select36, %23 ], [ 0, %17 ]
  %29 = and i32 %28, 2
  %.not33 = icmp eq i32 %29, 0
  br i1 %.not33, label %.thread, label %30

30:                                               ; preds = %27
  %31 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2) #2
  %.not34 = icmp eq i32 %31, 0
  %spec.select37 = select i1 %.not34, i32 %.3, i32 1
  %32 = load volatile i32, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !17
  %33 = and i32 %32, -9
  store volatile i32 %33, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !17
  br label %.thread

34:                                               ; preds = %select.unfold.thread
  store i32 -1, ptr %1, align 4, !tbaa !18
  %35 = getelementptr inbounds i8, ptr %0, i64 8
  %36 = load i32, ptr %35, align 4, !tbaa !19
  %37 = getelementptr inbounds i8, ptr %0, i64 12
  %38 = load i32, ptr %37, align 4, !tbaa !20
  %39 = add i32 %36, %38
  %40 = icmp ult i32 %36, %39
  br i1 %40, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %34
  %41 = getelementptr inbounds i8, ptr %0, i64 16
  br label %42

42:                                               ; preds = %.lr.ph, %60
  %.040 = phi i32 [ %36, %.lr.ph ], [ %61, %60 ]
  %43 = load i32, ptr %6, align 4, !tbaa !11
  %44 = load i32, ptr %41, align 4, !tbaa !14
  tail call void @FLASH_Erase_Sector(i32 noundef %.040, i32 noundef %43, i32 noundef %44)
  %45 = load i32, ptr %6, align 4, !tbaa !11
  %46 = and i32 %45, 1
  %.not28 = icmp eq i32 %46, 0
  br i1 %.not28, label %51, label %47

47:                                               ; preds = %42
  %48 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 1) #2
  %49 = load volatile i32, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !15
  %50 = and i32 %49, -1797
  store volatile i32 %50, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !15
  %.pre43 = load i32, ptr %6, align 4, !tbaa !11
  br label %51

51:                                               ; preds = %47, %42
  %52 = phi i32 [ %.pre43, %47 ], [ %45, %42 ]
  %.6 = phi i32 [ %48, %47 ], [ 0, %42 ]
  %53 = and i32 %52, 2
  %.not29 = icmp eq i32 %53, 0
  br i1 %.not29, label %58, label %54

54:                                               ; preds = %51
  %55 = tail call i32 @FLASH_WaitForLastOperation(i32 noundef 50000, i32 noundef 2) #2
  %56 = load volatile i32, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !17
  %57 = and i32 %56, -1797
  store volatile i32 %57, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !17
  br label %58

58:                                               ; preds = %54, %51
  %.7 = phi i32 [ %55, %54 ], [ %.6, %51 ]
  %.not30 = icmp eq i32 %.7, 0
  br i1 %.not30, label %60, label %59

59:                                               ; preds = %58
  store i32 %.040, ptr %1, align 4, !tbaa !18
  br label %.thread

60:                                               ; preds = %58
  %61 = add nuw i32 %.040, 1
  %62 = load i32, ptr %37, align 4, !tbaa !20
  %63 = load i32, ptr %35, align 4, !tbaa !19
  %64 = add i32 %63, %62
  %65 = icmp ult i32 %61, %64
  br i1 %65, label %42, label %.thread, !llvm.loop !21

.thread:                                          ; preds = %60, %34, %13, %select.unfold, %59, %27, %30
  %.8 = phi i32 [ %spec.select37, %30 ], [ %.3, %27 ], [ %.7, %59 ], [ 1, %select.unfold ], [ 1, %13 ], [ 0, %34 ], [ 0, %60 ]
  store i32 0, ptr getelementptr inbounds (i8, ptr @pFlash, i64 20), align 4, !tbaa !5
  br label %66

66:                                               ; preds = %2, %.thread
  %.024 = phi i32 [ %.8, %.thread ], [ 2, %2 ]
  ret i32 %.024
}

declare i32 @FLASH_WaitForLastOperation(i32 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @FLASH_MassErase(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @FLASH_Erase_Sector(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, !7, i64 20}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 24}
!11 = !{!12, !7, i64 4}
!12 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16}
!13 = !{!12, !7, i64 0}
!14 = !{!12, !7, i64 16}
!15 = !{!16, !7, i64 12}
!16 = !{!"", !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, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !8, i64 72, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !8, i64 100, !7, i64 260, !7, i64 264, !7, i64 268, !7, i64 272, !7, i64 276, !8, i64 280, !7, i64 296, !7, i64 300, !7, i64 304, !7, i64 308, !7, i64 312, !7, i64 316, !8, i64 320, !7, i64 336, !7, i64 340, !7, i64 344, !7, i64 348, !7, i64 352}
!17 = !{!16, !7, i64 268}
!18 = !{!7, !7, i64 0}
!19 = !{!12, !7, i64 8}
!20 = !{!12, !7, i64 12}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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