; 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.XBram = type { %struct.XBram_Config, i32 }
%struct.XBram_Config = type { i16, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64 }

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

; Function Attrs: nounwind uwtable
define dso_local i32 @XBram_CfgInitialize(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca i32, align 4
  %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 90)
  store i32 1, ptr @Xil_AssertStatus, align 4, !tbaa !11
  store i32 0, ptr %4, align 4
  br label %91

12:                                               ; preds = %10
  %13 = load i64, ptr %7, align 8, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.XBram, ptr %14, i32 0, i32 0
  %16 = getelementptr inbounds %struct.XBram_Config, ptr %15, i32 0, i32 15
  store i64 %13, ptr %16, align 8, !tbaa !13
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.XBram_Config, ptr %17, i32 0, i32 13
  %19 = load i64, ptr %18, align 8, !tbaa !17
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.XBram, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %struct.XBram_Config, ptr %21, i32 0, i32 13
  store i64 %19, ptr %22, align 8, !tbaa !18
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.XBram_Config, ptr %23, i32 0, i32 14
  %25 = load i64, ptr %24, align 8, !tbaa !19
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.XBram, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.XBram_Config, ptr %27, i32 0, i32 14
  store i64 %25, ptr %28, align 8, !tbaa !20
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.XBram_Config, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 4, !tbaa !21
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.XBram, ptr %32, i32 0, i32 0
  %34 = getelementptr inbounds %struct.XBram_Config, ptr %33, i32 0, i32 1
  store i32 %31, ptr %34, align 4, !tbaa !22
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.XBram_Config, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !23
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.XBram, ptr %38, i32 0, i32 0
  %40 = getelementptr inbounds %struct.XBram_Config, ptr %39, i32 0, i32 2
  store i32 %37, ptr %40, align 8, !tbaa !24
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.XBram_Config, ptr %41, i32 0, i32 3
  %43 = load i32, ptr %42, align 4, !tbaa !25
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.XBram, ptr %44, i32 0, i32 0
  %46 = getelementptr inbounds %struct.XBram_Config, ptr %45, i32 0, i32 3
  store i32 %43, ptr %46, align 4, !tbaa !26
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.XBram_Config, ptr %47, i32 0, i32 4
  %49 = load i32, ptr %48, align 8, !tbaa !27
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.XBram, ptr %50, i32 0, i32 0
  %52 = getelementptr inbounds %struct.XBram_Config, ptr %51, i32 0, i32 4
  store i32 %49, ptr %52, align 8, !tbaa !28
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.XBram_Config, ptr %53, i32 0, i32 5
  %55 = load i32, ptr %54, align 4, !tbaa !29
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.XBram, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.XBram_Config, ptr %57, i32 0, i32 5
  store i32 %55, ptr %58, align 4, !tbaa !30
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.XBram_Config, ptr %59, i32 0, i32 6
  %61 = load i32, ptr %60, align 8, !tbaa !31
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.XBram, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.XBram_Config, ptr %63, i32 0, i32 6
  store i32 %61, ptr %64, align 8, !tbaa !32
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.XBram_Config, ptr %65, i32 0, i32 7
  %67 = load i32, ptr %66, align 4, !tbaa !33
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.XBram, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.XBram_Config, ptr %69, i32 0, i32 7
  store i32 %67, ptr %70, align 4, !tbaa !34
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.XBram_Config, ptr %71, i32 0, i32 8
  %73 = load i32, ptr %72, align 8, !tbaa !35
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.XBram, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct.XBram_Config, ptr %75, i32 0, i32 8
  store i32 %73, ptr %76, align 8, !tbaa !36
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.XBram_Config, ptr %77, i32 0, i32 9
  %79 = load i32, ptr %78, align 4, !tbaa !37
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.XBram, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %struct.XBram_Config, ptr %81, i32 0, i32 9
  store i32 %79, ptr %82, align 4, !tbaa !38
  %83 = load ptr, ptr %6, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.XBram_Config, ptr %83, i32 0, i32 12
  %85 = load i32, ptr %84, align 8, !tbaa !39
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.XBram, ptr %86, i32 0, i32 0
  %88 = getelementptr inbounds %struct.XBram_Config, ptr %87, i32 0, i32 12
  store i32 %85, ptr %88, align 8, !tbaa !40
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.XBram, ptr %89, i32 0, i32 1
  store i32 286331153, ptr %90, align 8, !tbaa !41
  store i32 0, ptr %4, align 4
  br label %91

91:                                               ; preds = %12, %11
  %92 = load i32, ptr %4, align 4
  ret i32 %92
}

declare void @Xil_Assert(ptr noundef, i32 noundef) #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" }

!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, !10, i64 72}
!14 = !{!"", !15, i64 0, !12, i64 88}
!15 = !{!"", !16, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80}
!16 = !{!"short", !7, i64 0}
!17 = !{!15, !10, i64 56}
!18 = !{!14, !10, i64 56}
!19 = !{!15, !10, i64 64}
!20 = !{!14, !10, i64 64}
!21 = !{!15, !12, i64 4}
!22 = !{!14, !12, i64 4}
!23 = !{!15, !12, i64 8}
!24 = !{!14, !12, i64 8}
!25 = !{!15, !12, i64 12}
!26 = !{!14, !12, i64 12}
!27 = !{!15, !12, i64 16}
!28 = !{!14, !12, i64 16}
!29 = !{!15, !12, i64 20}
!30 = !{!14, !12, i64 20}
!31 = !{!15, !12, i64 24}
!32 = !{!14, !12, i64 24}
!33 = !{!15, !12, i64 28}
!34 = !{!14, !12, i64 28}
!35 = !{!15, !12, i64 32}
!36 = !{!14, !12, i64 32}
!37 = !{!15, !12, i64 36}
!38 = !{!14, !12, i64 36}
!39 = !{!15, !12, i64 48}
!40 = !{!14, !12, i64 48}
!41 = !{!14, !12, i64 88}


; 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 [160 x i8], align 1

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

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 72
  store i64 %2, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %1, i64 56
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  %8 = load <2 x i64>, ptr %6, align 8, !tbaa !13
  store <2 x i64> %8, ptr %7, align 8, !tbaa !13
  %9 = getelementptr inbounds i8, ptr %1, i64 4
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load <4 x i32>, ptr %9, align 4, !tbaa !14
  store <4 x i32> %11, ptr %10, align 4, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %1, i64 20
  %13 = getelementptr inbounds i8, ptr %0, i64 20
  %14 = load <4 x i32>, ptr %12, align 4, !tbaa !14
  store <4 x i32> %14, ptr %13, align 4, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %1, i64 36
  %16 = load i32, ptr %15, align 4, !tbaa !15
  %17 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %16, ptr %17, align 4, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %1, i64 48
  %19 = load i32, ptr %18, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store i32 %19, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 286331153, ptr %21, align 8, !tbaa !19
  br label %23

22:                                               ; preds = %3
  tail call void @Xil_Assert(ptr noundef nonnull @.str, i32 noundef 90) #2
  br label %23

23:                                               ; preds = %4, %22
  %.sink = phi i32 [ 1, %22 ], [ 0, %4 ]
  store i32 %.sink, ptr @Xil_AssertStatus, align 4
  ret i32 0
}

declare void @Xil_Assert(ptr 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, !12, i64 72}
!6 = !{!"", !7, i64 0, !11, i64 88}
!7 = !{!"", !8, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80}
!8 = !{!"short", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!7, !11, i64 36}
!16 = !{!6, !11, i64 36}
!17 = !{!7, !11, i64 48}
!18 = !{!6, !11, i64 48}
!19 = !{!6, !11, i64 88}


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