; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/OvmfPkg (BlockIoInit)

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE = type { i32, ptr, ptr, ptr, ptr, %struct._EFI_BLOCK_IO_PROTOCOL }
%struct._EFI_BLOCK_IO_PROTOCOL = type { i64, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct._BLOCK_MMIO_PROTOCOL = type { i64, ptr, i64 }
%struct.EFI_BLOCK_IO_MEDIA = type { i32, i8, i8, i8, i8, i8, i32, i32, i64, i64, i32, i32 }

@.str = external hidden unnamed_addr constant [141 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@gBS = external global ptr, align 8
@gEfiCpuIo2ProtocolGuid = external global %struct.GUID, align 4
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@gBlockMmioProtocolGuid = external global %struct.GUID, align 4
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@gEfiBlockIoProtocolGuid = external global %struct.GUID, align 4

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

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

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

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @BlockIoInit(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %10 = call ptr @AllocateZeroPool(i64 noundef 88)
  store ptr %10, ptr %7, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %2
  %12 = call zeroext i8 @DebugAssertEnabled()
  %13 = icmp ne i8 %12, 0
  br i1 %13, label %14, label %19

14:                                               ; preds = %11
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  call void @DebugAssert(ptr noundef @.str, i64 noundef 291, ptr noundef @.str.4)
  br label %18

18:                                               ; preds = %17, %14
  br label %19

19:                                               ; preds = %18, %11
  br label %20

20:                                               ; preds = %19
  br label %21

21:                                               ; preds = %20
  %22 = load ptr, ptr @gBS, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %22, i32 0, i32 38
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %25, i32 0, i32 3
  %27 = call i64 %24(ptr noundef @gEfiCpuIo2ProtocolGuid, ptr noundef null, ptr noundef %26)
  store i64 %27, ptr %6, align 8, !tbaa !14
  br label %28

28:                                               ; preds = %21
  %29 = call zeroext i8 @DebugAssertEnabled()
  %30 = icmp ne i8 %29, 0
  br i1 %30, label %31, label %51

31:                                               ; preds = %28
  %32 = load i64, ptr %6, align 8, !tbaa !14
  %33 = icmp slt i64 %32, 0
  br i1 %33, label %34, label %50

34:                                               ; preds = %31
  br label %35

35:                                               ; preds = %34
  %36 = call zeroext i8 @DebugPrintEnabled()
  %37 = icmp ne i8 %36, 0
  br i1 %37, label %38, label %47

38:                                               ; preds = %35
  br label %39

39:                                               ; preds = %38
  %40 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %39
  %43 = load i64, ptr %6, align 8, !tbaa !14
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.5, i64 noundef %43)
  br label %44

44:                                               ; preds = %42, %39
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46, %35
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  call void @DebugAssert(ptr noundef @.str, i64 noundef 298, ptr noundef @.str.6)
  br label %50

50:                                               ; preds = %49, %31
  br label %51

51:                                               ; preds = %50, %28
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = load ptr, ptr @gBS, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %54, i32 0, i32 33
  %56 = load ptr, ptr %55, align 8, !tbaa !15
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %58, i32 0, i32 5
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = call i64 %56(ptr noundef %57, ptr noundef @gBlockMmioProtocolGuid, ptr noundef %8, ptr noundef %60, ptr noundef %61, i32 noundef 16)
  store i64 %62, ptr %6, align 8, !tbaa !14
  %63 = load i64, ptr %6, align 8, !tbaa !14
  %64 = icmp slt i64 %63, 0
  br i1 %64, label %65, label %81

65:                                               ; preds = %53
  br label %66

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

69:                                               ; preds = %66
  br label %70

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

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

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

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  br label %78

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

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  br label %172

81:                                               ; preds = %53
  br label %82

82:                                               ; preds = %81
  %83 = call zeroext i8 @DebugPrintEnabled()
  %84 = icmp ne i8 %83, 0
  br i1 %84, label %85, label %94

85:                                               ; preds = %82
  br label %86

86:                                               ; preds = %85
  %87 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %88 = icmp ne i8 %87, 0
  br i1 %88, label %89, label %91

89:                                               ; preds = %86
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.8, ptr noundef %90)
  br label %91

91:                                               ; preds = %89, %86
  br label %92

92:                                               ; preds = %91
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93, %82
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95
  br label %97

97:                                               ; preds = %96
  %98 = call zeroext i8 @DebugPrintEnabled()
  %99 = icmp ne i8 %98, 0
  br i1 %99, label %100, label %113

100:                                              ; preds = %97
  br label %101

101:                                              ; preds = %100
  %102 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %103 = icmp ne i8 %102, 0
  br i1 %103, label %104, label %110

104:                                              ; preds = %101
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._BLOCK_MMIO_PROTOCOL, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !18
  %108 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %107, i32 0, i32 8
  %109 = load i64, ptr %108, align 8, !tbaa !20
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.9, i64 noundef %109)
  br label %110

110:                                              ; preds = %104, %101
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112, %97
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %116, i32 0, i32 0
  store i32 1330203970, ptr %117, align 8, !tbaa !22
  %118 = load ptr, ptr %5, align 8, !tbaa !5
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %119, i32 0, i32 1
  store ptr %118, ptr %120, align 8, !tbaa !25
  %121 = load ptr, ptr %8, align 8, !tbaa !5
  %122 = load ptr, ptr %7, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %122, i32 0, i32 2
  store ptr %121, ptr %123, align 8, !tbaa !26
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._BLOCK_MMIO_PROTOCOL, ptr %124, i32 0, i32 1
  %126 = load ptr, ptr %125, align 8, !tbaa !18
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %127, i32 0, i32 5
  %129 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %128, i32 0, i32 1
  store ptr %126, ptr %129, align 8, !tbaa !27
  %130 = load ptr, ptr %7, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %130, i32 0, i32 5
  %132 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %131, i32 0, i32 2
  store ptr @BlockIoReset, ptr %132, align 8, !tbaa !28
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %133, i32 0, i32 5
  %135 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %134, i32 0, i32 3
  store ptr @BlockIoReadBlocks, ptr %135, align 8, !tbaa !29
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %136, i32 0, i32 5
  %138 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %137, i32 0, i32 4
  store ptr @BlockIoWriteBlocks, ptr %138, align 8, !tbaa !30
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %139, i32 0, i32 5
  %141 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %140, i32 0, i32 5
  store ptr @BlockIoFlushBlocks, ptr %141, align 8, !tbaa !31
  br label %142

142:                                              ; preds = %115
  %143 = call zeroext i8 @DebugPrintEnabled()
  %144 = icmp ne i8 %143, 0
  br i1 %144, label %145, label %159

145:                                              ; preds = %142
  br label %146

146:                                              ; preds = %145
  %147 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %148 = icmp ne i8 %147, 0
  br i1 %148, label %149, label %156

149:                                              ; preds = %146
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %150, i32 0, i32 5
  %152 = getelementptr inbounds %struct._EFI_BLOCK_IO_PROTOCOL, ptr %151, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !27
  %154 = getelementptr inbounds %struct.EFI_BLOCK_IO_MEDIA, ptr %153, i32 0, i32 8
  %155 = load i64, ptr %154, align 8, !tbaa !20
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.10, i64 noundef %155)
  br label %156

156:                                              ; preds = %149, %146
  br label %157

157:                                              ; preds = %156
  br label %158

158:                                              ; preds = %157
  br label %159

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

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  %162 = load ptr, ptr @gBS, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %162, i32 0, i32 14
  %164 = load ptr, ptr %163, align 8, !tbaa !32
  %165 = load ptr, ptr %7, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.BLOCK_MMIO_TO_BLOCK_IO_DEVICE, ptr %165, i32 0, i32 5
  %167 = call i64 %164(ptr noundef %5, ptr noundef @gEfiBlockIoProtocolGuid, i32 noundef 0, ptr noundef %166)
  store i64 %167, ptr %6, align 8, !tbaa !14
  %168 = load i64, ptr %6, align 8, !tbaa !14
  %169 = icmp slt i64 %168, 0
  br i1 %169, label %170, label %171

170:                                              ; preds = %161
  br label %172

171:                                              ; preds = %161
  store i64 0, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %192

172:                                              ; preds = %170, %80
  %173 = load ptr, ptr %7, align 8, !tbaa !5
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %177

175:                                              ; preds = %172
  %176 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %176)
  br label %177

177:                                              ; preds = %175, %172
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %190

180:                                              ; preds = %177
  %181 = load ptr, ptr @gBS, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %181, i32 0, i32 34
  %183 = load ptr, ptr %182, align 8, !tbaa !33
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  %185 = load ptr, ptr %4, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct._EFI_DRIVER_BINDING_PROTOCOL, ptr %185, i32 0, i32 5
  %187 = load ptr, ptr %186, align 8, !tbaa !16
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  %189 = call i64 %183(ptr noundef %184, ptr noundef @gBlockMmioProtocolGuid, ptr noundef %187, ptr noundef %188)
  br label %190

190:                                              ; preds = %180, %177
  %191 = load i64, ptr %6, align 8, !tbaa !14
  store i64 %191, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %192

192:                                              ; preds = %190, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %193 = load i64, ptr %3, align 8
  ret i64 %193
}

declare ptr @AllocateZeroPool(i64 noundef) #2

declare void @FreePool(ptr noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 320}
!10 = !{!"", !11, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !6, i64 280}
!16 = !{!17, !6, i64 40}
!17 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!18 = !{!19, !6, i64 8}
!19 = !{!"_BLOCK_MMIO_PROTOCOL", !12, i64 0, !6, i64 8, !12, i64 16}
!20 = !{!21, !12, i64 24}
!21 = !{!"", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !13, i64 12, !13, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 44}
!22 = !{!23, !13, i64 0}
!23 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !24, i64 40}
!24 = !{!"_EFI_BLOCK_IO_PROTOCOL", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!25 = !{!23, !6, i64 8}
!26 = !{!23, !6, i64 16}
!27 = !{!23, !6, i64 48}
!28 = !{!23, !6, i64 56}
!29 = !{!23, !6, i64 64}
!30 = !{!23, !6, i64 72}
!31 = !{!23, !6, i64 80}
!32 = !{!10, !6, i64 128}
!33 = !{!10, !6, i64 288}


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

%struct.GUID = type { i32, i16, i16, [8 x i8] }

@.str = external hidden unnamed_addr constant [141 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [24 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiCpuIo2ProtocolGuid = external global %struct.GUID, align 4
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [20 x i8], align 1
@gBlockMmioProtocolGuid = external global %struct.GUID, align 4
@.str.7 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [42 x i8], align 1
@gEfiBlockIoProtocolGuid = external global %struct.GUID, align 4

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @BlockIoInit(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %5 = tail call ptr @AllocateZeroPool(i64 noundef 88) #3
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %7 = icmp eq i8 %6, 0
  %8 = icmp ne ptr %5, null
  %or.cond = select i1 %7, i1 true, i1 %8
  br i1 %or.cond, label %10, label %9

9:                                                ; preds = %2
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 291, ptr noundef nonnull @.str.4) #3
  br label %10

10:                                               ; preds = %9, %2
  %11 = load ptr, ptr @gBS, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 320
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = getelementptr inbounds i8, ptr %5, i64 24
  %15 = tail call i64 %13(ptr noundef nonnull @gEfiCpuIo2ProtocolGuid, ptr noundef null, ptr noundef nonnull %14) #3
  %16 = tail call zeroext i8 @DebugAssertEnabled() #3
  %17 = icmp ne i8 %16, 0
  %18 = icmp slt i64 %15, 0
  %or.cond3 = select i1 %17, i1 %18, i1 false
  br i1 %or.cond3, label %19, label %25

19:                                               ; preds = %10
  %20 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not = icmp eq i8 %20, 0
  br i1 %.not, label %24, label %21

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

23:                                               ; preds = %21
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.5, i64 noundef %15) #3
  br label %24

24:                                               ; preds = %21, %23, %19
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 298, ptr noundef nonnull @.str.6) #3
  br label %25

25:                                               ; preds = %24, %10
  %26 = load ptr, ptr @gBS, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 280
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = getelementptr inbounds i8, ptr %0, i64 40
  %30 = load ptr, ptr %29, align 8, !tbaa !15
  %31 = call i64 %28(ptr noundef %1, ptr noundef nonnull @gBlockMmioProtocolGuid, ptr noundef nonnull %4, ptr noundef %30, ptr noundef %1, i32 noundef 16) #3
  %32 = icmp slt i64 %31, 0
  %33 = call zeroext i8 @DebugPrintEnabled() #3
  %.not37 = icmp eq i8 %33, 0
  br i1 %32, label %34, label %38

34:                                               ; preds = %25
  br i1 %.not37, label %78, label %35

35:                                               ; preds = %34
  %36 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not38 = icmp eq i8 %36, 0
  br i1 %.not38, label %78, label %37

37:                                               ; preds = %35
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.7, i64 noundef %31) #3
  br label %78

38:                                               ; preds = %25
  br i1 %.not37, label %43, label %39

39:                                               ; preds = %38
  %40 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not32 = icmp eq i8 %40, 0
  br i1 %.not32, label %43, label %41

41:                                               ; preds = %39
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.8, ptr noundef %42) #3
  br label %43

43:                                               ; preds = %38, %41, %39
  %44 = call zeroext i8 @DebugPrintEnabled() #3
  %.not33 = icmp eq i8 %44, 0
  br i1 %.not33, label %53, label %45

45:                                               ; preds = %43
  %46 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not34 = icmp eq i8 %46, 0
  br i1 %.not34, label %53, label %47

47:                                               ; preds = %45
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %48, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !17
  %51 = getelementptr inbounds i8, ptr %50, i64 24
  %52 = load i64, ptr %51, align 8, !tbaa !19
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.9, i64 noundef %52) #3
  br label %53

53:                                               ; preds = %45, %47, %43
  store i32 1330203970, ptr %5, align 8, !tbaa !21
  %54 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %1, ptr %54, align 8, !tbaa !24
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %55, ptr %56, align 8, !tbaa !25
  %57 = getelementptr inbounds i8, ptr %55, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = getelementptr inbounds i8, ptr %5, i64 40
  %60 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %58, ptr %60, align 8, !tbaa !26
  %61 = getelementptr inbounds i8, ptr %5, i64 56
  store ptr @BlockIoReset, ptr %61, align 8, !tbaa !27
  %62 = getelementptr inbounds i8, ptr %5, i64 64
  store ptr @BlockIoReadBlocks, ptr %62, align 8, !tbaa !28
  %63 = getelementptr inbounds i8, ptr %5, i64 72
  store ptr @BlockIoWriteBlocks, ptr %63, align 8, !tbaa !29
  %64 = getelementptr inbounds i8, ptr %5, i64 80
  store ptr @BlockIoFlushBlocks, ptr %64, align 8, !tbaa !30
  %65 = call zeroext i8 @DebugPrintEnabled() #3
  %.not35 = icmp eq i8 %65, 0
  br i1 %.not35, label %72, label %66

66:                                               ; preds = %53
  %67 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #3
  %.not36 = icmp eq i8 %67, 0
  br i1 %.not36, label %72, label %68

68:                                               ; preds = %66
  %69 = load ptr, ptr %60, align 8, !tbaa !26
  %70 = getelementptr inbounds i8, ptr %69, i64 24
  %71 = load i64, ptr %70, align 8, !tbaa !19
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.10, i64 noundef %71) #3
  br label %72

72:                                               ; preds = %66, %68, %53
  %73 = load ptr, ptr @gBS, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 128
  %75 = load ptr, ptr %74, align 8, !tbaa !31
  %76 = call i64 %75(ptr noundef nonnull %3, ptr noundef nonnull @gEfiBlockIoProtocolGuid, i32 noundef 0, ptr noundef nonnull %59) #3
  %77 = icmp slt i64 %76, 0
  br i1 %77, label %.thread, label %88

78:                                               ; preds = %34, %37, %35
  br i1 %8, label %.thread, label %79

.thread:                                          ; preds = %72, %78
  %.02542 = phi i64 [ %31, %78 ], [ %76, %72 ]
  call void @FreePool(ptr noundef nonnull %5) #3
  br label %79

79:                                               ; preds = %.thread, %78
  %.02541 = phi i64 [ %.02542, %.thread ], [ %31, %78 ]
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %.not39 = icmp eq ptr %80, null
  br i1 %.not39, label %88, label %81

81:                                               ; preds = %79
  %82 = load ptr, ptr @gBS, align 8, !tbaa !5
  %83 = getelementptr inbounds i8, ptr %82, i64 288
  %84 = load ptr, ptr %83, align 8, !tbaa !32
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = load ptr, ptr %29, align 8, !tbaa !15
  %87 = call i64 %84(ptr noundef %85, ptr noundef nonnull @gBlockMmioProtocolGuid, ptr noundef %86, ptr noundef %85) #3
  br label %88

88:                                               ; preds = %79, %81, %72
  %.0 = phi i64 [ 0, %72 ], [ %.02541, %81 ], [ %.02541, %79 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  ret i64 %.0
}

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 320}
!10 = !{!"", !11, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !6, i64 280}
!15 = !{!16, !6, i64 40}
!16 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !6, i64 8}
!18 = !{!"_BLOCK_MMIO_PROTOCOL", !12, i64 0, !6, i64 8, !12, i64 16}
!19 = !{!20, !12, i64 24}
!20 = !{!"", !13, i64 0, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !13, i64 12, !13, i64 16, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 44}
!21 = !{!22, !13, i64 0}
!22 = !{!"", !13, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !23, i64 40}
!23 = !{!"_EFI_BLOCK_IO_PROTOCOL", !12, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!24 = !{!22, !6, i64 8}
!25 = !{!22, !6, i64 16}
!26 = !{!22, !6, i64 48}
!27 = !{!22, !6, i64 56}
!28 = !{!22, !6, i64 64}
!29 = !{!22, !6, i64 72}
!30 = !{!22, !6, i64 80}
!31 = !{!10, !6, i64 128}
!32 = !{!10, !6, i64 288}


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