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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @FreeAlignedBuffer(ptr 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 ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

declare i64 @MultU64x32(i64 noundef, i32 noundef) #2

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

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

37:                                               ; preds = %5
  store i64 -9223372036854775801, ptr %6, align 8
  store i32 1, ptr %19, align 4
  br label %136

38:                                               ; preds = %5
  store i8 1, ptr %14, align 1, !tbaa !9
  br label %39

39:                                               ; preds = %131, %38
  %40 = load i8, ptr %14, align 1, !tbaa !9
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %132

42:                                               ; preds = %39
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = call ptr @ZeroMem(ptr noundef %43, i64 noundef 18)
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %45, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !23
  %48 = call i64 @MultU64x32(i64 noundef 3, i32 noundef 10000000)
  %49 = load ptr, ptr %12, align 8, !tbaa !5
  %50 = call i64 @ScsiRequestSenseCommand(ptr noundef %47, i64 noundef %48, ptr noundef %49, ptr noundef %13, ptr noundef %17, ptr noundef %18)
  store i64 %50, ptr %15, align 8, !tbaa !10
  %51 = load i64, ptr %15, align 8, !tbaa !10
  %52 = icmp eq i64 %51, 0
  br i1 %52, label %56, label %53

53:                                               ; preds = %42
  %54 = load i64, ptr %15, align 8, !tbaa !10
  %55 = icmp eq i64 %54, 4
  br i1 %55, label %56, label %57

56:                                               ; preds = %53, %42
  store i64 0, ptr %16, align 8, !tbaa !10
  br label %93

57:                                               ; preds = %53
  %58 = load i64, ptr %15, align 8, !tbaa !10
  %59 = icmp eq i64 %58, -9223372036854775790
  br i1 %59, label %63, label %60

60:                                               ; preds = %57
  %61 = load i64, ptr %15, align 8, !tbaa !10
  %62 = icmp eq i64 %61, -9223372036854775802
  br i1 %62, label %63, label %65

63:                                               ; preds = %60, %57
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 1, ptr %64, align 1, !tbaa !9
  store i64 -9223372036854775801, ptr %16, align 8, !tbaa !10
  br label %92

65:                                               ; preds = %60
  %66 = load i64, ptr %15, align 8, !tbaa !10
  %67 = icmp eq i64 %66, -9223372036854775806
  br i1 %67, label %71, label %68

68:                                               ; preds = %65
  %69 = load i64, ptr %15, align 8, !tbaa !10
  %70 = icmp eq i64 %69, -9223372036854775805
  br i1 %70, label %71, label %73

71:                                               ; preds = %68, %65
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 0, ptr %72, align 1, !tbaa !9
  store i64 -9223372036854775801, ptr %16, align 8, !tbaa !10
  br label %91

73:                                               ; preds = %68
  %74 = load i64, ptr %15, align 8, !tbaa !10
  %75 = icmp eq i64 %74, -9223372036854775801
  br i1 %75, label %76, label %90

76:                                               ; preds = %73
  %77 = load i8, ptr %11, align 1, !tbaa !9
  %78 = icmp ne i8 %77, 0
  br i1 %78, label %79, label %89

79:                                               ; preds = %76
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  %83 = getelementptr inbounds %struct._EFI_SCSI_IO_PROTOCOL, ptr %82, i32 0, i32 3
  %84 = load ptr, ptr %83, align 8, !tbaa !24
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %85, i32 0, i32 4
  %87 = load ptr, ptr %86, align 8, !tbaa !23
  %88 = call i64 %84(ptr noundef %87)
  br label %89

89:                                               ; preds = %79, %76
  store i64 -9223372036854775801, ptr %16, align 8, !tbaa !10
  br label %90

90:                                               ; preds = %89, %73
  br label %91

91:                                               ; preds = %90, %71
  br label %92

92:                                               ; preds = %91, %63
  br label %93

93:                                               ; preds = %92, %56
  %94 = load i64, ptr %16, align 8, !tbaa !10
  %95 = icmp slt i64 %94, 0
  br i1 %95, label %96, label %103

96:                                               ; preds = %93
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = load i64, ptr %97, align 8, !tbaa !10
  %99 = icmp ne i64 %98, 0
  br i1 %99, label %100, label %102

100:                                              ; preds = %96
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  store i8 0, ptr %101, align 1, !tbaa !9
  store i64 0, ptr %15, align 8, !tbaa !10
  br label %133

102:                                              ; preds = %96
  store i64 -9223372036854775801, ptr %15, align 8, !tbaa !10
  br label %133

103:                                              ; preds = %93
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %104, i32 0, i32 8
  %106 = load ptr, ptr %105, align 8, !tbaa !12
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = load i64, ptr %107, align 8, !tbaa !10
  %109 = getelementptr inbounds %struct.EFI_SCSI_SENSE_DATA, ptr %106, i64 %108
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = load i8, ptr %13, align 1, !tbaa !9
  %112 = zext i8 %111 to i64
  %113 = call ptr @CopyMem(ptr noundef %109, ptr noundef %110, i64 noundef %112)
  %114 = load ptr, ptr %10, align 8, !tbaa !5
  %115 = load i64, ptr %114, align 8, !tbaa !10
  %116 = add i64 %115, 1
  store i64 %116, ptr %114, align 8, !tbaa !10
  %117 = load ptr, ptr %12, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.EFI_SCSI_SENSE_DATA, ptr %117, i32 0, i32 2
  %119 = load i8, ptr %118, align 1
  %120 = and i8 %119, 15
  %121 = zext i8 %120 to i32
  %122 = icmp eq i32 %121, 0
  br i1 %122, label %130, label %123

123:                                              ; preds = %103
  %124 = load ptr, ptr %10, align 8, !tbaa !5
  %125 = load i64, ptr %124, align 8, !tbaa !10
  %126 = load ptr, ptr %7, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.SCSI_DISK_DEV, ptr %126, i32 0, i32 9
  %128 = load i64, ptr %127, align 8, !tbaa !22
  %129 = icmp eq i64 %125, %128
  br i1 %129, label %130, label %131

130:                                              ; preds = %123, %103
  store i8 0, ptr %14, align 1, !tbaa !9
  br label %131

131:                                              ; preds = %130, %123
  br label %39, !llvm.loop !26

132:                                              ; preds = %39
  br label %133

133:                                              ; preds = %132, %102, %100
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreeAlignedBuffer(ptr noundef %134, i64 noundef 18)
  %135 = load i64, ptr %15, align 8, !tbaa !10
  store i64 %135, ptr %6, align 8
  store i32 1, ptr %19, align 4
  br label %136

136:                                              ; preds = %133, %37
  call void @llvm.lifetime.end.p0(i64 1, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %137 = load i64, ptr %6, align 8
  ret i64 %137
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !7, i64 0}
!12 = !{!13, !6, i64 128}
!13 = !{!"", !14, i64 0, !6, i64 8, !15, i64 16, !16, i64 64, !6, i64 112, !7, i64 120, !7, i64 121, !17, i64 122, !6, i64 128, !11, i64 136, !18, i64 144, !6, i64 240, !19, i64 248, !14, i64 296, !14, i64 300, !21, i64 304, !7, i64 816}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_EFI_BLOCK_IO_PROTOCOL", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!"", !14, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !14, i64 12, !14, i64 16, !11, i64 24, !11, i64 32, !14, i64 40, !14, i64 44}
!17 = !{!"short", !7, i64 0}
!18 = !{!"", !7, i64 0, !7, i64 0, !7, i64 1, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5}
!19 = !{!"_EFI_DISK_INFO_PROTOCOL", !20, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!"", !14, i64 0, !17, i64 4, !17, i64 6, !7, i64 8}
!21 = !{!"", !17, i64 0, !17, i64 2, !17, i64 4, !7, i64 6, !7, i64 20, !7, i64 40, !7, i64 46, !7, i64 54, !7, i64 94, !17, i64 98, !17, i64 100, !17, i64 102, !17, i64 104, !17, i64 106, !7, i64 108, !17, i64 124, !17, i64 126, !17, i64 128, !17, i64 130, !17, i64 132, !17, i64 134, !17, i64 136, !7, i64 138, !7, i64 142, !7, i64 146, !17, i64 150, !17, i64 152, !17, i64 154, !17, i64 156, !17, i64 158, !17, i64 160, !17, i64 162, !17, i64 164, !17, i64 166, !17, i64 168, !17, i64 170, !17, i64 172, !17, i64 174, !17, i64 176, !17, i64 178, !17, i64 180, !17, i64 182, !17, i64 184, !17, i64 186, !17, i64 188, !7, i64 190, !7, i64 216, !7, i64 224, !7, i64 232, !17, i64 238, !17, i64 240, !7, i64 242, !17, i64 250, !7, i64 252, !17, i64 256, !7, i64 258, !7, i64 320, !7, i64 352, !17, i64 444, !17, i64 446, !7, i64 448, !17, i64 510}
!22 = !{!13, !11, i64 136}
!23 = !{!13, !6, i64 112}
!24 = !{!25, !6, i64 24}
!25 = !{!"_EFI_SCSI_IO_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.EFI_SCSI_SENSE_DATA = type { i8, i8, i8, [4 x i8], i8, [4 x i8], i8, i8, i8, [3 x i8] }

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

; Function Attrs: nounwind uwtable
declare dso_local void @FreeAlignedBuffer(ptr 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 ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i64 @MultU64x32(i64 noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local i64 @ScsiDiskRequestSenseKeys(ptr noundef %0, ptr nocapture noundef writeonly %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef %3, i8 noundef zeroext %4) local_unnamed_addr #0 {
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %8) #3
  store i8 18, ptr %6, align 1, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %0, i64 128
  %10 = load ptr, ptr %9, align 8, !tbaa !8
  %11 = getelementptr inbounds i8, ptr %0, i64 136
  %12 = load i64, ptr %11, align 8, !tbaa !20
  %13 = mul i64 %12, 18
  %14 = tail call ptr @ZeroMem(ptr noundef %10, i64 noundef %13) #3
  store i64 0, ptr %3, align 8, !tbaa !21
  %15 = load ptr, ptr %9, align 8, !tbaa !8
  store ptr %15, ptr %2, align 8, !tbaa !22
  %16 = tail call ptr @AllocateAlignedBuffer(ptr noundef %0, i64 noundef 18)
  %17 = icmp eq ptr %16, null
  br i1 %17, label %56, label %.preheader

.preheader:                                       ; preds = %5
  %18 = getelementptr inbounds i8, ptr %0, i64 112
  %19 = getelementptr inbounds i8, ptr %16, i64 2
  br label %20

20:                                               ; preds = %53, %.preheader
  %21 = call ptr @ZeroMem(ptr noundef nonnull %16, i64 noundef 18) #3
  %22 = load ptr, ptr %18, align 8, !tbaa !23
  %23 = call i64 @MultU64x32(i64 noundef 3, i32 noundef 10000000) #3
  %24 = call i64 @ScsiRequestSenseCommand(ptr noundef %22, i64 noundef %23, ptr noundef nonnull %16, ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %8) #3
  %25 = and i64 %24, -5
  %or.cond = icmp eq i64 %25, 0
  br i1 %or.cond, label %41, label %26

26:                                               ; preds = %20
  switch i64 %24, label %28 [
    i64 -9223372036854775790, label %27
    i64 -9223372036854775802, label %27
  ]

27:                                               ; preds = %26, %26
  store i8 1, ptr %1, align 1, !tbaa !5
  br label %.critedge

28:                                               ; preds = %26
  %29 = and i64 %24, -2
  %or.cond5 = icmp eq i64 %29, -9223372036854775806
  br i1 %or.cond5, label %30, label %31

30:                                               ; preds = %28
  store i8 0, ptr %1, align 1, !tbaa !5
  br label %.critedge

31:                                               ; preds = %28
  %32 = icmp eq i64 %24, -9223372036854775801
  br i1 %32, label %33, label %41

33:                                               ; preds = %31
  %.not47 = icmp eq i8 %4, 0
  br i1 %.not47, label %.critedge, label %34

34:                                               ; preds = %33
  %35 = load ptr, ptr %18, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %35, i64 24
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = call i64 %37(ptr noundef %35) #3
  br label %.critedge

.critedge:                                        ; preds = %33, %34, %30, %27
  %39 = load i64, ptr %3, align 8, !tbaa !21
  %.not48 = icmp eq i64 %39, 0
  br i1 %.not48, label %.loopexit, label %40

40:                                               ; preds = %.critedge
  store i8 0, ptr %1, align 1, !tbaa !5
  br label %.loopexit

41:                                               ; preds = %31, %20
  %42 = load ptr, ptr %9, align 8, !tbaa !8
  %43 = load i64, ptr %3, align 8, !tbaa !21
  %44 = getelementptr inbounds %struct.EFI_SCSI_SENSE_DATA, ptr %42, i64 %43
  %45 = load i8, ptr %6, align 1, !tbaa !5
  %46 = zext i8 %45 to i64
  %47 = call ptr @CopyMem(ptr noundef %44, ptr noundef nonnull %16, i64 noundef %46) #3
  %48 = load i64, ptr %3, align 8, !tbaa !21
  %49 = add i64 %48, 1
  store i64 %49, ptr %3, align 8, !tbaa !21
  %50 = load i8, ptr %19, align 1
  %51 = and i8 %50, 15
  %52 = icmp eq i8 %51, 0
  br i1 %52, label %.loopexit, label %53

53:                                               ; preds = %41
  %54 = load i64, ptr %11, align 8, !tbaa !20
  %55 = icmp eq i64 %49, %54
  br i1 %55, label %.loopexit, label %20, !llvm.loop !26

.loopexit:                                        ; preds = %53, %41, %.critedge, %40
  %.141 = phi i64 [ 0, %40 ], [ -9223372036854775801, %.critedge ], [ %24, %41 ], [ %24, %53 ]
  call void @FreeAlignedBuffer(ptr noundef nonnull %16, i64 noundef 18)
  br label %56

56:                                               ; preds = %5, %.loopexit
  %.044 = phi i64 [ %.141, %.loopexit ], [ -9223372036854775801, %5 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #3
  ret i64 %.044
}

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !11, i64 128}
!9 = !{!"", !10, i64 0, !11, i64 8, !12, i64 16, !14, i64 64, !11, i64 112, !6, i64 120, !6, i64 121, !15, i64 122, !11, i64 128, !13, i64 136, !16, i64 144, !11, i64 240, !17, i64 248, !10, i64 296, !10, i64 300, !19, i64 304, !6, i64 816}
!10 = !{!"int", !6, i64 0}
!11 = !{!"any pointer", !6, i64 0}
!12 = !{!"_EFI_BLOCK_IO_PROTOCOL", !13, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!13 = !{!"long long", !6, i64 0}
!14 = !{!"", !10, i64 0, !6, i64 4, !6, i64 5, !6, i64 6, !6, i64 7, !6, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !13, i64 32, !10, i64 40, !10, i64 44}
!15 = !{!"short", !6, i64 0}
!16 = !{!"", !6, i64 0, !6, i64 0, !6, i64 1, !6, i64 1, !6, i64 2, !6, i64 3, !6, i64 4, !6, i64 5}
!17 = !{!"_EFI_DISK_INFO_PROTOCOL", !18, i64 0, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40}
!18 = !{!"", !10, i64 0, !15, i64 4, !15, i64 6, !6, i64 8}
!19 = !{!"", !15, i64 0, !15, i64 2, !15, i64 4, !6, i64 6, !6, i64 20, !6, i64 40, !6, i64 46, !6, i64 54, !6, i64 94, !15, i64 98, !15, i64 100, !15, i64 102, !15, i64 104, !15, i64 106, !6, i64 108, !15, i64 124, !15, i64 126, !15, i64 128, !15, i64 130, !15, i64 132, !15, i64 134, !15, i64 136, !6, i64 138, !6, i64 142, !6, 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, !6, i64 190, !6, i64 216, !6, i64 224, !6, i64 232, !15, i64 238, !15, i64 240, !6, i64 242, !15, i64 250, !6, i64 252, !15, i64 256, !6, i64 258, !6, i64 320, !6, i64 352, !15, i64 444, !15, i64 446, !6, i64 448, !15, i64 510}
!20 = !{!9, !13, i64 136}
!21 = !{!13, !13, i64 0}
!22 = !{!11, !11, i64 0}
!23 = !{!9, !11, i64 112}
!24 = !{!25, !11, i64 24}
!25 = !{!"_EFI_SCSI_IO_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !10, i64 40}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


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