; LLVM IR from FrancesoM/Bisc8FX :: sdk_projects/bisc8_platform/ps7_cortexa9_0/standalone_domain/bsp/ps7_cortexa9_0_ (CfgInitialize)

; 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.XEmacPs_Config = type { i16, i64, i8, i8, i8, i8, i8, i8, i8 }
%struct.XEmacPs_Instance = type { %struct.XEmacPs_Config, i32, i32, i32, %struct.XEmacPs_BdRing, %struct.XEmacPs_BdRing, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.XEmacPs_BdRing = type { i64, i64, i64, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32 }

@Xil_AssertStatus = external global i32, align 4
@.str = external hidden unnamed_addr constant [165 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @XEmacPs_CfgInitialize(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %3
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !11
  br label %12

11:                                               ; preds = %3
  call void @Xil_Assert(ptr noundef @.str, i32 noundef 84)
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !11
  store i64 0, ptr %4, align 8
  br label %79

12:                                               ; preds = %10
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %12
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !11
  br label %17

16:                                               ; preds = %12
  call void @Xil_Assert(ptr noundef @.str, i32 noundef 85)
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !11
  store i64 0, ptr %4, align 8
  br label %79

17:                                               ; preds = %15
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.XEmacPs_Config, ptr %18, i32 0, i32 0
  %20 = load i16, ptr %19, align 8, !tbaa !13
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %21, i32 0, i32 0
  %23 = getelementptr inbounds %struct.XEmacPs_Config, ptr %22, i32 0, i32 0
  store i16 %20, ptr %23, align 8, !tbaa !16
  %24 = load i64, ptr %7, align 8, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %25, i32 0, i32 0
  %27 = getelementptr inbounds %struct.XEmacPs_Config, ptr %26, i32 0, i32 1
  store i64 %24, ptr %27, align 8, !tbaa !19
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.XEmacPs_Config, ptr %28, i32 0, i32 2
  %30 = load i8, ptr %29, align 8, !tbaa !20
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.XEmacPs_Config, ptr %32, i32 0, i32 2
  store i8 %30, ptr %33, align 8, !tbaa !21
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.XEmacPs_Config, ptr %34, i32 0, i32 3
  %36 = load i8, ptr %35, align 1, !tbaa !22
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.XEmacPs_Config, ptr %38, i32 0, i32 3
  store i8 %36, ptr %39, align 1, !tbaa !23
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.XEmacPs_Config, ptr %40, i32 0, i32 4
  %42 = load i8, ptr %41, align 2, !tbaa !24
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.XEmacPs_Config, ptr %44, i32 0, i32 4
  store i8 %42, ptr %45, align 2, !tbaa !25
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.XEmacPs_Config, ptr %46, i32 0, i32 5
  %48 = load i8, ptr %47, align 1, !tbaa !26
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.XEmacPs_Config, ptr %50, i32 0, i32 5
  store i8 %48, ptr %51, align 1, !tbaa !27
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.XEmacPs_Config, ptr %52, i32 0, i32 6
  %54 = load i8, ptr %53, align 4, !tbaa !28
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %55, i32 0, i32 0
  %57 = getelementptr inbounds %struct.XEmacPs_Config, ptr %56, i32 0, i32 6
  store i8 %54, ptr %57, align 4, !tbaa !29
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.XEmacPs_Config, ptr %58, i32 0, i32 7
  %60 = load i8, ptr %59, align 1, !tbaa !30
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %61, i32 0, i32 0
  %63 = getelementptr inbounds %struct.XEmacPs_Config, ptr %62, i32 0, i32 7
  store i8 %60, ptr %63, align 1, !tbaa !31
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.XEmacPs_Config, ptr %64, i32 0, i32 8
  %66 = load i8, ptr %65, align 2, !tbaa !32
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %67, i32 0, i32 0
  %69 = getelementptr inbounds %struct.XEmacPs_Config, ptr %68, i32 0, i32 8
  store i8 %66, ptr %69, align 2, !tbaa !33
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %70, i32 0, i32 6
  store ptr @XEmacPs_StubHandler, ptr %71, align 8, !tbaa !34
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %72, i32 0, i32 7
  store ptr @XEmacPs_StubHandler, ptr %73, align 8, !tbaa !35
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %74, i32 0, i32 10
  store ptr @XEmacPs_StubHandler, ptr %75, align 8, !tbaa !36
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.XEmacPs_Instance, ptr %76, i32 0, i32 2
  store i32 286331153, ptr %77, align 4, !tbaa !37
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  call void @XEmacPs_Reset(ptr noundef %78)
  store i64 0, ptr %4, align 8
  br label %79

79:                                               ; preds = %17, %16, %11
  %80 = load i64, ptr %4, align 8
  ret i64 %80
}

declare void @Xil_Assert(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @XEmacPs_StubHandler() #0

; Function Attrs: nounwind uwtable
declare dso_local void @XEmacPs_Reset(ptr noundef) #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" }

!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}
!13 = !{!14, !15, i64 0}
!14 = !{!"", !15, i64 0, !10, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !7, i64 22}
!15 = !{!"short", !7, i64 0}
!16 = !{!17, !15, i64 0}
!17 = !{!"XEmacPs_Instance", !14, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !18, i64 40, !18, i64 152, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !12, i64 312, !12, i64 316, !12, i64 320, !12, i64 324, !12, i64 328}
!18 = !{!"", !10, i64 0, !10, i64 8, !10, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104}
!19 = !{!17, !10, i64 8}
!20 = !{!14, !7, i64 16}
!21 = !{!17, !7, i64 16}
!22 = !{!14, !7, i64 17}
!23 = !{!17, !7, i64 17}
!24 = !{!14, !7, i64 18}
!25 = !{!17, !7, i64 18}
!26 = !{!14, !7, i64 19}
!27 = !{!17, !7, i64 19}
!28 = !{!14, !7, i64 20}
!29 = !{!17, !7, i64 20}
!30 = !{!14, !7, i64 21}
!31 = !{!17, !7, i64 21}
!32 = !{!14, !7, i64 22}
!33 = !{!17, !7, i64 22}
!34 = !{!17, !6, i64 264}
!35 = !{!17, !6, i64 272}
!36 = !{!17, !6, i64 296}
!37 = !{!17, !12, i64 28}


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

@Xil_AssertStatus = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [165 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @XEmacPs_CfgInitialize(ptr noundef %0, ptr noundef readonly %1, i64 noundef %2) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %5, label %4

4:                                                ; preds = %3
  store i32 0, ptr @Xil_AssertStatus, align 4, !tbaa !5
  %.not26 = icmp eq ptr %1, null
  br i1 %.not26, label %25, label %6

5:                                                ; preds = %3
  tail call void @Xil_Assert(ptr noundef nonnull @.str, i32 noundef 84) #2
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !5
  br label %26

6:                                                ; preds = %4
  %7 = load i16, ptr %1, align 8, !tbaa !9
  store i16 %7, ptr %0, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %2, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = getelementptr inbounds i8, ptr %0, i64 16
  %11 = load <4 x i8>, ptr %9, align 8, !tbaa !18
  store <4 x i8> %11, ptr %10, align 8, !tbaa !18
  %12 = getelementptr inbounds i8, ptr %1, i64 20
  %13 = load i8, ptr %12, align 4, !tbaa !19
  %14 = getelementptr inbounds i8, ptr %0, i64 20
  store i8 %13, ptr %14, align 4, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %1, i64 21
  %16 = load i8, ptr %15, align 1, !tbaa !21
  %17 = getelementptr inbounds i8, ptr %0, i64 21
  store i8 %16, ptr %17, align 1, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %1, i64 22
  %19 = load i8, ptr %18, align 2, !tbaa !23
  %20 = getelementptr inbounds i8, ptr %0, i64 22
  store i8 %19, ptr %20, align 2, !tbaa !24
  %21 = getelementptr inbounds i8, ptr %0, i64 264
  store ptr @XEmacPs_StubHandler, ptr %21, align 8, !tbaa !25
  %22 = getelementptr inbounds i8, ptr %0, i64 272
  store ptr @XEmacPs_StubHandler, ptr %22, align 8, !tbaa !26
  %23 = getelementptr inbounds i8, ptr %0, i64 296
  store ptr @XEmacPs_StubHandler, ptr %23, align 8, !tbaa !27
  %24 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 286331153, ptr %24, align 4, !tbaa !28
  tail call void @XEmacPs_Reset(ptr noundef nonnull %0)
  br label %26

25:                                               ; preds = %4
  tail call void @Xil_Assert(ptr noundef nonnull @.str, i32 noundef 85) #2
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %6, %25, %5
  ret i64 0
}

declare void @Xil_Assert(ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @XEmacPs_StubHandler() #0

; Function Attrs: nounwind uwtable
declare dso_local void @XEmacPs_Reset(ptr 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, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"", !11, i64 0, !12, i64 8, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !7, i64 22}
!11 = !{!"short", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !11, i64 0}
!14 = !{!"XEmacPs_Instance", !10, i64 0, !6, i64 24, !6, i64 28, !6, i64 32, !15, i64 40, !15, i64 152, !16, i64 264, !16, i64 272, !16, i64 280, !16, i64 288, !16, i64 296, !16, i64 304, !6, i64 312, !6, i64 316, !6, i64 320, !6, i64 324, !6, i64 328}
!15 = !{!"", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24, !6, i64 28, !6, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !16, i64 72, !16, i64 80, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !6, i64 104}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!14, !12, i64 8}
!18 = !{!7, !7, i64 0}
!19 = !{!10, !7, i64 20}
!20 = !{!14, !7, i64 20}
!21 = !{!10, !7, i64 21}
!22 = !{!14, !7, i64 21}
!23 = !{!10, !7, i64 22}
!24 = !{!14, !7, i64 22}
!25 = !{!14, !16, i64 264}
!26 = !{!14, !16, i64 272}
!27 = !{!14, !16, i64 296}
!28 = !{!14, !6, i64 28}


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