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

; 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._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct._UDP4_SERVICE_DATA_ = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, ptr, ptr, %struct._LIST_ENTRY, i64, ptr, ptr }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._UDP4_INSTANCE_DATA_ = type { i32, %struct._LIST_ENTRY, ptr, %struct._EFI_UDP4_PROTOCOL, %struct.EFI_UDP4_CONFIG_DATA, ptr, i8, i8, %struct.NET_MAP, %struct.NET_MAP, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i16, i64, ptr, i8 }
%struct._EFI_UDP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_UDP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, i8, i32, i32, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%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._IP_IO = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, i8, i8, %union.IP_IO_IP_COMPLETION_TOKEN, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, i8 }
%union.IP_IO_IP_PROTOCOL = type { ptr }
%union.IP_IO_IP_COMPLETION_TOKEN = type { %struct.EFI_IP4_COMPLETION_TOKEN }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct._IP_IO_IP_INFO = type { %union.EFI_IP_ADDRESS, %union.IP_IO_IP_MASK, %struct._LIST_ENTRY, ptr, %union.IP_IO_IP_PROTOCOL, %union.IP_IO_IP_COMPLETION_TOKEN, i64, i8 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%union.IP_IO_IP_MASK = type { i32 }

@gUdp4DriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.str = external hidden unnamed_addr constant [153 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external global ptr, align 8
@gEfiIp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @Udp4ServiceBindingCreateChild(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %17, label %14

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

17:                                               ; preds = %14, %2
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %155

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

22:                                               ; preds = %18
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = ptrtoint ptr %23 to i64
  %25 = sub i64 %24, ptrtoint (ptr getelementptr inbounds (%struct._UDP4_SERVICE_DATA_, ptr null, i32 0, i32 1) to i64)
  %26 = inttoptr i64 %25 to ptr
  %27 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp ne i32 %28, 879780949
  br i1 %29, label %30, label %32

30:                                               ; preds = %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 319, ptr noundef @.str.1)
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  br label %37

32:                                               ; preds = %22, %18
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = ptrtoint ptr %33 to i64
  %35 = sub i64 %34, ptrtoint (ptr getelementptr inbounds (%struct._UDP4_SERVICE_DATA_, ptr null, i32 0, i32 1) to i64)
  %36 = inttoptr i64 %35 to ptr
  br label %37

37:                                               ; preds = %32, %30
  %38 = phi ptr [ %31, %30 ], [ %36, %32 ]
  store ptr %38, ptr %7, align 8, !tbaa !5
  %39 = call ptr @AllocateZeroPool(i64 noundef 336)
  store ptr %39, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %37
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %155

43:                                               ; preds = %37
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  call void @Udp4InitInstance(ptr noundef %44, ptr noundef %45)
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %46, i32 0, i32 6
  %48 = load ptr, ptr %47, align 8, !tbaa !15
  %49 = call ptr @IpIoAddIp(ptr noundef %48)
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %50, i32 0, i32 15
  store ptr %49, ptr %51, align 8, !tbaa !16
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %52, i32 0, i32 15
  %54 = load ptr, ptr %53, align 8, !tbaa !16
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %57

56:                                               ; preds = %43
  store i64 -9223372036854775799, ptr %6, align 8, !tbaa !23
  br label %124

57:                                               ; preds = %43
  %58 = load ptr, ptr @gBS, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %58, i32 0, i32 39
  %60 = load ptr, ptr %59, align 8, !tbaa !24
  %61 = load ptr, ptr %5, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %62, i32 0, i32 3
  %64 = call i64 (ptr, ...) %60(ptr noundef %61, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %63, ptr noundef null)
  store i64 %64, ptr %6, align 8, !tbaa !23
  %65 = load i64, ptr %6, align 8, !tbaa !23
  %66 = icmp slt i64 %65, 0
  br i1 %66, label %67, label %68

67:                                               ; preds = %57
  br label %124

68:                                               ; preds = %57
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %71, i32 0, i32 5
  store ptr %70, ptr %72, align 8, !tbaa !27
  %73 = load ptr, ptr @gBS, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %73, i32 0, i32 33
  %75 = load ptr, ptr %74, align 8, !tbaa !28
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %76, i32 0, i32 6
  %78 = load ptr, ptr %77, align 8, !tbaa !15
  %79 = getelementptr inbounds %struct._IP_IO, ptr %78, i32 0, i32 4
  %80 = load ptr, ptr %79, align 8, !tbaa !29
  %81 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gUdp4DriverBinding, i32 0, i32 5), align 8, !tbaa !31
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %82, i32 0, i32 5
  %84 = load ptr, ptr %83, align 8, !tbaa !27
  %85 = call i64 %75(ptr noundef %80, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %10, ptr noundef %81, ptr noundef %84, i32 noundef 8)
  store i64 %85, ptr %6, align 8, !tbaa !23
  %86 = load i64, ptr %6, align 8, !tbaa !23
  %87 = icmp slt i64 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %68
  br label %124

89:                                               ; preds = %68
  %90 = load ptr, ptr @gBS, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %90, i32 0, i32 33
  %92 = load ptr, ptr %91, align 8, !tbaa !28
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %93, i32 0, i32 15
  %95 = load ptr, ptr %94, align 8, !tbaa !16
  %96 = getelementptr inbounds %struct._IP_IO_IP_INFO, ptr %95, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !33
  %98 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gUdp4DriverBinding, i32 0, i32 5), align 8, !tbaa !31
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %99, i32 0, i32 5
  %101 = load ptr, ptr %100, align 8, !tbaa !27
  %102 = call i64 %92(ptr noundef %97, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %10, ptr noundef %98, ptr noundef %101, i32 noundef 8)
  store i64 %102, ptr %6, align 8, !tbaa !23
  %103 = load i64, ptr %6, align 8, !tbaa !23
  %104 = icmp slt i64 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %89
  br label %124

106:                                              ; preds = %89
  %107 = load ptr, ptr @gBS, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %107, i32 0, i32 1
  %109 = load ptr, ptr %108, align 8, !tbaa !35
  %110 = call i64 %109(i64 noundef 8)
  store i64 %110, ptr %9, align 8, !tbaa !23
  %111 = load ptr, ptr %7, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %111, i32 0, i32 4
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %113, i32 0, i32 1
  %115 = call ptr @InsertTailList(ptr noundef %112, ptr noundef %114)
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %116, i32 0, i32 5
  %118 = load i64, ptr %117, align 8, !tbaa !36
  %119 = add i64 %118, 1
  store i64 %119, ptr %117, align 8, !tbaa !36
  %120 = load ptr, ptr @gBS, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %120, i32 0, i32 2
  %122 = load ptr, ptr %121, align 8, !tbaa !37
  %123 = load i64, ptr %9, align 8, !tbaa !23
  call void %122(i64 noundef %123)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %155

124:                                              ; preds = %105, %88, %67, %56
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %125, i32 0, i32 5
  %127 = load ptr, ptr %126, align 8, !tbaa !27
  %128 = icmp ne ptr %127, null
  br i1 %128, label %129, label %139

129:                                              ; preds = %124
  %130 = load ptr, ptr @gBS, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %130, i32 0, i32 40
  %132 = load ptr, ptr %131, align 8, !tbaa !38
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %133, i32 0, i32 5
  %135 = load ptr, ptr %134, align 8, !tbaa !27
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %136, i32 0, i32 3
  %138 = call i64 (ptr, ...) %132(ptr noundef %135, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %137, ptr noundef null)
  br label %139

139:                                              ; preds = %129, %124
  %140 = load ptr, ptr %8, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %140, i32 0, i32 15
  %142 = load ptr, ptr %141, align 8, !tbaa !16
  %143 = icmp ne ptr %142, null
  br i1 %143, label %144, label %151

144:                                              ; preds = %139
  %145 = load ptr, ptr %7, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._UDP4_SERVICE_DATA_, ptr %145, i32 0, i32 6
  %147 = load ptr, ptr %146, align 8, !tbaa !15
  %148 = load ptr, ptr %8, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._UDP4_INSTANCE_DATA_, ptr %148, i32 0, i32 15
  %150 = load ptr, ptr %149, align 8, !tbaa !16
  call void @IpIoRemoveIp(ptr noundef %147, ptr noundef %150)
  br label %151

151:                                              ; preds = %144, %139
  %152 = load ptr, ptr %8, align 8, !tbaa !5
  call void @Udp4CleanInstance(ptr noundef %152)
  %153 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %153)
  %154 = load i64, ptr %6, align 8, !tbaa !23
  store i64 %154, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %155

155:                                              ; preds = %151, %106, %42, %17
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  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
  %156 = load i64, ptr %3, align 8
  ret i64 %156
}

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare void @FreePool(ptr noundef) #2

declare ptr @AllocateZeroPool(i64 noundef) #2

declare void @Udp4InitInstance(ptr noundef, ptr noundef) #2

declare ptr @IpIoAddIp(ptr noundef) #2

declare ptr @InsertTailList(ptr noundef, ptr noundef) #2

declare void @IpIoRemoveIp(ptr noundef, ptr noundef) #2

declare void @Udp4CleanInstance(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, !11, i64 0}
!10 = !{!"_UDP4_SERVICE_DATA_", !11, i64 0, !12, i64 8, !6, i64 24, !6, i64 32, !13, i64 40, !14, i64 56, !6, i64 64, !6, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!13 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!14 = !{!"long long", !7, i64 0}
!15 = !{!10, !6, i64 64}
!16 = !{!17, !6, i64 320}
!17 = !{!"_UDP4_INSTANCE_DATA_", !11, i64 0, !13, i64 8, !6, i64 24, !18, i64 32, !19, i64 96, !6, i64 136, !7, i64 144, !7, i64 145, !22, i64 152, !22, i64 192, !22, i64 232, !13, i64 272, !13, i64 288, !21, i64 304, !14, i64 312, !6, i64 320, !7, i64 328}
!18 = !{!"_EFI_UDP4_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!19 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !7, i64 6, !11, i64 8, !11, i64 12, !7, i64 16, !20, i64 17, !20, i64 21, !21, i64 26, !20, i64 28, !21, i64 32}
!20 = !{!"", !7, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = !{!"", !13, i64 0, !13, i64 16, !14, i64 32}
!23 = !{!14, !14, i64 0}
!24 = !{!25, !6, i64 328}
!25 = !{!"", !26, 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}
!26 = !{!"", !14, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!27 = !{!17, !6, i64 136}
!28 = !{!25, !6, i64 280}
!29 = !{!30, !6, i64 48}
!30 = !{!"_IP_IO", !13, i64 0, !13, i64 16, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !7, i64 64, !7, i64 65, !7, i64 72, !13, i64 96, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!31 = !{!32, !6, i64 40}
!32 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!33 = !{!34, !6, i64 40}
!34 = !{!"_IP_IO_IP_INFO", !7, i64 0, !7, i64 16, !13, i64 24, !6, i64 40, !7, i64 48, !7, i64 56, !14, i64 80, !7, i64 88}
!35 = !{!25, !6, i64 24}
!36 = !{!10, !14, i64 56}
!37 = !{!25, !6, i64 32}
!38 = !{!25, !6, i64 336}


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

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

@gUdp4DriverBinding = external dso_local local_unnamed_addr global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.str = external hidden unnamed_addr constant [153 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@gEfiIp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Udp4ServiceBindingCreateChild(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %4 = icmp eq ptr %0, null
  %5 = icmp eq ptr %1, null
  %or.cond = or i1 %4, %5
  br i1 %or.cond, label %78, label %6

6:                                                ; preds = %2
  %7 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %7, 0
  %.pre = ptrtoint ptr %0 to i64
  %.pre48 = add i64 %.pre, -8
  %.pre50 = inttoptr i64 %.pre48 to ptr
  br i1 %.not, label %._crit_edge, label %8

8:                                                ; preds = %6
  %9 = load i32, ptr %.pre50, align 8, !tbaa !5
  %.not45 = icmp eq i32 %9, 879780949
  br i1 %.not45, label %._crit_edge, label %10

10:                                               ; preds = %8
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 319, ptr noundef nonnull @.str.1) #3
  br label %._crit_edge

._crit_edge:                                      ; preds = %6, %8, %10
  %11 = phi ptr [ %0, %10 ], [ %.pre50, %8 ], [ %.pre50, %6 ]
  %12 = tail call ptr @AllocateZeroPool(i64 noundef 336) #3
  %13 = icmp eq ptr %12, null
  br i1 %13, label %78, label %14

14:                                               ; preds = %._crit_edge
  tail call void @Udp4InitInstance(ptr noundef %11, ptr noundef nonnull %12) #3
  %15 = getelementptr inbounds i8, ptr %11, i64 64
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = tail call ptr @IpIoAddIp(ptr noundef %16) #3
  %18 = getelementptr inbounds i8, ptr %12, i64 320
  store ptr %17, ptr %18, align 8, !tbaa !15
  %19 = icmp eq ptr %17, null
  br i1 %19, label %64, label %20

20:                                               ; preds = %14
  %21 = load ptr, ptr @gBS, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %21, i64 328
  %23 = load ptr, ptr %22, align 8, !tbaa !23
  %24 = getelementptr inbounds i8, ptr %12, i64 32
  %25 = tail call i64 (ptr, ...) %23(ptr noundef nonnull %1, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef nonnull %24, ptr noundef null) #3
  %26 = icmp slt i64 %25, 0
  br i1 %26, label %64, label %27

27:                                               ; preds = %20
  %28 = load ptr, ptr %1, align 8, !tbaa !22
  %29 = getelementptr inbounds i8, ptr %12, i64 136
  store ptr %28, ptr %29, align 8, !tbaa !26
  %30 = load ptr, ptr @gBS, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %30, i64 280
  %32 = load ptr, ptr %31, align 8, !tbaa !27
  %33 = load ptr, ptr %15, align 8, !tbaa !14
  %34 = getelementptr inbounds i8, ptr %33, i64 48
  %35 = load ptr, ptr %34, align 8, !tbaa !28
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @gUdp4DriverBinding, i64 40), align 8, !tbaa !30
  %37 = call i64 %32(ptr noundef %35, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %3, ptr noundef %36, ptr noundef %28, i32 noundef 8) #3
  %38 = icmp slt i64 %37, 0
  br i1 %38, label %64, label %39

39:                                               ; preds = %27
  %40 = load ptr, ptr @gBS, align 8, !tbaa !22
  %41 = getelementptr inbounds i8, ptr %40, i64 280
  %42 = load ptr, ptr %41, align 8, !tbaa !27
  %43 = load ptr, ptr %18, align 8, !tbaa !15
  %44 = getelementptr inbounds i8, ptr %43, i64 40
  %45 = load ptr, ptr %44, align 8, !tbaa !32
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @gUdp4DriverBinding, i64 40), align 8, !tbaa !30
  %47 = load ptr, ptr %29, align 8, !tbaa !26
  %48 = call i64 %42(ptr noundef %45, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %3, ptr noundef %46, ptr noundef %47, i32 noundef 8) #3
  %49 = icmp slt i64 %48, 0
  br i1 %49, label %64, label %50

50:                                               ; preds = %39
  %51 = load ptr, ptr @gBS, align 8, !tbaa !22
  %52 = getelementptr inbounds i8, ptr %51, i64 24
  %53 = load ptr, ptr %52, align 8, !tbaa !34
  %54 = call i64 %53(i64 noundef 8) #3
  %55 = getelementptr inbounds i8, ptr %11, i64 40
  %56 = getelementptr inbounds i8, ptr %12, i64 8
  %57 = call ptr @InsertTailList(ptr noundef nonnull %55, ptr noundef nonnull %56) #3
  %58 = getelementptr inbounds i8, ptr %11, i64 56
  %59 = load i64, ptr %58, align 8, !tbaa !35
  %60 = add i64 %59, 1
  store i64 %60, ptr %58, align 8, !tbaa !35
  %61 = load ptr, ptr @gBS, align 8, !tbaa !22
  %62 = getelementptr inbounds i8, ptr %61, i64 32
  %63 = load ptr, ptr %62, align 8, !tbaa !36
  call void %63(i64 noundef %54) #3
  br label %78

64:                                               ; preds = %14, %39, %27, %20
  %.036 = phi i64 [ %25, %20 ], [ %37, %27 ], [ %48, %39 ], [ -9223372036854775799, %14 ]
  %65 = getelementptr inbounds i8, ptr %12, i64 136
  %66 = load ptr, ptr %65, align 8, !tbaa !26
  %.not46 = icmp eq ptr %66, null
  br i1 %.not46, label %73, label %67

67:                                               ; preds = %64
  %68 = load ptr, ptr @gBS, align 8, !tbaa !22
  %69 = getelementptr inbounds i8, ptr %68, i64 336
  %70 = load ptr, ptr %69, align 8, !tbaa !37
  %71 = getelementptr inbounds i8, ptr %12, i64 32
  %72 = call i64 (ptr, ...) %70(ptr noundef nonnull %66, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef nonnull %71, ptr noundef null) #3
  br label %73

73:                                               ; preds = %67, %64
  %74 = load ptr, ptr %18, align 8, !tbaa !15
  %.not47 = icmp eq ptr %74, null
  br i1 %.not47, label %77, label %75

75:                                               ; preds = %73
  %76 = load ptr, ptr %15, align 8, !tbaa !14
  call void @IpIoRemoveIp(ptr noundef %76, ptr noundef nonnull %74) #3
  br label %77

77:                                               ; preds = %75, %73
  call void @Udp4CleanInstance(ptr noundef nonnull %12) #3
  call void @FreePool(ptr noundef nonnull %12) #3
  br label %78

78:                                               ; preds = %._crit_edge, %2, %77, %50
  %.0 = phi i64 [ %.036, %77 ], [ 0, %50 ], [ -9223372036854775806, %2 ], [ -9223372036854775799, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i64 %.0
}

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

declare void @Udp4InitInstance(ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @IpIoAddIp(ptr noundef) local_unnamed_addr #2

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @IpIoRemoveIp(ptr noundef, ptr noundef) local_unnamed_addr #2

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


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