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

; 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_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.UTP_TRD = type { i32, i32, i32, i32, i32, i32, i16, i16, i16, i16 }
%struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET = type { i64, ptr, ptr, ptr, ptr, i32, i32, i8, i8, i8, i8, i8 }
%struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.UTP_RESPONSE_UPIU = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i16, i32, [16 x i8], i16, [18 x i8] }

@.str.10 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsWaitMemSet(i64 noundef, i32 noundef, i32 noundef, i64 noundef) #0

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

; 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 zeroext i8 @DebugAssertEnabled() #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @SwapLittleEndianToBigEndian(ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsInitUtpPrdt(ptr noundef, ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsCreateScsiCommandDesc(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsFindAvailableSlotInTrl(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @UfsStartExecCmd(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
declare dso_local void @UfsStopExecCmd(ptr noundef, i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @UfsExecScsiCmds(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i16, align 2
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i64, align 8
  %21 = alloca i32, align 4
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  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 1, 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 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  store ptr null, ptr %16, align 8, !tbaa !5
  store ptr null, ptr %17, align 8, !tbaa !5
  store ptr null, ptr %18, align 8, !tbaa !5
  store i64 0, ptr %20, align 8, !tbaa !10
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %28, i32 0, i32 4
  %30 = load ptr, ptr %29, align 8, !tbaa !12
  store ptr %30, ptr %23, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = call i64 @UfsFindAvailableSlotInTrl(ptr noundef %31, ptr noundef %9)
  store i64 %32, ptr %8, align 8, !tbaa !10
  %33 = load i64, ptr %8, align 8, !tbaa !10
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %3
  %36 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %36, ptr %4, align 8
  store i32 1, ptr %27, align 4
  br label %313

37:                                               ; preds = %3
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %41 = load i8, ptr %9, align 1, !tbaa !9
  %42 = zext i8 %41 to i32
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %struct.UTP_TRD, ptr %40, i64 %43
  store ptr %44, ptr %10, align 8, !tbaa !5
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = load i8, ptr %6, align 1, !tbaa !9
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = call i64 @UfsCreateScsiCommandDesc(ptr noundef %45, i8 noundef zeroext %46, ptr noundef %47, ptr noundef %48, ptr noundef %16, ptr noundef %17)
  store i64 %49, ptr %8, align 8, !tbaa !10
  %50 = load i64, ptr %8, align 8, !tbaa !10
  %51 = icmp slt i64 %50, 0
  br i1 %51, label %52, label %54

52:                                               ; preds = %37
  %53 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %53, ptr %4, align 8
  store i32 1, ptr %27, align 4
  br label %313

54:                                               ; preds = %37
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.UTP_TRD, ptr %55, i32 0, i32 9
  %57 = load i16, ptr %56, align 1, !tbaa !20
  %58 = zext i16 %57 to i64
  %59 = mul i64 %58, 4
  %60 = load ptr, ptr %10, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.UTP_TRD, ptr %60, i32 0, i32 8
  %62 = load i16, ptr %61, align 1, !tbaa !22
  %63 = zext i16 %62 to i64
  %64 = mul i64 %63, 16
  %65 = add i64 %59, %64
  %66 = trunc i64 %65 to i32
  store i32 %66, ptr %12, align 4, !tbaa !23
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %67, i32 0, i32 8
  %69 = load i8, ptr %68, align 1, !tbaa !24
  %70 = zext i8 %69 to i32
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %79

72:                                               ; preds = %54
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %73, i32 0, i32 1
  %75 = load ptr, ptr %74, align 8, !tbaa !26
  store ptr %75, ptr %19, align 8, !tbaa !5
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %76, i32 0, i32 5
  %78 = load i32, ptr %77, align 8, !tbaa !27
  store i32 %78, ptr %21, align 4, !tbaa !23
  store i32 2, ptr %25, align 4, !tbaa !23
  store i32 1, ptr %24, align 4, !tbaa !23
  br label %86

79:                                               ; preds = %54
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !28
  store ptr %82, ptr %19, align 8, !tbaa !5
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %83, i32 0, i32 6
  %85 = load i32, ptr %84, align 4, !tbaa !29
  store i32 %85, ptr %21, align 4, !tbaa !23
  store i32 1, ptr %25, align 4, !tbaa !23
  store i32 0, ptr %24, align 4, !tbaa !23
  br label %86

86:                                               ; preds = %79, %72
  %87 = load i32, ptr %21, align 4, !tbaa !23
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %86
  store i32 0, ptr %25, align 4, !tbaa !23
  br label %109

90:                                               ; preds = %86
  %91 = load i32, ptr %21, align 4, !tbaa !23
  %92 = zext i32 %91 to i64
  store i64 %92, ptr %22, align 8, !tbaa !10
  %93 = load ptr, ptr %23, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %93, i32 0, i32 3
  %95 = load ptr, ptr %94, align 8, !tbaa !30
  %96 = load ptr, ptr %23, align 8, !tbaa !5
  %97 = load i32, ptr %24, align 4, !tbaa !23
  %98 = load ptr, ptr %19, align 8, !tbaa !5
  %99 = call i64 %95(ptr noundef %96, i32 noundef %97, ptr noundef %98, ptr noundef %22, ptr noundef %20, ptr noundef %18)
  store i64 %99, ptr %8, align 8, !tbaa !10
  %100 = load i64, ptr %8, align 8, !tbaa !10
  %101 = icmp slt i64 %100, 0
  br i1 %101, label %107, label %102

102:                                              ; preds = %90
  %103 = load i32, ptr %21, align 4, !tbaa !23
  %104 = zext i32 %103 to i64
  %105 = load i64, ptr %22, align 8, !tbaa !10
  %106 = icmp ne i64 %104, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %102, %90
  br label %282

108:                                              ; preds = %102
  br label %109

109:                                              ; preds = %108, %89
  %110 = load ptr, ptr %16, align 8, !tbaa !5
  %111 = getelementptr inbounds i8, ptr %110, i64 32
  %112 = getelementptr inbounds i8, ptr %111, i64 56
  store ptr %112, ptr %26, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %109
  %114 = call zeroext i8 @DebugAssertEnabled()
  %115 = icmp ne i8 %114, 0
  br i1 %115, label %116, label %121

116:                                              ; preds = %113
  %117 = load ptr, ptr %26, align 8, !tbaa !5
  %118 = icmp ne ptr %117, null
  br i1 %118, label %120, label %119

119:                                              ; preds = %116
  call void @DebugAssert(ptr noundef @.str.10, i64 noundef 1407, ptr noundef @.str.36)
  br label %120

120:                                              ; preds = %119, %116
  br label %121

121:                                              ; preds = %120, %113
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  %124 = load ptr, ptr %26, align 8, !tbaa !5
  %125 = load i64, ptr %20, align 8, !tbaa !10
  %126 = inttoptr i64 %125 to ptr
  %127 = load i32, ptr %21, align 4, !tbaa !23
  %128 = call i64 @UfsInitUtpPrdt(ptr noundef %124, ptr noundef %126, i32 noundef %127)
  %129 = load ptr, ptr %5, align 8, !tbaa !5
  %130 = load i8, ptr %9, align 1, !tbaa !9
  call void @UfsStartExecCmd(ptr noundef %129, i8 noundef zeroext %130)
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._UFS_PASS_THRU_PRIVATE_DATA, ptr %131, i32 0, i32 5
  %133 = load i64, ptr %132, align 8, !tbaa !32
  %134 = add i64 %133, 88
  store i64 %134, ptr %11, align 8, !tbaa !10
  %135 = load i64, ptr %11, align 8, !tbaa !10
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %136, i32 0, i32 0
  %138 = load i64, ptr %137, align 8, !tbaa !33
  %139 = call i64 @UfsWaitMemSet(i64 noundef %135, i32 noundef 1, i32 noundef 0, i64 noundef %138)
  store i64 %139, ptr %8, align 8, !tbaa !10
  %140 = load i64, ptr %8, align 8, !tbaa !10
  %141 = icmp slt i64 %140, 0
  br i1 %141, label %142, label %143

142:                                              ; preds = %123
  br label %264

143:                                              ; preds = %123
  %144 = load ptr, ptr %16, align 8, !tbaa !5
  %145 = load ptr, ptr %10, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.UTP_TRD, ptr %145, i32 0, i32 7
  %147 = load i16, ptr %146, align 1, !tbaa !34
  %148 = zext i16 %147 to i64
  %149 = mul i64 %148, 4
  %150 = getelementptr inbounds i8, ptr %144, i64 %149
  store ptr %150, ptr %13, align 8, !tbaa !5
  br label %151

151:                                              ; preds = %143
  %152 = call zeroext i8 @DebugAssertEnabled()
  %153 = icmp ne i8 %152, 0
  br i1 %153, label %154, label %159

154:                                              ; preds = %151
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = icmp ne ptr %155, null
  br i1 %156, label %158, label %157

157:                                              ; preds = %154
  call void @DebugAssert(ptr noundef @.str.10, i64 noundef 1428, ptr noundef @.str.37)
  br label %158

158:                                              ; preds = %157, %154
  br label %159

159:                                              ; preds = %158, %151
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr %13, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %162, i32 0, i32 13
  %164 = load i16, ptr %163, align 1, !tbaa !35
  store i16 %164, ptr %14, align 2, !tbaa !37
  call void @SwapLittleEndianToBigEndian(ptr noundef %14, i32 noundef 2)
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %165, i32 0, i32 11
  %167 = load i8, ptr %166, align 4, !tbaa !38
  %168 = zext i8 %167 to i32
  %169 = icmp ne i32 %168, 0
  br i1 %169, label %170, label %189

170:                                              ; preds = %161
  %171 = load ptr, ptr %7, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %171, i32 0, i32 3
  %173 = load ptr, ptr %172, align 8, !tbaa !39
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %189

175:                                              ; preds = %170
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %176, i32 0, i32 3
  %178 = load ptr, ptr %177, align 8, !tbaa !39
  %179 = load ptr, ptr %13, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %179, i32 0, i32 14
  %181 = getelementptr inbounds [18 x i8], ptr %180, i64 0, i64 0
  %182 = load i16, ptr %14, align 2, !tbaa !37
  %183 = zext i16 %182 to i64
  %184 = call ptr @CopyMem(ptr noundef %178, ptr noundef %181, i64 noundef %183)
  %185 = load i16, ptr %14, align 2, !tbaa !37
  %186 = trunc i16 %185 to i8
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %187, i32 0, i32 11
  store i8 %186, ptr %188, align 4, !tbaa !38
  br label %189

189:                                              ; preds = %175, %170, %161
  %190 = load ptr, ptr %13, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %190, i32 0, i32 7
  %192 = load i8, ptr %191, align 1, !tbaa !40
  %193 = load ptr, ptr %7, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %193, i32 0, i32 10
  store i8 %192, ptr %194, align 1, !tbaa !41
  %195 = load ptr, ptr %13, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %195, i32 0, i32 6
  %197 = load i8, ptr %196, align 1, !tbaa !42
  %198 = zext i8 %197 to i32
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %215

200:                                              ; preds = %189
  br label %201

201:                                              ; preds = %200
  %202 = call zeroext i8 @DebugPrintEnabled()
  %203 = icmp ne i8 %202, 0
  br i1 %203, label %204, label %212

204:                                              ; preds = %201
  br label %205

205:                                              ; preds = %204
  %206 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %207 = icmp ne i8 %206, 0
  br i1 %207, label %208, label %209

208:                                              ; preds = %205
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.38)
  br label %209

209:                                              ; preds = %208, %205
  br label %210

210:                                              ; preds = %209
  br label %211

211:                                              ; preds = %210
  br label %212

212:                                              ; preds = %211, %201
  br label %213

213:                                              ; preds = %212
  br label %214

214:                                              ; preds = %213
  store i64 -9223372036854775801, ptr %8, align 8, !tbaa !10
  br label %264

215:                                              ; preds = %189
  %216 = load ptr, ptr %10, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.UTP_TRD, ptr %216, i32 0, i32 2
  %218 = load i32, ptr %217, align 1
  %219 = and i32 %218, 255
  %220 = icmp eq i32 %219, 0
  br i1 %220, label %221, label %262

221:                                              ; preds = %215
  %222 = load ptr, ptr %7, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %222, i32 0, i32 8
  %224 = load i8, ptr %223, align 1, !tbaa !24
  %225 = zext i8 %224 to i32
  %226 = icmp eq i32 %225, 0
  br i1 %226, label %227, label %244

227:                                              ; preds = %221
  %228 = load ptr, ptr %13, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %228, i32 0, i32 1
  %230 = load i8, ptr %229, align 1, !tbaa !43
  %231 = zext i8 %230 to i32
  %232 = and i32 %231, 32
  %233 = icmp eq i32 %232, 32
  br i1 %233, label %234, label %243

234:                                              ; preds = %227
  %235 = load ptr, ptr %13, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %235, i32 0, i32 11
  %237 = load i32, ptr %236, align 1, !tbaa !44
  store i32 %237, ptr %15, align 4, !tbaa !23
  call void @SwapLittleEndianToBigEndian(ptr noundef %15, i32 noundef 4)
  %238 = load i32, ptr %15, align 4, !tbaa !23
  %239 = load ptr, ptr %7, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %239, i32 0, i32 5
  %241 = load i32, ptr %240, align 8, !tbaa !27
  %242 = sub i32 %241, %238
  store i32 %242, ptr %240, align 8, !tbaa !27
  br label %243

243:                                              ; preds = %234, %227
  br label %261

244:                                              ; preds = %221
  %245 = load ptr, ptr %13, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %245, i32 0, i32 1
  %247 = load i8, ptr %246, align 1, !tbaa !43
  %248 = zext i8 %247 to i32
  %249 = and i32 %248, 32
  %250 = icmp eq i32 %249, 32
  br i1 %250, label %251, label %260

251:                                              ; preds = %244
  %252 = load ptr, ptr %13, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct.UTP_RESPONSE_UPIU, ptr %252, i32 0, i32 11
  %254 = load i32, ptr %253, align 1, !tbaa !44
  store i32 %254, ptr %15, align 4, !tbaa !23
  call void @SwapLittleEndianToBigEndian(ptr noundef %15, i32 noundef 4)
  %255 = load i32, ptr %15, align 4, !tbaa !23
  %256 = load ptr, ptr %7, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %256, i32 0, i32 6
  %258 = load i32, ptr %257, align 4, !tbaa !29
  %259 = sub i32 %258, %255
  store i32 %259, ptr %257, align 4, !tbaa !29
  br label %260

260:                                              ; preds = %251, %244
  br label %261

261:                                              ; preds = %260, %243
  br label %263

262:                                              ; preds = %215
  store i64 -9223372036854775801, ptr %8, align 8, !tbaa !10
  br label %263

263:                                              ; preds = %262, %261
  br label %264

264:                                              ; preds = %263, %214, %142
  %265 = load ptr, ptr %23, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %265, i32 0, i32 5
  %267 = load ptr, ptr %266, align 8, !tbaa !45
  %268 = load ptr, ptr %23, align 8, !tbaa !5
  %269 = call i64 %267(ptr noundef %268)
  %270 = load ptr, ptr %5, align 8, !tbaa !5
  %271 = load i8, ptr %9, align 1, !tbaa !9
  call void @UfsStopExecCmd(ptr noundef %270, i8 noundef zeroext %271)
  %272 = load ptr, ptr %18, align 8, !tbaa !5
  %273 = icmp ne ptr %272, null
  br i1 %273, label %274, label %281

274:                                              ; preds = %264
  %275 = load ptr, ptr %23, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %275, i32 0, i32 4
  %277 = load ptr, ptr %276, align 8, !tbaa !46
  %278 = load ptr, ptr %23, align 8, !tbaa !5
  %279 = load ptr, ptr %18, align 8, !tbaa !5
  %280 = call i64 %277(ptr noundef %278, ptr noundef %279)
  br label %281

281:                                              ; preds = %274, %264
  br label %282

282:                                              ; preds = %281, %107
  %283 = load ptr, ptr %17, align 8, !tbaa !5
  %284 = icmp ne ptr %283, null
  br i1 %284, label %285, label %292

285:                                              ; preds = %282
  %286 = load ptr, ptr %23, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %286, i32 0, i32 4
  %288 = load ptr, ptr %287, align 8, !tbaa !46
  %289 = load ptr, ptr %23, align 8, !tbaa !5
  %290 = load ptr, ptr %17, align 8, !tbaa !5
  %291 = call i64 %288(ptr noundef %289, ptr noundef %290)
  br label %292

292:                                              ; preds = %285, %282
  %293 = load ptr, ptr %16, align 8, !tbaa !5
  %294 = icmp ne ptr %293, null
  br i1 %294, label %295, label %311

295:                                              ; preds = %292
  %296 = load ptr, ptr %23, align 8, !tbaa !5
  %297 = getelementptr inbounds %struct._EDKII_UFS_HOST_CONTROLLER_PROTOCOL, ptr %296, i32 0, i32 2
  %298 = load ptr, ptr %297, align 8, !tbaa !47
  %299 = load ptr, ptr %23, align 8, !tbaa !5
  %300 = load i32, ptr %12, align 4, !tbaa !23
  %301 = lshr i32 %300, 12
  %302 = load i32, ptr %12, align 4, !tbaa !23
  %303 = and i32 %302, 4095
  %304 = icmp ne i32 %303, 0
  %305 = zext i1 %304 to i64
  %306 = select i1 %304, i32 1, i32 0
  %307 = add i32 %301, %306
  %308 = zext i32 %307 to i64
  %309 = load ptr, ptr %16, align 8, !tbaa !5
  %310 = call i64 %298(ptr noundef %299, i64 noundef %308, ptr noundef %309)
  br label %311

311:                                              ; preds = %295, %292
  %312 = load i64, ptr %8, align 8, !tbaa !10
  store i64 %312, ptr %4, align 8
  store i32 1, ptr %27, align 4
  br label %313

313:                                              ; preds = %311, %52, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, 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 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %314 = load i64, ptr %4, align 8
  ret i64 %314
}

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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !6, i64 96}
!13 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !14, i64 0, !6, i64 8, !15, i64 16, !16, i64 32, !6, i64 96, !11, 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, !17, i64 168}
!14 = !{!"int", !7, i64 0}
!15 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8}
!16 = !{!"_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}
!17 = !{!"", !7, i64 0, !18, i64 12, !18, i64 13}
!18 = !{!"short", !7, i64 0}
!19 = !{!13, !6, i64 120}
!20 = !{!21, !18, i64 30}
!21 = !{!"", !14, i64 0, !14, i64 3, !14, i64 3, !14, i64 3, !14, i64 3, !14, i64 4, !14, i64 8, !14, i64 9, !14, i64 12, !14, i64 16, !14, i64 16, !14, i64 20, !18, i64 24, !18, i64 26, !18, i64 28, !18, i64 30}
!22 = !{!21, !18, i64 28}
!23 = !{!14, !14, i64 0}
!24 = !{!25, !7, i64 49}
!25 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!26 = !{!25, !6, i64 8}
!27 = !{!25, !14, i64 40}
!28 = !{!25, !6, i64 16}
!29 = !{!25, !14, i64 44}
!30 = !{!31, !6, i64 24}
!31 = !{!"_EDKII_UFS_HOST_CONTROLLER_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!32 = !{!13, !11, i64 104}
!33 = !{!25, !11, i64 0}
!34 = !{!21, !18, i64 26}
!35 = !{!36, !18, i64 32}
!36 = !{!"", !7, i64 0, !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !18, i64 10, !14, i64 12, !7, i64 16, !18, i64 32, !7, i64 34}
!37 = !{!18, !18, i64 0}
!38 = !{!25, !7, i64 52}
!39 = !{!25, !6, i64 24}
!40 = !{!36, !7, i64 7}
!41 = !{!25, !7, i64 51}
!42 = !{!36, !7, i64 6}
!43 = !{!36, !7, i64 1}
!44 = !{!36, !14, i64 12}
!45 = !{!31, !6, i64 40}
!46 = !{!31, !6, i64 32}
!47 = !{!31, !6, i64 16}


; 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.UTP_TRD = type { i32, i32, i32, i32, i32, i32, i16, i16, i16, i16 }

@.str.10 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsWaitMemSet(i64 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #0

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

; 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 zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local void @SwapLittleEndianToBigEndian(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsInitUtpPrdt(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsCreateScsiCommandDesc(ptr noundef, i8 noundef zeroext, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @UfsFindAvailableSlotInTrl(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @UfsStartExecCmd(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @UfsStopExecCmd(ptr noundef, i8 noundef zeroext) local_unnamed_addr #0

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

16:                                               ; preds = %3
  %17 = getelementptr inbounds i8, ptr %0, i64 120
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = load i8, ptr %4, align 1, !tbaa !19
  %20 = zext i8 %19 to i64
  %21 = getelementptr inbounds %struct.UTP_TRD, ptr %18, i64 %20
  %22 = call i64 @UfsCreateScsiCommandDesc(ptr noundef nonnull %0, i8 noundef zeroext %1, ptr noundef %2, ptr noundef %21, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %23 = icmp slt i64 %22, 0
  br i1 %23, label %150, label %24

24:                                               ; preds = %16
  %25 = getelementptr inbounds i8, ptr %21, i64 30
  %26 = load i16, ptr %25, align 1, !tbaa !20
  %27 = zext i16 %26 to i32
  %28 = shl nuw nsw i32 %27, 2
  %29 = getelementptr inbounds i8, ptr %21, i64 28
  %30 = load i16, ptr %29, align 1, !tbaa !22
  %31 = zext i16 %30 to i32
  %32 = shl nuw nsw i32 %31, 4
  %33 = add nuw nsw i32 %32, %28
  %34 = getelementptr inbounds i8, ptr %2, i64 49
  %35 = load i8, ptr %34, align 1, !tbaa !23
  %36 = icmp eq i8 %35, 0
  %37 = getelementptr inbounds i8, ptr %2, i64 40
  %38 = getelementptr inbounds i8, ptr %2, i64 44
  %.070.in = select i1 %36, ptr %37, ptr %38
  %.070 = load i32, ptr %.070.in, align 4, !tbaa !25
  %39 = icmp eq i32 %.070, 0
  br i1 %39, label %47, label %40

40:                                               ; preds = %24
  %.068 = zext i1 %36 to i32
  %.071.in.v = select i1 %36, i64 8, i64 16
  %.071.in = getelementptr inbounds i8, ptr %2, i64 %.071.in.v
  %.071 = load ptr, ptr %.071.in, align 8, !tbaa !5
  %41 = zext i32 %.070 to i64
  store i64 %41, ptr %11, align 8, !tbaa !9
  %42 = getelementptr inbounds i8, ptr %13, i64 24
  %43 = load ptr, ptr %42, align 8, !tbaa !26
  %44 = call i64 %43(ptr noundef %13, i32 noundef %.068, ptr noundef %.071, ptr noundef nonnull %11, ptr noundef nonnull %10, ptr noundef nonnull %9) #3
  %45 = icmp sgt i64 %44, -1
  %46 = load i64, ptr %11, align 8
  %.not = icmp eq i64 %46, %41
  %or.cond = select i1 %45, i1 %.not, i1 false
  br i1 %or.cond, label %47, label %133

47:                                               ; preds = %40, %24
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = call zeroext i8 @DebugAssertEnabled() #3
  %50 = getelementptr inbounds i8, ptr %48, i64 88
  %51 = load i64, ptr %10, align 8, !tbaa !9
  %52 = inttoptr i64 %51 to ptr
  %53 = call i64 @UfsInitUtpPrdt(ptr noundef nonnull %50, ptr noundef %52, i32 noundef %.070)
  %54 = load i8, ptr %4, align 1, !tbaa !19
  call void @UfsStartExecCmd(ptr noundef nonnull %0, i8 noundef zeroext %54)
  %55 = getelementptr inbounds i8, ptr %0, i64 104
  %56 = load i64, ptr %55, align 8, !tbaa !28
  %57 = add i64 %56, 88
  %58 = load i64, ptr %2, align 8, !tbaa !29
  %59 = call i64 @UfsWaitMemSet(i64 noundef %57, i32 noundef 1, i32 noundef 0, i64 noundef %58)
  %60 = icmp slt i64 %59, 0
  br i1 %60, label %123, label %61

61:                                               ; preds = %47
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %21, i64 26
  %64 = load i16, ptr %63, align 1, !tbaa !30
  %65 = zext i16 %64 to i64
  %66 = shl nuw nsw i64 %65, 2
  %67 = getelementptr inbounds i8, ptr %62, i64 %66
  %68 = call zeroext i8 @DebugAssertEnabled() #3
  %69 = icmp eq i8 %68, 0
  %70 = icmp ne ptr %62, null
  %or.cond3 = select i1 %69, i1 true, i1 %70
  br i1 %or.cond3, label %72, label %71

71:                                               ; preds = %61
  call void @DebugAssert(ptr noundef nonnull @.str.10, i64 noundef 1428, ptr noundef nonnull @.str.37) #3
  br label %72

72:                                               ; preds = %71, %61
  %73 = getelementptr inbounds i8, ptr %67, i64 32
  %74 = load i16, ptr %73, align 1, !tbaa !31
  store i16 %74, ptr %5, align 2, !tbaa !33
  call void @SwapLittleEndianToBigEndian(ptr noundef nonnull %5, i32 noundef 2)
  %75 = getelementptr inbounds i8, ptr %2, i64 52
  %76 = load i8, ptr %75, align 4, !tbaa !34
  %.not82 = icmp eq i8 %76, 0
  br i1 %.not82, label %87, label %77

77:                                               ; preds = %72
  %78 = getelementptr inbounds i8, ptr %2, i64 24
  %79 = load ptr, ptr %78, align 8, !tbaa !35
  %.not83 = icmp eq ptr %79, null
  br i1 %.not83, label %87, label %80

80:                                               ; preds = %77
  %81 = getelementptr inbounds i8, ptr %67, i64 34
  %82 = load i16, ptr %5, align 2, !tbaa !33
  %83 = zext i16 %82 to i64
  %84 = call ptr @CopyMem(ptr noundef nonnull %79, ptr noundef nonnull %81, i64 noundef %83) #3
  %85 = load i16, ptr %5, align 2, !tbaa !33
  %86 = trunc i16 %85 to i8
  store i8 %86, ptr %75, align 4, !tbaa !34
  br label %87

87:                                               ; preds = %80, %77, %72
  %88 = getelementptr inbounds i8, ptr %67, i64 7
  %89 = load i8, ptr %88, align 1, !tbaa !36
  %90 = getelementptr inbounds i8, ptr %2, i64 51
  store i8 %89, ptr %90, align 1, !tbaa !37
  %91 = getelementptr inbounds i8, ptr %67, i64 6
  %92 = load i8, ptr %91, align 1, !tbaa !38
  %.not84 = icmp eq i8 %92, 0
  br i1 %.not84, label %98, label %93

93:                                               ; preds = %87
  %94 = call zeroext i8 @DebugPrintEnabled() #3
  %.not87 = icmp eq i8 %94, 0
  br i1 %.not87, label %123, label %95

95:                                               ; preds = %93
  %96 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not88 = icmp eq i8 %96, 0
  br i1 %.not88, label %123, label %97

97:                                               ; preds = %95
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.38) #3
  br label %123

98:                                               ; preds = %87
  %99 = getelementptr inbounds i8, ptr %21, i64 8
  %100 = load i32, ptr %99, align 1
  %101 = and i32 %100, 255
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %123

103:                                              ; preds = %98
  %104 = load i8, ptr %34, align 1, !tbaa !23
  %105 = icmp eq i8 %104, 0
  %106 = getelementptr inbounds i8, ptr %67, i64 1
  %107 = load i8, ptr %106, align 1, !tbaa !39
  %108 = and i8 %107, 32
  %.not86 = icmp eq i8 %108, 0
  br i1 %105, label %109, label %116

109:                                              ; preds = %103
  br i1 %.not86, label %123, label %110

110:                                              ; preds = %109
  %111 = getelementptr inbounds i8, ptr %67, i64 12
  %112 = load i32, ptr %111, align 1, !tbaa !40
  store i32 %112, ptr %6, align 4, !tbaa !25
  call void @SwapLittleEndianToBigEndian(ptr noundef nonnull %6, i32 noundef 4)
  %113 = load i32, ptr %6, align 4, !tbaa !25
  %114 = load i32, ptr %37, align 8, !tbaa !41
  %115 = sub i32 %114, %113
  store i32 %115, ptr %37, align 8, !tbaa !41
  br label %123

116:                                              ; preds = %103
  br i1 %.not86, label %123, label %117

117:                                              ; preds = %116
  %118 = getelementptr inbounds i8, ptr %67, i64 12
  %119 = load i32, ptr %118, align 1, !tbaa !40
  store i32 %119, ptr %6, align 4, !tbaa !25
  call void @SwapLittleEndianToBigEndian(ptr noundef nonnull %6, i32 noundef 4)
  %120 = load i32, ptr %6, align 4, !tbaa !25
  %121 = load i32, ptr %38, align 4, !tbaa !42
  %122 = sub i32 %121, %120
  store i32 %122, ptr %38, align 4, !tbaa !42
  br label %123

123:                                              ; preds = %98, %93, %97, %95, %116, %117, %109, %110, %47
  %.069 = phi i64 [ %59, %47 ], [ %59, %110 ], [ %59, %109 ], [ %59, %117 ], [ %59, %116 ], [ -9223372036854775801, %95 ], [ -9223372036854775801, %97 ], [ -9223372036854775801, %93 ], [ -9223372036854775801, %98 ]
  %124 = getelementptr inbounds i8, ptr %13, i64 40
  %125 = load ptr, ptr %124, align 8, !tbaa !43
  %126 = call i64 %125(ptr noundef %13) #3
  %127 = load i8, ptr %4, align 1, !tbaa !19
  call void @UfsStopExecCmd(ptr noundef nonnull %0, i8 noundef zeroext %127)
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %.not89 = icmp eq ptr %128, null
  br i1 %.not89, label %133, label %129

129:                                              ; preds = %123
  %130 = getelementptr inbounds i8, ptr %13, i64 32
  %131 = load ptr, ptr %130, align 8, !tbaa !44
  %132 = call i64 %131(ptr noundef nonnull %13, ptr noundef nonnull %128) #3
  br label %133

133:                                              ; preds = %123, %129, %40
  %.1 = phi i64 [ %.069, %129 ], [ %.069, %123 ], [ %44, %40 ]
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  %.not90 = icmp eq ptr %134, null
  br i1 %.not90, label %139, label %135

135:                                              ; preds = %133
  %136 = getelementptr inbounds i8, ptr %13, i64 32
  %137 = load ptr, ptr %136, align 8, !tbaa !44
  %138 = call i64 %137(ptr noundef nonnull %13, ptr noundef nonnull %134) #3
  br label %139

139:                                              ; preds = %135, %133
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %.not91 = icmp eq ptr %140, null
  br i1 %.not91, label %150, label %141

141:                                              ; preds = %139
  %142 = getelementptr inbounds i8, ptr %13, i64 16
  %143 = load ptr, ptr %142, align 8, !tbaa !45
  %144 = lshr i32 %33, 12
  %145 = and i32 %33, 4092
  %.not92 = icmp ne i32 %145, 0
  %146 = zext i1 %.not92 to i32
  %147 = add nuw nsw i32 %144, %146
  %148 = zext nneg i32 %147 to i64
  %149 = call i64 %143(ptr noundef nonnull %13, i64 noundef %148, ptr noundef nonnull %140) #3
  br label %150

150:                                              ; preds = %139, %141, %16, %3
  %.0 = phi i64 [ %14, %3 ], [ %22, %16 ], [ %.1, %141 ], [ %.1, %139 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #3
  ret i64 %.0
}

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 96}
!12 = !{!"_UFS_PASS_THRU_PRIVATE_DATA", !13, i64 0, !6, i64 8, !14, i64 16, !15, i64 32, !6, i64 96, !10, 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, !16, i64 168}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8}
!15 = !{!"_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}
!16 = !{!"", !7, i64 0, !17, i64 12, !17, i64 13}
!17 = !{!"short", !7, i64 0}
!18 = !{!12, !6, i64 120}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !17, i64 30}
!21 = !{!"", !13, i64 0, !13, i64 3, !13, i64 3, !13, i64 3, !13, i64 3, !13, i64 4, !13, i64 8, !13, i64 9, !13, i64 12, !13, i64 16, !13, i64 16, !13, i64 20, !17, i64 24, !17, i64 26, !17, i64 28, !17, i64 30}
!22 = !{!21, !17, i64 28}
!23 = !{!24, !7, i64 49}
!24 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!25 = !{!13, !13, i64 0}
!26 = !{!27, !6, i64 24}
!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 = !{!12, !10, i64 104}
!29 = !{!24, !10, i64 0}
!30 = !{!21, !17, i64 26}
!31 = !{!32, !17, i64 32}
!32 = !{!"", !7, i64 0, !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !7, i64 9, !17, i64 10, !13, i64 12, !7, i64 16, !17, i64 32, !7, i64 34}
!33 = !{!17, !17, i64 0}
!34 = !{!24, !7, i64 52}
!35 = !{!24, !6, i64 24}
!36 = !{!32, !7, i64 7}
!37 = !{!24, !7, i64 51}
!38 = !{!32, !7, i64 6}
!39 = !{!32, !7, i64 1}
!40 = !{!32, !13, i64 12}
!41 = !{!24, !13, i64 40}
!42 = !{!24, !13, i64 44}
!43 = !{!27, !6, i64 40}
!44 = !{!27, !6, i64 32}
!45 = !{!27, !6, i64 16}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass