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

; 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.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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.UFS_CONFIG_DESC = type { %struct.UFS_CONFIG_DESC_GEN_HEADER, [8 x %struct.UFS_UNIT_DESC_CONFIG_PARAMS] }
%struct.UFS_CONFIG_DESC_GEN_HEADER = type <{ i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, [5 x i8] }>
%struct.UFS_UNIT_DESC_CONFIG_PARAMS = type <{ i8, i8, i8, i8, i32, i8, i8, i8, i16, [3 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._EDKII_UFS_HOST_CONTROLLER_PROTOCOL = type { ptr, ptr, ptr, ptr, 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.UFS_EXPOSED_LUNS = type { [12 x i8], i16 }

@gUfsPassThruTemplate = external dso_local global { 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, { [12 x i8], i8, i8 } }, align 8
@.str = external hidden unnamed_addr constant [151 x i8], align 1
@gBS = external global ptr, align 8
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@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

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsPassThruDriverBindingStart(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
  %13 = alloca %struct.UFS_CONFIG_DESC, align 1
  %14 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 144, ptr %13) #3
  store i64 0, ptr %8, align 8, !tbaa !9
  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
  br label %15

15:                                               ; preds = %3
  %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 %6, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.2, 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 %6, align 8, !tbaa !5
  %34 = load ptr, ptr %5, 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 %6, align 8, !tbaa !5
  %38 = call i64 %32(ptr noundef %33, ptr noundef @gEdkiiUfsHostControllerProtocolGuid, ptr noundef %9, ptr noundef %36, ptr noundef %37, i32 noundef 16)
  store i64 %38, ptr %8, align 8, !tbaa !9
  %39 = load i64, ptr %8, align 8, !tbaa !9
  %40 = icmp slt i64 %39, 0
  br i1 %40, label %41, label %57

41:                                               ; preds = %29
  br label %42

42:                                               ; preds = %41
  %43 = call zeroext i8 @DebugPrintEnabled()
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %45, label %54

45:                                               ; preds = %42
  br label %46

46:                                               ; preds = %45
  %47 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %48 = icmp ne i8 %47, 0
  br i1 %48, label %49, label %51

49:                                               ; preds = %46
  %50 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.3, i64 noundef %50)
  br label %51

51:                                               ; preds = %49, %46
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53, %42
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  br label %261

57:                                               ; preds = %29
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = call i64 %60(ptr noundef %61, ptr noundef %11)
  store i64 %62, ptr %8, align 8, !tbaa !9
  %63 = load i64, ptr %8, align 8, !tbaa !9
  %64 = icmp slt i64 %63, 0
  br i1 %64, label %65, label %81

65:                                               ; preds = %57
  br label %66

66:                                               ; preds = %65
  %67 = call zeroext i8 @DebugPrintEnabled()
  %68 = icmp ne i8 %67, 0
  br i1 %68, label %69, label %78

69:                                               ; preds = %66
  br label %70

70:                                               ; preds = %69
  %71 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %72 = icmp ne i8 %71, 0
  br i1 %72, label %73, label %75

73:                                               ; preds = %70
  %74 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.4, i64 noundef %74)
  br label %75

75:                                               ; preds = %73, %70
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  br label %78

78:                                               ; preds = %77, %66
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  br label %261

81:                                               ; preds = %57
  %82 = call ptr @AllocateCopyPool(i64 noundef 184, ptr noundef @gUfsPassThruTemplate)
  store ptr %82, ptr %10, align 8, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = icmp eq ptr %83, null
  br i1 %84, label %85, label %86

85:                                               ; preds = %81
  store i64 -9223372036854775799, ptr %8, align 8, !tbaa !9
  br label %261

86:                                               ; preds = %81
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %89, i32 0, i32 3
  %91 = getelementptr inbounds %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, ptr %90, i32 0, i32 0
  store ptr %88, ptr %91, align 8, !tbaa !19
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = load ptr, ptr %10, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %93, i32 0, i32 4
  store ptr %92, ptr %94, align 8, !tbaa !25
  %95 = load i64, ptr %11, align 8, !tbaa !9
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %96, i32 0, i32 5
  store i64 %95, ptr %97, align 8, !tbaa !26
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = call i64 @UfsControllerInit(ptr noundef %98)
  store i64 %99, ptr %8, align 8, !tbaa !9
  %100 = load i64, ptr %8, align 8, !tbaa !9
  %101 = icmp slt i64 %100, 0
  br i1 %101, label %102, label %118

102:                                              ; preds = %86
  br label %103

103:                                              ; preds = %102
  %104 = call zeroext i8 @DebugPrintEnabled()
  %105 = icmp ne i8 %104, 0
  br i1 %105, label %106, label %115

106:                                              ; preds = %103
  br label %107

107:                                              ; preds = %106
  %108 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %109 = icmp ne i8 %108, 0
  br i1 %109, label %110, label %112

110:                                              ; preds = %107
  %111 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.5, i64 noundef %111)
  br label %112

112:                                              ; preds = %110, %107
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114, %103
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  br label %261

118:                                              ; preds = %86
  %119 = load ptr, ptr %10, align 8, !tbaa !5
  %120 = call i64 @UfsExecNopCmds(ptr noundef %119)
  store i64 %120, ptr %8, align 8, !tbaa !9
  %121 = load i64, ptr %8, align 8, !tbaa !9
  %122 = icmp slt i64 %121, 0
  br i1 %122, label %123, label %139

123:                                              ; preds = %118
  br label %124

124:                                              ; preds = %123
  %125 = call zeroext i8 @DebugPrintEnabled()
  %126 = icmp ne i8 %125, 0
  br i1 %126, label %127, label %136

127:                                              ; preds = %124
  br label %128

128:                                              ; preds = %127
  %129 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %130 = icmp ne i8 %129, 0
  br i1 %130, label %131, label %133

131:                                              ; preds = %128
  %132 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.6, i64 noundef %132)
  br label %133

133:                                              ; preds = %131, %128
  br label %134

134:                                              ; preds = %133
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135, %124
  br label %137

137:                                              ; preds = %136
  br label %138

138:                                              ; preds = %137
  br label %261

139:                                              ; preds = %118
  %140 = load ptr, ptr %10, align 8, !tbaa !5
  %141 = call i64 @UfsSetFlag(ptr noundef %140, i8 noundef zeroext 1)
  store i64 %141, ptr %8, align 8, !tbaa !9
  %142 = load i64, ptr %8, align 8, !tbaa !9
  %143 = icmp slt i64 %142, 0
  br i1 %143, label %144, label %160

144:                                              ; preds = %139
  br label %145

145:                                              ; preds = %144
  %146 = call zeroext i8 @DebugPrintEnabled()
  %147 = icmp ne i8 %146, 0
  br i1 %147, label %148, label %157

148:                                              ; preds = %145
  br label %149

149:                                              ; preds = %148
  %150 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %151 = icmp ne i8 %150, 0
  br i1 %151, label %152, label %154

152:                                              ; preds = %149
  %153 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.7, i64 noundef %153)
  br label %154

154:                                              ; preds = %152, %149
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156, %145
  br label %158

158:                                              ; preds = %157
  br label %159

159:                                              ; preds = %158
  br label %261

160:                                              ; preds = %139
  %161 = load ptr, ptr %10, align 8, !tbaa !5
  %162 = call i64 @UfsRwDeviceDesc(ptr noundef %161, i8 noundef zeroext 1, i8 noundef zeroext 1, i8 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef %13, i32 noundef 144)
  store i64 %162, ptr %8, align 8, !tbaa !9
  %163 = load i64, ptr %8, align 8, !tbaa !9
  %164 = icmp slt i64 %163, 0
  br i1 %164, label %165, label %181

165:                                              ; preds = %160
  br label %166

166:                                              ; preds = %165
  %167 = call zeroext i8 @DebugPrintEnabled()
  %168 = icmp ne i8 %167, 0
  br i1 %168, label %169, label %178

169:                                              ; preds = %166
  br label %170

170:                                              ; preds = %169
  %171 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %172 = icmp ne i8 %171, 0
  br i1 %172, label %173, label %175

173:                                              ; preds = %170
  %174 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.8, i64 noundef %174)
  br label %175

175:                                              ; preds = %173, %170
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177, %166
  br label %179

179:                                              ; preds = %178
  br label %180

180:                                              ; preds = %179
  br label %261

181:                                              ; preds = %160
  store i32 0, ptr %12, align 4, !tbaa !27
  br label %182

182:                                              ; preds = %225, %181
  %183 = load i32, ptr %12, align 4, !tbaa !27
  %184 = icmp ult i32 %183, 8
  br i1 %184, label %185, label %228

185:                                              ; preds = %182
  %186 = getelementptr inbounds %struct.UFS_CONFIG_DESC, ptr %13, i32 0, i32 1
  %187 = load i32, ptr %12, align 4, !tbaa !27
  %188 = zext i32 %187 to i64
  %189 = getelementptr inbounds [8 x %struct.UFS_UNIT_DESC_CONFIG_PARAMS], ptr %186, i64 0, i64 %188
  %190 = getelementptr inbounds %struct.UFS_UNIT_DESC_CONFIG_PARAMS, ptr %189, i32 0, i32 0
  %191 = load i8, ptr %190, align 1, !tbaa !28
  %192 = zext i8 %191 to i32
  %193 = icmp ne i32 %192, 0
  br i1 %193, label %194, label %224

194:                                              ; preds = %185
  %195 = load i32, ptr %12, align 4, !tbaa !27
  %196 = shl i32 1, %195
  %197 = load ptr, ptr %10, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %197, i32 0, i32 14
  %199 = getelementptr inbounds %struct.UFS_EXPOSED_LUNS, ptr %198, i32 0, i32 1
  %200 = load i16, ptr %199, align 4
  %201 = and i16 %200, 4095
  %202 = zext i16 %201 to i32
  %203 = or i32 %202, %196
  %204 = trunc i32 %203 to i16
  %205 = load i16, ptr %199, align 4
  %206 = and i16 %204, 4095
  %207 = and i16 %205, -4096
  %208 = or i16 %207, %206
  store i16 %208, ptr %199, align 4
  br label %209

209:                                              ; preds = %194
  %210 = call zeroext i8 @DebugPrintEnabled()
  %211 = icmp ne i8 %210, 0
  br i1 %211, label %212, label %221

212:                                              ; preds = %209
  br label %213

213:                                              ; preds = %212
  %214 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %215 = icmp ne i8 %214, 0
  br i1 %215, label %216, label %218

216:                                              ; preds = %213
  %217 = load i32, ptr %12, align 4, !tbaa !27
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.9, i32 noundef %217)
  br label %218

218:                                              ; preds = %216, %213
  br label %219

219:                                              ; preds = %218
  br label %220

220:                                              ; preds = %219
  br label %221

221:                                              ; preds = %220, %209
  br label %222

222:                                              ; preds = %221
  br label %223

223:                                              ; preds = %222
  br label %224

224:                                              ; preds = %223, %185
  br label %225

225:                                              ; preds = %224
  %226 = load i32, ptr %12, align 4, !tbaa !27
  %227 = add i32 %226, 1
  store i32 %227, ptr %12, align 4, !tbaa !27
  br label %182, !llvm.loop !30

228:                                              ; preds = %182
  %229 = load ptr, ptr @gBS, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %229, i32 0, i32 14
  %231 = load ptr, ptr %230, align 8, !tbaa !32
  %232 = load ptr, ptr %10, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %232, i32 0, i32 3
  %234 = call i64 %231(ptr noundef %6, ptr noundef @gEfiExtScsiPassThruProtocolGuid, i32 noundef 0, ptr noundef %233)
  store i64 %234, ptr %8, align 8, !tbaa !9
  br label %235

235:                                              ; preds = %228
  %236 = call zeroext i8 @DebugAssertEnabled()
  %237 = icmp ne i8 %236, 0
  br i1 %237, label %238, label %258

238:                                              ; preds = %235
  %239 = load i64, ptr %8, align 8, !tbaa !9
  %240 = icmp slt i64 %239, 0
  br i1 %240, label %241, label %257

241:                                              ; preds = %238
  br label %242

242:                                              ; preds = %241
  %243 = call zeroext i8 @DebugPrintEnabled()
  %244 = icmp ne i8 %243, 0
  br i1 %244, label %245, label %254

245:                                              ; preds = %242
  br label %246

246:                                              ; preds = %245
  %247 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %248 = icmp ne i8 %247, 0
  br i1 %248, label %249, label %251

249:                                              ; preds = %246
  %250 = load i64, ptr %8, align 8, !tbaa !9
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.10, i64 noundef %250)
  br label %251

251:                                              ; preds = %249, %246
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252
  br label %254

254:                                              ; preds = %253, %242
  br label %255

255:                                              ; preds = %254
  br label %256

256:                                              ; preds = %255
  call void @DebugAssert(ptr noundef @.str, i64 noundef 882, ptr noundef @.str.11)
  br label %257

257:                                              ; preds = %256, %238
  br label %258

258:                                              ; preds = %257, %235
  br label %259

259:                                              ; preds = %258
  br label %260

260:                                              ; preds = %259
  store i64 0, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %371

261:                                              ; preds = %180, %159, %138, %117, %85, %80, %56
  %262 = load ptr, ptr %10, align 8, !tbaa !5
  %263 = icmp ne ptr %262, null
  br i1 %263, label %264, label %356

264:                                              ; preds = %261
  %265 = load ptr, ptr %10, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %265, i32 0, i32 13
  %267 = load ptr, ptr %266, align 8, !tbaa !33
  %268 = icmp ne ptr %267, null
  br i1 %268, label %269, label %278

269:                                              ; preds = %264
  %270 = load ptr, ptr %9, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %270, i32 0, i32 4
  %272 = load ptr, ptr %271, align 8, !tbaa !34
  %273 = load ptr, ptr %9, align 8, !tbaa !5
  %274 = load ptr, ptr %10, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %274, i32 0, i32 13
  %276 = load ptr, ptr %275, align 8, !tbaa !33
  %277 = call i64 %272(ptr noundef %273, ptr noundef %276)
  br label %278

278:                                              ; preds = %269, %264
  %279 = load ptr, ptr %10, align 8, !tbaa !5
  %280 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %279, i32 0, i32 11
  %281 = load ptr, ptr %280, align 8, !tbaa !35
  %282 = icmp ne ptr %281, null
  br i1 %282, label %283, label %309

283:                                              ; preds = %278
  %284 = load ptr, ptr %9, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %284, i32 0, i32 2
  %286 = load ptr, ptr %285, align 8, !tbaa !36
  %287 = load ptr, ptr %9, align 8, !tbaa !5
  %288 = load ptr, ptr %10, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %288, i32 0, i32 12
  %290 = load i8, ptr %289, align 8, !tbaa !37
  %291 = zext i8 %290 to i64
  %292 = mul i64 %291, 80
  %293 = lshr i64 %292, 12
  %294 = load ptr, ptr %10, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %294, i32 0, i32 12
  %296 = load i8, ptr %295, align 8, !tbaa !37
  %297 = zext i8 %296 to i64
  %298 = mul i64 %297, 80
  %299 = and i64 %298, 4095
  %300 = icmp ne i64 %299, 0
  %301 = zext i1 %300 to i64
  %302 = select i1 %300, i32 1, i32 0
  %303 = sext i32 %302 to i64
  %304 = add i64 %293, %303
  %305 = load ptr, ptr %10, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %305, i32 0, i32 11
  %307 = load ptr, ptr %306, align 8, !tbaa !35
  %308 = call i64 %286(ptr noundef %287, i64 noundef %304, ptr noundef %307)
  br label %309

309:                                              ; preds = %283, %278
  %310 = load ptr, ptr %10, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %310, i32 0, i32 10
  %312 = load ptr, ptr %311, align 8, !tbaa !38
  %313 = icmp ne ptr %312, null
  br i1 %313, label %314, label %323

314:                                              ; preds = %309
  %315 = load ptr, ptr %9, align 8, !tbaa !5
  %316 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %315, i32 0, i32 4
  %317 = load ptr, ptr %316, align 8, !tbaa !34
  %318 = load ptr, ptr %9, align 8, !tbaa !5
  %319 = load ptr, ptr %10, align 8, !tbaa !5
  %320 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %319, i32 0, i32 10
  %321 = load ptr, ptr %320, align 8, !tbaa !38
  %322 = call i64 %317(ptr noundef %318, ptr noundef %321)
  br label %323

323:                                              ; preds = %314, %309
  %324 = load ptr, ptr %10, align 8, !tbaa !5
  %325 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %324, i32 0, i32 8
  %326 = load ptr, ptr %325, align 8, !tbaa !39
  %327 = icmp ne ptr %326, null
  br i1 %327, label %328, label %354

328:                                              ; preds = %323
  %329 = load ptr, ptr %9, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %329, i32 0, i32 2
  %331 = load ptr, ptr %330, align 8, !tbaa !36
  %332 = load ptr, ptr %9, align 8, !tbaa !5
  %333 = load ptr, ptr %10, align 8, !tbaa !5
  %334 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %333, i32 0, i32 9
  %335 = load i8, ptr %334, align 8, !tbaa !40
  %336 = zext i8 %335 to i64
  %337 = mul i64 %336, 80
  %338 = lshr i64 %337, 12
  %339 = load ptr, ptr %10, align 8, !tbaa !5
  %340 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %339, i32 0, i32 9
  %341 = load i8, ptr %340, align 8, !tbaa !40
  %342 = zext i8 %341 to i64
  %343 = mul i64 %342, 80
  %344 = and i64 %343, 4095
  %345 = icmp ne i64 %344, 0
  %346 = zext i1 %345 to i64
  %347 = select i1 %345, i32 1, i32 0
  %348 = sext i32 %347 to i64
  %349 = add i64 %338, %348
  %350 = load ptr, ptr %10, align 8, !tbaa !5
  %351 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %350, i32 0, i32 8
  %352 = load ptr, ptr %351, align 8, !tbaa !39
  %353 = call i64 %331(ptr noundef %332, i64 noundef %349, ptr noundef %352)
  br label %354

354:                                              ; preds = %328, %323
  %355 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %355)
  br label %356

356:                                              ; preds = %354, %261
  %357 = load ptr, ptr %9, align 8, !tbaa !5
  %358 = icmp ne ptr %357, null
  br i1 %358, label %359, label %369

359:                                              ; preds = %356
  %360 = load ptr, ptr @gBS, align 8, !tbaa !5
  %361 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %360, i32 0, i32 34
  %362 = load ptr, ptr %361, align 8, !tbaa !41
  %363 = load ptr, ptr %6, align 8, !tbaa !5
  %364 = load ptr, ptr %5, align 8, !tbaa !5
  %365 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %364, i32 0, i32 5
  %366 = load ptr, ptr %365, align 8, !tbaa !15
  %367 = load ptr, ptr %6, align 8, !tbaa !5
  %368 = call i64 %362(ptr noundef %363, ptr noundef @gEdkiiUfsHostControllerProtocolGuid, ptr noundef %366, ptr noundef %367)
  br label %369

369:                                              ; preds = %359, %356
  %370 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %370, ptr %4, align 8
  store i32 1, ptr %14, align 4
  br label %371

371:                                              ; preds = %369, %260
  call void @llvm.lifetime.end.p0(i64 144, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %372 = load i64, ptr %4, align 8
  ret i64 %372
}

; 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 i64 @UfsControllerInit(ptr noundef) #2

declare i64 @UfsExecNopCmds(ptr noundef) #2

declare i64 @UfsSetFlag(ptr noundef, i8 noundef zeroext) #2

declare i64 @UfsRwDeviceDesc(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, i32 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 0}
!18 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!20, !6, i64 32}
!20 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !14, i64 0, !6, i64 8, !21, i64 16, !22, 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, !23, i64 168}
!21 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8}
!22 = !{!"_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}
!23 = !{!"", !7, i64 0, !24, i64 12, !24, i64 13}
!24 = !{!"short", !7, i64 0}
!25 = !{!20, !6, i64 96}
!26 = !{!20, !10, i64 104}
!27 = !{!14, !14, i64 0}
!28 = !{!29, !7, i64 0}
!29 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !14, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !24, i64 11, !7, i64 13}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!12, !6, i64 128}
!33 = !{!20, !6, i64 160}
!34 = !{!18, !6, i64 32}
!35 = !{!20, !6, i64 144}
!36 = !{!18, !6, i64 16}
!37 = !{!20, !7, i64 152}
!38 = !{!20, !6, i64 136}
!39 = !{!20, !6, i64 120}
!40 = !{!20, !7, i64 128}
!41 = !{!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.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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.UFS_CONFIG_DESC = type { %struct.UFS_CONFIG_DESC_GEN_HEADER, [8 x %struct.UFS_UNIT_DESC_CONFIG_PARAMS] }
%struct.UFS_CONFIG_DESC_GEN_HEADER = type <{ i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, [5 x i8] }>
%struct.UFS_UNIT_DESC_CONFIG_PARAMS = type <{ i8, i8, i8, i8, i32, i8, i8, i8, i16, [3 x i8] }>

@gUfsPassThruTemplate = external dso_local global { 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, { [12 x i8], i8, i8 } }, align 8
@.str = external hidden unnamed_addr constant [151 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEdkiiUfsHostControllerProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [45 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [23 x i8], align 1
@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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @UfsPassThruDriverBindingStart(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
  %7 = alloca %struct.UFS_CONFIG_DESC, align 1
  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
  call void @llvm.lifetime.start.p0(i64 144, ptr nonnull %7) #3
  store ptr null, ptr %5, align 8, !tbaa !5
  store i64 0, ptr %6, align 8, !tbaa !9
  %8 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %8, 0
  br i1 %.not, label %12, label %9

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

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

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

20:                                               ; preds = %12
  %21 = call zeroext i8 @DebugPrintEnabled() #3
  %.not79 = icmp eq i8 %21, 0
  br i1 %.not79, label %219, label %22

22:                                               ; preds = %20
  %23 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not80 = icmp eq i8 %23, 0
  br i1 %.not80, label %219, label %24

24:                                               ; preds = %22
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.3, i64 noundef %18) #3
  br label %219

25:                                               ; preds = %12
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = load ptr, ptr %26, align 8, !tbaa !17
  %28 = call i64 %27(ptr noundef nonnull %26, ptr noundef nonnull %6) #3
  %29 = icmp slt i64 %28, 0
  br i1 %29, label %30, label %35

30:                                               ; preds = %25
  %31 = call zeroext i8 @DebugPrintEnabled() #3
  %.not77 = icmp eq i8 %31, 0
  br i1 %.not77, label %219, label %32

32:                                               ; preds = %30
  %33 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not78 = icmp eq i8 %33, 0
  br i1 %.not78, label %219, label %34

34:                                               ; preds = %32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.4, i64 noundef %28) #3
  br label %219

35:                                               ; preds = %25
  %36 = call ptr @AllocateCopyPool(i64 noundef 184, ptr noundef nonnull @gUfsPassThruTemplate) #3
  %37 = icmp eq ptr %36, null
  br i1 %37, label %219, label %38

38:                                               ; preds = %35
  %39 = getelementptr inbounds i8, ptr %36, i64 16
  %40 = getelementptr inbounds i8, ptr %36, i64 32
  store ptr %39, ptr %40, align 8, !tbaa !19
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %36, i64 96
  store ptr %41, ptr %42, align 8, !tbaa !25
  %43 = load i64, ptr %6, align 8, !tbaa !9
  %44 = getelementptr inbounds i8, ptr %36, i64 104
  store i64 %43, ptr %44, align 8, !tbaa !26
  %45 = call i64 @UfsControllerInit(ptr noundef nonnull %36) #3
  %46 = icmp slt i64 %45, 0
  br i1 %46, label %47, label %52

47:                                               ; preds = %38
  %48 = call zeroext i8 @DebugPrintEnabled() #3
  %.not75 = icmp eq i8 %48, 0
  br i1 %.not75, label %170, label %49

49:                                               ; preds = %47
  %50 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not76 = icmp eq i8 %50, 0
  br i1 %.not76, label %170, label %51

51:                                               ; preds = %49
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.5, i64 noundef %45) #3
  br label %170

52:                                               ; preds = %38
  %53 = call i64 @UfsExecNopCmds(ptr noundef nonnull %36) #3
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %52
  %56 = call zeroext i8 @DebugPrintEnabled() #3
  %.not73 = icmp eq i8 %56, 0
  br i1 %.not73, label %170, label %57

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

59:                                               ; preds = %57
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.6, i64 noundef %53) #3
  br label %170

60:                                               ; preds = %52
  %61 = call i64 @UfsSetFlag(ptr noundef nonnull %36, i8 noundef zeroext 1) #3
  %62 = icmp slt i64 %61, 0
  br i1 %62, label %63, label %68

63:                                               ; preds = %60
  %64 = call zeroext i8 @DebugPrintEnabled() #3
  %.not71 = icmp eq i8 %64, 0
  br i1 %.not71, label %170, label %65

65:                                               ; preds = %63
  %66 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not72 = icmp eq i8 %66, 0
  br i1 %.not72, label %170, label %67

67:                                               ; preds = %65
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.7, i64 noundef %61) #3
  br label %170

68:                                               ; preds = %60
  %69 = call i64 @UfsRwDeviceDesc(ptr noundef nonnull %36, i8 noundef zeroext 1, i8 noundef zeroext 1, i8 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef nonnull %7, i32 noundef 144) #3
  %70 = icmp slt i64 %69, 0
  br i1 %70, label %74, label %.preheader

.preheader:                                       ; preds = %68
  %71 = getelementptr inbounds i8, ptr %7, i64 16
  %72 = getelementptr inbounds i8, ptr %36, i64 180
  %73 = load i8, ptr %71, align 1, !tbaa !27
  %.not66 = icmp eq i8 %73, 0
  br i1 %.not66, label %86, label %79

74:                                               ; preds = %68
  %75 = call zeroext i8 @DebugPrintEnabled() #3
  %.not69 = icmp eq i8 %75, 0
  br i1 %.not69, label %170, label %76

76:                                               ; preds = %74
  %77 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not70 = icmp eq i8 %77, 0
  br i1 %.not70, label %170, label %78

78:                                               ; preds = %76
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.8, i64 noundef %69) #3
  br label %170

79:                                               ; preds = %.preheader
  %80 = load i16, ptr %72, align 4
  %81 = or i16 %80, 1
  store i16 %81, ptr %72, align 4
  %82 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67 = icmp eq i8 %82, 0
  br i1 %.not67, label %86, label %83

83:                                               ; preds = %79
  %84 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68 = icmp eq i8 %84, 0
  br i1 %.not68, label %86, label %85

85:                                               ; preds = %83
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 0) #3
  br label %86

86:                                               ; preds = %.preheader, %83, %85, %79
  %87 = getelementptr inbounds i8, ptr %7, i64 32
  %88 = load i8, ptr %87, align 1, !tbaa !27
  %.not66.1 = icmp eq i8 %88, 0
  br i1 %.not66.1, label %96, label %89

89:                                               ; preds = %86
  %90 = load i16, ptr %72, align 4
  %91 = or i16 %90, 2
  store i16 %91, ptr %72, align 4
  %92 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.1 = icmp eq i8 %92, 0
  br i1 %.not67.1, label %96, label %93

93:                                               ; preds = %89
  %94 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.1 = icmp eq i8 %94, 0
  br i1 %.not68.1, label %96, label %95

95:                                               ; preds = %93
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 1) #3
  br label %96

96:                                               ; preds = %95, %93, %89, %86
  %97 = getelementptr inbounds i8, ptr %7, i64 48
  %98 = load i8, ptr %97, align 1, !tbaa !27
  %.not66.2 = icmp eq i8 %98, 0
  br i1 %.not66.2, label %106, label %99

99:                                               ; preds = %96
  %100 = load i16, ptr %72, align 4
  %101 = or i16 %100, 4
  store i16 %101, ptr %72, align 4
  %102 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.2 = icmp eq i8 %102, 0
  br i1 %.not67.2, label %106, label %103

103:                                              ; preds = %99
  %104 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.2 = icmp eq i8 %104, 0
  br i1 %.not68.2, label %106, label %105

105:                                              ; preds = %103
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 2) #3
  br label %106

106:                                              ; preds = %105, %103, %99, %96
  %107 = getelementptr inbounds i8, ptr %7, i64 64
  %108 = load i8, ptr %107, align 1, !tbaa !27
  %.not66.3 = icmp eq i8 %108, 0
  br i1 %.not66.3, label %116, label %109

109:                                              ; preds = %106
  %110 = load i16, ptr %72, align 4
  %111 = or i16 %110, 8
  store i16 %111, ptr %72, align 4
  %112 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.3 = icmp eq i8 %112, 0
  br i1 %.not67.3, label %116, label %113

113:                                              ; preds = %109
  %114 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.3 = icmp eq i8 %114, 0
  br i1 %.not68.3, label %116, label %115

115:                                              ; preds = %113
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 3) #3
  br label %116

116:                                              ; preds = %115, %113, %109, %106
  %117 = getelementptr inbounds i8, ptr %7, i64 80
  %118 = load i8, ptr %117, align 1, !tbaa !27
  %.not66.4 = icmp eq i8 %118, 0
  br i1 %.not66.4, label %126, label %119

119:                                              ; preds = %116
  %120 = load i16, ptr %72, align 4
  %121 = or i16 %120, 16
  store i16 %121, ptr %72, align 4
  %122 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.4 = icmp eq i8 %122, 0
  br i1 %.not67.4, label %126, label %123

123:                                              ; preds = %119
  %124 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.4 = icmp eq i8 %124, 0
  br i1 %.not68.4, label %126, label %125

125:                                              ; preds = %123
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 4) #3
  br label %126

126:                                              ; preds = %125, %123, %119, %116
  %127 = getelementptr inbounds i8, ptr %7, i64 96
  %128 = load i8, ptr %127, align 1, !tbaa !27
  %.not66.5 = icmp eq i8 %128, 0
  br i1 %.not66.5, label %136, label %129

129:                                              ; preds = %126
  %130 = load i16, ptr %72, align 4
  %131 = or i16 %130, 32
  store i16 %131, ptr %72, align 4
  %132 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.5 = icmp eq i8 %132, 0
  br i1 %.not67.5, label %136, label %133

133:                                              ; preds = %129
  %134 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.5 = icmp eq i8 %134, 0
  br i1 %.not68.5, label %136, label %135

135:                                              ; preds = %133
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 5) #3
  br label %136

136:                                              ; preds = %135, %133, %129, %126
  %137 = getelementptr inbounds i8, ptr %7, i64 112
  %138 = load i8, ptr %137, align 1, !tbaa !27
  %.not66.6 = icmp eq i8 %138, 0
  br i1 %.not66.6, label %146, label %139

139:                                              ; preds = %136
  %140 = load i16, ptr %72, align 4
  %141 = or i16 %140, 64
  store i16 %141, ptr %72, align 4
  %142 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.6 = icmp eq i8 %142, 0
  br i1 %.not67.6, label %146, label %143

143:                                              ; preds = %139
  %144 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.6 = icmp eq i8 %144, 0
  br i1 %.not68.6, label %146, label %145

145:                                              ; preds = %143
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 6) #3
  br label %146

146:                                              ; preds = %145, %143, %139, %136
  %147 = getelementptr inbounds i8, ptr %7, i64 128
  %148 = load i8, ptr %147, align 1, !tbaa !27
  %.not66.7 = icmp eq i8 %148, 0
  br i1 %.not66.7, label %156, label %149

149:                                              ; preds = %146
  %150 = load i16, ptr %72, align 4
  %151 = or i16 %150, 128
  store i16 %151, ptr %72, align 4
  %152 = call zeroext i8 @DebugPrintEnabled() #3
  %.not67.7 = icmp eq i8 %152, 0
  br i1 %.not67.7, label %156, label %153

153:                                              ; preds = %149
  %154 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not68.7 = icmp eq i8 %154, 0
  br i1 %.not68.7, label %156, label %155

155:                                              ; preds = %153
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i32 noundef 7) #3
  br label %156

156:                                              ; preds = %155, %153, %149, %146
  %157 = load ptr, ptr @gBS, align 8, !tbaa !5
  %158 = getelementptr inbounds i8, ptr %157, i64 128
  %159 = load ptr, ptr %158, align 8, !tbaa !29
  %160 = call i64 %159(ptr noundef nonnull %4, ptr noundef nonnull @gEfiExtScsiPassThruProtocolGuid, i32 noundef 0, ptr noundef nonnull %40) #3
  %161 = call zeroext i8 @DebugAssertEnabled() #3
  %162 = icmp ne i8 %161, 0
  %163 = icmp slt i64 %160, 0
  %or.cond = select i1 %162, i1 %163, i1 false
  br i1 %or.cond, label %164, label %227

164:                                              ; preds = %156
  %165 = call zeroext i8 @DebugPrintEnabled() #3
  %.not64 = icmp eq i8 %165, 0
  br i1 %.not64, label %169, label %166

166:                                              ; preds = %164
  %167 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not65 = icmp eq i8 %167, 0
  br i1 %.not65, label %169, label %168

168:                                              ; preds = %166
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.10, i64 noundef %160) #3
  br label %169

169:                                              ; preds = %166, %168, %164
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 882, ptr noundef nonnull @.str.11) #3
  br label %227

170:                                              ; preds = %51, %49, %47, %59, %57, %55, %67, %65, %63, %78, %76, %74
  %.049.ph = phi i64 [ %69, %74 ], [ %69, %76 ], [ %69, %78 ], [ %61, %63 ], [ %61, %65 ], [ %61, %67 ], [ %53, %55 ], [ %53, %57 ], [ %53, %59 ], [ %45, %47 ], [ %45, %49 ], [ %45, %51 ]
  %171 = getelementptr inbounds i8, ptr %36, i64 160
  %172 = load ptr, ptr %171, align 8, !tbaa !30
  %.not82 = icmp eq ptr %172, null
  br i1 %.not82, label %178, label %173

173:                                              ; preds = %170
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = getelementptr inbounds i8, ptr %174, i64 32
  %176 = load ptr, ptr %175, align 8, !tbaa !31
  %177 = call i64 %176(ptr noundef %174, ptr noundef nonnull %172) #3
  br label %178

178:                                              ; preds = %173, %170
  %179 = getelementptr inbounds i8, ptr %36, i64 144
  %180 = load ptr, ptr %179, align 8, !tbaa !32
  %.not83 = icmp eq ptr %180, null
  br i1 %.not83, label %194, label %181

181:                                              ; preds = %178
  %182 = load ptr, ptr %5, align 8, !tbaa !5
  %183 = getelementptr inbounds i8, ptr %182, i64 16
  %184 = load ptr, ptr %183, align 8, !tbaa !33
  %185 = getelementptr inbounds i8, ptr %36, i64 152
  %186 = load i8, ptr %185, align 8, !tbaa !34
  %187 = zext i8 %186 to i64
  %188 = mul nuw nsw i64 %187, 80
  %189 = lshr i64 %188, 12
  %190 = and i64 %188, 4080
  %.not84 = icmp ne i64 %190, 0
  %191 = zext i1 %.not84 to i64
  %192 = add nuw nsw i64 %189, %191
  %193 = call i64 %184(ptr noundef %182, i64 noundef %192, ptr noundef nonnull %180) #3
  br label %194

194:                                              ; preds = %181, %178
  %195 = getelementptr inbounds i8, ptr %36, i64 136
  %196 = load ptr, ptr %195, align 8, !tbaa !35
  %.not85 = icmp eq ptr %196, null
  br i1 %.not85, label %202, label %197

197:                                              ; preds = %194
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds i8, ptr %198, i64 32
  %200 = load ptr, ptr %199, align 8, !tbaa !31
  %201 = call i64 %200(ptr noundef %198, ptr noundef nonnull %196) #3
  br label %202

202:                                              ; preds = %197, %194
  %203 = getelementptr inbounds i8, ptr %36, i64 120
  %204 = load ptr, ptr %203, align 8, !tbaa !36
  %.not86 = icmp eq ptr %204, null
  br i1 %.not86, label %218, label %205

205:                                              ; preds = %202
  %206 = load ptr, ptr %5, align 8, !tbaa !5
  %207 = getelementptr inbounds i8, ptr %206, i64 16
  %208 = load ptr, ptr %207, align 8, !tbaa !33
  %209 = getelementptr inbounds i8, ptr %36, i64 128
  %210 = load i8, ptr %209, align 8, !tbaa !37
  %211 = zext i8 %210 to i64
  %212 = mul nuw nsw i64 %211, 80
  %213 = lshr i64 %212, 12
  %214 = and i64 %212, 4080
  %.not87 = icmp ne i64 %214, 0
  %215 = zext i1 %.not87 to i64
  %216 = add nuw nsw i64 %213, %215
  %217 = call i64 %208(ptr noundef %206, i64 noundef %216, ptr noundef nonnull %204) #3
  br label %218

218:                                              ; preds = %205, %202
  call void @FreePool(ptr noundef nonnull %36) #3
  br label %219

219:                                              ; preds = %22, %24, %20, %32, %34, %30, %35, %218
  %.04993 = phi i64 [ %.049.ph, %218 ], [ %18, %24 ], [ %18, %22 ], [ %18, %20 ], [ %28, %34 ], [ %28, %32 ], [ %28, %30 ], [ -9223372036854775799, %35 ]
  %220 = load ptr, ptr %5, align 8, !tbaa !5
  %.not88 = icmp eq ptr %220, null
  br i1 %.not88, label %227, label %221

221:                                              ; preds = %219
  %222 = load ptr, ptr @gBS, align 8, !tbaa !5
  %223 = getelementptr inbounds i8, ptr %222, i64 288
  %224 = load ptr, ptr %223, align 8, !tbaa !38
  %225 = load ptr, ptr %16, align 8, !tbaa !15
  %226 = call i64 %224(ptr noundef %1, ptr noundef nonnull @gEdkiiUfsHostControllerProtocolGuid, ptr noundef %225, ptr noundef %1) #3
  br label %227

227:                                              ; preds = %219, %221, %156, %169
  %.050 = phi i64 [ 0, %169 ], [ 0, %156 ], [ %.04993, %221 ], [ %.04993, %219 ]
  call void @llvm.lifetime.end.p0(i64 144, ptr nonnull %7) #3
  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 %.050
}

; 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 i64 @UfsControllerInit(ptr noundef) local_unnamed_addr #2

declare i64 @UfsExecNopCmds(ptr noundef) local_unnamed_addr #2

declare i64 @UfsSetFlag(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

declare i64 @UfsRwDeviceDesc(ptr noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext, ptr noundef, i32 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 0}
!18 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!20, !6, i64 32}
!20 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !14, i64 0, !6, i64 8, !21, i64 16, !22, 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, !23, i64 168}
!21 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8}
!22 = !{!"_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}
!23 = !{!"", !7, i64 0, !24, i64 12, !24, i64 13}
!24 = !{!"short", !7, i64 0}
!25 = !{!20, !6, i64 96}
!26 = !{!20, !10, i64 104}
!27 = !{!28, !7, i64 0}
!28 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !14, i64 4, !7, i64 8, !7, i64 9, !7, i64 10, !24, i64 11, !7, i64 13}
!29 = !{!12, !6, i64 128}
!30 = !{!20, !6, i64 160}
!31 = !{!18, !6, i64 32}
!32 = !{!20, !6, i64 144}
!33 = !{!18, !6, i64 16}
!34 = !{!20, !7, i64 152}
!35 = !{!20, !6, i64 136}
!36 = !{!20, !6, i64 120}
!37 = !{!20, !7, i64 128}
!38 = !{!12, !6, i64 288}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass