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

; 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_SENSE_DATA = type { i8, i8, i8, [4 x i8], i8, [4 x i8], i8, i8, i8, [3 x i8] }

@.str.7 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 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
define dso_local i64 @DetectMediaParsingSenseKeys(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  %12 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 1, ptr %12, align 8, !tbaa !9
  %13 = load i64, ptr %8, align 8, !tbaa !9
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %15, label %27

15:                                               ; preds = %4
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %16, i32 0, i32 2
  %18 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %17, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %19, i32 0, i32 2
  %21 = load i8, ptr %20, align 1, !tbaa !21
  %22 = zext i8 %21 to i32
  %23 = icmp eq i32 %22, 1
  br i1 %23, label %24, label %26

24:                                               ; preds = %15
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %25, align 8, !tbaa !9
  br label %26

26:                                               ; preds = %24, %15
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

27:                                               ; preds = %4
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load i64, ptr %8, align 8, !tbaa !9
  %30 = call zeroext i8 @ScsiDiskHaveSenseKey(ptr noundef %28, i64 noundef %29)
  %31 = icmp ne i8 %30, 0
  br i1 %31, label %44, label %32

32:                                               ; preds = %27
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %34, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !11
  %37 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %36, i32 0, i32 2
  %38 = load i8, ptr %37, align 1, !tbaa !21
  %39 = zext i8 %38 to i32
  %40 = icmp eq i32 %39, 1
  br i1 %40, label %41, label %43

41:                                               ; preds = %32
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %42, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %41, %32
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

44:                                               ; preds = %27
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load i64, ptr %8, align 8, !tbaa !9
  %47 = call zeroext i8 @ScsiDiskIsNoMedia(ptr noundef %45, i64 noundef %46)
  %48 = icmp ne i8 %47, 0
  br i1 %48, label %49, label %75

49:                                               ; preds = %44
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %51, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %53, i32 0, i32 2
  store i8 0, ptr %54, align 1, !tbaa !21
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %55, i32 0, i32 2
  %57 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %58, i32 0, i32 8
  store i64 0, ptr %59, align 8, !tbaa !22
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %60, align 8, !tbaa !9
  br label %61

61:                                               ; preds = %49
  %62 = call zeroext i8 @DebugPrintEnabled()
  %63 = icmp ne i8 %62, 0
  br i1 %63, label %64, label %72

64:                                               ; preds = %61
  br label %65

65:                                               ; preds = %64
  %66 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304)
  %67 = icmp ne i8 %66, 0
  br i1 %67, label %68, label %69

68:                                               ; preds = %65
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.7)
  br label %69

69:                                               ; preds = %68, %65
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71, %61
  br label %73

73:                                               ; preds = %72
  br label %74

74:                                               ; preds = %73
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

75:                                               ; preds = %44
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load i64, ptr %8, align 8, !tbaa !9
  %78 = call zeroext i8 @ScsiDiskIsMediaChange(ptr noundef %76, i64 noundef %77)
  %79 = icmp ne i8 %78, 0
  br i1 %79, label %80, label %102

80:                                               ; preds = %75
  %81 = load ptr, ptr %6, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %81, i32 0, i32 2
  %83 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !11
  %85 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !23
  %87 = add i32 %86, 1
  store i32 %87, ptr %85, align 8, !tbaa !23
  br label %88

88:                                               ; preds = %80
  %89 = call zeroext i8 @DebugPrintEnabled()
  %90 = icmp ne i8 %89, 0
  br i1 %90, label %91, label %99

91:                                               ; preds = %88
  br label %92

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

95:                                               ; preds = %92
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.8)
  br label %96

96:                                               ; preds = %95, %92
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  br label %99

99:                                               ; preds = %98, %88
  br label %100

100:                                              ; preds = %99
  br label %101

101:                                              ; preds = %100
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

102:                                              ; preds = %75
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = load i64, ptr %8, align 8, !tbaa !9
  %105 = call zeroext i8 @ScsiDiskIsResetBefore(ptr noundef %103, i64 noundef %104)
  %106 = icmp ne i8 %105, 0
  br i1 %106, label %107, label %123

107:                                              ; preds = %102
  %108 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 2, ptr %108, align 8, !tbaa !9
  br label %109

109:                                              ; preds = %107
  %110 = call zeroext i8 @DebugPrintEnabled()
  %111 = icmp ne i8 %110, 0
  br i1 %111, label %112, label %120

112:                                              ; preds = %109
  br label %113

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

116:                                              ; preds = %113
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.9)
  br label %117

117:                                              ; preds = %116, %113
  br label %118

118:                                              ; preds = %117
  br label %119

119:                                              ; preds = %118
  br label %120

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

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

123:                                              ; preds = %102
  %124 = load ptr, ptr %7, align 8, !tbaa !5
  %125 = load i64, ptr %8, align 8, !tbaa !9
  %126 = call zeroext i8 @ScsiDiskIsMediaError(ptr noundef %124, i64 noundef %125)
  %127 = icmp ne i8 %126, 0
  br i1 %127, label %128, label %144

128:                                              ; preds = %123
  br label %129

129:                                              ; preds = %128
  %130 = call zeroext i8 @DebugPrintEnabled()
  %131 = icmp ne i8 %130, 0
  br i1 %131, label %132, label %140

132:                                              ; preds = %129
  br label %133

133:                                              ; preds = %132
  %134 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304)
  %135 = icmp ne i8 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %133
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.10)
  br label %137

137:                                              ; preds = %136, %133
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139, %129
  br label %141

141:                                              ; preds = %140
  br label %142

142:                                              ; preds = %141
  %143 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 3, ptr %143, align 8, !tbaa !9
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

144:                                              ; preds = %123
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = load i64, ptr %8, align 8, !tbaa !9
  %147 = call zeroext i8 @ScsiDiskIsHardwareError(ptr noundef %145, i64 noundef %146)
  %148 = icmp ne i8 %147, 0
  br i1 %148, label %149, label %165

149:                                              ; preds = %144
  br label %150

150:                                              ; preds = %149
  %151 = call zeroext i8 @DebugPrintEnabled()
  %152 = icmp ne i8 %151, 0
  br i1 %152, label %153, label %161

153:                                              ; preds = %150
  br label %154

154:                                              ; preds = %153
  %155 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304)
  %156 = icmp ne i8 %155, 0
  br i1 %156, label %157, label %158

157:                                              ; preds = %154
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.11)
  br label %158

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

159:                                              ; preds = %158
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160, %150
  br label %162

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  %164 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 3, ptr %164, align 8, !tbaa !9
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

165:                                              ; preds = %144
  %166 = load ptr, ptr %7, align 8, !tbaa !5
  %167 = load i64, ptr %8, align 8, !tbaa !9
  %168 = call zeroext i8 @ScsiDiskIsDriveReady(ptr noundef %166, i64 noundef %167, ptr noundef %10)
  %169 = icmp ne i8 %168, 0
  br i1 %169, label %191, label %170

170:                                              ; preds = %165
  %171 = load i8, ptr %10, align 1, !tbaa !24
  %172 = icmp ne i8 %171, 0
  br i1 %172, label %173, label %189

173:                                              ; preds = %170
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 2, ptr %174, align 8, !tbaa !9
  br label %175

175:                                              ; preds = %173
  %176 = call zeroext i8 @DebugPrintEnabled()
  %177 = icmp ne i8 %176, 0
  br i1 %177, label %178, label %186

178:                                              ; preds = %175
  br label %179

179:                                              ; preds = %178
  %180 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304)
  %181 = icmp ne i8 %180, 0
  br i1 %181, label %182, label %183

182:                                              ; preds = %179
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.12)
  br label %183

183:                                              ; preds = %182, %179
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185, %175
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

189:                                              ; preds = %170
  %190 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 0, ptr %190, align 8, !tbaa !9
  store i64 -9223372036854775801, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

191:                                              ; preds = %165
  %192 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 3, ptr %192, align 8, !tbaa !9
  br label %193

193:                                              ; preds = %191
  %194 = call zeroext i8 @DebugPrintEnabled()
  %195 = icmp ne i8 %194, 0
  br i1 %195, label %196, label %213

196:                                              ; preds = %193
  br label %197

197:                                              ; preds = %196
  %198 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304)
  %199 = icmp ne i8 %198, 0
  br i1 %199, label %200, label %210

200:                                              ; preds = %197
  %201 = load ptr, ptr %7, align 8, !tbaa !5
  %202 = getelementptr inbounds %struct.EFI_SCSI_SENSE_DATA, ptr %201, i32 0, i32 2
  %203 = load i8, ptr %202, align 1
  %204 = and i8 %203, 15
  %205 = zext i8 %204 to i32
  %206 = load ptr, ptr %7, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.EFI_SCSI_SENSE_DATA, ptr %206, i32 0, i32 6
  %208 = load i8, ptr %207, align 1, !tbaa !25
  %209 = zext i8 %208 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef @.str.13, i32 noundef %205, i32 noundef %209)
  br label %210

210:                                              ; preds = %200, %197
  br label %211

211:                                              ; preds = %210
  br label %212

212:                                              ; preds = %211
  br label %213

213:                                              ; preds = %212, %193
  br label %214

214:                                              ; preds = %213
  br label %215

215:                                              ; preds = %214
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %216

216:                                              ; preds = %215, %189, %188, %163, %142, %122, %101, %74, %43, %26
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  %217 = load i64, ptr %5, align 8
  ret i64 %217
}

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

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

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

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

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

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

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

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, !6, i64 24}
!12 = !{!"", !13, i64 0, !6, i64 8, !14, i64 16, !15, i64 64, !6, i64 112, !7, i64 120, !7, i64 121, !16, i64 122, !6, i64 128, !10, i64 136, !17, i64 144, !6, i64 240, !18, i64 248, !13, i64 296, !13, i64 300, !20, i64 304, !7, i64 816}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_EFI_BLOCK_IO_PROTOCOL", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!"", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !13, i64 12, !13, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 44}
!16 = !{!"short", !7, i64 0}
!17 = !{!"", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5}
!18 = !{!"_EFI_DISK_INFO_PROTOCOL", !19, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!"", !13, i64 0, !16, i64 4, !16, i64 6, !7, i64 8}
!20 = !{!"", !16, i64 0, !16, i64 2, !16, i64 4, !7, i64 6, !7, i64 20, !7, i64 40, !7, i64 46, !7, i64 54, !7, i64 94, !16, i64 98, !16, i64 100, !16, i64 102, !16, i64 104, !16, i64 106, !7, i64 108, !16, i64 124, !16, i64 126, !16, i64 128, !16, i64 130, !16, i64 132, !16, i64 134, !16, i64 136, !7, i64 138, !7, i64 142, !7, 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, !7, i64 190, !7, i64 216, !7, i64 224, !7, i64 232, !16, i64 238, !16, i64 240, !7, i64 242, !16, i64 250, !7, i64 252, !16, i64 256, !7, i64 258, !7, i64 320, !7, i64 352, !16, i64 444, !16, i64 446, !7, i64 448, !16, i64 510}
!21 = !{!15, !7, i64 5}
!22 = !{!15, !10, i64 24}
!23 = !{!15, !13, i64 0}
!24 = !{!7, !7, i64 0}
!25 = !{!26, !7, i64 12}
!26 = !{!"", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 2, !7, i64 2, !7, i64 2, !7, i64 3, !7, i64 7, !7, i64 8, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15}


; 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.7 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [40 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
define dso_local range(i64 -9223372036854775801, 1) i64 @DetectMediaParsingSenseKeys(ptr nocapture noundef readonly %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #2 {
  %5 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  store i64 1, ptr %3, align 8, !tbaa !5
  %6 = icmp eq i64 %2, 0
  br i1 %6, label %7, label %14

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %9, i64 5
  %11 = load i8, ptr %10, align 1, !tbaa !20
  %12 = icmp eq i8 %11, 1
  br i1 %12, label %13, label %90

13:                                               ; preds = %7
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %90

14:                                               ; preds = %4
  %15 = tail call zeroext i8 @ScsiDiskHaveSenseKey(ptr noundef %1, i64 noundef %2)
  %.not = icmp eq i8 %15, 0
  br i1 %.not, label %16, label %23

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = getelementptr inbounds i8, ptr %18, i64 5
  %20 = load i8, ptr %19, align 1, !tbaa !20
  %21 = icmp eq i8 %20, 1
  br i1 %21, label %22, label %90

22:                                               ; preds = %16
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %90

23:                                               ; preds = %14
  %24 = tail call zeroext i8 @ScsiDiskIsNoMedia(ptr noundef %1, i64 noundef %2)
  %.not33 = icmp eq i8 %24, 0
  br i1 %.not33, label %34, label %25

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %0, i64 24
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = getelementptr inbounds i8, ptr %27, i64 5
  store i8 0, ptr %28, align 1, !tbaa !20
  %29 = getelementptr inbounds i8, ptr %27, i64 24
  store i64 0, ptr %29, align 8, !tbaa !21
  store i64 0, ptr %3, align 8, !tbaa !5
  %30 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not52 = icmp eq i8 %30, 0
  br i1 %.not52, label %90, label %31

31:                                               ; preds = %25
  %32 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not53 = icmp eq i8 %32, 0
  br i1 %.not53, label %90, label %33

33:                                               ; preds = %31
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.7) #3
  br label %90

34:                                               ; preds = %23
  %35 = tail call zeroext i8 @ScsiDiskIsMediaChange(ptr noundef %1, i64 noundef %2)
  %.not34 = icmp eq i8 %35, 0
  br i1 %.not34, label %45, label %36

36:                                               ; preds = %34
  %37 = getelementptr inbounds i8, ptr %0, i64 24
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = load i32, ptr %38, align 8, !tbaa !22
  %40 = add i32 %39, 1
  store i32 %40, ptr %38, align 8, !tbaa !22
  %41 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not50 = icmp eq i8 %41, 0
  br i1 %.not50, label %90, label %42

42:                                               ; preds = %36
  %43 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not51 = icmp eq i8 %43, 0
  br i1 %.not51, label %90, label %44

44:                                               ; preds = %42
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.8) #3
  br label %90

45:                                               ; preds = %34
  %46 = tail call zeroext i8 @ScsiDiskIsResetBefore(ptr noundef %1, i64 noundef %2)
  %.not35 = icmp eq i8 %46, 0
  br i1 %.not35, label %52, label %47

47:                                               ; preds = %45
  store i64 2, ptr %3, align 8, !tbaa !5
  %48 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not48 = icmp eq i8 %48, 0
  br i1 %.not48, label %90, label %49

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

51:                                               ; preds = %49
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.9) #3
  br label %90

52:                                               ; preds = %45
  %53 = tail call zeroext i8 @ScsiDiskIsMediaError(ptr noundef %1, i64 noundef %2)
  %.not36 = icmp eq i8 %53, 0
  br i1 %.not36, label %60, label %54

54:                                               ; preds = %52
  %55 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not46 = icmp eq i8 %55, 0
  br i1 %.not46, label %59, label %56

56:                                               ; preds = %54
  %57 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not47 = icmp eq i8 %57, 0
  br i1 %.not47, label %59, label %58

58:                                               ; preds = %56
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.10) #3
  br label %59

59:                                               ; preds = %56, %58, %54
  store i64 3, ptr %3, align 8, !tbaa !5
  br label %90

60:                                               ; preds = %52
  %61 = tail call zeroext i8 @ScsiDiskIsHardwareError(ptr noundef %1, i64 noundef %2)
  %.not37 = icmp eq i8 %61, 0
  br i1 %.not37, label %68, label %62

62:                                               ; preds = %60
  %63 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not44 = icmp eq i8 %63, 0
  br i1 %.not44, label %67, label %64

64:                                               ; preds = %62
  %65 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not45 = icmp eq i8 %65, 0
  br i1 %.not45, label %67, label %66

66:                                               ; preds = %64
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.11) #3
  br label %67

67:                                               ; preds = %64, %66, %62
  store i64 3, ptr %3, align 8, !tbaa !5
  br label %90

68:                                               ; preds = %60
  %69 = call zeroext i8 @ScsiDiskIsDriveReady(ptr noundef %1, i64 noundef %2, ptr noundef nonnull %5)
  %.not38 = icmp eq i8 %69, 0
  br i1 %.not38, label %70, label %78

70:                                               ; preds = %68
  %71 = load i8, ptr %5, align 1, !tbaa !23
  %.not39 = icmp eq i8 %71, 0
  br i1 %.not39, label %77, label %72

72:                                               ; preds = %70
  store i64 2, ptr %3, align 8, !tbaa !5
  %73 = call zeroext i8 @DebugPrintEnabled() #3
  %.not40 = icmp eq i8 %73, 0
  br i1 %.not40, label %90, label %74

74:                                               ; preds = %72
  %75 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not41 = icmp eq i8 %75, 0
  br i1 %.not41, label %90, label %76

76:                                               ; preds = %74
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.12) #3
  br label %90

77:                                               ; preds = %70
  store i64 0, ptr %3, align 8, !tbaa !5
  br label %90

78:                                               ; preds = %68
  store i64 3, ptr %3, align 8, !tbaa !5
  %79 = call zeroext i8 @DebugPrintEnabled() #3
  %.not42 = icmp eq i8 %79, 0
  br i1 %.not42, label %90, label %80

80:                                               ; preds = %78
  %81 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4194304) #3
  %.not43 = icmp eq i8 %81, 0
  br i1 %.not43, label %90, label %82

82:                                               ; preds = %80
  %83 = getelementptr inbounds i8, ptr %1, i64 2
  %84 = load i8, ptr %83, align 1
  %85 = and i8 %84, 15
  %86 = zext nneg i8 %85 to i32
  %87 = getelementptr inbounds i8, ptr %1, i64 12
  %88 = load i8, ptr %87, align 1, !tbaa !24
  %89 = zext i8 %88 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4194304, ptr noundef nonnull @.str.13, i32 noundef %86, i32 noundef %89) #3
  br label %90

90:                                               ; preds = %78, %82, %80, %72, %76, %74, %47, %51, %49, %36, %44, %42, %25, %33, %31, %16, %22, %7, %13, %77, %67, %59
  %.0 = phi i64 [ -9223372036854775801, %59 ], [ -9223372036854775801, %67 ], [ -9223372036854775801, %77 ], [ 0, %13 ], [ 0, %7 ], [ 0, %22 ], [ 0, %16 ], [ 0, %31 ], [ 0, %33 ], [ 0, %25 ], [ 0, %42 ], [ 0, %44 ], [ 0, %36 ], [ 0, %49 ], [ 0, %51 ], [ 0, %47 ], [ 0, %74 ], [ 0, %76 ], [ 0, %72 ], [ 0, %80 ], [ 0, %82 ], [ 0, %78 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  ret i64 %.0
}

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

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

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

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass