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

; 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.CIRRUS_LOGIC_5430_VIDEO_MODES = type { i32, i32, i32, i32, ptr, ptr, i8 }
%struct.VALID_EDID_TIMING = type { i32, [17 x i32] }
%struct.EDID_TIMING = type { i16, i16, i16 }
%struct.CIRRUS_LOGIC_5430_PRIVATE_DATA = type { i64, ptr, ptr, i64, %struct._EFI_UGA_DRAW_PROTOCOL, %struct._EFI_GRAPHICS_OUTPUT_PROTOCOL, %struct.EFI_EDID_DISCOVERED_PROTOCOL, %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr, ptr, i64, i64, [3 x %struct.CIRRUS_LOGIC_5430_MODE_DATA], ptr, i8 }
%struct._EFI_UGA_DRAW_PROTOCOL = type { ptr, ptr, ptr }
%struct._EFI_GRAPHICS_OUTPUT_PROTOCOL = type { ptr, ptr, ptr, ptr }
%struct.EFI_EDID_DISCOVERED_PROTOCOL = type { i32, ptr }
%struct.EFI_EDID_ACTIVE_PROTOCOL = type { i32, ptr }
%struct.CIRRUS_LOGIC_5430_MODE_DATA = type { i32, i32, i32, i32, i32 }
%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._EFI_EDID_OVERRIDE_PROTOCOL = type { ptr }

@gBS = external global ptr, align 8
@gEfiEdidOverrideProtocolGuid = external global %struct.GUID, align 4
@CirrusLogic5430VideoModes = external global [0 x %struct.CIRRUS_LOGIC_5430_VIDEO_MODES], align 8

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

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

declare ptr @AllocateCopyPool(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 zeroext i8 @SearchEdidTiming(ptr noundef, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @CirrusLogic5430VideoModeSetup(ptr noundef %0) #0 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca %struct.VALID_EDID_TIMING, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i8, align 1
  %20 = alloca ptr, align 8
  %21 = alloca %struct.EDID_TIMING, align 2
  %22 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 6, ptr %21) #3
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %23, i32 0, i32 6
  %25 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %24, i32 0, i32 1
  store ptr null, ptr %25, align 8, !tbaa !9
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %26, i32 0, i32 6
  %28 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %27, i32 0, i32 0
  store i32 0, ptr %28, align 8, !tbaa !16
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %29, i32 0, i32 7
  %31 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %30, i32 0, i32 1
  store ptr null, ptr %31, align 8, !tbaa !17
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %32, i32 0, i32 7
  %34 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %33, i32 0, i32 0
  store i32 0, ptr %34, align 8, !tbaa !18
  store i8 0, ptr %6, align 1, !tbaa !19
  store i8 0, ptr %9, align 1, !tbaa !19
  store i32 255, ptr %8, align 4, !tbaa !20
  store i64 0, ptr %10, align 8, !tbaa !21
  store ptr null, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %14, align 8, !tbaa !21
  store ptr null, ptr %15, align 8, !tbaa !5
  store ptr null, ptr %13, align 8, !tbaa !5
  %35 = load ptr, ptr @gBS, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %35, i32 0, i32 38
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = call i64 %37(ptr noundef @gEfiEdidOverrideProtocolGuid, ptr noundef null, ptr noundef %7)
  store i64 %38, ptr %4, align 8, !tbaa !21
  %39 = load i64, ptr %4, align 8, !tbaa !21
  %40 = icmp slt i64 %39, 0
  br i1 %40, label %65, label %41

41:                                               ; preds = %1
  %42 = call ptr @AllocatePool(i64 noundef 256)
  store ptr %42, ptr %11, align 8, !tbaa !5
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = icmp eq ptr null, %43
  br i1 %44, label %45, label %46

45:                                               ; preds = %41
  store i64 -9223372036854775799, ptr %4, align 8, !tbaa !21
  br label %282

46:                                               ; preds = %41
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._EFI_EDID_OVERRIDE_PROTOCOL, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !25
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %51, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  %54 = call i64 %49(ptr noundef %50, ptr noundef %53, ptr noundef %8, ptr noundef %10, ptr noundef %11)
  store i64 %54, ptr %4, align 8, !tbaa !21
  %55 = load i64, ptr %4, align 8, !tbaa !21
  %56 = icmp slt i64 %55, 0
  br i1 %56, label %64, label %57

57:                                               ; preds = %46
  %58 = load i32, ptr %8, align 4, !tbaa !20
  %59 = icmp eq i32 %58, 0
  br i1 %59, label %60, label %64

60:                                               ; preds = %57
  %61 = load i64, ptr %10, align 8, !tbaa !21
  %62 = icmp ne i64 %61, 0
  br i1 %62, label %63, label %64

63:                                               ; preds = %60
  store i8 1, ptr %9, align 1, !tbaa !19
  br label %64

64:                                               ; preds = %63, %60, %57, %46
  br label %65

65:                                               ; preds = %64, %1
  %66 = load i8, ptr %9, align 1, !tbaa !19
  %67 = zext i8 %66 to i32
  %68 = icmp ne i32 %67, 1
  br i1 %68, label %72, label %69

69:                                               ; preds = %65
  %70 = load i32, ptr %8, align 4, !tbaa !20
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %105

72:                                               ; preds = %69, %65
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = call i64 @ReadEdidData(ptr noundef %73, ptr noundef %13, ptr noundef %12)
  %75 = icmp eq i64 %74, 0
  br i1 %75, label %76, label %104

76:                                               ; preds = %72
  %77 = load i64, ptr %12, align 8, !tbaa !21
  %78 = trunc i64 %77 to i32
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %79, i32 0, i32 6
  %81 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %80, i32 0, i32 0
  store i32 %78, ptr %81, align 8, !tbaa !16
  %82 = load i64, ptr %12, align 8, !tbaa !21
  %83 = load ptr, ptr %13, align 8, !tbaa !5
  %84 = call ptr @AllocateCopyPool(i64 noundef %82, ptr noundef %83)
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %85, i32 0, i32 6
  %87 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %86, i32 0, i32 1
  store ptr %84, ptr %87, align 8, !tbaa !9
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %88, i32 0, i32 6
  %90 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !9
  %92 = icmp eq ptr null, %91
  br i1 %92, label %93, label %94

93:                                               ; preds = %76
  store i64 -9223372036854775799, ptr %4, align 8, !tbaa !21
  br label %282

94:                                               ; preds = %76
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %95, i32 0, i32 6
  %97 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %96, i32 0, i32 0
  %98 = load i32, ptr %97, align 8, !tbaa !16
  %99 = zext i32 %98 to i64
  store i64 %99, ptr %14, align 8, !tbaa !21
  %100 = load ptr, ptr %3, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %100, i32 0, i32 6
  %102 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %101, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8, !tbaa !9
  store ptr %103, ptr %15, align 8, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !19
  br label %104

104:                                              ; preds = %94, %72
  br label %105

105:                                              ; preds = %104, %69
  %106 = load i8, ptr %6, align 1, !tbaa !19
  %107 = zext i8 %106 to i32
  %108 = icmp ne i32 %107, 1
  br i1 %108, label %109, label %116

109:                                              ; preds = %105
  %110 = load i8, ptr %9, align 1, !tbaa !19
  %111 = zext i8 %110 to i32
  %112 = icmp eq i32 %111, 1
  br i1 %112, label %113, label %116

113:                                              ; preds = %109
  %114 = load i64, ptr %10, align 8, !tbaa !21
  store i64 %114, ptr %14, align 8, !tbaa !21
  %115 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %115, ptr %15, align 8, !tbaa !5
  store i8 1, ptr %6, align 1, !tbaa !19
  br label %116

116:                                              ; preds = %113, %109, %105
  %117 = load i8, ptr %6, align 1, !tbaa !19
  %118 = zext i8 %117 to i32
  %119 = icmp eq i32 %118, 1
  br i1 %119, label %120, label %145

120:                                              ; preds = %116
  %121 = load ptr, ptr %15, align 8, !tbaa !5
  %122 = call zeroext i8 @ParseEdidData(ptr noundef %121, ptr noundef %16)
  %123 = zext i8 %122 to i32
  %124 = icmp eq i32 %123, 1
  br i1 %124, label %125, label %144

125:                                              ; preds = %120
  %126 = load i64, ptr %14, align 8, !tbaa !21
  %127 = trunc i64 %126 to i32
  %128 = load ptr, ptr %3, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %128, i32 0, i32 7
  %130 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %129, i32 0, i32 0
  store i32 %127, ptr %130, align 8, !tbaa !18
  %131 = load i64, ptr %14, align 8, !tbaa !21
  %132 = load ptr, ptr %15, align 8, !tbaa !5
  %133 = call ptr @AllocateCopyPool(i64 noundef %131, ptr noundef %132)
  %134 = load ptr, ptr %3, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %134, i32 0, i32 7
  %136 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %135, i32 0, i32 1
  store ptr %133, ptr %136, align 8, !tbaa !17
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %137, i32 0, i32 7
  %139 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %138, i32 0, i32 1
  %140 = load ptr, ptr %139, align 8, !tbaa !17
  %141 = icmp eq ptr null, %140
  br i1 %141, label %142, label %143

142:                                              ; preds = %125
  store i64 -9223372036854775799, ptr %4, align 8, !tbaa !21
  br label %282

143:                                              ; preds = %125
  br label %144

144:                                              ; preds = %143, %120
  br label %152

145:                                              ; preds = %116
  %146 = load ptr, ptr %3, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %146, i32 0, i32 7
  %148 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %147, i32 0, i32 0
  store i32 0, ptr %148, align 8, !tbaa !18
  %149 = load ptr, ptr %3, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %149, i32 0, i32 7
  %151 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %150, i32 0, i32 1
  store ptr null, ptr %151, align 8, !tbaa !17
  store i8 0, ptr %6, align 1, !tbaa !19
  br label %152

152:                                              ; preds = %145, %144
  %153 = load i8, ptr %6, align 1, !tbaa !19
  %154 = icmp ne i8 %153, 0
  br i1 %154, label %155, label %235

155:                                              ; preds = %152
  store i32 0, ptr %17, align 4, !tbaa !20
  %156 = load ptr, ptr %3, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %156, i32 0, i32 12
  %158 = getelementptr inbounds [3 x %struct.CIRRUS_LOGIC_5430_MODE_DATA], ptr %157, i64 0, i64 0
  store ptr %158, ptr %18, align 8, !tbaa !5
  store ptr @CirrusLogic5430VideoModes, ptr %20, align 8, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !20
  br label %159

159:                                              ; preds = %227, %155
  %160 = load i32, ptr %5, align 4, !tbaa !20
  %161 = icmp ult i32 %160, 3
  br i1 %161, label %162, label %230

162:                                              ; preds = %159
  store i8 1, ptr %19, align 1, !tbaa !19
  %163 = load ptr, ptr %20, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 8, !tbaa !28
  %166 = trunc i32 %165 to i16
  %167 = getelementptr inbounds %struct.EDID_TIMING, ptr %21, i32 0, i32 0
  store i16 %166, ptr %167, align 2, !tbaa !30
  %168 = load ptr, ptr %20, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %168, i32 0, i32 1
  %170 = load i32, ptr %169, align 4, !tbaa !33
  %171 = trunc i32 %170 to i16
  %172 = getelementptr inbounds %struct.EDID_TIMING, ptr %21, i32 0, i32 1
  store i16 %171, ptr %172, align 2, !tbaa !34
  %173 = load ptr, ptr %20, align 8, !tbaa !5
  %174 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %173, i32 0, i32 3
  %175 = load i32, ptr %174, align 4, !tbaa !35
  %176 = trunc i32 %175 to i16
  %177 = getelementptr inbounds %struct.EDID_TIMING, ptr %21, i32 0, i32 2
  store i16 %176, ptr %177, align 2, !tbaa !36
  %178 = call zeroext i8 @SearchEdidTiming(ptr noundef %16, ptr noundef %21)
  %179 = zext i8 %178 to i32
  %180 = icmp ne i32 %179, 1
  br i1 %180, label %181, label %182

181:                                              ; preds = %162
  store i8 0, ptr %19, align 1, !tbaa !19
  br label %182

182:                                              ; preds = %181, %162
  %183 = load ptr, ptr %20, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %183, i32 0, i32 0
  %185 = load i32, ptr %184, align 8, !tbaa !28
  %186 = icmp eq i32 %185, 0
  br i1 %186, label %192, label %187

187:                                              ; preds = %182
  %188 = load ptr, ptr %20, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %188, i32 0, i32 1
  %190 = load i32, ptr %189, align 4, !tbaa !33
  %191 = icmp eq i32 %190, 0
  br i1 %191, label %192, label %193

192:                                              ; preds = %187, %182
  store i8 0, ptr %19, align 1, !tbaa !19
  br label %193

193:                                              ; preds = %192, %187
  %194 = load i8, ptr %19, align 1, !tbaa !19
  %195 = icmp ne i8 %194, 0
  br i1 %195, label %196, label %224

196:                                              ; preds = %193
  %197 = load i32, ptr %5, align 4, !tbaa !20
  %198 = load ptr, ptr %18, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %198, i32 0, i32 0
  store i32 %197, ptr %199, align 4, !tbaa !37
  %200 = load ptr, ptr %20, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %200, i32 0, i32 0
  %202 = load i32, ptr %201, align 8, !tbaa !28
  %203 = load ptr, ptr %18, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %203, i32 0, i32 1
  store i32 %202, ptr %204, align 4, !tbaa !39
  %205 = load ptr, ptr %20, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %205, i32 0, i32 1
  %207 = load i32, ptr %206, align 4, !tbaa !33
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %208, i32 0, i32 2
  store i32 %207, ptr %209, align 4, !tbaa !40
  %210 = load ptr, ptr %20, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %210, i32 0, i32 2
  %212 = load i32, ptr %211, align 8, !tbaa !41
  %213 = load ptr, ptr %18, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %213, i32 0, i32 3
  store i32 %212, ptr %214, align 4, !tbaa !42
  %215 = load ptr, ptr %20, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %215, i32 0, i32 3
  %217 = load i32, ptr %216, align 4, !tbaa !35
  %218 = load ptr, ptr %18, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %218, i32 0, i32 4
  store i32 %217, ptr %219, align 4, !tbaa !43
  %220 = load ptr, ptr %18, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %220, i32 1
  store ptr %221, ptr %18, align 8, !tbaa !5
  %222 = load i32, ptr %17, align 4, !tbaa !20
  %223 = add i32 %222, 1
  store i32 %223, ptr %17, align 4, !tbaa !20
  br label %224

224:                                              ; preds = %196, %193
  %225 = load ptr, ptr %20, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %225, i32 1
  store ptr %226, ptr %20, align 8, !tbaa !5
  br label %227

227:                                              ; preds = %224
  %228 = load i32, ptr %5, align 4, !tbaa !20
  %229 = add i32 %228, 1
  store i32 %229, ptr %5, align 4, !tbaa !20
  br label %159, !llvm.loop !44

230:                                              ; preds = %159
  %231 = load i32, ptr %17, align 4, !tbaa !20
  %232 = zext i32 %231 to i64
  %233 = load ptr, ptr %3, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %233, i32 0, i32 11
  store i64 %232, ptr %234, align 8, !tbaa !46
  br label %276

235:                                              ; preds = %152
  %236 = load ptr, ptr %3, align 8, !tbaa !5
  %237 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %236, i32 0, i32 12
  %238 = getelementptr inbounds [3 x %struct.CIRRUS_LOGIC_5430_MODE_DATA], ptr %237, i64 0, i64 0
  store ptr %238, ptr %18, align 8, !tbaa !5
  store ptr @CirrusLogic5430VideoModes, ptr %20, align 8, !tbaa !5
  store i32 0, ptr %5, align 4, !tbaa !20
  br label %239

239:                                              ; preds = %270, %235
  %240 = load i32, ptr %5, align 4, !tbaa !20
  %241 = icmp ult i32 %240, 3
  br i1 %241, label %242, label %273

242:                                              ; preds = %239
  %243 = load i32, ptr %5, align 4, !tbaa !20
  %244 = load ptr, ptr %18, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %244, i32 0, i32 0
  store i32 %243, ptr %245, align 4, !tbaa !37
  %246 = load ptr, ptr %20, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %246, i32 0, i32 0
  %248 = load i32, ptr %247, align 8, !tbaa !28
  %249 = load ptr, ptr %18, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %249, i32 0, i32 1
  store i32 %248, ptr %250, align 4, !tbaa !39
  %251 = load ptr, ptr %20, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %251, i32 0, i32 1
  %253 = load i32, ptr %252, align 4, !tbaa !33
  %254 = load ptr, ptr %18, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %254, i32 0, i32 2
  store i32 %253, ptr %255, align 4, !tbaa !40
  %256 = load ptr, ptr %20, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %256, i32 0, i32 2
  %258 = load i32, ptr %257, align 8, !tbaa !41
  %259 = load ptr, ptr %18, align 8, !tbaa !5
  %260 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %259, i32 0, i32 3
  store i32 %258, ptr %260, align 4, !tbaa !42
  %261 = load ptr, ptr %20, align 8, !tbaa !5
  %262 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %261, i32 0, i32 3
  %263 = load i32, ptr %262, align 4, !tbaa !35
  %264 = load ptr, ptr %18, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %264, i32 0, i32 4
  store i32 %263, ptr %265, align 4, !tbaa !43
  %266 = load ptr, ptr %18, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_MODE_DATA, ptr %266, i32 1
  store ptr %267, ptr %18, align 8, !tbaa !5
  %268 = load ptr, ptr %20, align 8, !tbaa !5
  %269 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_VIDEO_MODES, ptr %268, i32 1
  store ptr %269, ptr %20, align 8, !tbaa !5
  br label %270

270:                                              ; preds = %242
  %271 = load i32, ptr %5, align 4, !tbaa !20
  %272 = add i32 %271, 1
  store i32 %272, ptr %5, align 4, !tbaa !20
  br label %239, !llvm.loop !47

273:                                              ; preds = %239
  %274 = load ptr, ptr %3, align 8, !tbaa !5
  %275 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %274, i32 0, i32 11
  store i64 3, ptr %275, align 8, !tbaa !46
  br label %276

276:                                              ; preds = %273, %230
  %277 = load ptr, ptr %11, align 8, !tbaa !5
  %278 = icmp ne ptr %277, null
  br i1 %278, label %279, label %281

279:                                              ; preds = %276
  %280 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %280)
  br label %281

281:                                              ; preds = %279, %276
  store i64 0, ptr %2, align 8
  store i32 1, ptr %22, align 4
  br label %310

282:                                              ; preds = %142, %93, %45
  %283 = load ptr, ptr %11, align 8, !tbaa !5
  %284 = icmp ne ptr %283, null
  br i1 %284, label %285, label %287

285:                                              ; preds = %282
  %286 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %286)
  br label %287

287:                                              ; preds = %285, %282
  %288 = load ptr, ptr %3, align 8, !tbaa !5
  %289 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %288, i32 0, i32 6
  %290 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %289, i32 0, i32 1
  %291 = load ptr, ptr %290, align 8, !tbaa !9
  %292 = icmp ne ptr %291, null
  br i1 %292, label %293, label %298

293:                                              ; preds = %287
  %294 = load ptr, ptr %3, align 8, !tbaa !5
  %295 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %294, i32 0, i32 6
  %296 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %295, i32 0, i32 1
  %297 = load ptr, ptr %296, align 8, !tbaa !9
  call void @FreePool(ptr noundef %297)
  br label %298

298:                                              ; preds = %293, %287
  %299 = load ptr, ptr %3, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %299, i32 0, i32 6
  %301 = getelementptr inbounds %struct.EFI_EDID_DISCOVERED_PROTOCOL, ptr %300, i32 0, i32 1
  %302 = load ptr, ptr %301, align 8, !tbaa !9
  %303 = icmp ne ptr %302, null
  br i1 %303, label %304, label %309

304:                                              ; preds = %298
  %305 = load ptr, ptr %3, align 8, !tbaa !5
  %306 = getelementptr inbounds %struct.CIRRUS_LOGIC_5430_PRIVATE_DATA, ptr %305, i32 0, i32 7
  %307 = getelementptr inbounds %struct.EFI_EDID_ACTIVE_PROTOCOL, ptr %306, i32 0, i32 1
  %308 = load ptr, ptr %307, align 8, !tbaa !17
  call void @FreePool(ptr noundef %308)
  br label %309

309:                                              ; preds = %304, %298
  store i64 -9223372036854775801, ptr %2, align 8
  store i32 1, ptr %22, align 4
  br label %310

310:                                              ; preds = %309, %281
  call void @llvm.lifetime.end.p0(i64 6, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %311 = load i64, ptr %2, align 8
  ret i64 %311
}

declare ptr @AllocatePool(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 96}
!10 = !{!"", !11, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !12, i64 32, !13, i64 56, !14, i64 88, !14, i64 104, !6, i64 120, !6, i64 128, !11, i64 136, !11, i64 144, !7, i64 152, !6, i64 216, !7, i64 224}
!11 = !{!"long long", !7, i64 0}
!12 = !{!"_EFI_UGA_DRAW_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16}
!13 = !{!"_EFI_GRAPHICS_OUTPUT_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!14 = !{!"", !15, i64 0, !6, i64 8}
!15 = !{!"int", !7, i64 0}
!16 = !{!10, !15, i64 88}
!17 = !{!10, !6, i64 112}
!18 = !{!10, !15, i64 104}
!19 = !{!7, !7, i64 0}
!20 = !{!15, !15, i64 0}
!21 = !{!11, !11, i64 0}
!22 = !{!23, !6, i64 320}
!23 = !{!"", !24, 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}
!24 = !{!"", !11, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!25 = !{!26, !6, i64 0}
!26 = !{!"_EFI_EDID_OVERRIDE_PROTOCOL", !6, i64 0}
!27 = !{!10, !6, i64 8}
!28 = !{!29, !15, i64 0}
!29 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !6, i64 16, !6, i64 24, !7, i64 32}
!30 = !{!31, !32, i64 0}
!31 = !{!"", !32, i64 0, !32, i64 2, !32, i64 4}
!32 = !{!"short", !7, i64 0}
!33 = !{!29, !15, i64 4}
!34 = !{!31, !32, i64 2}
!35 = !{!29, !15, i64 12}
!36 = !{!31, !32, i64 4}
!37 = !{!38, !15, i64 0}
!38 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16}
!39 = !{!38, !15, i64 4}
!40 = !{!38, !15, i64 8}
!41 = !{!29, !15, i64 8}
!42 = !{!38, !15, i64 12}
!43 = !{!38, !15, i64 16}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!10, !11, i64 144}
!47 = distinct !{!47, !45}


; 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] }
%struct.CIRRUS_LOGIC_5430_VIDEO_MODES = type { i32, i32, i32, i32, ptr, ptr, i8 }
%struct.VALID_EDID_TIMING = type { i32, [17 x i32] }
%struct.EDID_TIMING = type { i16, i16, i16 }

@gBS = external local_unnamed_addr global ptr, align 8
@gEfiEdidOverrideProtocolGuid = external global %struct.GUID, align 4
@CirrusLogic5430VideoModes = external local_unnamed_addr global [0 x %struct.CIRRUS_LOGIC_5430_VIDEO_MODES], align 8

; Function Attrs: nounwind uwtable
declare dso_local i64 @ReadEdidData(ptr noundef, ptr noundef, ptr 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

declare ptr @AllocateCopyPool(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 zeroext i8 @SearchEdidTiming(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775801, 1) i64 @CirrusLogic5430VideoModeSetup(ptr noundef %0) local_unnamed_addr #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.VALID_EDID_TIMING, align 4
  %9 = alloca %struct.EDID_TIMING, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 6, ptr nonnull %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 88
  %11 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr null, ptr %11, align 8, !tbaa !5
  store i32 0, ptr %10, align 8, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %0, i64 104
  %13 = getelementptr inbounds i8, ptr %0, i64 112
  store ptr null, ptr %13, align 8, !tbaa !16
  store i32 0, ptr %12, align 8, !tbaa !17
  store i32 255, ptr %3, align 4, !tbaa !18
  store i64 0, ptr %4, align 8, !tbaa !19
  store ptr null, ptr %5, align 8, !tbaa !20
  store ptr null, ptr %7, align 8, !tbaa !20
  %14 = load ptr, ptr @gBS, align 8, !tbaa !20
  %15 = getelementptr inbounds i8, ptr %14, i64 320
  %16 = load ptr, ptr %15, align 8, !tbaa !21
  %17 = call i64 %16(ptr noundef nonnull @gEfiEdidOverrideProtocolGuid, ptr noundef null, ptr noundef nonnull %2) #3
  %18 = icmp slt i64 %17, 0
  br i1 %18, label %.thread, label %19

19:                                               ; preds = %1
  %20 = call ptr @AllocatePool(i64 noundef 256) #3
  store ptr %20, ptr %5, align 8, !tbaa !20
  %21 = icmp eq ptr %20, null
  br i1 %21, label %.thread113, label %22

22:                                               ; preds = %19
  %23 = load ptr, ptr %2, align 8, !tbaa !20
  %24 = load ptr, ptr %23, align 8, !tbaa !24
  %25 = getelementptr inbounds i8, ptr %0, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !26
  %27 = call i64 %24(ptr noundef nonnull %23, ptr noundef %26, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5) #3
  %28 = icmp sgt i64 %27, -1
  %29 = load i32, ptr %3, align 4
  %30 = icmp eq i32 %29, 0
  %or.cond = select i1 %28, i1 %30, i1 false
  %31 = load i64, ptr %4, align 8
  %32 = icmp ne i64 %31, 0
  %or.cond3 = select i1 %or.cond, i1 %32, i1 false
  %33 = icmp ne i32 %29, 1
  %or.cond5.not = select i1 %or.cond3, i1 %33, i1 false
  br i1 %or.cond5.not, label %.thread138, label %.thread

.thread138:                                       ; preds = %22
  %34 = load i64, ptr %4, align 8
  %35 = load ptr, ptr %5, align 8
  br label %47

.thread:                                          ; preds = %1, %22
  %36 = phi i1 [ %or.cond3, %22 ], [ false, %1 ]
  %37 = call i64 @ReadEdidData(ptr noundef nonnull %0, ptr noundef nonnull %7, ptr noundef nonnull %6)
  %38 = icmp eq i64 %37, 0
  br i1 %38, label %39, label %.thr_comm

39:                                               ; preds = %.thread
  %40 = load i64, ptr %6, align 8, !tbaa !19
  %41 = trunc i64 %40 to i32
  store i32 %41, ptr %10, align 8, !tbaa !15
  %42 = load ptr, ptr %7, align 8, !tbaa !20
  %43 = call ptr @AllocateCopyPool(i64 noundef %40, ptr noundef %42) #3
  store ptr %43, ptr %11, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %129, label %51

.thr_comm:                                        ; preds = %.thread
  %cond.fr133 = freeze i1 %36
  %45 = load i64, ptr %4, align 8
  %46 = load ptr, ptr %5, align 8
  %spec.select = select i1 %cond.fr133, i64 %45, i64 0
  %spec.select144 = select i1 %cond.fr133, ptr %46, ptr null
  br label %47

47:                                               ; preds = %.thr_comm, %.thread138
  %48 = phi i64 [ %34, %.thread138 ], [ %spec.select, %.thr_comm ]
  %.ph136141 = phi i1 [ true, %.thread138 ], [ %cond.fr133, %.thr_comm ]
  %49 = phi ptr [ %35, %.thread138 ], [ %46, %.thr_comm ]
  %50 = phi ptr [ %35, %.thread138 ], [ %spec.select144, %.thr_comm ]
  br i1 %.ph136141, label %54, label %115

51:                                               ; preds = %39
  %52 = load i32, ptr %10, align 8, !tbaa !15
  %53 = zext i32 %52 to i64
  br label %54

54:                                               ; preds = %51, %47
  %.186132 = phi ptr [ %50, %47 ], [ %43, %51 ]
  %.188131 = phi i64 [ %48, %47 ], [ %53, %51 ]
  %55 = call zeroext i8 @ParseEdidData(ptr noundef %.186132, ptr noundef nonnull %8)
  %56 = icmp eq i8 %55, 1
  br i1 %56, label %57, label %61

57:                                               ; preds = %54
  %58 = trunc i64 %.188131 to i32
  store i32 %58, ptr %12, align 8, !tbaa !17
  %59 = call ptr @AllocateCopyPool(i64 noundef %.188131, ptr noundef %.186132) #3
  store ptr %59, ptr %13, align 8, !tbaa !16
  %60 = icmp eq ptr %59, null
  br i1 %60, label %129, label %61

61:                                               ; preds = %54, %57
  %62 = getelementptr inbounds i8, ptr %0, i64 152
  %63 = getelementptr inbounds i8, ptr %9, i64 4
  %64 = load <2 x i32>, ptr @CirrusLogic5430VideoModes, align 8, !tbaa !18
  %65 = trunc <2 x i32> %64 to <2 x i16>
  store <2 x i16> %65, ptr %9, align 4, !tbaa !27
  %66 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 12), align 4, !tbaa !29
  %67 = trunc i32 %66 to i16
  store i16 %67, ptr %63, align 4, !tbaa !31
  %68 = call zeroext i8 @SearchEdidTiming(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %69 = load i32, ptr @CirrusLogic5430VideoModes, align 8, !tbaa !33
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %.thread110, label %71

71:                                               ; preds = %61
  %.not101 = icmp ne i8 %68, 1
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 4), align 4, !tbaa !34
  %73 = icmp eq i32 %72, 0
  %or.cond118 = select i1 %73, i1 true, i1 %.not101
  br i1 %or.cond118, label %.thread110, label %74

74:                                               ; preds = %71
  store i32 0, ptr %62, align 4, !tbaa !35
  %75 = getelementptr inbounds i8, ptr %0, i64 156
  store i32 %69, ptr %75, align 4, !tbaa !37
  %76 = getelementptr inbounds i8, ptr %0, i64 160
  store i32 %72, ptr %76, align 4, !tbaa !38
  %77 = getelementptr inbounds i8, ptr %0, i64 164
  %78 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 8), align 8, !tbaa !18
  store <2 x i32> %78, ptr %77, align 4, !tbaa !18
  %79 = getelementptr inbounds i8, ptr %0, i64 172
  br label %.thread110

.thread110:                                       ; preds = %71, %61, %74
  %.184 = phi i32 [ 1, %74 ], [ 0, %61 ], [ 0, %71 ]
  %.182 = phi ptr [ %79, %74 ], [ %62, %61 ], [ %62, %71 ]
  %80 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 40), align 8, !tbaa !18
  %81 = trunc <2 x i32> %80 to <2 x i16>
  store <2 x i16> %81, ptr %9, align 4, !tbaa !27
  %82 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 52), align 4, !tbaa !29
  %83 = trunc i32 %82 to i16
  store i16 %83, ptr %63, align 4, !tbaa !31
  %84 = call zeroext i8 @SearchEdidTiming(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 40), align 8, !tbaa !33
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %.thread110.1, label %87

87:                                               ; preds = %.thread110
  %.not101.1 = icmp ne i8 %84, 1
  %88 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 44), align 4, !tbaa !34
  %89 = icmp eq i32 %88, 0
  %or.cond118.1 = select i1 %89, i1 true, i1 %.not101.1
  br i1 %or.cond118.1, label %.thread110.1, label %90

90:                                               ; preds = %87
  store i32 1, ptr %.182, align 4, !tbaa !35
  %91 = getelementptr inbounds i8, ptr %.182, i64 4
  store i32 %85, ptr %91, align 4, !tbaa !37
  %92 = getelementptr inbounds i8, ptr %.182, i64 8
  store i32 %88, ptr %92, align 4, !tbaa !38
  %93 = getelementptr inbounds i8, ptr %.182, i64 12
  %94 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 48), align 8, !tbaa !18
  store <2 x i32> %94, ptr %93, align 4, !tbaa !18
  %95 = getelementptr inbounds i8, ptr %.182, i64 20
  %96 = add nuw nsw i32 %.184, 1
  br label %.thread110.1

.thread110.1:                                     ; preds = %90, %87, %.thread110
  %.184.1 = phi i32 [ %96, %90 ], [ %.184, %.thread110 ], [ %.184, %87 ]
  %.182.1 = phi ptr [ %95, %90 ], [ %.182, %.thread110 ], [ %.182, %87 ]
  %97 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 80), align 8, !tbaa !18
  %98 = trunc <2 x i32> %97 to <2 x i16>
  store <2 x i16> %98, ptr %9, align 4, !tbaa !27
  %99 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 92), align 4, !tbaa !29
  %100 = trunc i32 %99 to i16
  store i16 %100, ptr %63, align 4, !tbaa !31
  %101 = call zeroext i8 @SearchEdidTiming(ptr noundef nonnull %8, ptr noundef nonnull %9)
  %102 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 80), align 8, !tbaa !33
  %103 = icmp eq i32 %102, 0
  br i1 %103, label %.thread110.2, label %104

104:                                              ; preds = %.thread110.1
  %.not101.2 = icmp ne i8 %101, 1
  %105 = load i32, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 84), align 4, !tbaa !34
  %106 = icmp eq i32 %105, 0
  %or.cond118.2 = select i1 %106, i1 true, i1 %.not101.2
  br i1 %or.cond118.2, label %.thread110.2, label %107

107:                                              ; preds = %104
  store i32 2, ptr %.182.1, align 4, !tbaa !35
  %108 = getelementptr inbounds i8, ptr %.182.1, i64 4
  store i32 %102, ptr %108, align 4, !tbaa !37
  %109 = getelementptr inbounds i8, ptr %.182.1, i64 8
  store i32 %105, ptr %109, align 4, !tbaa !38
  %110 = getelementptr inbounds i8, ptr %.182.1, i64 12
  %111 = load <2 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 88), align 8, !tbaa !18
  store <2 x i32> %111, ptr %110, align 4, !tbaa !18
  %112 = add nuw nsw i32 %.184.1, 1
  br label %.thread110.2

.thread110.2:                                     ; preds = %107, %104, %.thread110.1
  %.184.2 = phi i32 [ %112, %107 ], [ %.184.1, %.thread110.1 ], [ %.184.1, %104 ]
  %113 = zext nneg i32 %.184.2 to i64
  %114 = getelementptr inbounds i8, ptr %0, i64 144
  store i64 %113, ptr %114, align 8, !tbaa !39
  %.pre = load ptr, ptr %5, align 8, !tbaa !20
  br label %126

115:                                              ; preds = %47
  store i32 0, ptr %12, align 8, !tbaa !17
  store ptr null, ptr %13, align 8, !tbaa !16
  %116 = getelementptr inbounds i8, ptr %0, i64 152
  store i32 0, ptr %116, align 4, !tbaa !35
  %117 = getelementptr inbounds i8, ptr %0, i64 156
  %118 = load <4 x i32>, ptr @CirrusLogic5430VideoModes, align 8, !tbaa !18
  store <4 x i32> %118, ptr %117, align 4, !tbaa !18
  %119 = getelementptr inbounds i8, ptr %0, i64 172
  store i32 1, ptr %119, align 4, !tbaa !35
  %120 = getelementptr inbounds i8, ptr %0, i64 176
  %121 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 40), align 8, !tbaa !18
  store <4 x i32> %121, ptr %120, align 4, !tbaa !18
  %122 = getelementptr inbounds i8, ptr %0, i64 192
  store i32 2, ptr %122, align 4, !tbaa !35
  %123 = getelementptr inbounds i8, ptr %0, i64 196
  %124 = load <4 x i32>, ptr getelementptr inbounds (i8, ptr @CirrusLogic5430VideoModes, i64 80), align 8, !tbaa !18
  store <4 x i32> %124, ptr %123, align 4, !tbaa !18
  %125 = getelementptr inbounds i8, ptr %0, i64 144
  store i64 3, ptr %125, align 8, !tbaa !39
  br label %126

126:                                              ; preds = %115, %.thread110.2
  %127 = phi ptr [ %49, %115 ], [ %.pre, %.thread110.2 ]
  %.not100 = icmp eq ptr %127, null
  br i1 %.not100, label %.thread116, label %128

128:                                              ; preds = %126
  call void @FreePool(ptr noundef nonnull %127) #3
  br label %.thread116

129:                                              ; preds = %57, %39
  %.pr = load ptr, ptr %5, align 8, !tbaa !20
  %.not103 = icmp eq ptr %.pr, null
  br i1 %.not103, label %.thread113, label %130

130:                                              ; preds = %129
  call void @FreePool(ptr noundef nonnull %.pr) #3
  br label %.thread113

.thread113:                                       ; preds = %19, %130, %129
  %131 = load ptr, ptr %11, align 8, !tbaa !5
  %.not104 = icmp eq ptr %131, null
  br i1 %.not104, label %.thread116, label %132

132:                                              ; preds = %.thread113
  call void @FreePool(ptr noundef nonnull %131) #3
  %.pr115 = load ptr, ptr %11, align 8, !tbaa !5
  %.not105 = icmp eq ptr %.pr115, null
  br i1 %.not105, label %.thread116, label %133

133:                                              ; preds = %132
  %134 = load ptr, ptr %13, align 8, !tbaa !16
  call void @FreePool(ptr noundef %134) #3
  br label %.thread116

.thread116:                                       ; preds = %.thread113, %132, %133, %126, %128
  %.095 = phi i64 [ 0, %128 ], [ 0, %126 ], [ -9223372036854775801, %133 ], [ -9223372036854775801, %132 ], [ -9223372036854775801, %.thread113 ]
  call void @llvm.lifetime.end.p0(i64 6, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret i64 %.095
}

declare ptr @AllocatePool(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, !10, i64 96}
!6 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !7, i64 24, !11, i64 32, !12, i64 56, !13, i64 88, !13, i64 104, !10, i64 120, !10, i64 128, !7, i64 136, !7, i64 144, !8, i64 152, !10, i64 216, !8, i64 224}
!7 = !{!"long long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_EFI_UGA_DRAW_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16}
!12 = !{!"_EFI_GRAPHICS_OUTPUT_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24}
!13 = !{!"", !14, i64 0, !10, i64 8}
!14 = !{!"int", !8, i64 0}
!15 = !{!6, !14, i64 88}
!16 = !{!6, !10, i64 112}
!17 = !{!6, !14, i64 104}
!18 = !{!14, !14, i64 0}
!19 = !{!7, !7, i64 0}
!20 = !{!10, !10, i64 0}
!21 = !{!22, !10, i64 320}
!22 = !{!"", !23, i64 0, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368}
!23 = !{!"", !7, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !14, i64 20}
!24 = !{!25, !10, i64 0}
!25 = !{!"_EFI_EDID_OVERRIDE_PROTOCOL", !10, i64 0}
!26 = !{!6, !10, i64 8}
!27 = !{!28, !28, i64 0}
!28 = !{!"short", !8, i64 0}
!29 = !{!30, !14, i64 12}
!30 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !10, i64 16, !10, i64 24, !8, i64 32}
!31 = !{!32, !28, i64 4}
!32 = !{!"", !28, i64 0, !28, i64 2, !28, i64 4}
!33 = !{!30, !14, i64 0}
!34 = !{!30, !14, i64 4}
!35 = !{!36, !14, i64 0}
!36 = !{!"", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16}
!37 = !{!36, !14, i64 4}
!38 = !{!36, !14, i64 8}
!39 = !{!6, !7, i64 144}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,ReassociatePass,SCCPPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass