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

; 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.XSdPs = type { %struct.XSdPs_Config, i32, i32, i32, i32, i8, i8, i8, i8, i32, i8, [4 x i32], i32, [4 x i32], i32, i32, i32, i32, i32, i64, i16, i32, i8, i32 }
%struct.XSdPs_Config = type { i16, i32, i32, i32, i32, i32, i32, i32, i8 }

; Function Attrs: nounwind uwtable
define dso_local void @XSdPs_Identify_UhsMode(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 13
  %7 = load i8, ptr %6, align 1, !tbaa !9
  %8 = zext i8 %7 to i32
  %9 = and i32 %8, 8
  %10 = icmp ne i32 %9, 0
  br i1 %10, label %11, label %32

11:                                               ; preds = %2
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.XSdPs, ptr %12, i32 0, i32 0
  %14 = getelementptr inbounds %struct.XSdPs_Config, ptr %13, i32 0, i32 2
  %15 = load i32, ptr %14, align 8, !tbaa !10
  %16 = icmp uge i32 %15, 175000000
  br i1 %16, label %17, label %32

17:                                               ; preds = %11
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.XSdPs, ptr %18, i32 0, i32 16
  store i32 3, ptr %19, align 4, !tbaa !16
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.XSdPs, ptr %20, i32 0, i32 0
  %22 = getelementptr inbounds %struct.XSdPs_Config, ptr %21, i32 0, i32 6
  %23 = load i32, ptr %22, align 8, !tbaa !17
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %25, label %28

25:                                               ; preds = %17
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.XSdPs, ptr %26, i32 0, i32 17
  store i32 2, ptr %27, align 8, !tbaa !18
  br label %31

28:                                               ; preds = %17
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.XSdPs, ptr %29, i32 0, i32 17
  store i32 3, ptr %30, align 8, !tbaa !18
  br label %31

31:                                               ; preds = %28, %25
  br label %96

32:                                               ; preds = %11, %2
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %33, i64 13
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = zext i8 %35 to i32
  %37 = and i32 %36, 4
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %50

39:                                               ; preds = %32
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.XSdPs, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %struct.XSdPs_Config, ptr %41, i32 0, i32 2
  %43 = load i32, ptr %42, align 8, !tbaa !10
  %44 = icmp uge i32 %43, 100000000
  br i1 %44, label %45, label %50

45:                                               ; preds = %39
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.XSdPs, ptr %46, i32 0, i32 16
  store i32 2, ptr %47, align 4, !tbaa !16
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.XSdPs, ptr %48, i32 0, i32 17
  store i32 3, ptr %49, align 8, !tbaa !18
  br label %95

50:                                               ; preds = %39, %32
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %51, i64 13
  %53 = load i8, ptr %52, align 1, !tbaa !9
  %54 = zext i8 %53 to i32
  %55 = and i32 %54, 16
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %70

57:                                               ; preds = %50
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.XSdPs, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.XSdPs_Config, ptr %59, i32 0, i32 2
  %61 = load i32, ptr %60, align 8, !tbaa !10
  %62 = icmp uge i32 %61, 50000000
  br i1 %62, label %63, label %70

63:                                               ; preds = %57
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.XSdPs, ptr %64, i32 0, i32 16
  store i32 4, ptr %65, align 4, !tbaa !16
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.XSdPs, ptr %66, i32 0, i32 17
  store i32 4, ptr %67, align 8, !tbaa !18
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.XSdPs, ptr %68, i32 0, i32 18
  store i32 61, ptr %69, align 4, !tbaa !19
  br label %94

70:                                               ; preds = %57, %50
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds i8, ptr %71, i64 13
  %73 = load i8, ptr %72, align 1, !tbaa !9
  %74 = zext i8 %73 to i32
  %75 = and i32 %74, 2
  %76 = icmp ne i32 %75, 0
  br i1 %76, label %77, label %90

77:                                               ; preds = %70
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.XSdPs, ptr %78, i32 0, i32 0
  %80 = getelementptr inbounds %struct.XSdPs_Config, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %80, align 8, !tbaa !10
  %82 = icmp uge i32 %81, 50000000
  br i1 %82, label %83, label %90

83:                                               ; preds = %77
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.XSdPs, ptr %84, i32 0, i32 16
  store i32 1, ptr %85, align 4, !tbaa !16
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.XSdPs, ptr %86, i32 0, i32 17
  store i32 5, ptr %87, align 8, !tbaa !18
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.XSdPs, ptr %88, i32 0, i32 18
  store i32 21, ptr %89, align 4, !tbaa !19
  br label %93

90:                                               ; preds = %77, %70
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.XSdPs, ptr %91, i32 0, i32 16
  store i32 0, ptr %92, align 4, !tbaa !16
  br label %93

93:                                               ; preds = %90, %83
  br label %94

94:                                               ; preds = %93, %63
  br label %95

95:                                               ; preds = %94, %45
  br label %96

96:                                               ; preds = %95, %31
  ret void
}

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 = !{!7, !7, i64 0}
!10 = !{!11, !14, i64 8}
!11 = !{!"", !12, i64 0, !14, i64 36, !14, i64 40, !14, i64 44, !14, i64 48, !7, i64 52, !7, i64 53, !7, i64 54, !7, i64 55, !14, i64 56, !7, i64 60, !7, i64 64, !14, i64 80, !7, i64 84, !14, i64 100, !14, i64 104, !14, i64 108, !14, i64 112, !14, i64 116, !15, i64 120, !13, i64 128, !14, i64 132, !7, i64 136, !14, i64 140}
!12 = !{!"", !13, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !7, i64 32}
!13 = !{!"short", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = !{!11, !14, i64 108}
!17 = !{!11, !14, i64 24}
!18 = !{!11, !14, i64 112}
!19 = !{!11, !14, i64 116}


; 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: readwrite) uwtable
define dso_local void @XSdPs_Identify_UhsMode(ptr nocapture noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 13
  %4 = load i8, ptr %3, align 1, !tbaa !5
  %5 = and i8 %4, 8
  %.not = icmp eq i8 %5, 0
  br i1 %.not, label %18, label %6

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !8
  %9 = icmp ugt i32 %8, 174999999
  br i1 %9, label %10, label %18

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 3, ptr %11, align 4, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 24
  %13 = load i32, ptr %12, align 8, !tbaa !15
  %14 = icmp eq i32 %13, 2
  %15 = getelementptr inbounds i8, ptr %0, i64 112
  br i1 %14, label %16, label %17

16:                                               ; preds = %10
  store i32 2, ptr %15, align 8, !tbaa !16
  br label %49

17:                                               ; preds = %10
  store i32 3, ptr %15, align 8, !tbaa !16
  br label %49

18:                                               ; preds = %6, %2
  %19 = and i8 %4, 4
  %.not21 = icmp eq i8 %19, 0
  br i1 %.not21, label %27, label %20

20:                                               ; preds = %18
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !8
  %23 = icmp ugt i32 %22, 99999999
  br i1 %23, label %24, label %27

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 2, ptr %25, align 4, !tbaa !14
  %26 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 3, ptr %26, align 8, !tbaa !16
  br label %49

27:                                               ; preds = %20, %18
  %28 = and i8 %4, 16
  %.not22 = icmp eq i8 %28, 0
  br i1 %.not22, label %37, label %29

29:                                               ; preds = %27
  %30 = getelementptr inbounds i8, ptr %0, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !8
  %32 = icmp ugt i32 %31, 49999999
  br i1 %32, label %33, label %37

33:                                               ; preds = %29
  %34 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 4, ptr %34, align 4, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 4, ptr %35, align 8, !tbaa !16
  %36 = getelementptr inbounds i8, ptr %0, i64 116
  store i32 61, ptr %36, align 4, !tbaa !17
  br label %49

37:                                               ; preds = %29, %27
  %38 = and i8 %4, 2
  %.not23 = icmp eq i8 %38, 0
  br i1 %.not23, label %47, label %39

39:                                               ; preds = %37
  %40 = getelementptr inbounds i8, ptr %0, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !8
  %42 = icmp ugt i32 %41, 49999999
  br i1 %42, label %43, label %47

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 1, ptr %44, align 4, !tbaa !14
  %45 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 5, ptr %45, align 8, !tbaa !16
  %46 = getelementptr inbounds i8, ptr %0, i64 116
  store i32 21, ptr %46, align 4, !tbaa !17
  br label %49

47:                                               ; preds = %39, %37
  %48 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 0, ptr %48, align 4, !tbaa !14
  br label %49

49:                                               ; preds = %24, %43, %47, %33, %16, %17
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !12, i64 8}
!9 = !{!"", !10, i64 0, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !6, i64 52, !6, i64 53, !6, i64 54, !6, i64 55, !12, i64 56, !6, i64 60, !6, i64 64, !12, i64 80, !6, i64 84, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !13, i64 120, !11, i64 128, !12, i64 132, !6, i64 136, !12, i64 140}
!10 = !{!"", !11, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !6, i64 32}
!11 = !{!"short", !6, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{!"long", !6, i64 0}
!14 = !{!9, !12, i64 108}
!15 = !{!9, !12, i64 24}
!16 = !{!9, !12, i64 112}
!17 = !{!9, !12, i64 116}


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