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

; 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_CRCInitTypeDef = type { i32, i32, 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 }

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

; 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_FLASHEx_ComputeCRC(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %7 = call i32 @FLASH_OB_WaitForLastOperation(i32 noundef 50000)
  store i32 %7, ptr %5, align 4, !tbaa !9
  %8 = load i32, ptr %5, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %182

10:                                               ; preds = %2
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 4, !tbaa !11
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %15, label %98

15:                                               ; preds = %10
  %16 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !13
  %17 = zext i32 %16 to i64
  %18 = or i64 %17, 32768
  %19 = trunc i64 %18 to i32
  store volatile i32 %19, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !13
  %20 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 5), align 4, !tbaa !15
  %21 = zext i32 %20 to i64
  %22 = or i64 %21, 402653184
  %23 = trunc i64 %22 to i32
  store volatile i32 %23, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 5), align 4, !tbaa !15
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = zext i32 %26 to i64
  %28 = or i64 131072, %27
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !17
  %32 = zext i32 %31 to i64
  %33 = or i64 %28, %32
  %34 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %35 = zext i32 %34 to i64
  %36 = or i64 %35, %33
  %37 = trunc i64 %36 to i32
  store volatile i32 %37, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %38, i32 0, i32 0
  %40 = load i32, ptr %39, align 4, !tbaa !17
  %41 = zext i32 %40 to i64
  %42 = icmp eq i64 %41, 256
  br i1 %42, label %43, label %67

43:                                               ; preds = %15
  %44 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %45 = zext i32 %44 to i64
  %46 = or i64 %45, 1024
  %47 = trunc i64 %46 to i32
  store volatile i32 %47, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %48, i32 0, i32 3
  %50 = load i32, ptr %49, align 4, !tbaa !19
  store i32 %50, ptr %6, align 4, !tbaa !9
  br label %51

51:                                               ; preds = %63, %43
  %52 = load i32, ptr %6, align 4, !tbaa !9
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 4, !tbaa !20
  %56 = load ptr, ptr %3, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %56, i32 0, i32 3
  %58 = load i32, ptr %57, align 4, !tbaa !19
  %59 = add i32 %55, %58
  %60 = icmp ult i32 %52, %59
  br i1 %60, label %61, label %66

61:                                               ; preds = %51
  %62 = load i32, ptr %6, align 4, !tbaa !9
  call void @FLASH_CRC_AddSector(i32 noundef %62, i32 noundef 1)
  br label %63

63:                                               ; preds = %61
  %64 = load i32, ptr %6, align 4, !tbaa !9
  %65 = add i32 %64, 1
  store i32 %65, ptr %6, align 4, !tbaa !9
  br label %51, !llvm.loop !21

66:                                               ; preds = %51
  br label %86

67:                                               ; preds = %15
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 4, !tbaa !17
  %71 = zext i32 %70 to i64
  %72 = icmp eq i64 %71, 4194560
  br i1 %72, label %73, label %78

73:                                               ; preds = %67
  %74 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %75 = zext i32 %74 to i64
  %76 = or i64 %75, 4194304
  %77 = trunc i64 %76 to i32
  store volatile i32 %77, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  br label %85

78:                                               ; preds = %67
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %79, i32 0, i32 5
  %81 = load i32, ptr %80, align 4, !tbaa !23
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %82, i32 0, i32 6
  %84 = load i32, ptr %83, align 4, !tbaa !24
  call void @FLASH_CRC_SelectAddress(i32 noundef %81, i32 noundef %84, i32 noundef 1)
  br label %85

85:                                               ; preds = %78, %73
  br label %86

86:                                               ; preds = %85, %66
  %87 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %88 = zext i32 %87 to i64
  %89 = or i64 %88, 65536
  %90 = trunc i64 %89 to i32
  store volatile i32 %90, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 19), align 4, !tbaa !18
  %91 = call i32 @FLASH_CRC_WaitForLastOperation(i32 noundef 50000, i32 noundef 1)
  store i32 %91, ptr %5, align 4, !tbaa !9
  %92 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 22), align 4, !tbaa !25
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %92, ptr %93, align 4, !tbaa !9
  %94 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !13
  %95 = zext i32 %94 to i64
  %96 = and i64 %95, -32769
  %97 = trunc i64 %96 to i32
  store volatile i32 %97, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 3), align 4, !tbaa !13
  store volatile i32 402653184, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 5), align 4, !tbaa !15
  br label %181

98:                                               ; preds = %10
  %99 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !26
  %100 = zext i32 %99 to i64
  %101 = or i64 %100, 32768
  %102 = trunc i64 %101 to i32
  store volatile i32 %102, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !26
  %103 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 29), align 4, !tbaa !27
  %104 = zext i32 %103 to i64
  %105 = or i64 %104, 402653184
  %106 = trunc i64 %105 to i32
  store volatile i32 %106, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 29), align 4, !tbaa !27
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %107, i32 0, i32 1
  %109 = load i32, ptr %108, align 4, !tbaa !16
  %110 = zext i32 %109 to i64
  %111 = or i64 131072, %110
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %112, i32 0, i32 0
  %114 = load i32, ptr %113, align 4, !tbaa !17
  %115 = zext i32 %114 to i64
  %116 = or i64 %111, %115
  %117 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %118 = zext i32 %117 to i64
  %119 = or i64 %118, %116
  %120 = trunc i64 %119 to i32
  store volatile i32 %120, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %121, i32 0, i32 0
  %123 = load i32, ptr %122, align 4, !tbaa !17
  %124 = zext i32 %123 to i64
  %125 = icmp eq i64 %124, 256
  br i1 %125, label %126, label %150

126:                                              ; preds = %98
  %127 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %128 = zext i32 %127 to i64
  %129 = or i64 %128, 1024
  %130 = trunc i64 %129 to i32
  store volatile i32 %130, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %131, i32 0, i32 3
  %133 = load i32, ptr %132, align 4, !tbaa !19
  store i32 %133, ptr %6, align 4, !tbaa !9
  br label %134

134:                                              ; preds = %146, %126
  %135 = load i32, ptr %6, align 4, !tbaa !9
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %136, i32 0, i32 4
  %138 = load i32, ptr %137, align 4, !tbaa !20
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %139, i32 0, i32 3
  %141 = load i32, ptr %140, align 4, !tbaa !19
  %142 = add i32 %138, %141
  %143 = icmp ult i32 %135, %142
  br i1 %143, label %144, label %149

144:                                              ; preds = %134
  %145 = load i32, ptr %6, align 4, !tbaa !9
  call void @FLASH_CRC_AddSector(i32 noundef %145, i32 noundef 2)
  br label %146

146:                                              ; preds = %144
  %147 = load i32, ptr %6, align 4, !tbaa !9
  %148 = add i32 %147, 1
  store i32 %148, ptr %6, align 4, !tbaa !9
  br label %134, !llvm.loop !29

149:                                              ; preds = %134
  br label %169

150:                                              ; preds = %98
  %151 = load ptr, ptr %3, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %151, i32 0, i32 0
  %153 = load i32, ptr %152, align 4, !tbaa !17
  %154 = zext i32 %153 to i64
  %155 = icmp eq i64 %154, 4194560
  br i1 %155, label %156, label %161

156:                                              ; preds = %150
  %157 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %158 = zext i32 %157 to i64
  %159 = or i64 %158, 4194304
  %160 = trunc i64 %159 to i32
  store volatile i32 %160, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  br label %168

161:                                              ; preds = %150
  %162 = load ptr, ptr %3, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %162, i32 0, i32 5
  %164 = load i32, ptr %163, align 4, !tbaa !23
  %165 = load ptr, ptr %3, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.FLASH_CRCInitTypeDef, ptr %165, i32 0, i32 6
  %167 = load i32, ptr %166, align 4, !tbaa !24
  call void @FLASH_CRC_SelectAddress(i32 noundef %164, i32 noundef %167, i32 noundef 2)
  br label %168

168:                                              ; preds = %161, %156
  br label %169

169:                                              ; preds = %168, %149
  %170 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %171 = zext i32 %170 to i64
  %172 = or i64 %171, 65536
  %173 = trunc i64 %172 to i32
  store volatile i32 %173, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 38), align 4, !tbaa !28
  %174 = call i32 @FLASH_CRC_WaitForLastOperation(i32 noundef 50000, i32 noundef 2)
  store i32 %174, ptr %5, align 4, !tbaa !9
  %175 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 22), align 4, !tbaa !25
  %176 = load ptr, ptr %4, align 8, !tbaa !5
  store i32 %175, ptr %176, align 4, !tbaa !9
  %177 = load volatile i32, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !26
  %178 = zext i32 %177 to i64
  %179 = and i64 %178, -32769
  %180 = trunc i64 %179 to i32
  store volatile i32 %180, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 27), align 4, !tbaa !26
  store volatile i32 402653184, ptr getelementptr inbounds (%struct.FLASH_TypeDef, ptr inttoptr (i64 1375739904 to ptr), i32 0, i32 29), align 4, !tbaa !27
  br label %181

181:                                              ; preds = %169, %86
  br label %182

182:                                              ; preds = %181, %2
  %183 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %183
}

declare i32 @FLASH_OB_WaitForLastOperation(i32 noundef) #2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 8}
!12 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!13 = !{!14, !10, i64 12}
!14 = !{!"", !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}
!15 = !{!14, !10, i64 20}
!16 = !{!12, !10, i64 4}
!17 = !{!12, !10, i64 0}
!18 = !{!14, !10, i64 80}
!19 = !{!12, !10, i64 12}
!20 = !{!12, !10, i64 16}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!12, !10, i64 20}
!24 = !{!12, !10, i64 24}
!25 = !{!14, !10, i64 92}
!26 = !{!14, !10, i64 268}
!27 = !{!14, !10, i64 276}
!28 = !{!14, !10, i64 336}
!29 = distinct !{!29, !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 i32 @HAL_FLASHEx_ComputeCRC(ptr nocapture noundef readonly %0, ptr nocapture noundef writeonly %1) local_unnamed_addr #0 {
  %3 = tail call i32 @FLASH_OB_WaitForLastOperation(i32 noundef 50000) #2
  %4 = icmp eq i32 %3, 0
  br i1 %4, label %5, label %82

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp eq i32 %7, 1
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  br i1 %8, label %10, label %43

10:                                               ; preds = %5
  %11 = load volatile i32, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !10
  %12 = or i32 %11, 32768
  store volatile i32 %12, ptr inttoptr (i64 1375739916 to ptr), align 4, !tbaa !10
  %13 = load volatile i32, ptr inttoptr (i64 1375739924 to ptr), align 4, !tbaa !12
  %14 = or i32 %13, 402653184
  store volatile i32 %14, ptr inttoptr (i64 1375739924 to ptr), align 4, !tbaa !12
  %15 = load i32, ptr %9, align 4, !tbaa !13
  %16 = load i32, ptr %0, align 4, !tbaa !14
  %17 = load volatile i32, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  %18 = or i32 %15, %17
  %19 = or i32 %18, %16
  %20 = or i32 %19, 131072
  store volatile i32 %20, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  switch i32 %16, label %38 [
    i32 256, label %21
    i32 4194560, label %35
  ]

21:                                               ; preds = %10
  %22 = load volatile i32, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  %23 = or i32 %22, 1024
  store volatile i32 %23, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  %24 = getelementptr inbounds i8, ptr %0, i64 12
  %25 = load i32, ptr %24, align 4, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %0, i64 16
  %27 = load i32, ptr %26, align 4, !tbaa !17
  %28 = add i32 %25, %27
  %29 = icmp ult i32 %25, %28
  br i1 %29, label %.lr.ph35, label %.sink.split

.lr.ph35:                                         ; preds = %21, %.lr.ph35
  %.034 = phi i32 [ %30, %.lr.ph35 ], [ %25, %21 ]
  tail call void @FLASH_CRC_AddSector(i32 noundef %.034, i32 noundef 1)
  %30 = add nuw i32 %.034, 1
  %31 = load i32, ptr %26, align 4, !tbaa !17
  %32 = load i32, ptr %24, align 4, !tbaa !16
  %33 = add i32 %32, %31
  %34 = icmp ult i32 %30, %33
  br i1 %34, label %.lr.ph35, label %.sink.split, !llvm.loop !18

35:                                               ; preds = %10
  %36 = load volatile i32, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  %37 = or i32 %36, 4194304
  store volatile i32 %37, ptr inttoptr (i64 1375739984 to ptr), align 16, !tbaa !15
  br label %.sink.split

38:                                               ; preds = %10
  %39 = getelementptr inbounds i8, ptr %0, i64 20
  %40 = load i32, ptr %39, align 4, !tbaa !20
  %41 = getelementptr inbounds i8, ptr %0, i64 24
  %42 = load i32, ptr %41, align 4, !tbaa !21
  tail call void @FLASH_CRC_SelectAddress(i32 noundef %40, i32 noundef %42, i32 noundef 1)
  br label %.sink.split

43:                                               ; preds = %5
  %44 = load volatile i32, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !22
  %45 = or i32 %44, 32768
  store volatile i32 %45, ptr inttoptr (i64 1375740172 to ptr), align 4, !tbaa !22
  %46 = load volatile i32, ptr inttoptr (i64 1375740180 to ptr), align 4, !tbaa !23
  %47 = or i32 %46, 402653184
  store volatile i32 %47, ptr inttoptr (i64 1375740180 to ptr), align 4, !tbaa !23
  %48 = load i32, ptr %9, align 4, !tbaa !13
  %49 = load i32, ptr %0, align 4, !tbaa !14
  %50 = load volatile i32, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  %51 = or i32 %48, %50
  %52 = or i32 %51, %49
  %53 = or i32 %52, 131072
  store volatile i32 %53, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  switch i32 %49, label %71 [
    i32 256, label %54
    i32 4194560, label %68
  ]

54:                                               ; preds = %43
  %55 = load volatile i32, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  %56 = or i32 %55, 1024
  store volatile i32 %56, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  %57 = getelementptr inbounds i8, ptr %0, i64 12
  %58 = load i32, ptr %57, align 4, !tbaa !16
  %59 = getelementptr inbounds i8, ptr %0, i64 16
  %60 = load i32, ptr %59, align 4, !tbaa !17
  %61 = add i32 %58, %60
  %62 = icmp ult i32 %58, %61
  br i1 %62, label %.lr.ph, label %.sink.split

.lr.ph:                                           ; preds = %54, %.lr.ph
  %.133 = phi i32 [ %63, %.lr.ph ], [ %58, %54 ]
  tail call void @FLASH_CRC_AddSector(i32 noundef %.133, i32 noundef 2)
  %63 = add nuw i32 %.133, 1
  %64 = load i32, ptr %59, align 4, !tbaa !17
  %65 = load i32, ptr %57, align 4, !tbaa !16
  %66 = add i32 %65, %64
  %67 = icmp ult i32 %63, %66
  br i1 %67, label %.lr.ph, label %.sink.split, !llvm.loop !25

68:                                               ; preds = %43
  %69 = load volatile i32, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  %70 = or i32 %69, 4194304
  store volatile i32 %70, ptr inttoptr (i64 1375740240 to ptr), align 16, !tbaa !24
  br label %.sink.split

71:                                               ; preds = %43
  %72 = getelementptr inbounds i8, ptr %0, i64 20
  %73 = load i32, ptr %72, align 4, !tbaa !20
  %74 = getelementptr inbounds i8, ptr %0, i64 24
  %75 = load i32, ptr %74, align 4, !tbaa !21
  tail call void @FLASH_CRC_SelectAddress(i32 noundef %73, i32 noundef %75, i32 noundef 2)
  br label %.sink.split

.sink.split:                                      ; preds = %.lr.ph, %.lr.ph35, %71, %68, %54, %38, %35, %21
  %.sink45 = phi ptr [ inttoptr (i64 1375739984 to ptr), %21 ], [ inttoptr (i64 1375739984 to ptr), %35 ], [ inttoptr (i64 1375739984 to ptr), %38 ], [ inttoptr (i64 1375740240 to ptr), %54 ], [ inttoptr (i64 1375740240 to ptr), %68 ], [ inttoptr (i64 1375740240 to ptr), %71 ], [ inttoptr (i64 1375739984 to ptr), %.lr.ph35 ], [ inttoptr (i64 1375740240 to ptr), %.lr.ph ]
  %.sink41 = phi i32 [ 1, %21 ], [ 1, %35 ], [ 1, %38 ], [ 2, %54 ], [ 2, %68 ], [ 2, %71 ], [ 1, %.lr.ph35 ], [ 2, %.lr.ph ]
  %.sink39 = phi ptr [ inttoptr (i64 1375739916 to ptr), %21 ], [ inttoptr (i64 1375739916 to ptr), %35 ], [ inttoptr (i64 1375739916 to ptr), %38 ], [ inttoptr (i64 1375740172 to ptr), %54 ], [ inttoptr (i64 1375740172 to ptr), %68 ], [ inttoptr (i64 1375740172 to ptr), %71 ], [ inttoptr (i64 1375739916 to ptr), %.lr.ph35 ], [ inttoptr (i64 1375740172 to ptr), %.lr.ph ]
  %.sink = phi ptr [ inttoptr (i64 1375739924 to ptr), %21 ], [ inttoptr (i64 1375739924 to ptr), %35 ], [ inttoptr (i64 1375739924 to ptr), %38 ], [ inttoptr (i64 1375740180 to ptr), %54 ], [ inttoptr (i64 1375740180 to ptr), %68 ], [ inttoptr (i64 1375740180 to ptr), %71 ], [ inttoptr (i64 1375739924 to ptr), %.lr.ph35 ], [ inttoptr (i64 1375740180 to ptr), %.lr.ph ]
  %76 = load volatile i32, ptr %.sink45, align 16, !tbaa !26
  %77 = or i32 %76, 65536
  store volatile i32 %77, ptr %.sink45, align 16, !tbaa !26
  %78 = tail call i32 @FLASH_CRC_WaitForLastOperation(i32 noundef 50000, i32 noundef %.sink41) #2
  %79 = load volatile i32, ptr inttoptr (i64 1375739996 to ptr), align 4, !tbaa !27
  store i32 %79, ptr %1, align 4, !tbaa !26
  %80 = load volatile i32, ptr %.sink39, align 4, !tbaa !26
  %81 = and i32 %80, -32769
  store volatile i32 %81, ptr %.sink39, align 4, !tbaa !26
  store volatile i32 402653184, ptr %.sink, align 4, !tbaa !26
  br label %82

82:                                               ; preds = %.sink.split, %2
  %.028 = phi i32 [ %3, %2 ], [ %78, %.sink.split ]
  ret i32 %.028
}

declare i32 @FLASH_OB_WaitForLastOperation(i32 noundef) local_unnamed_addr #1

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

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

declare i32 @FLASH_CRC_WaitForLastOperation(i32 noundef, i32 noundef) local_unnamed_addr #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 = { "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 8}
!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 = !{!11, !7, i64 12}
!11 = !{!"", !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}
!12 = !{!11, !7, i64 20}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 0}
!15 = !{!11, !7, i64 80}
!16 = !{!6, !7, i64 12}
!17 = !{!6, !7, i64 16}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !7, i64 20}
!21 = !{!6, !7, i64 24}
!22 = !{!11, !7, i64 268}
!23 = !{!11, !7, i64 276}
!24 = !{!11, !7, i64 336}
!25 = distinct !{!25, !19}
!26 = !{!7, !7, i64 0}
!27 = !{!11, !7, i64 92}


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