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

; 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._IP4_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i64, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, %struct.IP4_ASSEMBLE_TABLE, %struct.IGMP_SERVICE_DATA, ptr, ptr, ptr, ptr, %struct.EFI_MANAGED_NETWORK_CONFIG_DATA, %struct.EFI_SIMPLE_NETWORK_MODE, ptr, ptr, ptr, ptr, ptr, i32, i32 }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.IP4_ASSEMBLE_TABLE = type { [31 x %struct._LIST_ENTRY] }
%struct.IGMP_SERVICE_DATA = type { i64, %struct._LIST_ENTRY }
%struct.EFI_MANAGED_NETWORK_CONFIG_DATA = type { i32, i32, i16, i8, i8, i8, i8, i8, i8, i8 }
%struct.EFI_SIMPLE_NETWORK_MODE = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, [16 x %struct.EFI_MAC_ADDRESS], %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, %struct.EFI_MAC_ADDRESS, i8, i8, i8, i8, i8 }
%struct.EFI_MAC_ADDRESS = type { [32 x i8] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct._IP4_PROTOCOL = type { i32, %struct._EFI_IP4_PROTOCOL, ptr, i64, ptr, %struct._LIST_ENTRY, %struct.NET_MAP, %struct.NET_MAP, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct.EFI_LOCK, ptr, %struct._LIST_ENTRY, ptr, ptr, i32, ptr, i32, %struct.EFI_IP4_CONFIG_DATA }
%struct._EFI_IP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.NET_MAP = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, i64 }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct.EFI_IP4_CONFIG_DATA = type { i8, i8, i8, i8, i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, i8, i8, i8, i32, i32 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }

@gIp4DriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [151 x i8], align 1
@gEfiManagedNetworkProtocolGuid = external global %struct.GUID, align 4
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiIp4ProtocolGuid = external global %struct.GUID, align 4

; 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 @AllocatePool(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip4ServiceBindingCreateChild(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, 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 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 %109

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._IP4_SERVICE, ptr null, i32 0, i32 1) to i64)
  %26 = inttoptr i64 %25 to ptr
  %27 = getelementptr inbounds %struct._IP4_SERVICE, ptr %26, i32 0, i32 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp ne i32 %28, 1395937353
  br i1 %29, label %30, label %32

30:                                               ; preds = %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 778, ptr noundef @.str.2)
  %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._IP4_SERVICE, 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 %6, align 8, !tbaa !5
  %39 = call ptr @AllocatePool(i64 noundef 336)
  store ptr %39, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %7, 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 %109

43:                                               ; preds = %37
  %44 = load ptr, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  call void @Ip4InitProtocol(ptr noundef %44, ptr noundef %45)
  %46 = load ptr, ptr @gBS, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %46, i32 0, i32 39
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %50, i32 0, i32 1
  %52 = call i64 (ptr, ...) %48(ptr noundef %49, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %51, ptr noundef null)
  store i64 %52, ptr %9, align 8, !tbaa !23
  %53 = load i64, ptr %9, align 8, !tbaa !23
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %56

55:                                               ; preds = %43
  br label %100

56:                                               ; preds = %43
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = load ptr, ptr %7, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %59, i32 0, i32 2
  store ptr %58, ptr %60, align 8, !tbaa !24
  %61 = load ptr, ptr @gBS, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %61, i32 0, i32 33
  %63 = load ptr, ptr %62, align 8, !tbaa !30
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct._IP4_SERVICE, ptr %64, i32 0, i32 12
  %66 = load ptr, ptr %65, align 8, !tbaa !31
  %67 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gIp4DriverBinding, i32 0, i32 5), align 8, !tbaa !32
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %68, i32 0, i32 2
  %70 = load ptr, ptr %69, align 8, !tbaa !24
  %71 = call i64 %63(ptr noundef %66, ptr noundef @gEfiManagedNetworkProtocolGuid, ptr noundef %10, ptr noundef %67, ptr noundef %70, i32 noundef 8)
  store i64 %71, ptr %9, align 8, !tbaa !23
  %72 = load i64, ptr %9, align 8, !tbaa !23
  %73 = icmp slt i64 %72, 0
  br i1 %73, label %74, label %82

74:                                               ; preds = %56
  %75 = load ptr, ptr @gBS, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %75, i32 0, i32 40
  %77 = load ptr, ptr %76, align 8, !tbaa !34
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %79, i32 0, i32 1
  %81 = call i64 (ptr, ...) %77(ptr noundef %78, ptr noundef @gEfiIp4ProtocolGuid, ptr noundef %80, ptr noundef null)
  br label %100

82:                                               ; preds = %56
  %83 = load ptr, ptr @gBS, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %83, i32 0, i32 1
  %85 = load ptr, ptr %84, align 8, !tbaa !35
  %86 = call i64 %85(i64 noundef 8)
  store i64 %86, ptr %8, align 8, !tbaa !23
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._IP4_SERVICE, ptr %87, i32 0, i32 4
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._IP4_PROTOCOL, ptr %89, i32 0, i32 5
  %91 = call ptr @InsertTailList(ptr noundef %88, ptr noundef %90)
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._IP4_SERVICE, ptr %92, i32 0, i32 3
  %94 = load i64, ptr %93, align 8, !tbaa !36
  %95 = add i64 %94, 1
  store i64 %95, ptr %93, align 8, !tbaa !36
  %96 = load ptr, ptr @gBS, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %96, i32 0, i32 2
  %98 = load ptr, ptr %97, align 8, !tbaa !37
  %99 = load i64, ptr %8, align 8, !tbaa !23
  call void %98(i64 noundef %99)
  br label %100

100:                                              ; preds = %82, %74, %55
  %101 = load i64, ptr %9, align 8, !tbaa !23
  %102 = icmp slt i64 %101, 0
  br i1 %102, label %103, label %107

103:                                              ; preds = %100
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = call i64 @Ip4CleanProtocol(ptr noundef %104)
  %106 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %106)
  br label %107

107:                                              ; preds = %103, %100
  %108 = load i64, ptr %9, align 8, !tbaa !23
  store i64 %108, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %109

109:                                              ; preds = %107, %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
  %110 = load i64, ptr %3, align 8
  ret i64 %110
}

declare void @FreePool(ptr noundef) #1

declare void @Ip4InitProtocol(ptr noundef, ptr noundef) #1

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

declare i64 @Ip4CleanProtocol(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, !11, i64 0}
!10 = !{!"_IP4_SERVICE", !11, i64 0, !12, i64 8, !13, i64 24, !13, i64 32, !14, i64 40, !14, i64 56, !6, i64 72, !6, i64 80, !15, i64 88, !16, i64 584, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !17, i64 640, !19, i64 660, !6, i64 1320, !6, i64 1328, !6, i64 1336, !6, i64 1344, !6, i64 1352, !11, i64 1360, !11, i64 1364}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!13 = !{!"long long", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"", !7, i64 0}
!16 = !{!"", !13, i64 0, !14, i64 8}
!17 = !{!"", !11, i64 0, !11, i64 4, !18, i64 8, !7, i64 10, !7, i64 11, !7, i64 12, !7, i64 13, !7, i64 14, !7, i64 15, !7, i64 16}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !15, i64 552, !15, i64 584, !15, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!20 = !{!21, !6, i64 328}
!21 = !{!"", !22, 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}
!22 = !{!"", !13, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!23 = !{!13, !13, i64 0}
!24 = !{!25, !6, i64 72}
!25 = !{!"_IP4_PROTOCOL", !11, i64 0, !26, i64 8, !6, i64 72, !13, i64 80, !6, i64 88, !14, i64 96, !27, i64 112, !27, i64 152, !14, i64 192, !14, i64 208, !28, i64 224, !6, i64 248, !14, i64 256, !6, i64 272, !6, i64 280, !11, i64 288, !6, i64 296, !11, i64 304, !29, i64 308}
!26 = !{!"_EFI_IP4_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}
!27 = !{!"", !14, i64 0, !14, i64 16, !13, i64 32}
!28 = !{!"", !13, i64 0, !13, i64 8, !11, i64 16}
!29 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !7, i64 4, !7, i64 5, !15, i64 6, !15, i64 10, !7, i64 14, !7, i64 15, !7, i64 16, !7, i64 17, !11, i64 20, !11, i64 24}
!30 = !{!21, !6, i64 280}
!31 = !{!10, !6, i64 624}
!32 = !{!33, !6, i64 40}
!33 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!34 = !{!21, !6, i64 336}
!35 = !{!21, !6, i64 24}
!36 = !{!10, !13, i64 32}
!37 = !{!21, !6, i64 32}


; 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] }

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

