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

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

%union.EFI_DEV_PATH = type <{ %struct.INFINIBAND_DEVICE_PATH, [12 x i8] }>
%struct.INFINIBAND_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i32, [16 x i8], i64, i64, i64 }
%struct.EFI_DEVICE_PATH_PROTOCOL = type { i8, i8, [2 x i8] }
%struct.BIOS_LEGACY_DRIVE = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, ptr, i8, i8, i8, i8, i16, i16, %struct.EDD_DRIVE_PARAMETERS }
%struct.EDD_DRIVE_PARAMETERS = type <{ i16, i16, i32, i32, i32, i64, i16, i32, i16, i8, i8, i16, [4 x i8], [8 x i8], %union.EDD_INTERFACE_PATH, %union.EDD_DEVICE_PATH, i8, i8 }>
%union.EDD_INTERFACE_PATH = type { %struct.EDD_PCI }
%struct.EDD_PCI = type { i8, i8, i8, i8, i32 }
%union.EDD_DEVICE_PATH = type { %struct.EDD_USB }
%struct.EDD_USB = type { i64, i64 }
%struct.ATAPI_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i8, i8, i16 }
%struct.EDD_ATAPI = type { i8, i8, [14 x i8] }
%struct.CONTROLLER_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i32 }
%struct.SCSI_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i16, i16 }
%struct.EDD_SCSI = type <{ i16, i64, [6 x i8] }>
%struct.USB_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i8, i8 }
%struct.F1394_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i32, i64 }
%struct.EDD_1394 = type { i64, i64 }
%struct.FIBRECHANNEL_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i32, i64, i64 }
%struct.EDD_FIBRE = type { i64, i64 }

@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [74 x i8], align 1

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

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

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @BuildEdd30DevicePath(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %union.EFI_DEV_PATH, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 60, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %11, i32 0, i32 16
  %13 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %12, i32 0, i32 14
  %14 = getelementptr inbounds %struct.EDD_PCI, ptr %13, i32 0, i32 3
  %15 = load i8, ptr %14, align 1, !tbaa !9
  %16 = zext i8 %15 to i32
  store i32 %16, ptr %9, align 4, !tbaa !10
  %17 = call ptr @ZeroMem(ptr noundef %8, i64 noundef 60)
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %18, i32 0, i32 16
  %20 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %19, i32 0, i32 13
  %21 = getelementptr inbounds [8 x i8], ptr %20, i64 0, i64 0
  %22 = call i64 @AsciiStrnCmp(ptr noundef @.str.5, ptr noundef %21, i64 noundef 5)
  %23 = icmp eq i64 %22, 0
  br i1 %23, label %31, label %24

24:                                               ; preds = %3
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %25, i32 0, i32 16
  %27 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %26, i32 0, i32 13
  %28 = getelementptr inbounds [8 x i8], ptr %27, i64 0, i64 0
  %29 = call i64 @AsciiStrnCmp(ptr noundef @.str.6, ptr noundef %28, i64 noundef 3)
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %31, label %54

31:                                               ; preds = %24, %3
  %32 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %33 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %32, i32 0, i32 0
  store i8 3, ptr %33, align 1, !tbaa !9
  %34 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %35 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %34, i32 0, i32 1
  store i8 1, ptr %35, align 1, !tbaa !9
  %36 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %37 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %36, i64 noundef 8)
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %38, i32 0, i32 16
  %40 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %39, i32 0, i32 15
  %41 = getelementptr inbounds %struct.EDD_ATAPI, ptr %40, i32 0, i32 0
  %42 = load i8, ptr %41, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 2
  store i8 %42, ptr %43, align 1, !tbaa !9
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %44, i32 0, i32 16
  %46 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %45, i32 0, i32 15
  %47 = getelementptr inbounds %struct.EDD_ATAPI, ptr %46, i32 0, i32 1
  %48 = load i8, ptr %47, align 1, !tbaa !9
  %49 = zext i8 %48 to i16
  %50 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 3
  store i16 %49, ptr %50, align 1, !tbaa !9
  %51 = load i32, ptr %9, align 4, !tbaa !10
  %52 = trunc i32 %51 to i8
  %53 = getelementptr inbounds %struct.ATAPI_DEVICE_PATH, ptr %8, i32 0, i32 1
  store i8 %52, ptr %53, align 1, !tbaa !9
  br label %192

54:                                               ; preds = %24
  %55 = load i32, ptr %9, align 4, !tbaa !10
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %71

57:                                               ; preds = %54
  %58 = call ptr @ZeroMem(ptr noundef %8, i64 noundef 60)
  %59 = getelementptr inbounds %struct.CONTROLLER_DEVICE_PATH, ptr %8, i32 0, i32 0
  %60 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %59, i32 0, i32 0
  store i8 1, ptr %60, align 1, !tbaa !9
  %61 = getelementptr inbounds %struct.CONTROLLER_DEVICE_PATH, ptr %8, i32 0, i32 0
  %62 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %61, i32 0, i32 1
  store i8 5, ptr %62, align 1, !tbaa !9
  %63 = getelementptr inbounds %struct.CONTROLLER_DEVICE_PATH, ptr %8, i32 0, i32 0
  %64 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %63, i64 noundef 8)
  %65 = load i32, ptr %9, align 4, !tbaa !10
  %66 = getelementptr inbounds %struct.CONTROLLER_DEVICE_PATH, ptr %8, i32 0, i32 1
  store i32 %65, ptr %66, align 1, !tbaa !9
  %67 = load ptr, ptr %7, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  %69 = call ptr @AppendDevicePathNode(ptr noundef %68, ptr noundef %8)
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %69, ptr %70, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %57, %54
  %72 = call ptr @ZeroMem(ptr noundef %8, i64 noundef 60)
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %73, i32 0, i32 16
  %75 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %74, i32 0, i32 13
  %76 = getelementptr inbounds [8 x i8], ptr %75, i64 0, i64 0
  %77 = call i64 @AsciiStrnCmp(ptr noundef @.str.7, ptr noundef %76, i64 noundef 4)
  %78 = icmp eq i64 %77, 0
  br i1 %78, label %79, label %98

79:                                               ; preds = %71
  %80 = getelementptr inbounds %struct.SCSI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %81 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %80, i32 0, i32 0
  store i8 3, ptr %81, align 1, !tbaa !9
  %82 = getelementptr inbounds %struct.SCSI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %83 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %82, i32 0, i32 1
  store i8 2, ptr %83, align 1, !tbaa !9
  %84 = getelementptr inbounds %struct.SCSI_DEVICE_PATH, ptr %8, i32 0, i32 0
  %85 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %84, i64 noundef 8)
  %86 = getelementptr inbounds %struct.SCSI_DEVICE_PATH, ptr %8, i32 0, i32 2
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %87, i32 0, i32 16
  %89 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %88, i32 0, i32 15
  %90 = getelementptr inbounds %struct.EDD_SCSI, ptr %89, i32 0, i32 1
  %91 = call ptr @CopyMem(ptr noundef %86, ptr noundef %90, i64 noundef 2)
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %92, i32 0, i32 16
  %94 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %93, i32 0, i32 15
  %95 = getelementptr inbounds %struct.EDD_SCSI, ptr %94, i32 0, i32 0
  %96 = load i16, ptr %95, align 8, !tbaa !9
  %97 = getelementptr inbounds %struct.SCSI_DEVICE_PATH, ptr %8, i32 0, i32 1
  store i16 %96, ptr %97, align 1, !tbaa !9
  br label %191

98:                                               ; preds = %71
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %99, i32 0, i32 16
  %101 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %100, i32 0, i32 13
  %102 = getelementptr inbounds [8 x i8], ptr %101, i64 0, i64 0
  %103 = call i64 @AsciiStrnCmp(ptr noundef @.str.8, ptr noundef %102, i64 noundef 3)
  %104 = icmp eq i64 %103, 0
  br i1 %104, label %105, label %119

105:                                              ; preds = %98
  %106 = getelementptr inbounds %struct.USB_DEVICE_PATH, ptr %8, i32 0, i32 0
  %107 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %106, i32 0, i32 0
  store i8 3, ptr %107, align 1, !tbaa !9
  %108 = getelementptr inbounds %struct.USB_DEVICE_PATH, ptr %8, i32 0, i32 0
  %109 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %108, i32 0, i32 1
  store i8 5, ptr %109, align 1, !tbaa !9
  %110 = getelementptr inbounds %struct.USB_DEVICE_PATH, ptr %8, i32 0, i32 0
  %111 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %110, i64 noundef 6)
  %112 = load ptr, ptr %6, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %112, i32 0, i32 16
  %114 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %113, i32 0, i32 15
  %115 = getelementptr inbounds %struct.EDD_USB, ptr %114, i32 0, i32 1
  %116 = load i64, ptr %115, align 8, !tbaa !9
  %117 = trunc i64 %116 to i8
  %118 = getelementptr inbounds %struct.USB_DEVICE_PATH, ptr %8, i32 0, i32 1
  store i8 %117, ptr %118, align 1, !tbaa !9
  br label %190

119:                                              ; preds = %98
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %120, i32 0, i32 16
  %122 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %121, i32 0, i32 13
  %123 = getelementptr inbounds [8 x i8], ptr %122, i64 0, i64 0
  %124 = call i64 @AsciiStrnCmp(ptr noundef @.str.9, ptr noundef %123, i64 noundef 4)
  %125 = icmp eq i64 %124, 0
  br i1 %125, label %126, label %139

126:                                              ; preds = %119
  %127 = getelementptr inbounds %struct.F1394_DEVICE_PATH, ptr %8, i32 0, i32 0
  %128 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %127, i32 0, i32 0
  store i8 3, ptr %128, align 1, !tbaa !9
  %129 = getelementptr inbounds %struct.F1394_DEVICE_PATH, ptr %8, i32 0, i32 0
  %130 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %129, i32 0, i32 1
  store i8 4, ptr %130, align 1, !tbaa !9
  %131 = getelementptr inbounds %struct.F1394_DEVICE_PATH, ptr %8, i32 0, i32 0
  %132 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %131, i64 noundef 16)
  %133 = load ptr, ptr %6, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %133, i32 0, i32 16
  %135 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %134, i32 0, i32 15
  %136 = getelementptr inbounds %struct.EDD_1394, ptr %135, i32 0, i32 0
  %137 = load i64, ptr %136, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct.F1394_DEVICE_PATH, ptr %8, i32 0, i32 2
  store i64 %137, ptr %138, align 1, !tbaa !9
  br label %189

139:                                              ; preds = %119
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %140, i32 0, i32 16
  %142 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %141, i32 0, i32 13
  %143 = getelementptr inbounds [8 x i8], ptr %142, i64 0, i64 0
  %144 = call i64 @AsciiStrnCmp(ptr noundef @.str.10, ptr noundef %143, i64 noundef 5)
  %145 = icmp eq i64 %144, 0
  br i1 %145, label %146, label %165

146:                                              ; preds = %139
  %147 = getelementptr inbounds %struct.FIBRECHANNEL_DEVICE_PATH, ptr %8, i32 0, i32 0
  %148 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %147, i32 0, i32 0
  store i8 3, ptr %148, align 1, !tbaa !9
  %149 = getelementptr inbounds %struct.FIBRECHANNEL_DEVICE_PATH, ptr %8, i32 0, i32 0
  %150 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %149, i32 0, i32 1
  store i8 3, ptr %150, align 1, !tbaa !9
  %151 = getelementptr inbounds %struct.FIBRECHANNEL_DEVICE_PATH, ptr %8, i32 0, i32 0
  %152 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef %151, i64 noundef 24)
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %153, i32 0, i32 16
  %155 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %154, i32 0, i32 15
  %156 = getelementptr inbounds %struct.EDD_FIBRE, ptr %155, i32 0, i32 0
  %157 = load i64, ptr %156, align 8, !tbaa !9
  %158 = getelementptr inbounds %struct.FIBRECHANNEL_DEVICE_PATH, ptr %8, i32 0, i32 2
  store i64 %157, ptr %158, align 1, !tbaa !9
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %159, i32 0, i32 16
  %161 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %160, i32 0, i32 15
  %162 = getelementptr inbounds %struct.EDD_FIBRE, ptr %161, i32 0, i32 1
  %163 = load i64, ptr %162, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct.FIBRECHANNEL_DEVICE_PATH, ptr %8, i32 0, i32 3
  store i64 %163, ptr %164, align 1, !tbaa !9
  br label %188

165:                                              ; preds = %139
  br label %166

166:                                              ; preds = %165
  %167 = call zeroext i8 @DebugPrintEnabled()
  %168 = icmp ne i8 %167, 0
  br i1 %168, label %169, label %185

169:                                              ; preds = %166
  br label %170

170:                                              ; preds = %169
  %171 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096)
  %172 = icmp ne i8 %171, 0
  br i1 %172, label %173, label %182

173:                                              ; preds = %170
  %174 = load ptr, ptr %6, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %174, i32 0, i32 1
  %176 = load i8, ptr %175, align 1, !tbaa !12
  %177 = zext i8 %176 to i32
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.BIOS_LEGACY_DRIVE, ptr %178, i32 0, i32 16
  %180 = getelementptr inbounds %struct.EDD_DRIVE_PARAMETERS, ptr %179, i32 0, i32 13
  %181 = getelementptr inbounds [8 x i8], ptr %180, i64 0, i64 0
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef @.str.11, i32 noundef %177, ptr noundef %181)
  br label %182

182:                                              ; preds = %173, %170
  br label %183

183:                                              ; preds = %182
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184, %166
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187, %146
  br label %189

189:                                              ; preds = %188, %126
  br label %190

190:                                              ; preds = %189, %105
  br label %191

191:                                              ; preds = %190, %79
  br label %192

192:                                              ; preds = %191, %31
  %193 = getelementptr inbounds %struct.EFI_DEVICE_PATH_PROTOCOL, ptr %8, i32 0, i32 0
  %194 = load i8, ptr %193, align 1, !tbaa !9
  %195 = zext i8 %194 to i32
  %196 = icmp eq i32 %195, 0
  br i1 %196, label %197, label %198

197:                                              ; preds = %192
  store i64 -9223372036854775805, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %202

198:                                              ; preds = %192
  %199 = load ptr, ptr %5, align 8, !tbaa !5
  %200 = call ptr @AppendDevicePathNode(ptr noundef %199, ptr noundef %8)
  %201 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %200, ptr %201, align 8, !tbaa !5
  store i64 0, ptr %4, align 8
  store i32 1, ptr %10, align 4
  br label %202

202:                                              ; preds = %198, %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 60, ptr %8) #3
  %203 = load i64, ptr %4, align 8
  ret i64 %203
}

declare zeroext i16 @SetDevicePathNodeLength(ptr noundef, i64 noundef) #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #1

declare ptr @AppendDevicePathNode(ptr noundef, ptr noundef) #1

declare i64 @AsciiStrnCmp(ptr noundef, ptr noundef, i64 noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !7, i64 1}
!13 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !7, i64 7, !7, i64 8, !6, i64 16, !7, i64 24, !7, i64 25, !7, i64 26, !7, i64 27, !14, i64 28, !14, i64 30, !15, i64 32}
!14 = !{!"short", !7, i64 0}
!15 = !{!"", !14, i64 0, !14, i64 2, !11, i64 4, !11, i64 8, !11, i64 12, !16, i64 16, !14, i64 24, !11, i64 26, !14, i64 30, !7, i64 32, !7, i64 33, !14, i64 34, !7, i64 36, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 72, !7, i64 73}
!16 = !{!"long long", !7, i64 0}


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

%union.EFI_DEV_PATH = type <{ %struct.INFINIBAND_DEVICE_PATH, [12 x i8] }>
%struct.INFINIBAND_DEVICE_PATH = type { %struct.EFI_DEVICE_PATH_PROTOCOL, i32, [16 x i8], i64, i64, i64 }
%struct.EFI_DEVICE_PATH_PROTOCOL = type { i8, i8, [2 x i8] }

@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [74 x i8], align 1

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

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

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775805, 1) i64 @BuildEdd30DevicePath(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2) local_unnamed_addr #2 {
  %4 = alloca %union.EFI_DEV_PATH, align 1
  call void @llvm.lifetime.start.p0(i64 60, ptr nonnull %4) #3
  %5 = getelementptr inbounds i8, ptr %1, i64 83
  %6 = load i8, ptr %5, align 1, !tbaa !5
  %7 = zext i8 %6 to i32
  %8 = call ptr @ZeroMem(ptr noundef nonnull %4, i64 noundef 60) #3
  %9 = getelementptr inbounds i8, ptr %1, i64 72
  %10 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.5, ptr noundef nonnull %9, i64 noundef 5) #3
  %11 = icmp eq i64 %10, 0
  br i1 %11, label %15, label %12

12:                                               ; preds = %3
  %13 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.6, ptr noundef nonnull %9, i64 noundef 3) #3
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %15, label %26

15:                                               ; preds = %12, %3
  store i8 3, ptr %4, align 1, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 1, ptr %16, align 1, !tbaa !5
  %17 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 8) #3
  %18 = getelementptr inbounds i8, ptr %1, i64 88
  %19 = load i8, ptr %18, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %4, i64 5
  store i8 %19, ptr %20, align 1, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %1, i64 89
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = zext i8 %22 to i16
  %24 = getelementptr inbounds i8, ptr %4, i64 6
  store i16 %23, ptr %24, align 1, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %4, i64 4
  store i8 %6, ptr %25, align 1, !tbaa !5
  br label %83

26:                                               ; preds = %12
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %34, label %27

27:                                               ; preds = %26
  %28 = call ptr @ZeroMem(ptr noundef nonnull %4, i64 noundef 60) #3
  store i8 1, ptr %4, align 1, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 5, ptr %29, align 1, !tbaa !5
  %30 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 8) #3
  %31 = getelementptr inbounds i8, ptr %4, i64 4
  store i32 %7, ptr %31, align 1, !tbaa !5
  %32 = load ptr, ptr %2, align 8, !tbaa !8
  %33 = call ptr @AppendDevicePathNode(ptr noundef %32, ptr noundef nonnull %4) #3
  store ptr %33, ptr %2, align 8, !tbaa !8
  br label %34

34:                                               ; preds = %27, %26
  %35 = call ptr @ZeroMem(ptr noundef nonnull %4, i64 noundef 60) #3
  %36 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.7, ptr noundef nonnull %9, i64 noundef 4) #3
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %47

38:                                               ; preds = %34
  store i8 3, ptr %4, align 1, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 2, ptr %39, align 1, !tbaa !5
  %40 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 8) #3
  %41 = getelementptr inbounds i8, ptr %4, i64 6
  %42 = getelementptr inbounds i8, ptr %1, i64 88
  %43 = getelementptr inbounds i8, ptr %1, i64 90
  %44 = call ptr @CopyMem(ptr noundef nonnull %41, ptr noundef nonnull %43, i64 noundef 2) #3
  %45 = load i16, ptr %42, align 8, !tbaa !5
  %46 = getelementptr inbounds i8, ptr %4, i64 4
  store i16 %45, ptr %46, align 1, !tbaa !5
  br label %83

47:                                               ; preds = %34
  %48 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.8, ptr noundef nonnull %9, i64 noundef 3) #3
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %57

50:                                               ; preds = %47
  store i8 3, ptr %4, align 1, !tbaa !5
  %51 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 5, ptr %51, align 1, !tbaa !5
  %52 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 6) #3
  %53 = getelementptr inbounds i8, ptr %1, i64 96
  %54 = load i64, ptr %53, align 8, !tbaa !5
  %55 = trunc i64 %54 to i8
  %56 = getelementptr inbounds i8, ptr %4, i64 4
  store i8 %55, ptr %56, align 1, !tbaa !5
  br label %83

57:                                               ; preds = %47
  %58 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.9, ptr noundef nonnull %9, i64 noundef 4) #3
  %59 = icmp eq i64 %58, 0
  br i1 %59, label %60, label %66

60:                                               ; preds = %57
  store i8 3, ptr %4, align 1, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 4, ptr %61, align 1, !tbaa !5
  %62 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 16) #3
  %63 = getelementptr inbounds i8, ptr %1, i64 88
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %4, i64 8
  store i64 %64, ptr %65, align 1, !tbaa !5
  br label %83

66:                                               ; preds = %57
  %67 = call i64 @AsciiStrnCmp(ptr noundef nonnull @.str.10, ptr noundef nonnull %9, i64 noundef 5) #3
  %68 = icmp eq i64 %67, 0
  br i1 %68, label %69, label %75

69:                                               ; preds = %66
  store i8 3, ptr %4, align 1, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %4, i64 1
  store i8 3, ptr %70, align 1, !tbaa !5
  %71 = call zeroext i16 @SetDevicePathNodeLength(ptr noundef nonnull %4, i64 noundef 24) #3
  %72 = getelementptr inbounds i8, ptr %1, i64 88
  %73 = getelementptr inbounds i8, ptr %4, i64 8
  %74 = load <2 x i64>, ptr %72, align 8, !tbaa !5
  store <2 x i64> %74, ptr %73, align 1, !tbaa !5
  br label %83

75:                                               ; preds = %66
  %76 = call zeroext i8 @DebugPrintEnabled() #3
  %.not25 = icmp eq i8 %76, 0
  br i1 %.not25, label %83, label %77

77:                                               ; preds = %75
  %78 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 4096) #3
  %.not26 = icmp eq i8 %78, 0
  br i1 %.not26, label %83, label %79

79:                                               ; preds = %77
  %80 = getelementptr inbounds i8, ptr %1, i64 1
  %81 = load i8, ptr %80, align 1, !tbaa !10
  %82 = zext i8 %81 to i32
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 4096, ptr noundef nonnull @.str.11, i32 noundef %82, ptr noundef nonnull %9) #3
  br label %83

83:                                               ; preds = %38, %60, %75, %79, %77, %69, %50, %15
  %84 = load i8, ptr %4, align 1, !tbaa !5
  %85 = icmp eq i8 %84, 0
  br i1 %85, label %88, label %86

86:                                               ; preds = %83
  %87 = call ptr @AppendDevicePathNode(ptr noundef %0, ptr noundef nonnull %4) #3
  store ptr %87, ptr %2, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %83, %86
  %.0 = phi i64 [ 0, %86 ], [ -9223372036854775805, %83 ]
  call void @llvm.lifetime.end.p0(i64 60, ptr nonnull %4) #3
  ret i64 %.0
}

declare zeroext i16 @SetDevicePathNodeLength(ptr noundef, i64 noundef) local_unnamed_addr #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

declare ptr @AppendDevicePathNode(ptr noundef, ptr noundef) local_unnamed_addr #1

declare i64 @AsciiStrnCmp(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !6, i64 1}
!11 = !{!"", !6, i64 0, !6, i64 1, !6, i64 2, !6, i64 3, !6, i64 4, !6, i64 5, !6, i64 6, !6, i64 7, !6, i64 8, !9, i64 16, !6, i64 24, !6, i64 25, !6, i64 26, !6, i64 27, !12, i64 28, !12, i64 30, !13, i64 32}
!12 = !{!"short", !6, i64 0}
!13 = !{!"", !12, i64 0, !12, i64 2, !14, i64 4, !14, i64 8, !14, i64 12, !15, i64 16, !12, i64 24, !14, i64 26, !12, i64 30, !6, i64 32, !6, i64 33, !12, i64 34, !6, i64 36, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 72, !6, i64 73}
!14 = !{!"int", !6, i64 0}
!15 = !{!"long long", !6, i64 0}


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