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

; 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.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._UFS_PASS_THRU_PRIVATE_DATA = type { i32, ptr, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, ptr, i64, i32, i8, ptr, i8, ptr, ptr, i8, ptr, %struct.UFS_EXPOSED_LUNS }
%struct.EFI_EXT_SCSI_PASS_THRU_MODE = type { i32, i32, i32 }
%struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.UFS_EXPOSED_LUNS = type { [12 x i8], i16 }
%struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [151 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external global ptr, align 8
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@gEfiExtScsiPassThruProtocolGuid = external global %struct.GUID, align 4
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsPassThruDriverBindingStop(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  br label %15

15:                                               ; preds = %4
  %16 = call zeroext i8 @DebugPrintEnabled()
  %17 = icmp ne i8 %16, 0
  br i1 %17, label %18, label %27

18:                                               ; preds = %15
  br label %19

19:                                               ; preds = %18
  %20 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %21 = icmp ne i8 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %19
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.12, ptr noundef %23)
  br label %24

24:                                               ; preds = %22, %19
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26, %15
  br label %28

28:                                               ; preds = %27
  br label %29

29:                                               ; preds = %28
  %30 = load ptr, ptr @gBS, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %30, i32 0, i32 33
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %34, i32 0, i32 5
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = call i64 %32(ptr noundef %33, ptr noundef @gEfiExtScsiPassThruProtocolGuid, ptr noundef %12, ptr noundef %36, ptr noundef %37, i32 noundef 2)
  store i64 %38, ptr %10, align 8, !tbaa !9
  %39 = load i64, ptr %10, align 8, !tbaa !9
  %40 = icmp slt i64 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %29
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %206

42:                                               ; preds = %29
  %43 = call zeroext i8 @DebugAssertEnabled()
  %44 = zext i8 %43 to i32
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %56

46:                                               ; preds = %42
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = ptrtoint ptr %47 to i64
  %49 = sub i64 %48, ptrtoint (ptr getelementptr inbounds (%struct._UFS_PASS_THRU_PRIVATE_DATA, ptr null, i32 0, i32 3) to i64)
  %50 = inttoptr i64 %49 to ptr
  %51 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %50, i32 0, i32 0
  %52 = load i32, ptr %51, align 8, !tbaa !17
  %53 = icmp ne i32 %52, 1347634773
  br i1 %53, label %54, label %56

54:                                               ; preds = %46
  call void @DebugAssert(ptr noundef @.str, i64 noundef 972, ptr noundef @.str.1)
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  br label %61

56:                                               ; preds = %46, %42
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = ptrtoint ptr %57 to i64
  %59 = sub i64 %58, ptrtoint (ptr getelementptr inbounds (%struct._UFS_PASS_THRU_PRIVATE_DATA, ptr null, i32 0, i32 3) to i64)
  %60 = inttoptr i64 %59 to ptr
  br label %61

61:                                               ; preds = %56, %54
  %62 = phi ptr [ %55, %54 ], [ %60, %56 ]
  store ptr %62, ptr %11, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %63, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !23
  store ptr %65, ptr %13, align 8, !tbaa !5
  %66 = load ptr, ptr @gBS, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %66, i32 0, i32 16
  %68 = load ptr, ptr %67, align 8, !tbaa !24
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %70, i32 0, i32 3
  %72 = call i64 %68(ptr noundef %69, ptr noundef @gEfiExtScsiPassThruProtocolGuid, ptr noundef %71)
  store i64 %72, ptr %10, align 8, !tbaa !9
  %73 = load i64, ptr %10, align 8, !tbaa !9
  %74 = icmp slt i64 %73, 0
  br i1 %74, label %75, label %76

75:                                               ; preds = %61
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %206

76:                                               ; preds = %61
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = call i64 @UfsControllerStop(ptr noundef %77)
  store i64 %78, ptr %10, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %76
  %80 = call zeroext i8 @DebugAssertEnabled()
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %102

82:                                               ; preds = %79
  %83 = load i64, ptr %10, align 8, !tbaa !9
  %84 = icmp slt i64 %83, 0
  br i1 %84, label %85, label %101

85:                                               ; preds = %82
  br label %86

86:                                               ; preds = %85
  %87 = call zeroext i8 @DebugPrintEnabled()
  %88 = icmp ne i8 %87, 0
  br i1 %88, label %89, label %98

89:                                               ; preds = %86
  br label %90

90:                                               ; preds = %89
  %91 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %92 = icmp ne i8 %91, 0
  br i1 %92, label %93, label %95

93:                                               ; preds = %90
  %94 = load i64, ptr %10, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.10, i64 noundef %94)
  br label %95

95:                                               ; preds = %93, %90
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97, %86
  br label %99

99:                                               ; preds = %98
  br label %100

100:                                              ; preds = %99
  call void @DebugAssert(ptr noundef @.str, i64 noundef 989, ptr noundef @.str.11)
  br label %101

101:                                              ; preds = %100, %82
  br label %102

102:                                              ; preds = %101, %79
  br label %103

103:                                              ; preds = %102
  br label %104

104:                                              ; preds = %103
  %105 = load ptr, ptr %11, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %105, i32 0, i32 13
  %107 = load ptr, ptr %106, align 8, !tbaa !25
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %118

109:                                              ; preds = %104
  %110 = load ptr, ptr %13, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %110, i32 0, i32 4
  %112 = load ptr, ptr %111, align 8, !tbaa !26
  %113 = load ptr, ptr %13, align 8, !tbaa !5
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %114, i32 0, i32 13
  %116 = load ptr, ptr %115, align 8, !tbaa !25
  %117 = call i64 %112(ptr noundef %113, ptr noundef %116)
  br label %118

118:                                              ; preds = %109, %104
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %119, i32 0, i32 11
  %121 = load ptr, ptr %120, align 8, !tbaa !28
  %122 = icmp ne ptr %121, null
  br i1 %122, label %123, label %149

123:                                              ; preds = %118
  %124 = load ptr, ptr %13, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %124, i32 0, i32 2
  %126 = load ptr, ptr %125, align 8, !tbaa !29
  %127 = load ptr, ptr %13, align 8, !tbaa !5
  %128 = load ptr, ptr %11, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %128, i32 0, i32 12
  %130 = load i8, ptr %129, align 8, !tbaa !30
  %131 = zext i8 %130 to i64
  %132 = mul i64 %131, 80
  %133 = lshr i64 %132, 12
  %134 = load ptr, ptr %11, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %134, i32 0, i32 12
  %136 = load i8, ptr %135, align 8, !tbaa !30
  %137 = zext i8 %136 to i64
  %138 = mul i64 %137, 80
  %139 = and i64 %138, 4095
  %140 = icmp ne i64 %139, 0
  %141 = zext i1 %140 to i64
  %142 = select i1 %140, i32 1, i32 0
  %143 = sext i32 %142 to i64
  %144 = add i64 %133, %143
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %145, i32 0, i32 11
  %147 = load ptr, ptr %146, align 8, !tbaa !28
  %148 = call i64 %126(ptr noundef %127, i64 noundef %144, ptr noundef %147)
  br label %149

149:                                              ; preds = %123, %118
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %150, i32 0, i32 10
  %152 = load ptr, ptr %151, align 8, !tbaa !31
  %153 = icmp ne ptr %152, null
  br i1 %153, label %154, label %163

154:                                              ; preds = %149
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %155, i32 0, i32 4
  %157 = load ptr, ptr %156, align 8, !tbaa !26
  %158 = load ptr, ptr %13, align 8, !tbaa !5
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %159, i32 0, i32 10
  %161 = load ptr, ptr %160, align 8, !tbaa !31
  %162 = call i64 %157(ptr noundef %158, ptr noundef %161)
  br label %163

163:                                              ; preds = %154, %149
  %164 = load ptr, ptr %11, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %164, i32 0, i32 8
  %166 = load ptr, ptr %165, align 8, !tbaa !32
  %167 = icmp ne ptr %166, null
  br i1 %167, label %168, label %194

168:                                              ; preds = %163
  %169 = load ptr, ptr %13, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %169, i32 0, i32 2
  %171 = load ptr, ptr %170, align 8, !tbaa !29
  %172 = load ptr, ptr %13, align 8, !tbaa !5
  %173 = load ptr, ptr %11, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %173, i32 0, i32 9
  %175 = load i8, ptr %174, align 8, !tbaa !33
  %176 = zext i8 %175 to i64
  %177 = mul i64 %176, 80
  %178 = lshr i64 %177, 12
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %179, i32 0, i32 9
  %181 = load i8, ptr %180, align 8, !tbaa !33
  %182 = zext i8 %181 to i64
  %183 = mul i64 %182, 80
  %184 = and i64 %183, 4095
  %185 = icmp ne i64 %184, 0
  %186 = zext i1 %185 to i64
  %187 = select i1 %185, i32 1, i32 0
  %188 = sext i32 %187 to i64
  %189 = add i64 %178, %188
  %190 = load ptr, ptr %11, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %190, i32 0, i32 8
  %192 = load ptr, ptr %191, align 8, !tbaa !32
  %193 = call i64 %171(ptr noundef %172, i64 noundef %189, ptr noundef %192)
  br label %194

194:                                              ; preds = %168, %163
  %195 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %195)
  %196 = load ptr, ptr @gBS, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %196, i32 0, i32 34
  %198 = load ptr, ptr %197, align 8, !tbaa !34
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %200, i32 0, i32 5
  %202 = load ptr, ptr %201, align 8, !tbaa !15
  %203 = load ptr, ptr %7, align 8, !tbaa !5
  %204 = call i64 %198(ptr noundef %199, ptr noundef @gEdkiiUfsHostControllerProtocolGuid, ptr noundef %202, ptr noundef %203)
  %205 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %205, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %206

206:                                              ; preds = %194, %75, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %207 = load i64, ptr %5, align 8
  ret i64 %207
}

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

declare i64 @UfsControllerStop(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, !14, i64 0}
!18 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !14, i64 0, !6, i64 8, !19, i64 16, !20, i64 32, !6, i64 96, !10, i64 104, !14, i64 112, !7, i64 116, !6, i64 120, !7, i64 128, !6, i64 136, !6, i64 144, !7, i64 152, !6, i64 160, !21, i64 168}
!19 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8}
!20 = !{!"_EFI_EXT_SCSI_PASS_THRU_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!21 = !{!"", !7, i64 0, !22, i64 12, !22, i64 13}
!22 = !{!"short", !7, i64 0}
!23 = !{!18, !6, i64 96}
!24 = !{!12, !6, i64 144}
!25 = !{!18, !6, i64 160}
!26 = !{!27, !6, i64 32}
!27 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!28 = !{!18, !6, i64 144}
!29 = !{!27, !6, i64 16}
!30 = !{!18, !7, i64 152}
!31 = !{!18, !6, i64 136}
!32 = !{!18, !6, i64 120}
!33 = !{!18, !7, i64 128}
!34 = !{!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.GUID = type { i32, i16, i16, [8 x i8] }

@.str = external hidden unnamed_addr constant [151 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@gEfiExtScsiPassThruProtocolGuid = external global %struct.GUID, align 4
@.str.10 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsPassThruDriverBindingStop(ptr nocapture noundef readonly %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef readnone %3) local_unnamed_addr #0 {
  %5 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %10, label %7

7:                                                ; preds = %4
  %8 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not43 = icmp eq i8 %8, 0
  br i1 %.not43, label %10, label %9

9:                                                ; preds = %7
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.12, ptr noundef %1) #3
  br label %10

10:                                               ; preds = %7, %9, %4
  %11 = load ptr, ptr @gBS, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 280
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %0, i64 40
  %15 = load ptr, ptr %14, align 8, !tbaa !14
  %16 = call i64 %13(ptr noundef %1, ptr noundef nonnull @gEfiExtScsiPassThruProtocolGuid, ptr noundef nonnull %5, ptr noundef %15, ptr noundef %1, i32 noundef 2) #3
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %94, label %18

18:                                               ; preds = %10
  %19 = call zeroext i8 @DebugAssertEnabled() #3
  %.not44 = icmp eq i8 %19, 0
  %.pre = load ptr, ptr %5, align 8, !tbaa !5
  %.pre54 = ptrtoint ptr %.pre to i64
  %.pre55 = add i64 %.pre54, -32
  %.pre57 = inttoptr i64 %.pre55 to ptr
  br i1 %.not44, label %._crit_edge, label %20

20:                                               ; preds = %18
  %21 = load i32, ptr %.pre57, align 8, !tbaa !16
  %.not45 = icmp eq i32 %21, 1347634773
  br i1 %.not45, label %._crit_edge, label %22

22:                                               ; preds = %20
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 972, ptr noundef nonnull @.str.1) #3
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %18, %20, %22
  %24 = phi ptr [ %23, %22 ], [ %.pre57, %20 ], [ %.pre57, %18 ]
  %25 = getelementptr inbounds i8, ptr %24, i64 96
  %26 = load ptr, ptr %25, align 8, !tbaa !22
  %27 = load ptr, ptr @gBS, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %27, i64 144
  %29 = load ptr, ptr %28, align 8, !tbaa !23
  %30 = getelementptr inbounds i8, ptr %24, i64 32
  %31 = call i64 %29(ptr noundef %1, ptr noundef nonnull @gEfiExtScsiPassThruProtocolGuid, ptr noundef nonnull %30) #3
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %94, label %33

33:                                               ; preds = %._crit_edge
  %34 = call i64 @UfsControllerStop(ptr noundef nonnull %24) #3
  %35 = call zeroext i8 @DebugAssertEnabled() #3
  %36 = icmp ne i8 %35, 0
  %37 = icmp slt i64 %34, 0
  %or.cond = select i1 %36, i1 %37, i1 false
  br i1 %or.cond, label %38, label %44

38:                                               ; preds = %33
  %39 = call zeroext i8 @DebugPrintEnabled() #3
  %.not46 = icmp eq i8 %39, 0
  br i1 %.not46, label %43, label %40

40:                                               ; preds = %38
  %41 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not47 = icmp eq i8 %41, 0
  br i1 %.not47, label %43, label %42

42:                                               ; preds = %40
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.10, i64 noundef %34) #3
  br label %43

43:                                               ; preds = %40, %42, %38
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 989, ptr noundef nonnull @.str.11) #3
  br label %44

44:                                               ; preds = %43, %33
  %45 = getelementptr inbounds i8, ptr %24, i64 160
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  %.not48 = icmp eq ptr %46, null
  br i1 %.not48, label %51, label %47

47:                                               ; preds = %44
  %48 = getelementptr inbounds i8, ptr %26, i64 32
  %49 = load ptr, ptr %48, align 8, !tbaa !25
  %50 = call i64 %49(ptr noundef %26, ptr noundef nonnull %46) #3
  br label %51

51:                                               ; preds = %47, %44
  %52 = getelementptr inbounds i8, ptr %24, i64 144
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  %.not49 = icmp eq ptr %53, null
  br i1 %.not49, label %66, label %54

54:                                               ; preds = %51
  %55 = getelementptr inbounds i8, ptr %26, i64 16
  %56 = load ptr, ptr %55, align 8, !tbaa !28
  %57 = getelementptr inbounds i8, ptr %24, i64 152
  %58 = load i8, ptr %57, align 8, !tbaa !29
  %59 = zext i8 %58 to i64
  %60 = mul nuw nsw i64 %59, 80
  %61 = lshr i64 %60, 12
  %62 = and i64 %60, 4080
  %.not50 = icmp ne i64 %62, 0
  %63 = zext i1 %.not50 to i64
  %64 = add nuw nsw i64 %61, %63
  %65 = call i64 %56(ptr noundef %26, i64 noundef %64, ptr noundef nonnull %53) #3
  br label %66

66:                                               ; preds = %54, %51
  %67 = getelementptr inbounds i8, ptr %24, i64 136
  %68 = load ptr, ptr %67, align 8, !tbaa !30
  %.not51 = icmp eq ptr %68, null
  br i1 %.not51, label %73, label %69

69:                                               ; preds = %66
  %70 = getelementptr inbounds i8, ptr %26, i64 32
  %71 = load ptr, ptr %70, align 8, !tbaa !25
  %72 = call i64 %71(ptr noundef %26, ptr noundef nonnull %68) #3
  br label %73

73:                                               ; preds = %69, %66
  %74 = getelementptr inbounds i8, ptr %24, i64 120
  %75 = load ptr, ptr %74, align 8, !tbaa !31
  %.not52 = icmp eq ptr %75, null
  br i1 %.not52, label %88, label %76

76:                                               ; preds = %73
  %77 = getelementptr inbounds i8, ptr %26, i64 16
  %78 = load ptr, ptr %77, align 8, !tbaa !28
  %79 = getelementptr inbounds i8, ptr %24, i64 128
  %80 = load i8, ptr %79, align 8, !tbaa !32
  %81 = zext i8 %80 to i64
  %82 = mul nuw nsw i64 %81, 80
  %83 = lshr i64 %82, 12
  %84 = and i64 %82, 4080
  %.not53 = icmp ne i64 %84, 0
  %85 = zext i1 %.not53 to i64
  %86 = add nuw nsw i64 %83, %85
  %87 = call i64 %78(ptr noundef %26, i64 noundef %86, ptr noundef nonnull %75) #3
  br label %88

88:                                               ; preds = %76, %73
  call void @FreePool(ptr noundef nonnull %24) #3
  %89 = load ptr, ptr @gBS, align 8, !tbaa !5
  %90 = getelementptr inbounds i8, ptr %89, i64 288
  %91 = load ptr, ptr %90, align 8, !tbaa !33
  %92 = load ptr, ptr %14, align 8, !tbaa !14
  %93 = call i64 %91(ptr noundef %1, ptr noundef nonnull @gEdkiiUfsHostControllerProtocolGuid, ptr noundef %92, ptr noundef %1) #3
  br label %94

94:                                               ; preds = %._crit_edge, %10, %88
  %.0 = phi i64 [ %34, %88 ], [ -9223372036854775801, %10 ], [ -9223372036854775801, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  ret i64 %.0
}

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

declare i64 @UfsControllerStop(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, !6, i64 280}
!10 = !{!"", !11, 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}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!17, !13, i64 0}
!17 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !13, i64 0, !6, i64 8, !18, i64 16, !19, i64 32, !6, i64 96, !12, i64 104, !13, i64 112, !7, i64 116, !6, i64 120, !7, i64 128, !6, i64 136, !6, i64 144, !7, i64 152, !6, i64 160, !20, i64 168}
!18 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8}
!19 = !{!"_EFI_EXT_SCSI_PASS_THRU_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!20 = !{!"", !7, i64 0, !21, i64 12, !21, i64 13}
!21 = !{!"short", !7, i64 0}
!22 = !{!17, !6, i64 96}
!23 = !{!10, !6, i64 144}
!24 = !{!17, !6, i64 160}
!25 = !{!26, !6, i64 32}
!26 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!27 = !{!17, !6, i64 144}
!28 = !{!26, !6, i64 16}
!29 = !{!17, !7, i64 152}
!30 = !{!17, !6, i64 136}
!31 = !{!17, !6, i64 120}
!32 = !{!17, !7, i64 128}
!33 = !{!10, !6, i64 288}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass