; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Bus/Pci (UfsHcDriverBindingStart)

; 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._UFS_HOST_CONTROLLER_PRIVATE_DATA = type { i32, ptr, %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr, i64 }
%struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct._EFI_PCI_IO_PROTOCOL = type { ptr, ptr, %struct.EFI_PCI_IO_PROTOCOL_ACCESS, %struct.EFI_PCI_IO_PROTOCOL_ACCESS, %struct.EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr }
%struct.EFI_PCI_IO_PROTOCOL_ACCESS = type { ptr, ptr }
%struct.EFI_PCI_IO_PROTOCOL_CONFIG_ACCESS = type { ptr, ptr }

@gUfsHcTemplate = external dso_local global %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, align 8
@.str = external hidden unnamed_addr constant [148 x i8], align 1
@gBS = external global ptr, align 8
@gEfiPciIoProtocolGuid = external global %struct.GUID, align 4
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsHcDriverBindingStart(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %9, align 8, !tbaa !5
  store ptr null, ptr %10, align 8, !tbaa !5
  store i64 0, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr @gBS, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %13, i32 0, i32 33
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %17, i32 0, i32 5
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call i64 %15(ptr noundef %16, ptr noundef @gEfiPciIoProtocolGuid, ptr noundef %9, ptr noundef %19, ptr noundef %20, i32 noundef 16)
  store i64 %21, ptr %8, align 8, !tbaa !9
  %22 = load i64, ptr %8, align 8, !tbaa !9
  %23 = icmp slt i64 %22, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %3
  %25 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %25, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %133

26:                                               ; preds = %3
  %27 = call ptr @AllocateCopyPool(i64 noundef 80, ptr noundef @gUfsHcTemplate)
  store ptr %27, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  store i64 -9223372036854775799, ptr %8, align 8, !tbaa !9
  br label %70

31:                                               ; preds = %26
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, ptr %33, i32 0, i32 3
  store ptr %32, ptr %34, align 8, !tbaa !17
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._EFI_PCI_IO_PROTOCOL, ptr %35, i32 0, i32 12
  %37 = load ptr, ptr %36, align 8, !tbaa !20
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, ptr %39, i32 0, i32 4
  %41 = call i64 %37(ptr noundef %38, i32 noundef 0, i64 noundef 0, ptr noundef %40)
  store i64 %41, ptr %8, align 8, !tbaa !9
  %42 = load i64, ptr %8, align 8, !tbaa !9
  %43 = icmp slt i64 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %31
  br label %70

45:                                               ; preds = %31
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._EFI_PCI_IO_PROTOCOL, ptr %46, i32 0, i32 12
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = call i64 %48(ptr noundef %49, i32 noundef 4, i64 noundef 0, ptr noundef %11)
  store i64 %50, ptr %8, align 8, !tbaa !9
  %51 = load i64, ptr %8, align 8, !tbaa !9
  %52 = icmp slt i64 %51, 0
  br i1 %52, label %62, label %53

53:                                               ; preds = %45
  %54 = load i64, ptr %11, align 8, !tbaa !9
  %55 = and i64 %54, 1792
  store i64 %55, ptr %11, align 8, !tbaa !9
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._EFI_PCI_IO_PROTOCOL, ptr %56, i32 0, i32 12
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = load i64, ptr %11, align 8, !tbaa !9
  %61 = call i64 %58(ptr noundef %59, i32 noundef 2, i64 noundef %60, ptr noundef null)
  store i64 %61, ptr %8, align 8, !tbaa !9
  br label %63

62:                                               ; preds = %45
  br label %70

63:                                               ; preds = %53
  %64 = load ptr, ptr @gBS, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %64, i32 0, i32 14
  %66 = load ptr, ptr %65, align 8, !tbaa !23
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, ptr %67, i32 0, i32 2
  %69 = call i64 %66(ptr noundef %6, ptr noundef @gEdkiiUfsHostControllerProtocolGuid, i32 noundef 0, ptr noundef %68)
  store i64 %69, ptr %8, align 8, !tbaa !9
  br label %70

70:                                               ; preds = %63, %62, %44, %30
  %71 = load i64, ptr %8, align 8, !tbaa !9
  %72 = icmp slt i64 %71, 0
  br i1 %72, label %73, label %131

73:                                               ; preds = %70
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %116

76:                                               ; preds = %73
  %77 = load ptr, ptr %10, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, ptr %77, i32 0, i32 4
  %79 = load i64, ptr %78, align 8, !tbaa !24
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %81, label %116

81:                                               ; preds = %76
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._EFI_PCI_IO_PROTOCOL, ptr %82, i32 0, i32 12
  %84 = load ptr, ptr %83, align 8, !tbaa !20
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = load ptr, ptr %10, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, ptr %86, i32 0, i32 4
  %88 = load i64, ptr %87, align 8, !tbaa !24
  %89 = call i64 %84(ptr noundef %85, i32 noundef 1, i64 noundef %88, ptr noundef null)
  store i64 %89, ptr %8, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %81
  %91 = call zeroext i8 @DebugAssertEnabled()
  %92 = icmp ne i8 %91, 0
  br i1 %92, label %93, label %113

93:                                               ; preds = %90
  %94 = load i64, ptr %8, align 8, !tbaa !9
  %95 = icmp slt i64 %94, 0
  br i1 %95, label %96, label %112

96:                                               ; preds = %93
  br label %97

97:                                               ; preds = %96
  %98 = call zeroext i8 @DebugPrintEnabled()
  %99 = icmp ne i8 %98, 0
  br i1 %99, label %100, label %109

100:                                              ; preds = %97
  br label %101

101:                                              ; preds = %100
  %102 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %103 = icmp ne i8 %102, 0
  br i1 %103, label %104, label %106

104:                                              ; preds = %101
  %105 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.2, i64 noundef %105)
  br label %106

106:                                              ; preds = %104, %101
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  br label %109

109:                                              ; preds = %108, %97
  br label %110

110:                                              ; preds = %109
  br label %111

111:                                              ; preds = %110
  call void @DebugAssert(ptr noundef @.str, i64 noundef 562, ptr noundef @.str.3)
  br label %112

112:                                              ; preds = %111, %93
  br label %113

113:                                              ; preds = %112, %90
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  br label %116

116:                                              ; preds = %115, %76, %73
  %117 = load ptr, ptr @gBS, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %117, i32 0, i32 34
  %119 = load ptr, ptr %118, align 8, !tbaa !25
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %121, i32 0, i32 5
  %123 = load ptr, ptr %122, align 8, !tbaa !15
  %124 = load ptr, ptr %6, align 8, !tbaa !5
  %125 = call i64 %119(ptr noundef %120, ptr noundef @gEfiPciIoProtocolGuid, ptr noundef %123, ptr noundef %124)
  %126 = load ptr, ptr %10, align 8, !tbaa !5
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %130

128:                                              ; preds = %116
  %129 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %129)
  br label %130

130:                                              ; preds = %128, %116
  br label %131

131:                                              ; preds = %130, %70
  %132 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %132, ptr %4, align 8
  store i32 1, ptr %12, align 4
  br label %133

133:                                              ; preds = %131, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %134 = load i64, ptr %4, align 8
  ret i64 %134
}

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

declare zeroext i8 @DebugAssertEnabled() #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) #2

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

declare ptr @AllocateCopyPool(i64 noundef, ptr noundef) #2

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #2

declare void @FreePool(ptr noundef) #2

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 = { "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 #3 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 280}
!12 = !{!"", !13, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!13 = !{!"", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 40}
!16 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !6, i64 64}
!18 = !{!"_UFS_HOST_CONTROLLER_PRIVATE_DATA", !14, i64 0, !6, i64 8, !19, i64 16, !6, i64 64, !10, i64 72}
!19 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!21, !6, i64 120}
!21 = !{!"_EFI_PCI_IO_PROTOCOL", !6, i64 0, !6, i64 8, !22, i64 16, !22, i64 32, !22, i64 48, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !10, i64 144, !6, i64 152}
!22 = !{!"", !6, i64 0, !6, i64 8}
!23 = !{!12, !6, i64 128}
!24 = !{!18, !10, i64 72}
!25 = !{!12, !6, i64 288}


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

%struct._UFS_HOST_CONTROLLER_PRIVATE_DATA = type { i32, ptr, %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr, i64 }
%struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }

@gUfsHcTemplate = external dso_local global %struct._UFS_HOST_CONTROLLER_PRIVATE_DATA, align 8
@.str = external hidden unnamed_addr constant [148 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiPciIoProtocolGuid = external global %struct.GUID, align 4
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsHcDriverBindingStart(ptr nocapture noundef readonly %0, ptr noundef %1, ptr nocapture noundef readnone %2) local_unnamed_addr #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  store i64 0, ptr %6, align 8, !tbaa !9
  %7 = load ptr, ptr @gBS, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 280
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !15
  %12 = call i64 %9(ptr noundef %1, ptr noundef nonnull @gEfiPciIoProtocolGuid, ptr noundef nonnull %5, ptr noundef %11, ptr noundef %1, i32 noundef 16) #3
  %13 = icmp slt i64 %12, 0
  br i1 %13, label %67, label %14

14:                                               ; preds = %3
  %15 = call ptr @AllocateCopyPool(i64 noundef 80, ptr noundef nonnull @gUfsHcTemplate) #3
  %16 = icmp eq ptr %15, null
  br i1 %16, label %59, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %15, i64 64
  store ptr %18, ptr %19, align 8, !tbaa !17
  %20 = getelementptr inbounds i8, ptr %18, i64 120
  %21 = load ptr, ptr %20, align 8, !tbaa !20
  %22 = getelementptr inbounds i8, ptr %15, i64 72
  %23 = call i64 %21(ptr noundef %18, i32 noundef 0, i64 noundef 0, ptr noundef nonnull %22) #3
  %24 = icmp slt i64 %23, 0
  br i1 %24, label %.thread34, label %25

25:                                               ; preds = %17
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 120
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = call i64 %28(ptr noundef %26, i32 noundef 4, i64 noundef 0, ptr noundef nonnull %6) #3
  %30 = icmp slt i64 %29, 0
  br i1 %30, label %.thread34, label %31

31:                                               ; preds = %25
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = and i64 %32, 1792
  store i64 %33, ptr %6, align 8, !tbaa !9
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds i8, ptr %34, i64 120
  %36 = load ptr, ptr %35, align 8, !tbaa !20
  %37 = call i64 %36(ptr noundef %34, i32 noundef 2, i64 noundef %33, ptr noundef null) #3
  %38 = load ptr, ptr @gBS, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 128
  %40 = load ptr, ptr %39, align 8, !tbaa !23
  %41 = getelementptr inbounds i8, ptr %15, i64 16
  %42 = call i64 %40(ptr noundef nonnull %4, ptr noundef nonnull @gEdkiiUfsHostControllerProtocolGuid, i32 noundef 0, ptr noundef nonnull %41) #3
  %43 = icmp slt i64 %42, 0
  br i1 %43, label %.thread34, label %67

.thread34:                                        ; preds = %25, %17, %31
  %.03336 = phi i64 [ %42, %31 ], [ %23, %17 ], [ %29, %25 ]
  %44 = load i64, ptr %22, align 8, !tbaa !24
  %.not29 = icmp eq i64 %44, 0
  br i1 %.not29, label %59, label %45

45:                                               ; preds = %.thread34
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 120
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = call i64 %48(ptr noundef %46, i32 noundef 1, i64 noundef %44, ptr noundef null) #3
  %50 = call zeroext i8 @DebugAssertEnabled() #3
  %51 = icmp ne i8 %50, 0
  %52 = icmp slt i64 %49, 0
  %or.cond = select i1 %51, i1 %52, i1 false
  br i1 %or.cond, label %53, label %59

53:                                               ; preds = %45
  %54 = call zeroext i8 @DebugPrintEnabled() #3
  %.not30 = icmp eq i8 %54, 0
  br i1 %.not30, label %58, label %55

55:                                               ; preds = %53
  %56 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not31 = icmp eq i8 %56, 0
  br i1 %.not31, label %58, label %57

57:                                               ; preds = %55
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.2, i64 noundef %49) #3
  br label %58

58:                                               ; preds = %55, %57, %53
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 562, ptr noundef nonnull @.str.3) #3
  br label %59

59:                                               ; preds = %14, %45, %58, %.thread34
  %.1 = phi i64 [ %49, %58 ], [ %49, %45 ], [ %.03336, %.thread34 ], [ -9223372036854775799, %14 ]
  %60 = load ptr, ptr @gBS, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 288
  %62 = load ptr, ptr %61, align 8, !tbaa !25
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = load ptr, ptr %10, align 8, !tbaa !15
  %65 = call i64 %62(ptr noundef %63, ptr noundef nonnull @gEfiPciIoProtocolGuid, ptr noundef %64, ptr noundef %63) #3
  br i1 %16, label %67, label %66

66:                                               ; preds = %59
  call void @FreePool(ptr noundef nonnull %15) #3
  br label %67

67:                                               ; preds = %31, %66, %59, %3
  %.020 = phi i64 [ %12, %3 ], [ %.1, %66 ], [ %.1, %59 ], [ %42, %31 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.020
}

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

declare void @DebugAssert(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @AllocateCopyPool(i64 noundef, ptr noundef) local_unnamed_addr #2

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #2

declare void @DebugPrint(i64 noundef, ptr noundef, ...) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 #3 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 280}
!12 = !{!"", !13, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!13 = !{!"", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 40}
!16 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !6, i64 64}
!18 = !{!"_UFS_HOST_CONTROLLER_PRIVATE_DATA", !14, i64 0, !6, i64 8, !19, i64 16, !6, i64 64, !10, i64 72}
!19 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!21, !6, i64 120}
!21 = !{!"_EFI_PCI_IO_PROTOCOL", !6, i64 0, !6, i64 8, !22, i64 16, !22, i64 32, !22, i64 48, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !10, i64 144, !6, i64 152}
!22 = !{!"", !6, i64 0, !6, i64 8}
!23 = !{!12, !6, i64 128}
!24 = !{!18, !10, i64 72}
!25 = !{!12, !6, i64 288}


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