; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (IScsiGetTcpConnDevicePath)

; 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._ISCSI_DRIVER_DATA = type { i32, ptr, ptr, %struct._ISCSI_PRIVATE_PROTOCOL, ptr, ptr, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, ptr, ptr, %struct._ISCSI_SESSION }
%struct._ISCSI_PRIVATE_PROTOCOL = type { i32 }
%struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_EXT_SCSI_PASS_THRU_MODE = type { i32, i32, i32 }
%struct._ISCSI_SESSION = type { i32, %struct._ISCSI_SESSION_CONFIG_DATA, %struct._ISCSI_CHAP_AUTH_DATA, [224 x i8], i64, i8, [6 x i8], i16, i32, i32, i32, i32, i16, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i16, i32, i8, i8, i32, i32, i32, i32, i16, i8, i8, i8 }
%struct._ISCSI_SESSION_CONFIG_DATA = type { %struct.ISCSI_SESSION_CONFIG_NVDATA, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.ISCSI_SESSION_CONFIG_NVDATA = type <{ i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, [224 x i8], %struct.EFI_IPv4_ADDRESS, i16, [8 x i8], [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._ISCSI_CHAP_AUTH_DATA = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._ISCSI_CONNECTION = type { i32, %struct._LIST_ENTRY, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i16, i32, %struct.NET_BUF_QUEUE, %struct._TCP4_IO, i32, i32, i32 }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct._TCP4_IO = type { ptr, ptr, ptr, ptr, %struct.EFI_TCP4_CONNECTION_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_CLOSE_TOKEN, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon }
%union.anon = type { ptr }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, 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.IPv4_DEVICE_PATH = type <{ %struct.EFI_DEVICE_PATH_PROTOCOL, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }>
%struct.EFI_DEVICE_PATH_PROTOCOL = type { i8, i8, [2 x i8] }

@.str.1 = external hidden unnamed_addr constant [153 x i8], align 1
@gBS = external global ptr, align 8
@gEfiDevicePathProtocolGuid = external global %struct.GUID, align 4
@.str.8 = external hidden unnamed_addr constant [21 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 @DebugAssertEnabled() #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiGetTcpConnDevicePath(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = 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 8, ptr %5) #3
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %11, i32 0, i32 10
  store ptr %12, ptr %4, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %13, i32 0, i32 5
  %15 = load i8, ptr %14, align 8, !tbaa !9
  %16 = zext i8 %15 to i32
  %17 = icmp ne i32 %16, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %1
  store ptr null, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %117

19:                                               ; preds = %1
  %20 = call zeroext i8 @DebugAssertEnabled()
  %21 = zext i8 %20 to i32
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %39

23:                                               ; preds = %19
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %24, i32 0, i32 13
  %26 = getelementptr inbounds %struct._LIST_ENTRY, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  %28 = ptrtoint ptr %27 to i64
  %29 = sub i64 %28, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %30 = inttoptr i64 %29 to ptr
  %31 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !21
  %33 = icmp ne i32 %32, 1313035081
  br i1 %33, label %34, label %39

34:                                               ; preds = %23
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 787, ptr noundef @.str.8)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %35, i32 0, i32 13
  %37 = getelementptr inbounds %struct._LIST_ENTRY, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !20
  br label %47

39:                                               ; preds = %23, %19
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %40, i32 0, i32 13
  %42 = getelementptr inbounds %struct._LIST_ENTRY, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !20
  %44 = ptrtoint ptr %43 to i64
  %45 = sub i64 %44, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %46 = inttoptr i64 %45 to ptr
  br label %47

47:                                               ; preds = %39, %34
  %48 = phi ptr [ %38, %34 ], [ %46, %39 ]
  store ptr %48, ptr %5, align 8, !tbaa !5
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %49, i32 0, i32 14
  store ptr %50, ptr %6, align 8, !tbaa !5
  %51 = load ptr, ptr @gBS, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %51, i32 0, i32 17
  %53 = load ptr, ptr %52, align 8, !tbaa !28
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._TCP4_IO, ptr %54, i32 0, i32 2
  %56 = load ptr, ptr %55, align 8, !tbaa !31
  %57 = call i64 %53(ptr noundef %56, ptr noundef @gEfiDevicePathProtocolGuid, ptr noundef %7)
  store i64 %57, ptr %8, align 8, !tbaa !32
  %58 = load i64, ptr %8, align 8, !tbaa !32
  %59 = icmp slt i64 %58, 0
  br i1 %59, label %60, label %61

60:                                               ; preds = %47
  store ptr null, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %117

61:                                               ; preds = %47
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = call ptr @DuplicateDevicePath(ptr noundef %62)
  store ptr %63, ptr %7, align 8, !tbaa !5
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %67

66:                                               ; preds = %61
  store ptr null, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %117

67:                                               ; preds = %61
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %68, ptr %9, align 8, !tbaa !5
  br label %69

69:                                               ; preds = %112, %67
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  %71 = call zeroext i8 @IsDevicePathEnd(ptr noundef %70)
  %72 = icmp ne i8 %71, 0
  %73 = xor i1 %72, true
  br i1 %73, label %74, label %115

74:                                               ; preds = %69
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = call zeroext i8 @DevicePathType(ptr noundef %75)
  %77 = zext i8 %76 to i32
  %78 = icmp eq i32 %77, 3
  br i1 %78, label %79, label %112

79:                                               ; preds = %74
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = call zeroext i8 @DevicePathSubType(ptr noundef %80)
  %82 = zext i8 %81 to i32
  %83 = icmp eq i32 %82, 12
  br i1 %83, label %84, label %112

84:                                               ; preds = %79
  %85 = load ptr, ptr %9, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.IPv4_DEVICE_PATH, ptr %85, i32 0, i32 3
  store i16 0, ptr %86, align 1, !tbaa !33
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %87, i32 0, i32 1
  %89 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %89, i32 0, i32 1
  %91 = load i8, ptr %90, align 1, !tbaa !34
  %92 = icmp ne i8 %91, 0
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i32
  %95 = trunc i32 %94 to i8
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.IPv4_DEVICE_PATH, ptr %96, i32 0, i32 6
  store i8 %95, ptr %97, align 1, !tbaa !33
  %98 = load ptr, ptr %9, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.IPv4_DEVICE_PATH, ptr %98, i32 0, i32 7
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %100, i32 0, i32 1
  %102 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %101, i32 0, i32 0
  %103 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %102, i32 0, i32 4
  %104 = call ptr @CopyMem(ptr noundef %99, ptr noundef %103, i64 noundef 4)
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.IPv4_DEVICE_PATH, ptr %105, i32 0, i32 8
  %107 = load ptr, ptr %4, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %107, i32 0, i32 1
  %109 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %108, i32 0, i32 0
  %110 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %109, i32 0, i32 3
  %111 = call ptr @CopyMem(ptr noundef %106, ptr noundef %110, i64 noundef 4)
  br label %115

112:                                              ; preds = %79, %74
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = call ptr @NextDevicePathNode(ptr noundef %113)
  store ptr %114, ptr %9, align 8, !tbaa !5
  br label %69, !llvm.loop !35

115:                                              ; preds = %84, %69
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %116, ptr %2, align 8
  store i32 1, ptr %10, align 4
  br label %117

117:                                              ; preds = %115, %66, %60, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %118 = load ptr, ptr %2, align 8
  ret ptr %118
}

declare ptr @DuplicateDevicePath(ptr noundef) #1

declare zeroext i8 @IsDevicePathEnd(ptr noundef) #1

declare zeroext i8 @DevicePathType(ptr noundef) #1

declare zeroext i8 @DevicePathSubType(ptr noundef) #1

declare ptr @NextDevicePathNode(ptr 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 = !{!10, !7, i64 2880}
!10 = !{!"_ISCSI_SESSION", !11, i64 0, !12, i64 4, !16, i64 276, !7, i64 2648, !18, i64 2872, !7, i64 2880, !7, i64 2881, !15, i64 2888, !11, i64 2892, !11, i64 2896, !11, i64 2900, !11, i64 2904, !15, i64 2908, !19, i64 2912, !11, i64 2928, !19, i64 2936, !15, i64 2952, !11, i64 2956, !7, i64 2960, !7, i64 2961, !11, i64 2964, !11, i64 2968, !11, i64 2972, !11, i64 2976, !15, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ISCSI_SESSION_CONFIG_DATA", !13, i64 0, !14, i64 259, !14, i64 263, !14, i64 267}
!13 = !{!"", !7, i64 0, !7, i64 1, !14, i64 2, !14, i64 6, !14, i64 10, !7, i64 14, !7, i64 15, !14, i64 239, !15, i64 243, !7, i64 245, !7, i64 253}
!14 = !{!"", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!"_ISCSI_CHAP_AUTH_DATA", !17, i64 0, !11, i64 292, !7, i64 296, !11, i64 1320, !7, i64 1324, !11, i64 1340, !7, i64 1344, !11, i64 2368}
!17 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!18 = !{!"long long", !7, i64 0}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!10, !6, i64 2912}
!21 = !{!22, !11, i64 0}
!22 = !{!"_ISCSI_CONNECTION", !11, i64 0, !19, i64 8, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !7, i64 45, !7, i64 46, !15, i64 48, !11, i64 52, !23, i64 56, !24, i64 112, !11, i64 240, !11, i64 244, !11, i64 248}
!23 = !{!"", !11, i64 0, !18, i64 8, !19, i64 16, !19, i64 32, !11, i64 48, !11, i64 52}
!24 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !25, i64 32, !27, i64 48, !27, i64 72, !27, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!25 = !{!"", !26, i64 0}
!26 = !{!"", !6, i64 0, !18, i64 8}
!27 = !{!"", !26, i64 0, !7, i64 16}
!28 = !{!29, !6, i64 152}
!29 = !{!"", !30, 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}
!30 = !{!"", !18, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!31 = !{!24, !6, i64 16}
!32 = !{!18, !18, i64 0}
!33 = !{!7, !7, i64 0}
!34 = !{!10, !7, i64 5}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}


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

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

@.str.1 = external hidden unnamed_addr constant [153 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiDevicePathProtocolGuid = external global %struct.GUID, align 4
@.str.8 = external hidden unnamed_addr constant [21 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 @DebugAssertEnabled() local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiGetTcpConnDevicePath(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %3 = getelementptr inbounds i8, ptr %0, i64 3024
  %4 = load i8, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i8 %4, 1
  br i1 %.not, label %5, label %45

5:                                                ; preds = %1
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not21 = icmp eq i8 %6, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %0, i64 3056
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !19
  %.pre29 = ptrtoint ptr %.pre to i64
  %.pre30 = add i64 %.pre29, -8
  %.pre32 = inttoptr i64 %.pre30 to ptr
  br i1 %.not21, label %._crit_edge, label %7

7:                                                ; preds = %5
  %8 = load i32, ptr %.pre32, align 8, !tbaa !20
  %.not22 = icmp eq i32 %8, 1313035081
  br i1 %.not22, label %._crit_edge, label %9

9:                                                ; preds = %7
  tail call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 787, ptr noundef nonnull @.str.8) #3
  %10 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !19
  br label %._crit_edge

._crit_edge:                                      ; preds = %5, %7, %9
  %11 = phi ptr [ %10, %9 ], [ %.pre32, %7 ], [ %.pre32, %5 ]
  %12 = load ptr, ptr @gBS, align 8, !tbaa !27
  %13 = getelementptr inbounds i8, ptr %12, i64 152
  %14 = load ptr, ptr %13, align 8, !tbaa !28
  %15 = getelementptr inbounds i8, ptr %11, i64 128
  %16 = load ptr, ptr %15, align 8, !tbaa !31
  %17 = call i64 %14(ptr noundef %16, ptr noundef nonnull @gEfiDevicePathProtocolGuid, ptr noundef nonnull %2) #3
  %18 = icmp slt i64 %17, 0
  br i1 %18, label %45, label %19

19:                                               ; preds = %._crit_edge
  %20 = load ptr, ptr %2, align 8, !tbaa !27
  %21 = call ptr @DuplicateDevicePath(ptr noundef %20) #3
  store ptr %21, ptr %2, align 8, !tbaa !27
  %22 = icmp eq ptr %21, null
  br i1 %22, label %45, label %.preheader

.preheader:                                       ; preds = %19
  %23 = call zeroext i8 @IsDevicePathEnd(ptr noundef nonnull %21) #3
  %.not2326 = icmp eq i8 %23, 0
  br i1 %.not2326, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader, %41
  %.027 = phi ptr [ %42, %41 ], [ %21, %.preheader ]
  %24 = call zeroext i8 @DevicePathType(ptr noundef %.027) #3
  %25 = icmp eq i8 %24, 3
  br i1 %25, label %26, label %41

26:                                               ; preds = %.lr.ph
  %27 = call zeroext i8 @DevicePathSubType(ptr noundef %.027) #3
  %28 = icmp eq i8 %27, 12
  br i1 %28, label %29, label %41

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %.027, i64 12
  store i16 0, ptr %30, align 1, !tbaa !32
  %31 = getelementptr inbounds i8, ptr %0, i64 149
  %32 = load i8, ptr %31, align 1, !tbaa !33
  %.not24 = icmp eq i8 %32, 0
  %33 = zext i1 %.not24 to i8
  %34 = getelementptr inbounds i8, ptr %.027, i64 18
  store i8 %33, ptr %34, align 1, !tbaa !32
  %35 = getelementptr inbounds i8, ptr %.027, i64 19
  %36 = getelementptr inbounds i8, ptr %0, i64 158
  %37 = call ptr @CopyMem(ptr noundef nonnull %35, ptr noundef nonnull %36, i64 noundef 4) #3
  %38 = getelementptr inbounds i8, ptr %.027, i64 23
  %39 = getelementptr inbounds i8, ptr %0, i64 154
  %40 = call ptr @CopyMem(ptr noundef nonnull %38, ptr noundef nonnull %39, i64 noundef 4) #3
  br label %.loopexit

41:                                               ; preds = %26, %.lr.ph
  %42 = call ptr @NextDevicePathNode(ptr noundef %.027) #3
  %43 = call zeroext i8 @IsDevicePathEnd(ptr noundef %42) #3
  %.not23 = icmp eq i8 %43, 0
  br i1 %.not23, label %.lr.ph, label %.loopexit, !llvm.loop !34

.loopexit:                                        ; preds = %41, %.preheader, %29
  %44 = load ptr, ptr %2, align 8, !tbaa !27
  br label %45

45:                                               ; preds = %19, %._crit_edge, %1, %.loopexit
  %.019 = phi ptr [ %44, %.loopexit ], [ null, %1 ], [ null, %._crit_edge ], [ null, %19 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret ptr %.019
}

declare ptr @DuplicateDevicePath(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @IsDevicePathEnd(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @DevicePathType(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @DevicePathSubType(ptr noundef) local_unnamed_addr #1

declare ptr @NextDevicePathNode(ptr 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, !8, i64 2880}
!6 = !{!"_ISCSI_SESSION", !7, i64 0, !10, i64 4, !14, i64 276, !8, i64 2648, !16, i64 2872, !8, i64 2880, !8, i64 2881, !13, i64 2888, !7, i64 2892, !7, i64 2896, !7, i64 2900, !7, i64 2904, !13, i64 2908, !17, i64 2912, !7, i64 2928, !17, i64 2936, !13, i64 2952, !7, i64 2956, !8, i64 2960, !8, i64 2961, !7, i64 2964, !7, i64 2968, !7, i64 2972, !7, i64 2976, !13, i64 2980, !8, i64 2982, !8, i64 2983, !8, i64 2984}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_ISCSI_SESSION_CONFIG_DATA", !11, i64 0, !12, i64 259, !12, i64 263, !12, i64 267}
!11 = !{!"", !8, i64 0, !8, i64 1, !12, i64 2, !12, i64 6, !12, i64 10, !8, i64 14, !8, i64 15, !12, i64 239, !13, i64 243, !8, i64 245, !8, i64 253}
!12 = !{!"", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!"_ISCSI_CHAP_AUTH_DATA", !15, i64 0, !7, i64 292, !8, i64 296, !7, i64 1320, !8, i64 1324, !7, i64 1340, !8, i64 1344, !7, i64 2368}
!15 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !8, i64 0, !8, i64 1, !8, i64 128, !8, i64 145, !8, i64 272}
!16 = !{!"long long", !8, i64 0}
!17 = !{!"_LIST_ENTRY", !18, i64 0, !18, i64 8}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!6, !18, i64 2912}
!20 = !{!21, !7, i64 0}
!21 = !{!"_ISCSI_CONNECTION", !7, i64 0, !17, i64 8, !18, i64 24, !18, i64 32, !8, i64 40, !8, i64 41, !8, i64 42, !8, i64 43, !8, i64 44, !8, i64 45, !8, i64 46, !13, i64 48, !7, i64 52, !22, i64 56, !23, i64 112, !7, i64 240, !7, i64 244, !7, i64 248}
!22 = !{!"", !7, i64 0, !16, i64 8, !17, i64 16, !17, i64 32, !7, i64 48, !7, i64 52}
!23 = !{!"_TCP4_IO", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !24, i64 32, !26, i64 48, !26, i64 72, !26, i64 96, !8, i64 120, !8, i64 121, !8, i64 122, !8, i64 123}
!24 = !{!"", !25, i64 0}
!25 = !{!"", !18, i64 0, !16, i64 8}
!26 = !{!"", !25, i64 0, !8, i64 16}
!27 = !{!18, !18, i64 0}
!28 = !{!29, !18, i64 152}
!29 = !{!"", !30, i64 0, !18, i64 24, !18, i64 32, !18, i64 40, !18, i64 48, !18, i64 56, !18, i64 64, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !18, i64 104, !18, i64 112, !18, i64 120, !18, i64 128, !18, i64 136, !18, i64 144, !18, i64 152, !18, i64 160, !18, i64 168, !18, i64 176, !18, i64 184, !18, i64 192, !18, i64 200, !18, i64 208, !18, i64 216, !18, i64 224, !18, i64 232, !18, i64 240, !18, i64 248, !18, i64 256, !18, i64 264, !18, i64 272, !18, i64 280, !18, i64 288, !18, i64 296, !18, i64 304, !18, i64 312, !18, i64 320, !18, i64 328, !18, i64 336, !18, i64 344, !18, i64 352, !18, i64 360, !18, i64 368}
!30 = !{!"", !16, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!31 = !{!23, !18, i64 16}
!32 = !{!8, !8, i64 0}
!33 = !{!6, !8, i64 5}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


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