; 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 @AllocatePool(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @Ip4ServiceBindingCreateChild(ptr noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %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 %52, label %6

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

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

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

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

14:                                               ; preds = %._crit_edge
  tail call void @Ip4InitProtocol(ptr noundef %11, ptr noundef nonnull %12) #3
  %15 = load ptr, ptr @gBS, align 8, !tbaa !19
  %16 = getelementptr inbounds i8, ptr %15, i64 328
  %17 = load ptr, ptr %16, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %12, i64 8
  %19 = tail call i64 (ptr, ...) %17(ptr noundef nonnull %1, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %18, ptr noundef null) #3
  %20 = icmp slt i64 %19, 0
  br i1 %20, label %50, label %21

21:                                               ; preds = %14
  %22 = load ptr, ptr %1, align 8, !tbaa !19
  %23 = getelementptr inbounds i8, ptr %12, i64 72
  store ptr %22, ptr %23, align 8, !tbaa !23
  %24 = load ptr, ptr @gBS, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %24, i64 280
  %26 = load ptr, ptr %25, align 8, !tbaa !29
  %27 = getelementptr inbounds i8, ptr %11, i64 624
  %28 = load ptr, ptr %27, align 8, !tbaa !30
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @gIp4DriverBinding, i64 40), align 8, !tbaa !31
  %30 = call i64 %26(ptr noundef %28, ptr noundef nonnull @gEfiManagedNetworkProtocolGuid, ptr noundef nonnull %3, ptr noundef %29, ptr noundef %22, i32 noundef 8) #3
  %31 = icmp slt i64 %30, 0
  %32 = load ptr, ptr @gBS, align 8, !tbaa !19
  br i1 %31, label %33, label %37

33:                                               ; preds = %21
  %34 = getelementptr inbounds i8, ptr %32, i64 336
  %35 = load ptr, ptr %34, align 8, !tbaa !33
  %36 = call i64 (ptr, ...) %35(ptr noundef nonnull %1, ptr noundef nonnull @gEfiIp4ProtocolGuid, ptr noundef nonnull %18, ptr noundef null) #3
  br label %50

37:                                               ; preds = %21
  %38 = getelementptr inbounds i8, ptr %32, i64 24
  %39 = load ptr, ptr %38, align 8, !tbaa !34
  %40 = call i64 %39(i64 noundef 8) #3
  %41 = getelementptr inbounds i8, ptr %11, i64 40
  %42 = getelementptr inbounds i8, ptr %12, i64 96
  %43 = call ptr @InsertTailList(ptr noundef nonnull %41, ptr noundef nonnull %42) #3
  %44 = getelementptr inbounds i8, ptr %11, i64 32
  %45 = load i64, ptr %44, align 8, !tbaa !35
  %46 = add i64 %45, 1
  store i64 %46, ptr %44, align 8, !tbaa !35
  %47 = load ptr, ptr @gBS, align 8, !tbaa !19
  %48 = getelementptr inbounds i8, ptr %47, i64 32
  %49 = load ptr, ptr %48, align 8, !tbaa !36
  call void %49(i64 noundef %40) #3
  br label %52

50:                                               ; preds = %14, %33
  %.0.ph = phi i64 [ %30, %33 ], [ %19, %14 ]
  %51 = call i64 @Ip4CleanProtocol(ptr noundef nonnull %12) #3
  call void @FreePool(ptr noundef nonnull %12) #3
  br label %52

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

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare void @Ip4InitProtocol(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare i64 @Ip4CleanProtocol(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, !7, i64 0}
!6 = !{!"_IP4_SERVICE", !7, i64 0, !10, i64 8, !12, i64 24, !12, i64 32, !13, i64 40, !13, i64 56, !11, i64 72, !11, i64 80, !14, i64 88, !15, i64 584, !11, i64 608, !11, i64 616, !11, i64 624, !11, i64 632, !16, i64 640, !18, i64 660, !11, i64 1320, !11, i64 1328, !11, i64 1336, !11, i64 1344, !11, i64 1352, !7, i64 1360, !7, i64 1364}
!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 = !{!"long long", !8, i64 0}
!13 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!14 = !{!"", !8, i64 0}
!15 = !{!"", !12, i64 0, !13, i64 8}
!16 = !{!"", !7, i64 0, !7, i64 4, !17, i64 8, !8, i64 10, !8, i64 11, !8, i64 12, !8, i64 13, !8, i64 14, !8, i64 15, !8, i64 16}
!17 = !{!"short", !8, i64 0}
!18 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !8, i64 40, !14, i64 552, !14, i64 584, !14, i64 616, !8, i64 648, !8, i64 649, !8, i64 650, !8, i64 651, !8, i64 652}
!19 = !{!11, !11, i64 0}
!20 = !{!21, !11, i64 328}
!21 = !{!"", !22, 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}
!22 = !{!"", !12, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!23 = !{!24, !11, i64 72}
!24 = !{!"_IP4_PROTOCOL", !7, i64 0, !25, i64 8, !11, i64 72, !12, i64 80, !11, i64 88, !13, i64 96, !26, i64 112, !26, i64 152, !13, i64 192, !13, i64 208, !27, i64 224, !11, i64 248, !13, i64 256, !11, i64 272, !11, i64 280, !7, i64 288, !11, i64 296, !7, i64 304, !28, i64 308}
!25 = !{!"_EFI_IP4_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}
!26 = !{!"", !13, i64 0, !13, i64 16, !12, i64 32}
!27 = !{!"", !12, i64 0, !12, i64 8, !7, i64 16}
!28 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !8, i64 4, !8, i64 5, !14, i64 6, !14, i64 10, !8, i64 14, !8, i64 15, !8, i64 16, !8, i64 17, !7, i64 20, !7, i64 24}
!29 = !{!21, !11, i64 280}
!30 = !{!6, !11, i64 624}
!31 = !{!32, !11, i64 40}
!32 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !11, i64 32, !11, i64 40}
!33 = !{!21, !11, i64 336}
!34 = !{!21, !11, i64 24}
!35 = !{!6, !12, i64 32}
!36 = !{!21, !11, i64 32}


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