; LLVM IR from CactiLab/Sherloc-Cortex-M-CFVD :: Sherloc_runtime/freertos/portable/GCC/ARM_CM23_NTZ/non_secure (port)

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

; Function Attrs: nounwind uwtable
define dso_local ptr @pxPortInitialiseStack(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) #0 section "privileged_functions" {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i64 %4, ptr %10, align 8, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds i32, ptr %11, i32 -1
  store ptr %12, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 16777216, ptr %13, align 4, !tbaa !11
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = getelementptr inbounds i32, ptr %14, i32 -1
  store ptr %15, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = ptrtoint ptr %16 to i32
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %17, ptr %18, align 4, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds i32, ptr %19, i32 -1
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 ptrtoint (ptr @prvTaskExitError to i32), ptr %21, align 4, !tbaa !11
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds i32, ptr %22, i32 -1
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 303174162, ptr %24, align 4, !tbaa !11
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds i32, ptr %25, i32 -1
  store ptr %26, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 50529027, ptr %27, align 4, !tbaa !11
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds i32, ptr %28, i32 -1
  store ptr %29, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 33686018, ptr %30, align 4, !tbaa !11
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds i32, ptr %31, i32 -1
  store ptr %32, ptr %6, align 8, !tbaa !5
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 16843009, ptr %33, align 4, !tbaa !11
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds i32, ptr %34, i32 -1
  store ptr %35, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = ptrtoint ptr %36 to i32
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %37, ptr %38, align 4, !tbaa !11
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds i32, ptr %39, i32 -1
  store ptr %40, ptr %6, align 8, !tbaa !5
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 286331153, ptr %41, align 4, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds i32, ptr %42, i32 -1
  store ptr %43, ptr %6, align 8, !tbaa !5
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 269488144, ptr %44, align 4, !tbaa !11
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds i32, ptr %45, i32 -1
  store ptr %46, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 151587081, ptr %47, align 4, !tbaa !11
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds i32, ptr %48, i32 -1
  store ptr %49, ptr %6, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 134744072, ptr %50, align 4, !tbaa !11
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds i32, ptr %51, i32 -1
  store ptr %52, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 117901063, ptr %53, align 4, !tbaa !11
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds i32, ptr %54, i32 -1
  store ptr %55, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 101058054, ptr %56, align 4, !tbaa !11
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds i32, ptr %57, i32 -1
  store ptr %58, ptr %6, align 8, !tbaa !5
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 84215045, ptr %59, align 4, !tbaa !11
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds i32, ptr %60, i32 -1
  store ptr %61, ptr %6, align 8, !tbaa !5
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 67372036, ptr %62, align 4, !tbaa !11
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds i32, ptr %63, i32 -1
  store ptr %64, ptr %6, align 8, !tbaa !5
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 -68, ptr %65, align 4, !tbaa !11
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds i32, ptr %66, i32 -1
  store ptr %67, ptr %6, align 8, !tbaa !5
  %68 = load i64, ptr %10, align 8, !tbaa !9
  %69 = icmp eq i64 %68, 1
  br i1 %69, label %70, label %72

70:                                               ; preds = %5
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 2, ptr %71, align 4, !tbaa !11
  br label %74

72:                                               ; preds = %5
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 3, ptr %73, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %72, %70
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds i32, ptr %75, i32 -1
  store ptr %76, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = ptrtoint ptr %77 to i32
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 %78, ptr %79, align 4, !tbaa !11
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  ret ptr %80
}

; Function Attrs: nounwind uwtable
declare hidden void @prvTaskExitError() #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" }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}


; 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: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local noundef nonnull ptr @pxPortInitialiseStack(ptr noundef writeonly %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i64 noundef %4) local_unnamed_addr #0 section "privileged_functions" {
  %6 = getelementptr inbounds i8, ptr %0, i64 -4
  store i32 16777216, ptr %6, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 -8
  %8 = ptrtoint ptr %2 to i64
  %9 = trunc i64 %8 to i32
  store i32 %9, ptr %7, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 -12
  store i32 ptrtoint (ptr @prvTaskExitError to i32), ptr %10, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 -28
  store <4 x i32> <i32 16843009, i32 33686018, i32 50529027, i32 303174162>, ptr %11, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %0, i64 -32
  %13 = ptrtoint ptr %3 to i64
  %14 = trunc i64 %13 to i32
  store i32 %14, ptr %12, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %0, i64 -36
  store i32 286331153, ptr %15, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %0, i64 -52
  store <4 x i32> <i32 117901063, i32 134744072, i32 151587081, i32 269488144>, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %0, i64 -68
  store <4 x i32> <i32 -68, i32 67372036, i32 84215045, i32 101058054>, ptr %17, align 4, !tbaa !5
  %18 = icmp eq i64 %4, 1
  %. = select i1 %18, i32 2, i32 3
  %19 = getelementptr inbounds i8, ptr %0, i64 -72
  store i32 %., ptr %19, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 -76
  %21 = ptrtoint ptr %1 to i64
  %22 = trunc i64 %21 to i32
  store i32 %22, ptr %20, align 4, !tbaa !5
  ret ptr %20
}

; Function Attrs: nounwind uwtable
declare hidden void @prvTaskExitError() #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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 = { 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: GlobalOptPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass