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

; 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.SCSI_DISK_DEV = type { i32, ptr, %struct._EFI_BLOCK_IO_PROTOCOL, %struct.EFI_BLOCK_IO_MEDIA, ptr, i8, i8, i16, ptr, i64, %struct.EFI_SCSI_INQUIRY_DATA, ptr, %struct._EFI_DISK_INFO_PROTOCOL, i32, i32, %struct.ATAPI_IDENTIFY_DATA, i8 }
%struct._EFI_BLOCK_IO_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_BLOCK_IO_MEDIA = type { i32, i8, i8, i8, i8, i8, i32, i32, i64, i64, i32, i32 }
%struct.EFI_SCSI_INQUIRY_DATA = type { i16, i8, i8, i8, [91 x i8] }
%struct._EFI_DISK_INFO_PROTOCOL = type { %struct.GUID, ptr, ptr, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.ATAPI_IDENTIFY_DATA = type { i16, i16, i16, [7 x i16], [20 x i8], [3 x i16], [8 x i8], [40 x i8], [2 x i16], i16, i16, i16, i16, i16, [8 x i16], i16, i16, i16, i16, i16, i16, i16, [2 x i16], [2 x i16], [2 x i16], i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, i16, [13 x i16], [4 x i16], [4 x i16], [3 x i16], i16, i16, [4 x i16], i16, [2 x i16], i16, [31 x i16], [16 x i16], [46 x i16], i16, i16, [31 x i16], i16 }
%struct._EFI_SCSI_IO_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, i32 }

@.str.14 = external hidden unnamed_addr constant [43 x i8], align 1

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

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @CheckHostAdapterStatus(i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @CheckTargetStatus(i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @ScsiDiskRead10(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, i32 noundef %5, i32 noundef %6) #2 {
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i8, align 1
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i8, align 1
  %20 = alloca i8, align 1
  %21 = alloca i64, align 8
  %22 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i64 %2, ptr %11, align 8, !tbaa !9
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store i32 %5, ptr %14, align 4, !tbaa !11
  store i32 %6, ptr %15, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, 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 1, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  br label %23

23:                                               ; preds = %145, %7
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %24, align 1, !tbaa !13
  store i64 0, ptr %21, align 8, !tbaa !9
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %25, i32 0, i32 9
  %27 = load i64, ptr %26, align 8, !tbaa !14
  %28 = mul i64 %27, 18
  %29 = trunc i64 %28 to i8
  store i8 %29, ptr %16, align 1, !tbaa !13
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %30, i32 0, i32 4
  %32 = load ptr, ptr %31, align 8, !tbaa !23
  %33 = load i64, ptr %11, align 8, !tbaa !9
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %34, i32 0, i32 8
  %36 = load ptr, ptr %35, align 8, !tbaa !24
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = load i32, ptr %14, align 4, !tbaa !11
  %40 = load i32, ptr %15, align 4, !tbaa !11
  %41 = call i64 @ScsiRead10Command(ptr noundef %32, i64 noundef %33, ptr noundef %36, ptr noundef %16, ptr noundef %19, ptr noundef %20, ptr noundef %37, ptr noundef %38, i32 noundef %39, i32 noundef %40)
  store i64 %41, ptr %18, align 8, !tbaa !9
  %42 = load i64, ptr %18, align 8, !tbaa !9
  %43 = icmp eq i64 %42, -9223372036854775802
  br i1 %43, label %44, label %46

44:                                               ; preds = %23
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %45, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

46:                                               ; preds = %23
  %47 = load i64, ptr %18, align 8, !tbaa !9
  %48 = icmp eq i64 %47, -9223372036854775806
  br i1 %48, label %52, label %49

49:                                               ; preds = %46
  %50 = load i64, ptr %18, align 8, !tbaa !9
  %51 = icmp eq i64 %50, -9223372036854775805
  br i1 %51, label %52, label %55

52:                                               ; preds = %49, %46
  %53 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %53, align 1, !tbaa !13
  %54 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %54, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

55:                                               ; preds = %49
  br label %56

56:                                               ; preds = %55
  %57 = load i8, ptr %19, align 1, !tbaa !13
  %58 = call i64 @CheckHostAdapterStatus(i8 noundef zeroext %57)
  store i64 %58, ptr %17, align 8, !tbaa !9
  %59 = load i64, ptr %17, align 8, !tbaa !9
  %60 = icmp eq i64 %59, -9223372036854775790
  br i1 %60, label %64, label %61

61:                                               ; preds = %56
  %62 = load i64, ptr %17, align 8, !tbaa !9
  %63 = icmp eq i64 %62, -9223372036854775802
  br i1 %63, label %64, label %66

64:                                               ; preds = %61, %56
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %65, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

66:                                               ; preds = %61
  %67 = load i64, ptr %17, align 8, !tbaa !9
  %68 = icmp eq i64 %67, -9223372036854775801
  br i1 %68, label %69, label %80

69:                                               ; preds = %66
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !23
  %73 = getelementptr inbounds %struct._EFI_SCSI_IO_PROTOCOL, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !25
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %75, i32 0, i32 4
  %77 = load ptr, ptr %76, align 8, !tbaa !23
  %78 = call i64 %74(ptr noundef %77)
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %79, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

80:                                               ; preds = %66
  br label %81

81:                                               ; preds = %80
  %82 = load i8, ptr %20, align 1, !tbaa !13
  %83 = call i64 @CheckTargetStatus(i8 noundef zeroext %82)
  store i64 %83, ptr %17, align 8, !tbaa !9
  %84 = load i64, ptr %17, align 8, !tbaa !9
  %85 = icmp eq i64 %84, -9223372036854775802
  br i1 %85, label %86, label %97

86:                                               ; preds = %81
  %87 = load ptr, ptr %9, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %88, align 8, !tbaa !23
  %90 = getelementptr inbounds %struct._EFI_SCSI_IO_PROTOCOL, ptr %89, i32 0, i32 3
  %91 = load ptr, ptr %90, align 8, !tbaa !27
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %92, i32 0, i32 4
  %94 = load ptr, ptr %93, align 8, !tbaa !23
  %95 = call i64 %91(ptr noundef %94)
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %96, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

97:                                               ; preds = %81
  %98 = load i64, ptr %17, align 8, !tbaa !9
  %99 = icmp eq i64 %98, -9223372036854775801
  br i1 %99, label %100, label %102

100:                                              ; preds = %97
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %101, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

102:                                              ; preds = %97
  br label %103

103:                                              ; preds = %102
  %104 = load i8, ptr %20, align 1, !tbaa !13
  %105 = zext i8 %104 to i32
  %106 = icmp eq i32 %105, 2
  br i1 %106, label %110, label %107

107:                                              ; preds = %103
  %108 = load i64, ptr %18, align 8, !tbaa !9
  %109 = icmp slt i64 %108, 0
  br i1 %109, label %110, label %159

110:                                              ; preds = %107, %103
  br label %111

111:                                              ; preds = %110
  %112 = call zeroext i8 @DebugPrintEnabled()
  %113 = icmp ne i8 %112, 0
  br i1 %113, label %114, label %122

114:                                              ; preds = %111
  br label %115

115:                                              ; preds = %114
  %116 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %117 = icmp ne i8 %116, 0
  br i1 %117, label %118, label %119

118:                                              ; preds = %115
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.14)
  br label %119

119:                                              ; preds = %118, %115
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121, %111
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = load ptr, ptr %9, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %126, i32 0, i32 8
  %128 = load ptr, ptr %127, align 8, !tbaa !24
  %129 = load i8, ptr %16, align 1, !tbaa !13
  %130 = zext i8 %129 to i64
  %131 = udiv i64 %130, 18
  %132 = call i64 @DetectMediaParsingSenseKeys(ptr noundef %125, ptr noundef %128, i64 noundef %131, ptr noundef %21)
  store i64 %132, ptr %17, align 8, !tbaa !9
  %133 = load i64, ptr %21, align 8, !tbaa !9
  %134 = icmp eq i64 %133, 2
  br i1 %134, label %135, label %137

135:                                              ; preds = %124
  %136 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 1, ptr %136, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

137:                                              ; preds = %124
  %138 = load i64, ptr %21, align 8, !tbaa !9
  %139 = icmp eq i64 %138, 3
  br i1 %139, label %140, label %157

140:                                              ; preds = %137
  %141 = load i32, ptr %15, align 4, !tbaa !11
  %142 = icmp ule i32 %141, 1
  br i1 %142, label %143, label %145

143:                                              ; preds = %140
  %144 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %144, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

145:                                              ; preds = %140
  %146 = load i32, ptr %15, align 4, !tbaa !11
  %147 = lshr i32 %146, 1
  store i32 %147, ptr %15, align 4, !tbaa !11
  %148 = load i32, ptr %15, align 4, !tbaa !11
  %149 = load ptr, ptr %9, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %149, i32 0, i32 2
  %151 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %150, i32 0, i32 1
  %152 = load ptr, ptr %151, align 8, !tbaa !28
  %153 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %152, i32 0, i32 6
  %154 = load i32, ptr %153, align 4, !tbaa !29
  %155 = mul i32 %148, %154
  %156 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %155, ptr %156, align 4, !tbaa !11
  br label %23

157:                                              ; preds = %137
  %158 = load ptr, ptr %10, align 8, !tbaa !5
  store i8 0, ptr %158, align 1, !tbaa !13
  store i64 -9223372036854775801, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

159:                                              ; preds = %107
  %160 = load i64, ptr %18, align 8, !tbaa !9
  store i64 %160, ptr %8, align 8
  store i32 1, ptr %22, align 4
  br label %161

161:                                              ; preds = %159, %157, %143, %135, %100, %86, %69, %64, %52, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 1, 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 1, ptr %16) #3
  %162 = load i64, ptr %8, align 8
  ret i64 %162
}

declare i64 @ScsiRead10Command(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { 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 #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, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !10, i64 136}
!15 = !{!"", !12, i64 0, !6, i64 8, !16, i64 16, !17, i64 64, !6, i64 112, !7, i64 120, !7, i64 121, !18, i64 122, !6, i64 128, !10, i64 136, !19, i64 144, !6, i64 240, !20, i64 248, !12, i64 296, !12, i64 300, !22, i64 304, !7, i64 816}
!16 = !{!"_EFI_BLOCK_IO_PROTOCOL", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!"", !12, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !12, i64 12, !12, i64 16, !10, i64 24, !10, i64 32, !12, i64 40, !12, i64 44}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5}
!20 = !{!"_EFI_DISK_INFO_PROTOCOL", !21, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = !{!"", !12, i64 0, !18, i64 4, !18, i64 6, !7, i64 8}
!22 = !{!"", !18, i64 0, !18, i64 2, !18, i64 4, !7, i64 6, !7, i64 20, !7, i64 40, !7, i64 46, !7, i64 54, !7, i64 94, !18, i64 98, !18, i64 100, !18, i64 102, !18, i64 104, !18, i64 106, !7, i64 108, !18, i64 124, !18, i64 126, !18, i64 128, !18, i64 130, !18, i64 132, !18, i64 134, !18, i64 136, !7, i64 138, !7, i64 142, !7, i64 146, !18, i64 150, !18, i64 152, !18, i64 154, !18, i64 156, !18, i64 158, !18, i64 160, !18, i64 162, !18, i64 164, !18, i64 166, !18, i64 168, !18, i64 170, !18, i64 172, !18, i64 174, !18, i64 176, !18, i64 178, !18, i64 180, !18, i64 182, !18, i64 184, !18, i64 186, !18, i64 188, !7, i64 190, !7, i64 216, !7, i64 224, !7, i64 232, !18, i64 238, !18, i64 240, !7, i64 242, !18, i64 250, !7, i64 252, !18, i64 256, !7, i64 258, !7, i64 320, !7, i64 352, !18, i64 444, !18, i64 446, !7, i64 448, !18, i64 510}
!23 = !{!15, !6, i64 112}
!24 = !{!15, !6, i64 128}
!25 = !{!26, !6, i64 16}
!26 = !{!"_EFI_SCSI_IO_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40}
!27 = !{!26, !6, i64 24}
!28 = !{!15, !6, i64 24}
!29 = !{!17, !12, i64 12}


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

@.str.14 = external hidden unnamed_addr constant [43 x i8], align 1

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @CheckHostAdapterStatus(i8 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @CheckTargetStatus(i8 noundef zeroext) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i64 @ScsiDiskRead10(ptr noundef %0, ptr nocapture noundef writeonly %1, i64 noundef %2, ptr noundef %3, ptr noundef %4, i32 noundef %5, i32 noundef %6) local_unnamed_addr #2 {
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  %12 = getelementptr inbounds i8, ptr %0, i64 136
  %13 = getelementptr inbounds i8, ptr %0, i64 112
  %14 = getelementptr inbounds i8, ptr %0, i64 128
  %15 = getelementptr inbounds i8, ptr %0, i64 24
  br label %16

16:                                               ; preds = %60, %7
  %.045 = phi i32 [ %6, %7 ], [ %61, %60 ]
  store i8 0, ptr %1, align 1, !tbaa !5
  store i64 0, ptr %11, align 8, !tbaa !8
  %17 = load i64, ptr %12, align 8, !tbaa !10
  %18 = trunc i64 %17 to i8
  %19 = mul i8 %18, 18
  store i8 %19, ptr %8, align 1, !tbaa !5
  %20 = load ptr, ptr %13, align 8, !tbaa !21
  %21 = load ptr, ptr %14, align 8, !tbaa !22
  %22 = call i64 @ScsiRead10Command(ptr noundef %20, i64 noundef %2, ptr noundef %21, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef %3, ptr noundef %4, i32 noundef %5, i32 noundef %.045) #3
  %23 = icmp eq i64 %22, -9223372036854775802
  br i1 %23, label %.loopexit.sink.split, label %24

24:                                               ; preds = %16
  %25 = and i64 %22, -2
  %or.cond = icmp eq i64 %25, -9223372036854775806
  br i1 %or.cond, label %.loopexit.sink.split, label %26

26:                                               ; preds = %24
  %27 = load i8, ptr %9, align 1, !tbaa !5
  %28 = call i64 @CheckHostAdapterStatus(i8 noundef zeroext %27)
  switch i64 %28, label %34 [
    i64 -9223372036854775790, label %.loopexit.sink.split
    i64 -9223372036854775802, label %.loopexit.sink.split
    i64 -9223372036854775801, label %29
  ]

29:                                               ; preds = %26
  %30 = load ptr, ptr %13, align 8, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %30, i64 16
  %32 = load ptr, ptr %31, align 8, !tbaa !23
  %33 = call i64 %32(ptr noundef %30) #3
  br label %.loopexit.sink.split

34:                                               ; preds = %26
  %35 = load i8, ptr %10, align 1, !tbaa !5
  %36 = call i64 @CheckTargetStatus(i8 noundef zeroext %35)
  switch i64 %36, label %42 [
    i64 -9223372036854775802, label %37
    i64 -9223372036854775801, label %.loopexit.sink.split
  ]

37:                                               ; preds = %34
  %38 = load ptr, ptr %13, align 8, !tbaa !21
  %39 = getelementptr inbounds i8, ptr %38, i64 24
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  %41 = call i64 %40(ptr noundef %38) #3
  br label %.loopexit.sink.split

42:                                               ; preds = %34
  %43 = load i8, ptr %10, align 1, !tbaa !5
  %44 = icmp eq i8 %43, 2
  %45 = icmp slt i64 %22, 0
  %or.cond5 = or i1 %45, %44
  br i1 %or.cond5, label %46, label %.loopexit

46:                                               ; preds = %42
  %47 = call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %47, 0
  br i1 %.not, label %51, label %48

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

50:                                               ; preds = %48
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.14) #3
  br label %51

51:                                               ; preds = %48, %50, %46
  %52 = load ptr, ptr %14, align 8, !tbaa !22
  %53 = load i8, ptr %8, align 1, !tbaa !5
  %54 = udiv i8 %53, 18
  %55 = zext nneg i8 %54 to i64
  %56 = call i64 @DetectMediaParsingSenseKeys(ptr noundef nonnull %0, ptr noundef %52, i64 noundef %55, ptr noundef nonnull %11)
  %57 = load i64, ptr %11, align 8, !tbaa !8
  switch i64 %57, label %.loopexit.sink.split.loopexit92 [
    i64 2, label %.loopexit.sink.split
    i64 3, label %58
  ]

58:                                               ; preds = %51
  %59 = icmp ult i32 %.045, 2
  br i1 %59, label %.loopexit.sink.split, label %60

60:                                               ; preds = %58
  %61 = lshr i32 %.045, 1
  %62 = load ptr, ptr %15, align 8, !tbaa !26
  %63 = getelementptr inbounds i8, ptr %62, i64 12
  %64 = load i32, ptr %63, align 4, !tbaa !27
  %65 = mul i32 %64, %61
  store i32 %65, ptr %4, align 4, !tbaa !28
  br label %16

.loopexit.sink.split.loopexit92:                  ; preds = %51
  br label %.loopexit.sink.split

.loopexit.sink.split:                             ; preds = %58, %34, %26, %26, %24, %16, %51, %.loopexit.sink.split.loopexit92, %29, %37
  %.sink = phi i8 [ 1, %37 ], [ 0, %29 ], [ 1, %51 ], [ 1, %16 ], [ 0, %24 ], [ 1, %26 ], [ 1, %26 ], [ 0, %34 ], [ 0, %58 ], [ 0, %.loopexit.sink.split.loopexit92 ]
  %.0.ph = phi i64 [ -9223372036854775801, %37 ], [ -9223372036854775801, %29 ], [ -9223372036854775801, %51 ], [ -9223372036854775801, %16 ], [ %22, %24 ], [ -9223372036854775801, %26 ], [ -9223372036854775801, %26 ], [ %36, %34 ], [ -9223372036854775801, %58 ], [ -9223372036854775801, %.loopexit.sink.split.loopexit92 ]
  store i8 %.sink, ptr %1, align 1, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %42, %.loopexit.sink.split
  %.0 = phi i64 [ %.0.ph, %.loopexit.sink.split ], [ %22, %42 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #3
  ret i64 %.0
}

declare i64 @ScsiRead10Command(ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #2 = { 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 #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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !6, i64 0}
!10 = !{!11, !9, i64 136}
!11 = !{!"", !12, i64 0, !13, i64 8, !14, i64 16, !15, i64 64, !13, i64 112, !6, i64 120, !6, i64 121, !16, i64 122, !13, i64 128, !9, i64 136, !17, i64 144, !13, i64 240, !18, i64 248, !12, i64 296, !12, i64 300, !20, i64 304, !6, i64 816}
!12 = !{!"int", !6, i64 0}
!13 = !{!"any pointer", !6, i64 0}
!14 = !{!"_EFI_BLOCK_IO_PROTOCOL", !9, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!15 = !{!"", !12, i64 0, !6, i64 4, !6, i64 5, !6, i64 6, !6, i64 7, !6, i64 8, !12, i64 12, !12, i64 16, !9, i64 24, !9, i64 32, !12, i64 40, !12, i64 44}
!16 = !{!"short", !6, i64 0}
!17 = !{!"", !6, i64 0, !6, i64 0, !6, i64 1, !6, i64 1, !6, i64 2, !6, i64 3, !6, i64 4, !6, i64 5}
!18 = !{!"_EFI_DISK_INFO_PROTOCOL", !19, i64 0, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40}
!19 = !{!"", !12, i64 0, !16, i64 4, !16, i64 6, !6, i64 8}
!20 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !6, i64 6, !6, i64 20, !6, i64 40, !6, i64 46, !6, i64 54, !6, i64 94, !16, i64 98, !16, i64 100, !16, i64 102, !16, i64 104, !16, i64 106, !6, i64 108, !16, i64 124, !16, i64 126, !16, i64 128, !16, i64 130, !16, i64 132, !16, i64 134, !16, i64 136, !6, i64 138, !6, i64 142, !6, i64 146, !16, i64 150, !16, i64 152, !16, i64 154, !16, i64 156, !16, i64 158, !16, i64 160, !16, i64 162, !16, i64 164, !16, i64 166, !16, i64 168, !16, i64 170, !16, i64 172, !16, i64 174, !16, i64 176, !16, i64 178, !16, i64 180, !16, i64 182, !16, i64 184, !16, i64 186, !16, i64 188, !6, i64 190, !6, i64 216, !6, i64 224, !6, i64 232, !16, i64 238, !16, i64 240, !6, i64 242, !16, i64 250, !6, i64 252, !16, i64 256, !6, i64 258, !6, i64 320, !6, i64 352, !16, i64 444, !16, i64 446, !6, i64 448, !16, i64 510}
!21 = !{!11, !13, i64 112}
!22 = !{!11, !13, i64 128}
!23 = !{!24, !13, i64 16}
!24 = !{!"_EFI_SCSI_IO_PROTOCOL", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !12, i64 40}
!25 = !{!24, !13, i64 24}
!26 = !{!11, !13, i64 24}
!27 = !{!15, !12, i64 12}
!28 = !{!12, !12, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass