; LLVM IR from rociodellasala/TP3_SO :: Kernel (stack)

; 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.StackFrame = type { i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64, i64 }

; Function Attrs: nounwind uwtable
define dso_local ptr @fillStackFrame(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  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 8, ptr %5) #2
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.StackFrame, ptr %6, i64 -1
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.StackFrame, ptr %8, i32 0, i32 0
  store i64 1, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.StackFrame, ptr %10, i32 0, i32 1
  store i64 2, ptr %11, align 8, !tbaa !12
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.StackFrame, ptr %12, i32 0, i32 2
  store i64 3, ptr %13, align 8, !tbaa !13
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.StackFrame, ptr %14, i32 0, i32 3
  store i64 4, ptr %15, align 8, !tbaa !14
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.StackFrame, ptr %16, i32 0, i32 4
  store i64 5, ptr %17, align 8, !tbaa !15
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.StackFrame, ptr %18, i32 0, i32 5
  store i64 6, ptr %19, align 8, !tbaa !16
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.StackFrame, ptr %20, i32 0, i32 6
  store i64 7, ptr %21, align 8, !tbaa !17
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.StackFrame, ptr %22, i32 0, i32 7
  store i64 8, ptr %23, align 8, !tbaa !18
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.StackFrame, ptr %24, i32 0, i32 8
  store i64 9, ptr %25, align 8, !tbaa !19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.StackFrame, ptr %26, i32 0, i32 9
  store i64 10, ptr %27, align 8, !tbaa !20
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.StackFrame, ptr %28, i32 0, i32 10
  store i64 11, ptr %29, align 8, !tbaa !21
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.StackFrame, ptr %30, i32 0, i32 11
  store i64 12, ptr %31, align 8, !tbaa !22
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.StackFrame, ptr %32, i32 0, i32 12
  store i64 13, ptr %33, align 8, !tbaa !23
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.StackFrame, ptr %34, i32 0, i32 13
  store i64 14, ptr %35, align 8, !tbaa !24
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.StackFrame, ptr %36, i32 0, i32 14
  store i64 15, ptr %37, align 8, !tbaa !25
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.StackFrame, ptr %38, i32 0, i32 15
  store i64 16, ptr %39, align 8, !tbaa !26
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.StackFrame, ptr %40, i32 0, i32 16
  store i64 17, ptr %41, align 8, !tbaa !27
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = ptrtoint ptr %42 to i64
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.StackFrame, ptr %44, i32 0, i32 17
  store i64 %43, ptr %45, align 8, !tbaa !28
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.StackFrame, ptr %46, i32 0, i32 18
  store i64 8, ptr %47, align 8, !tbaa !29
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.StackFrame, ptr %48, i32 0, i32 19
  store i64 514, ptr %49, align 8, !tbaa !30
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.StackFrame, ptr %50, i32 0, i32 22
  %52 = ptrtoint ptr %51 to i64
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.StackFrame, ptr %53, i32 0, i32 20
  store i64 %52, ptr %54, align 8, !tbaa !31
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.StackFrame, ptr %55, i32 0, i32 21
  store i64 0, ptr %56, align 8, !tbaa !32
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.StackFrame, ptr %57, i32 0, i32 22
  store i64 0, ptr %58, align 8, !tbaa !33
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret ptr %59
}

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

; 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 = { 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, !11, i64 0}
!10 = !{!"StackFrame", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !11, i64 104, !11, i64 112, !11, i64 120, !11, i64 128, !11, i64 136, !11, i64 144, !11, i64 152, !11, i64 160, !11, i64 168, !11, i64 176}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!10, !11, i64 16}
!14 = !{!10, !11, i64 24}
!15 = !{!10, !11, i64 32}
!16 = !{!10, !11, i64 40}
!17 = !{!10, !11, i64 48}
!18 = !{!10, !11, i64 56}
!19 = !{!10, !11, i64 64}
!20 = !{!10, !11, i64 72}
!21 = !{!10, !11, i64 80}
!22 = !{!10, !11, i64 88}
!23 = !{!10, !11, i64 96}
!24 = !{!10, !11, i64 104}
!25 = !{!10, !11, i64 112}
!26 = !{!10, !11, i64 120}
!27 = !{!10, !11, i64 128}
!28 = !{!10, !11, i64 136}
!29 = !{!10, !11, i64 144}
!30 = !{!10, !11, i64 152}
!31 = !{!10, !11, i64 160}
!32 = !{!10, !11, i64 168}
!33 = !{!10, !11, i64 176}


; 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 @fillStackFrame(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 -184
  store i64 1, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 -176
  store i64 2, ptr %4, align 8, !tbaa !10
  %5 = getelementptr inbounds i8, ptr %1, i64 -168
  store i64 3, ptr %5, align 8, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %1, i64 -160
  store i64 4, ptr %6, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %1, i64 -152
  store i64 5, ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %1, i64 -144
  store i64 6, ptr %8, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %1, i64 -136
  store i64 7, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %1, i64 -128
  store i64 8, ptr %10, align 8, !tbaa !16
  %11 = getelementptr inbounds i8, ptr %1, i64 -120
  store i64 9, ptr %11, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %1, i64 -112
  store i64 10, ptr %12, align 8, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %1, i64 -104
  store i64 11, ptr %13, align 8, !tbaa !19
  %14 = getelementptr inbounds i8, ptr %1, i64 -96
  store i64 12, ptr %14, align 8, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %1, i64 -88
  store i64 13, ptr %15, align 8, !tbaa !21
  %16 = getelementptr inbounds i8, ptr %1, i64 -80
  store i64 14, ptr %16, align 8, !tbaa !22
  %17 = getelementptr inbounds i8, ptr %1, i64 -72
  store i64 15, ptr %17, align 8, !tbaa !23
  %18 = getelementptr inbounds i8, ptr %1, i64 -64
  store i64 16, ptr %18, align 8, !tbaa !24
  %19 = getelementptr inbounds i8, ptr %1, i64 -56
  store i64 17, ptr %19, align 8, !tbaa !25
  %20 = ptrtoint ptr %0 to i64
  %21 = getelementptr inbounds i8, ptr %1, i64 -48
  store i64 %20, ptr %21, align 8, !tbaa !26
  %22 = getelementptr inbounds i8, ptr %1, i64 -40
  store i64 8, ptr %22, align 8, !tbaa !27
  %23 = getelementptr inbounds i8, ptr %1, i64 -32
  store i64 514, ptr %23, align 8, !tbaa !28
  %24 = getelementptr inbounds i8, ptr %1, i64 -8
  %25 = ptrtoint ptr %24 to i64
  %26 = getelementptr inbounds i8, ptr %1, i64 -24
  store i64 %25, ptr %26, align 8, !tbaa !29
  %27 = getelementptr inbounds i8, ptr %1, i64 -16
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %27, i8 0, i64 16, i1 false)
  ret ptr %3
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 0}
!6 = !{!"StackFrame", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !7, i64 152, !7, i64 160, !7, i64 168, !7, i64 176}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!6, !7, i64 16}
!12 = !{!6, !7, i64 24}
!13 = !{!6, !7, i64 32}
!14 = !{!6, !7, i64 40}
!15 = !{!6, !7, i64 48}
!16 = !{!6, !7, i64 56}
!17 = !{!6, !7, i64 64}
!18 = !{!6, !7, i64 72}
!19 = !{!6, !7, i64 80}
!20 = !{!6, !7, i64 88}
!21 = !{!6, !7, i64 96}
!22 = !{!6, !7, i64 104}
!23 = !{!6, !7, i64 112}
!24 = !{!6, !7, i64 120}
!25 = !{!6, !7, i64 128}
!26 = !{!6, !7, i64 136}
!27 = !{!6, !7, i64 144}
!28 = !{!6, !7, i64 152}
!29 = !{!6, !7, i64 160}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass