; LLVM IR from tastangh/TI-RSLK-Texas-Instruments-Robotics-System-The-Maze-Edition :: tirslk_maze_1_00_00/Flash (Scoreboard)

; 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.ScoreboardElement = type { i8, i8, i8, i32 }

@RAMScoreboard = external hidden global [5 x %struct.ScoreboardElement], align 16
@scoreblock = external hidden global i32, align 4
@boardptr = external hidden global ptr, align 8

; 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 void @Scoreboard_Record(i8 noundef signext %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3) #1 {
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i8 %0, ptr %5, align 1, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !5
  store i8 %2, ptr %7, align 1, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %11

11:                                               ; preds = %93, %4
  %12 = load i32, ptr %9, align 4, !tbaa !8
  %13 = icmp slt i32 %12, 5
  br i1 %13, label %14, label %96

14:                                               ; preds = %11
  %15 = load i32, ptr %8, align 4, !tbaa !8
  %16 = load i32, ptr %9, align 4, !tbaa !8
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %17
  %19 = getelementptr inbounds %struct.ScoreboardElement, ptr %18, i32 0, i32 3
  %20 = load i32, ptr %19, align 4, !tbaa !10
  %21 = icmp ugt i32 %15, %20
  br i1 %21, label %22, label %92

22:                                               ; preds = %14
  store i32 4, ptr %10, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %68, %22
  %24 = load i32, ptr %10, align 4, !tbaa !8
  %25 = load i32, ptr %9, align 4, !tbaa !8
  %26 = icmp sgt i32 %24, %25
  br i1 %26, label %27, label %71

27:                                               ; preds = %23
  %28 = load i32, ptr %10, align 4, !tbaa !8
  %29 = sub nsw i32 %28, 1
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %30
  %32 = getelementptr inbounds %struct.ScoreboardElement, ptr %31, i32 0, i32 0
  %33 = load i8, ptr %32, align 8, !tbaa !12
  %34 = load i32, ptr %10, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %35
  %37 = getelementptr inbounds %struct.ScoreboardElement, ptr %36, i32 0, i32 0
  store i8 %33, ptr %37, align 8, !tbaa !12
  %38 = load i32, ptr %10, align 4, !tbaa !8
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.ScoreboardElement, ptr %41, i32 0, i32 1
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = load i32, ptr %10, align 4, !tbaa !8
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %45
  %47 = getelementptr inbounds %struct.ScoreboardElement, ptr %46, i32 0, i32 1
  store i8 %43, ptr %47, align 1, !tbaa !13
  %48 = load i32, ptr %10, align 4, !tbaa !8
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %50
  %52 = getelementptr inbounds %struct.ScoreboardElement, ptr %51, i32 0, i32 2
  %53 = load i8, ptr %52, align 2, !tbaa !14
  %54 = load i32, ptr %10, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %55
  %57 = getelementptr inbounds %struct.ScoreboardElement, ptr %56, i32 0, i32 2
  store i8 %53, ptr %57, align 2, !tbaa !14
  %58 = load i32, ptr %10, align 4, !tbaa !8
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.ScoreboardElement, ptr %61, i32 0, i32 3
  %63 = load i32, ptr %62, align 4, !tbaa !10
  %64 = load i32, ptr %10, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.ScoreboardElement, ptr %66, i32 0, i32 3
  store i32 %63, ptr %67, align 4, !tbaa !10
  br label %68

68:                                               ; preds = %27
  %69 = load i32, ptr %10, align 4, !tbaa !8
  %70 = sub nsw i32 %69, 1
  store i32 %70, ptr %10, align 4, !tbaa !8
  br label %23, !llvm.loop !15

71:                                               ; preds = %23
  %72 = load i8, ptr %5, align 1, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.ScoreboardElement, ptr %75, i32 0, i32 0
  store i8 %72, ptr %76, align 8, !tbaa !12
  %77 = load i8, ptr %6, align 1, !tbaa !5
  %78 = load i32, ptr %9, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.ScoreboardElement, ptr %80, i32 0, i32 1
  store i8 %77, ptr %81, align 1, !tbaa !13
  %82 = load i8, ptr %7, align 1, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.ScoreboardElement, ptr %85, i32 0, i32 2
  store i8 %82, ptr %86, align 2, !tbaa !14
  %87 = load i32, ptr %8, align 4, !tbaa !8
  %88 = load i32, ptr %9, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %89
  %91 = getelementptr inbounds %struct.ScoreboardElement, ptr %90, i32 0, i32 3
  store i32 %87, ptr %91, align 4, !tbaa !10
  br label %96

92:                                               ; preds = %14
  br label %93

93:                                               ; preds = %92
  %94 = load i32, ptr %9, align 4, !tbaa !8
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %9, align 4, !tbaa !8
  br label %11, !llvm.loop !17

96:                                               ; preds = %71, %11
  %97 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %98 = load i32, ptr @scoreblock, align 4, !tbaa !8
  %99 = add i32 %98, 4088
  %100 = zext i32 %99 to i64
  %101 = inttoptr i64 %100 to ptr
  %102 = icmp ule ptr %97, %101
  br i1 %102, label %103, label %125

103:                                              ; preds = %96
  %104 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %105 = ptrtoint ptr %104 to i32
  %106 = load i8, ptr %5, align 1, !tbaa !5
  %107 = sext i8 %106 to i32
  %108 = shl i32 %107, 24
  %109 = load i8, ptr %6, align 1, !tbaa !5
  %110 = sext i8 %109 to i32
  %111 = shl i32 %110, 16
  %112 = or i32 %108, %111
  %113 = load i8, ptr %7, align 1, !tbaa !5
  %114 = sext i8 %113 to i32
  %115 = shl i32 %114, 8
  %116 = or i32 %112, %115
  %117 = call i32 @Flash_Write(i32 noundef %105, i32 noundef %116)
  %118 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %119 = getelementptr inbounds i32, ptr %118, i64 1
  %120 = ptrtoint ptr %119 to i32
  %121 = load i32, ptr %8, align 4, !tbaa !8
  %122 = call i32 @Flash_Write(i32 noundef %120, i32 noundef %121)
  %123 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %124 = getelementptr inbounds i32, ptr %123, i64 2
  store ptr %124, ptr @boardptr, align 8, !tbaa !18
  br label %176

125:                                              ; preds = %96
  %126 = load i32, ptr @scoreblock, align 4, !tbaa !8
  %127 = call i32 @Flash_Erase(i32 noundef %126)
  %128 = load i32, ptr @scoreblock, align 4, !tbaa !8
  %129 = zext i32 %128 to i64
  %130 = inttoptr i64 %129 to ptr
  store ptr %130, ptr @boardptr, align 8, !tbaa !18
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %131

131:                                              ; preds = %172, %125
  %132 = load i32, ptr %9, align 4, !tbaa !8
  %133 = icmp slt i32 %132, 5
  br i1 %133, label %134, label %175

134:                                              ; preds = %131
  %135 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %136 = ptrtoint ptr %135 to i32
  %137 = load i32, ptr %9, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %138
  %140 = getelementptr inbounds %struct.ScoreboardElement, ptr %139, i32 0, i32 0
  %141 = load i8, ptr %140, align 8, !tbaa !12
  %142 = sext i8 %141 to i32
  %143 = shl i32 %142, 24
  %144 = load i32, ptr %9, align 4, !tbaa !8
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.ScoreboardElement, ptr %146, i32 0, i32 1
  %148 = load i8, ptr %147, align 1, !tbaa !13
  %149 = sext i8 %148 to i32
  %150 = shl i32 %149, 16
  %151 = or i32 %143, %150
  %152 = load i32, ptr %9, align 4, !tbaa !8
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %153
  %155 = getelementptr inbounds %struct.ScoreboardElement, ptr %154, i32 0, i32 2
  %156 = load i8, ptr %155, align 2, !tbaa !14
  %157 = sext i8 %156 to i32
  %158 = shl i32 %157, 8
  %159 = or i32 %151, %158
  %160 = call i32 @Flash_Write(i32 noundef %136, i32 noundef %159)
  %161 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %162 = getelementptr inbounds i32, ptr %161, i64 1
  %163 = ptrtoint ptr %162 to i32
  %164 = load i32, ptr %9, align 4, !tbaa !8
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [5 x %struct.ScoreboardElement], ptr @RAMScoreboard, i64 0, i64 %165
  %167 = getelementptr inbounds %struct.ScoreboardElement, ptr %166, i32 0, i32 3
  %168 = load i32, ptr %167, align 4, !tbaa !10
  %169 = call i32 @Flash_Write(i32 noundef %163, i32 noundef %168)
  %170 = load ptr, ptr @boardptr, align 8, !tbaa !18
  %171 = getelementptr inbounds i32, ptr %170, i64 2
  store ptr %171, ptr @boardptr, align 8, !tbaa !18
  br label %172

172:                                              ; preds = %134
  %173 = load i32, ptr %9, align 4, !tbaa !8
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %9, align 4, !tbaa !8
  br label %131, !llvm.loop !20

175:                                              ; preds = %131
  br label %176

176:                                              ; preds = %175, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  ret void
}

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

declare i32 @Flash_Erase(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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !6, i64 0}
!10 = !{!11, !9, i64 4}
!11 = !{!"ScoreboardElement", !6, i64 0, !6, i64 1, !6, i64 2, !9, i64 4}
!12 = !{!11, !6, i64 0}
!13 = !{!11, !6, i64 1}
!14 = !{!11, !6, i64 2}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!19, !19, i64 0}
!19 = !{!"any pointer", !6, i64 0}
!20 = distinct !{!20, !16}


; 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.ScoreboardElement = type { i8, i8, i8, i32 }

@RAMScoreboard = external hidden local_unnamed_addr global [5 x %struct.ScoreboardElement], align 16
@scoreblock = external hidden local_unnamed_addr global i32, align 4
@boardptr = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
define dso_local void @Scoreboard_Record(i8 noundef signext %0, i8 noundef signext %1, i8 noundef signext %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 4), align 4, !tbaa !5
  %6 = icmp ult i32 %5, %3
  br i1 %6, label %.lr.ph.preheader, label %29

.lr.ph.preheader:                                 ; preds = %4, %29, %32, %35
  %7 = phi i1 [ false, %35 ], [ true, %32 ], [ true, %29 ], [ true, %4 ]
  %8 = phi i1 [ false, %35 ], [ false, %32 ], [ true, %29 ], [ true, %4 ]
  %.lcssa.ph = phi ptr [ getelementptr inbounds (i8, ptr @RAMScoreboard, i64 24), %35 ], [ getelementptr inbounds (i8, ptr @RAMScoreboard, i64 16), %32 ], [ getelementptr inbounds (i8, ptr @RAMScoreboard, i64 8), %29 ], [ @RAMScoreboard, %4 ]
  %9 = getelementptr inbounds i8, ptr %.lcssa.ph, i64 4
  %10 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 24), align 8, !tbaa !10
  store i8 %10, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 32), align 16, !tbaa !10
  %11 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 25), align 1, !tbaa !11
  store i8 %11, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 33), align 1, !tbaa !11
  %12 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 26), align 2, !tbaa !12
  store i8 %12, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 34), align 2, !tbaa !12
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 28), align 4, !tbaa !5
  store i32 %13, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 36), align 4, !tbaa !5
  br i1 %7, label %.lr.ph.1, label %._crit_edge, !llvm.loop !13

.lr.ph.1:                                         ; preds = %.lr.ph.preheader
  %14 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 16), align 16, !tbaa !10
  store i8 %14, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 24), align 8, !tbaa !10
  %15 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 17), align 1, !tbaa !11
  store i8 %15, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 25), align 1, !tbaa !11
  %16 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 18), align 2, !tbaa !12
  store i8 %16, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 26), align 2, !tbaa !12
  %17 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 20), align 4, !tbaa !5
  store i32 %17, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 28), align 4, !tbaa !5
  br i1 %8, label %.lr.ph.2, label %._crit_edge, !llvm.loop !13

.lr.ph.2:                                         ; preds = %.lr.ph.1
  %18 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 8), align 8, !tbaa !10
  store i8 %18, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 16), align 16, !tbaa !10
  %19 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 9), align 1, !tbaa !11
  store i8 %19, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 17), align 1, !tbaa !11
  %20 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 10), align 2, !tbaa !12
  store i8 %20, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 18), align 2, !tbaa !12
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 12), align 4, !tbaa !5
  store i32 %21, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 20), align 4, !tbaa !5
  br i1 %6, label %.lr.ph.3, label %._crit_edge, !llvm.loop !13

.lr.ph.3:                                         ; preds = %.lr.ph.2
  %22 = load i8, ptr @RAMScoreboard, align 16, !tbaa !10
  store i8 %22, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 8), align 8, !tbaa !10
  %23 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 1), align 1, !tbaa !11
  store i8 %23, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 9), align 1, !tbaa !11
  %24 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 2), align 2, !tbaa !12
  store i8 %24, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 10), align 2, !tbaa !12
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 4), align 4, !tbaa !5
  store i32 %25, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 12), align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %.lr.ph.1, %.lr.ph.2, %.lr.ph.3, %38
  %26 = phi ptr [ getelementptr inbounds (i8, ptr @RAMScoreboard, i64 36), %38 ], [ %9, %.lr.ph.3 ], [ %9, %.lr.ph.2 ], [ %9, %.lr.ph.1 ], [ %9, %.lr.ph.preheader ]
  %.lcssa53 = phi ptr [ getelementptr inbounds (i8, ptr @RAMScoreboard, i64 32), %38 ], [ %.lcssa.ph, %.lr.ph.3 ], [ %.lcssa.ph, %.lr.ph.2 ], [ %.lcssa.ph, %.lr.ph.1 ], [ %.lcssa.ph, %.lr.ph.preheader ]
  store i8 %0, ptr %.lcssa53, align 8, !tbaa !10
  %27 = getelementptr inbounds i8, ptr %.lcssa53, i64 1
  store i8 %1, ptr %27, align 1, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %.lcssa53, i64 2
  store i8 %2, ptr %28, align 2, !tbaa !12
  store i32 %3, ptr %26, align 4, !tbaa !5
  br label %.loopexit36

29:                                               ; preds = %4
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 12), align 4, !tbaa !5
  %31 = icmp ult i32 %30, %3
  br i1 %31, label %.lr.ph.preheader, label %32

32:                                               ; preds = %29
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 20), align 4, !tbaa !5
  %34 = icmp ult i32 %33, %3
  br i1 %34, label %.lr.ph.preheader, label %35

35:                                               ; preds = %32
  %36 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 28), align 4, !tbaa !5
  %37 = icmp ult i32 %36, %3
  br i1 %37, label %.lr.ph.preheader, label %38

38:                                               ; preds = %35
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 36), align 4, !tbaa !5
  %40 = icmp ult i32 %39, %3
  br i1 %40, label %._crit_edge, label %.loopexit36

.loopexit36:                                      ; preds = %38, %._crit_edge
  %41 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %42 = load i32, ptr @scoreblock, align 4, !tbaa !17
  %43 = add i32 %42, 4088
  %44 = zext i32 %43 to i64
  %45 = inttoptr i64 %44 to ptr
  %.not = icmp ugt ptr %41, %45
  br i1 %.not, label %.loopexit.loopexit, label %46

46:                                               ; preds = %.loopexit36
  %47 = ptrtoint ptr %41 to i64
  %48 = trunc i64 %47 to i32
  %49 = sext i8 %0 to i32
  %50 = shl nsw i32 %49, 24
  %51 = sext i8 %1 to i32
  %52 = shl nsw i32 %51, 16
  %53 = or i32 %52, %50
  %54 = sext i8 %2 to i32
  %55 = shl nsw i32 %54, 8
  %56 = or i32 %53, %55
  %57 = tail call i32 @Flash_Write(i32 noundef %48, i32 noundef %56) #2
  %58 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = ptrtoint ptr %59 to i64
  %61 = trunc i64 %60 to i32
  %62 = tail call i32 @Flash_Write(i32 noundef %61, i32 noundef %3) #2
  br label %.loopexit

.loopexit.loopexit:                               ; preds = %.loopexit36
  %63 = tail call i32 @Flash_Erase(i32 noundef %42) #2
  %64 = load i32, ptr @scoreblock, align 4, !tbaa !17
  %65 = zext i32 %64 to i64
  %66 = inttoptr i64 %65 to ptr
  store ptr %66, ptr @boardptr, align 8, !tbaa !15
  %67 = load i8, ptr @RAMScoreboard, align 16, !tbaa !10
  %68 = sext i8 %67 to i32
  %69 = shl nsw i32 %68, 24
  %70 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 1), align 1, !tbaa !11
  %71 = sext i8 %70 to i32
  %72 = shl nsw i32 %71, 16
  %73 = or i32 %72, %69
  %74 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 2), align 2, !tbaa !12
  %75 = sext i8 %74 to i32
  %76 = shl nsw i32 %75, 8
  %77 = or i32 %73, %76
  %78 = tail call i32 @Flash_Write(i32 noundef %64, i32 noundef %77) #2
  %79 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %80 = getelementptr inbounds i8, ptr %79, i64 4
  %81 = ptrtoint ptr %80 to i64
  %82 = trunc i64 %81 to i32
  %83 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 4), align 4, !tbaa !5
  %84 = tail call i32 @Flash_Write(i32 noundef %82, i32 noundef %83) #2
  %85 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %86 = getelementptr inbounds i8, ptr %85, i64 8
  store ptr %86, ptr @boardptr, align 8, !tbaa !15
  %87 = ptrtoint ptr %86 to i64
  %88 = trunc i64 %87 to i32
  %89 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 8), align 8, !tbaa !10
  %90 = sext i8 %89 to i32
  %91 = shl nsw i32 %90, 24
  %92 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 9), align 1, !tbaa !11
  %93 = sext i8 %92 to i32
  %94 = shl nsw i32 %93, 16
  %95 = or i32 %94, %91
  %96 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 10), align 2, !tbaa !12
  %97 = sext i8 %96 to i32
  %98 = shl nsw i32 %97, 8
  %99 = or i32 %95, %98
  %100 = tail call i32 @Flash_Write(i32 noundef %88, i32 noundef %99) #2
  %101 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %102 = getelementptr inbounds i8, ptr %101, i64 4
  %103 = ptrtoint ptr %102 to i64
  %104 = trunc i64 %103 to i32
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 12), align 4, !tbaa !5
  %106 = tail call i32 @Flash_Write(i32 noundef %104, i32 noundef %105) #2
  %107 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %108 = getelementptr inbounds i8, ptr %107, i64 8
  store ptr %108, ptr @boardptr, align 8, !tbaa !15
  %109 = ptrtoint ptr %108 to i64
  %110 = trunc i64 %109 to i32
  %111 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 16), align 16, !tbaa !10
  %112 = sext i8 %111 to i32
  %113 = shl nsw i32 %112, 24
  %114 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 17), align 1, !tbaa !11
  %115 = sext i8 %114 to i32
  %116 = shl nsw i32 %115, 16
  %117 = or i32 %116, %113
  %118 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 18), align 2, !tbaa !12
  %119 = sext i8 %118 to i32
  %120 = shl nsw i32 %119, 8
  %121 = or i32 %117, %120
  %122 = tail call i32 @Flash_Write(i32 noundef %110, i32 noundef %121) #2
  %123 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %124 = getelementptr inbounds i8, ptr %123, i64 4
  %125 = ptrtoint ptr %124 to i64
  %126 = trunc i64 %125 to i32
  %127 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 20), align 4, !tbaa !5
  %128 = tail call i32 @Flash_Write(i32 noundef %126, i32 noundef %127) #2
  %129 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %130 = getelementptr inbounds i8, ptr %129, i64 8
  store ptr %130, ptr @boardptr, align 8, !tbaa !15
  %131 = ptrtoint ptr %130 to i64
  %132 = trunc i64 %131 to i32
  %133 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 24), align 8, !tbaa !10
  %134 = sext i8 %133 to i32
  %135 = shl nsw i32 %134, 24
  %136 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 25), align 1, !tbaa !11
  %137 = sext i8 %136 to i32
  %138 = shl nsw i32 %137, 16
  %139 = or i32 %138, %135
  %140 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 26), align 2, !tbaa !12
  %141 = sext i8 %140 to i32
  %142 = shl nsw i32 %141, 8
  %143 = or i32 %139, %142
  %144 = tail call i32 @Flash_Write(i32 noundef %132, i32 noundef %143) #2
  %145 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %146 = getelementptr inbounds i8, ptr %145, i64 4
  %147 = ptrtoint ptr %146 to i64
  %148 = trunc i64 %147 to i32
  %149 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 28), align 4, !tbaa !5
  %150 = tail call i32 @Flash_Write(i32 noundef %148, i32 noundef %149) #2
  %151 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %152 = getelementptr inbounds i8, ptr %151, i64 8
  store ptr %152, ptr @boardptr, align 8, !tbaa !15
  %153 = ptrtoint ptr %152 to i64
  %154 = trunc i64 %153 to i32
  %155 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 32), align 16, !tbaa !10
  %156 = sext i8 %155 to i32
  %157 = shl nsw i32 %156, 24
  %158 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 33), align 1, !tbaa !11
  %159 = sext i8 %158 to i32
  %160 = shl nsw i32 %159, 16
  %161 = or i32 %160, %157
  %162 = load i8, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 34), align 2, !tbaa !12
  %163 = sext i8 %162 to i32
  %164 = shl nsw i32 %163, 8
  %165 = or i32 %161, %164
  %166 = tail call i32 @Flash_Write(i32 noundef %154, i32 noundef %165) #2
  %167 = load ptr, ptr @boardptr, align 8, !tbaa !15
  %168 = getelementptr inbounds i8, ptr %167, i64 4
  %169 = ptrtoint ptr %168 to i64
  %170 = trunc i64 %169 to i32
  %171 = load i32, ptr getelementptr inbounds (i8, ptr @RAMScoreboard, i64 36), align 4, !tbaa !5
  %172 = tail call i32 @Flash_Write(i32 noundef %170, i32 noundef %171) #2
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %46
  %.pn = load ptr, ptr @boardptr, align 8, !tbaa !15
  %storemerge = getelementptr inbounds i8, ptr %.pn, i64 8
  store ptr %storemerge, ptr @boardptr, align 8, !tbaa !15
  ret void
}

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

declare i32 @Flash_Erase(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, !9, i64 4}
!6 = !{!"ScoreboardElement", !7, i64 0, !7, i64 1, !7, i64 2, !9, i64 4}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !7, i64 0}
!11 = !{!6, !7, i64 1}
!12 = !{!6, !7, i64 2}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!9, !9, i64 0}


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