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

; 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.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._MTFTP4_PROTOCOL = type { i32, %struct._LIST_ENTRY, %struct._EFI_MTFTP4_PROTOCOL, i64, i8, ptr, ptr, %struct.EFI_MTFTP4_CONFIG_DATA, ptr, %struct.MTFTP4_OPTION, i16, i16, i16, %struct._LIST_ENTRY, i32, i16, i16, i32, ptr, ptr, i32, i32, i32, i32, i32, i16, i8, ptr }
%struct._EFI_MTFTP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_MTFTP4_CONFIG_DATA = type { i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, i16, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.MTFTP4_OPTION = type { i16, i8, i32, i32, i16, i8, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._MTFTP4_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, i16, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_SERVICE_BINDING_PROTOCOL = type { ptr, ptr }
%struct._UDP_IO = type { i32, %struct._LIST_ENTRY, i64, i8, ptr, ptr, ptr, %struct.EFI_SIMPLE_NETWORK_MODE, %struct._LIST_ENTRY, ptr, %union.anon, %union.anon.0 }
%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] }
%union.anon = type { ptr }
%union.anon.0 = type { %struct.EFI_UDP6_CONFIG_DATA }
%struct.EFI_UDP6_CONFIG_DATA = type { i8, i8, i8, i8, i8, i32, i32, %struct.EFI_IPv6_ADDRESS, i16, %struct.EFI_IPv6_ADDRESS, i16 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }

@gMtftp4DriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [157 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiMtftp4ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @Mtftp4ServiceBindingDestroyChild(ptr noundef %0, ptr noundef %1) #0 {
  %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 ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, 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 %158

18:                                               ; preds = %14
  %19 = load ptr, ptr @gBS, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %19, i32 0, i32 33
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp4DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call i64 %21(ptr noundef %22, ptr noundef @gEfiMtftp4ProtocolGuid, ptr noundef %8, ptr noundef %23, ptr noundef %24, i32 noundef 2)
  store i64 %25, ptr %9, align 8, !tbaa !16
  %26 = load i64, ptr %9, align 8, !tbaa !16
  %27 = icmp slt i64 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %18
  store i64 -9223372036854775805, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %158

29:                                               ; preds = %18
  %30 = call zeroext i8 @DebugAssertEnabled()
  %31 = zext i8 %30 to i32
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %43

33:                                               ; preds = %29
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = ptrtoint ptr %34 to i64
  %36 = sub i64 %35, ptrtoint (ptr getelementptr inbounds (%struct._MTFTP4_PROTOCOL, ptr null, i32 0, i32 2) to i64)
  %37 = inttoptr i64 %36 to ptr
  %38 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !17
  %40 = icmp ne i32 %39, 1886676596
  br i1 %40, label %41, label %43

41:                                               ; preds = %33
  call void @DebugAssert(ptr noundef @.str, i64 noundef 658, ptr noundef @.str.2)
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  br label %48

43:                                               ; preds = %33, %29
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = ptrtoint ptr %44 to i64
  %46 = sub i64 %45, ptrtoint (ptr getelementptr inbounds (%struct._MTFTP4_PROTOCOL, ptr null, i32 0, i32 2) to i64)
  %47 = inttoptr i64 %46 to ptr
  br label %48

48:                                               ; preds = %43, %41
  %49 = phi ptr [ %42, %41 ], [ %47, %43 ]
  store ptr %49, ptr %7, align 8, !tbaa !5
  %50 = call zeroext i8 @DebugAssertEnabled()
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %63

53:                                               ; preds = %48
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = ptrtoint ptr %54 to i64
  %56 = sub i64 %55, ptrtoint (ptr getelementptr inbounds (%struct._MTFTP4_SERVICE, ptr null, i32 0, i32 1) to i64)
  %57 = inttoptr i64 %56 to ptr
  %58 = getelementptr inbounds %struct._MTFTP4_SERVICE, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !25
  %60 = icmp ne i32 %59, 1347700308
  br i1 %60, label %61, label %63

61:                                               ; preds = %53
  call void @DebugAssert(ptr noundef @.str, i64 noundef 659, ptr noundef @.str.2)
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  br label %68

63:                                               ; preds = %53, %48
  %64 = load ptr, ptr %4, align 8, !tbaa !5
  %65 = ptrtoint ptr %64 to i64
  %66 = sub i64 %65, ptrtoint (ptr getelementptr inbounds (%struct._MTFTP4_SERVICE, ptr null, i32 0, i32 1) to i64)
  %67 = inttoptr i64 %66 to ptr
  br label %68

68:                                               ; preds = %63, %61
  %69 = phi ptr [ %62, %61 ], [ %67, %63 ]
  store ptr %69, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %70, i32 0, i32 5
  %72 = load ptr, ptr %71, align 8, !tbaa !28
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = icmp ne ptr %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %68
  store i64 -9223372036854775806, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %158

76:                                               ; preds = %68
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %77, i32 0, i32 4
  %79 = load i8, ptr %78, align 8, !tbaa !29
  %80 = icmp ne i8 %79, 0
  br i1 %80, label %81, label %82

81:                                               ; preds = %76
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %158

82:                                               ; preds = %76
  %83 = load ptr, ptr %7, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %83, i32 0, i32 4
  store i8 1, ptr %84, align 8, !tbaa !29
  %85 = load ptr, ptr @gBS, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %85, i32 0, i32 34
  %87 = load ptr, ptr %86, align 8, !tbaa !30
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._MTFTP4_SERVICE, ptr %88, i32 0, i32 8
  %90 = load ptr, ptr %89, align 8, !tbaa !31
  %91 = getelementptr inbounds %struct._UDP_IO, ptr %90, i32 0, i32 6
  %92 = load ptr, ptr %91, align 8, !tbaa !32
  %93 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp4DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = call i64 %87(ptr noundef %92, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %93, ptr noundef %94)
  %96 = load ptr, ptr @gBS, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %96, i32 0, i32 34
  %98 = load ptr, ptr %97, align 8, !tbaa !30
  %99 = load ptr, ptr %7, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %99, i32 0, i32 18
  %101 = load ptr, ptr %100, align 8, !tbaa !35
  %102 = getelementptr inbounds %struct._UDP_IO, ptr %101, i32 0, i32 6
  %103 = load ptr, ptr %102, align 8, !tbaa !32
  %104 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp4DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = call i64 %98(ptr noundef %103, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %104, ptr noundef %105)
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %107, i32 0, i32 27
  %109 = load ptr, ptr %108, align 8, !tbaa !36
  %110 = icmp ne ptr %109, null
  br i1 %110, label %111, label %123

111:                                              ; preds = %82
  %112 = load ptr, ptr @gBS, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %112, i32 0, i32 34
  %114 = load ptr, ptr %113, align 8, !tbaa !30
  %115 = load ptr, ptr %7, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %115, i32 0, i32 27
  %117 = load ptr, ptr %116, align 8, !tbaa !36
  %118 = getelementptr inbounds %struct._UDP_IO, ptr %117, i32 0, i32 6
  %119 = load ptr, ptr %118, align 8, !tbaa !32
  %120 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp4DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %121 = load ptr, ptr %5, align 8, !tbaa !5
  %122 = call i64 %114(ptr noundef %119, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %120, ptr noundef %121)
  br label %123

123:                                              ; preds = %111, %82
  %124 = load ptr, ptr @gBS, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %124, i32 0, i32 16
  %126 = load ptr, ptr %125, align 8, !tbaa !37
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = load ptr, ptr %8, align 8, !tbaa !5
  %129 = call i64 %126(ptr noundef %127, ptr noundef @gEfiMtftp4ProtocolGuid, ptr noundef %128)
  store i64 %129, ptr %9, align 8, !tbaa !16
  %130 = load i64, ptr %9, align 8, !tbaa !16
  %131 = icmp slt i64 %130, 0
  br i1 %131, label %132, label %136

132:                                              ; preds = %123
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %133, i32 0, i32 4
  store i8 0, ptr %134, align 8, !tbaa !29
  %135 = load i64, ptr %9, align 8, !tbaa !16
  store i64 %135, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %158

136:                                              ; preds = %123
  %137 = load ptr, ptr @gBS, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %137, i32 0, i32 1
  %139 = load ptr, ptr %138, align 8, !tbaa !38
  %140 = call i64 %139(i64 noundef 8)
  store i64 %140, ptr %10, align 8, !tbaa !16
  %141 = load ptr, ptr %7, align 8, !tbaa !5
  call void @Mtftp4CleanOperation(ptr noundef %141, i64 noundef -9223372036854775801)
  %142 = load ptr, ptr %7, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %142, i32 0, i32 18
  %144 = load ptr, ptr %143, align 8, !tbaa !35
  %145 = call i64 @UdpIoFreeIo(ptr noundef %144)
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %146, i32 0, i32 1
  %148 = call ptr @RemoveEntryList(ptr noundef %147)
  %149 = load ptr, ptr %6, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct._MTFTP4_SERVICE, ptr %149, i32 0, i32 2
  %151 = load i16, ptr %150, align 8, !tbaa !39
  %152 = add i16 %151, -1
  store i16 %152, ptr %150, align 8, !tbaa !39
  %153 = load ptr, ptr @gBS, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %153, i32 0, i32 2
  %155 = load ptr, ptr %154, align 8, !tbaa !40
  %156 = load i64, ptr %10, align 8, !tbaa !16
  call void %155(i64 noundef %156)
  %157 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %157)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %158

158:                                              ; preds = %136, %132, %81, %75, %28, %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
  %159 = load i64, ptr %3, align 8
  ret i64 %159
}

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

; 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 i64 @UdpIoFreeIo(ptr noundef) #2

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare ptr @RemoveEntryList(ptr noundef) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 280}
!10 = !{!"", !11, 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}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !13, i64 0}
!18 = !{!"_MTFTP4_PROTOCOL", !13, i64 0, !19, i64 8, !20, i64 24, !12, i64 88, !7, i64 96, !6, i64 104, !6, i64 112, !21, i64 120, !6, i64 152, !24, i64 160, !23, i64 180, !23, i64 182, !23, i64 184, !19, i64 192, !13, i64 208, !23, i64 212, !23, i64 214, !13, i64 216, !6, i64 224, !6, i64 232, !13, i64 240, !13, i64 244, !13, i64 248, !13, i64 252, !13, i64 256, !23, i64 260, !7, i64 262, !6, i64 264}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"_EFI_MTFTP4_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}
!21 = !{!"", !7, i64 0, !22, i64 1, !22, i64 5, !23, i64 10, !22, i64 12, !22, i64 16, !23, i64 20, !23, i64 22, !23, i64 24}
!22 = !{!"", !7, i64 0}
!23 = !{!"short", !7, i64 0}
!24 = !{!"", !23, i64 0, !7, i64 2, !13, i64 4, !13, i64 8, !23, i64 12, !7, i64 14, !13, i64 16}
!25 = !{!26, !13, i64 0}
!26 = !{!"_MTFTP4_SERVICE", !13, i64 0, !27, i64 8, !23, i64 24, !19, i64 32, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!27 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!28 = !{!18, !6, i64 104}
!29 = !{!18, !7, i64 96}
!30 = !{!10, !6, i64 288}
!31 = !{!26, !6, i64 80}
!32 = !{!33, !6, i64 56}
!33 = !{!"_UDP_IO", !13, i64 0, !19, i64 8, !12, i64 24, !7, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !34, i64 64, !19, i64 720, !6, i64 736, !7, i64 744, !7, i64 752}
!34 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !7, i64 40, !22, i64 552, !22, i64 584, !22, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!35 = !{!18, !6, i64 224}
!36 = !{!18, !6, i64 264}
!37 = !{!10, !6, i64 144}
!38 = !{!10, !6, i64 24}
!39 = !{!26, !23, i64 24}
!40 = !{!10, !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] }

@gMtftp4DriverBinding = 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 [157 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiMtftp4ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Mtftp4ServiceBindingDestroyChild(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 %82, label %6

6:                                                ; preds = %2
  %7 = load ptr, ptr @gBS, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 280
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp4DriverBinding, i64 40), align 8, !tbaa !14
  %11 = call i64 %9(ptr noundef nonnull %1, ptr noundef nonnull @gEfiMtftp4ProtocolGuid, ptr noundef nonnull %3, ptr noundef %10, ptr noundef nonnull %1, i32 noundef 2) #3
  %12 = icmp slt i64 %11, 0
  br i1 %12, label %82, label %13

13:                                               ; preds = %6
  %14 = call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %14, 0
  %.pre = load ptr, ptr %3, align 8, !tbaa !5
  %.pre42 = ptrtoint ptr %.pre to i64
  %.pre43 = add i64 %.pre42, -24
  %.pre45 = inttoptr i64 %.pre43 to ptr
  br i1 %.not, label %._crit_edge41, label %15

15:                                               ; preds = %13
  %16 = load i32, ptr %.pre45, align 8, !tbaa !16
  %.not35 = icmp eq i32 %16, 1886676596
  br i1 %.not35, label %._crit_edge41, label %17

17:                                               ; preds = %15
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 658, ptr noundef nonnull @.str.2) #3
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  br label %._crit_edge41

._crit_edge41:                                    ; preds = %13, %15, %17
  %19 = phi ptr [ %18, %17 ], [ %.pre45, %15 ], [ %.pre45, %13 ]
  %20 = call zeroext i8 @DebugAssertEnabled() #3
  %.not36 = icmp eq i8 %20, 0
  %.pre47 = ptrtoint ptr %0 to i64
  %.pre49 = add i64 %.pre47, -8
  %.pre51 = inttoptr i64 %.pre49 to ptr
  br i1 %.not36, label %._crit_edge, label %21

21:                                               ; preds = %._crit_edge41
  %22 = load i32, ptr %.pre51, align 8, !tbaa !24
  %.not37 = icmp eq i32 %22, 1347700308
  br i1 %.not37, label %._crit_edge, label %23

23:                                               ; preds = %21
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 659, ptr noundef nonnull @.str.2) #3
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge41, %21, %23
  %24 = phi ptr [ %0, %23 ], [ %.pre51, %21 ], [ %.pre51, %._crit_edge41 ]
  %25 = getelementptr inbounds i8, ptr %19, i64 104
  %26 = load ptr, ptr %25, align 8, !tbaa !27
  %.not38 = icmp eq ptr %26, %24
  br i1 %.not38, label %27, label %82

27:                                               ; preds = %._crit_edge
  %28 = getelementptr inbounds i8, ptr %19, i64 96
  %29 = load i8, ptr %28, align 8, !tbaa !28
  %.not39 = icmp eq i8 %29, 0
  br i1 %.not39, label %30, label %82

30:                                               ; preds = %27
  store i8 1, ptr %28, align 8, !tbaa !28
  %31 = load ptr, ptr @gBS, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 288
  %33 = load ptr, ptr %32, align 8, !tbaa !29
  %34 = getelementptr inbounds i8, ptr %24, i64 80
  %35 = load ptr, ptr %34, align 8, !tbaa !30
  %36 = getelementptr inbounds i8, ptr %35, i64 56
  %37 = load ptr, ptr %36, align 8, !tbaa !31
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp4DriverBinding, i64 40), align 8, !tbaa !14
  %39 = call i64 %33(ptr noundef %37, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef %38, ptr noundef nonnull %1) #3
  %40 = load ptr, ptr @gBS, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 288
  %42 = load ptr, ptr %41, align 8, !tbaa !29
  %43 = getelementptr inbounds i8, ptr %19, i64 224
  %44 = load ptr, ptr %43, align 8, !tbaa !34
  %45 = getelementptr inbounds i8, ptr %44, i64 56
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp4DriverBinding, i64 40), align 8, !tbaa !14
  %48 = call i64 %42(ptr noundef %46, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef %47, ptr noundef nonnull %1) #3
  %49 = getelementptr inbounds i8, ptr %19, i64 264
  %50 = load ptr, ptr %49, align 8, !tbaa !35
  %.not40 = icmp eq ptr %50, null
  br i1 %.not40, label %59, label %51

51:                                               ; preds = %30
  %52 = load ptr, ptr @gBS, align 8, !tbaa !5
  %53 = getelementptr inbounds i8, ptr %52, i64 288
  %54 = load ptr, ptr %53, align 8, !tbaa !29
  %55 = getelementptr inbounds i8, ptr %50, i64 56
  %56 = load ptr, ptr %55, align 8, !tbaa !31
  %57 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp4DriverBinding, i64 40), align 8, !tbaa !14
  %58 = call i64 %54(ptr noundef %56, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef %57, ptr noundef nonnull %1) #3
  br label %59

59:                                               ; preds = %51, %30
  %60 = load ptr, ptr @gBS, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 144
  %62 = load ptr, ptr %61, align 8, !tbaa !36
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = call i64 %62(ptr noundef nonnull %1, ptr noundef nonnull @gEfiMtftp4ProtocolGuid, ptr noundef %63) #3
  %65 = icmp slt i64 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %59
  store i8 0, ptr %28, align 8, !tbaa !28
  br label %82

67:                                               ; preds = %59
  %68 = load ptr, ptr @gBS, align 8, !tbaa !5
  %69 = getelementptr inbounds i8, ptr %68, i64 24
  %70 = load ptr, ptr %69, align 8, !tbaa !37
  %71 = call i64 %70(i64 noundef 8) #3
  call void @Mtftp4CleanOperation(ptr noundef nonnull %19, i64 noundef -9223372036854775801) #3
  %72 = load ptr, ptr %43, align 8, !tbaa !34
  %73 = call i64 @UdpIoFreeIo(ptr noundef %72) #3
  %74 = getelementptr inbounds i8, ptr %19, i64 8
  %75 = call ptr @RemoveEntryList(ptr noundef nonnull %74) #3
  %76 = getelementptr inbounds i8, ptr %24, i64 24
  %77 = load i16, ptr %76, align 8, !tbaa !38
  %78 = add i16 %77, -1
  store i16 %78, ptr %76, align 8, !tbaa !38
  %79 = load ptr, ptr @gBS, align 8, !tbaa !5
  %80 = getelementptr inbounds i8, ptr %79, i64 32
  %81 = load ptr, ptr %80, align 8, !tbaa !39
  call void %81(i64 noundef %71) #3
  call void @FreePool(ptr noundef nonnull %19) #3
  br label %82

82:                                               ; preds = %27, %._crit_edge, %6, %2, %67, %66
  %.0 = phi i64 [ %64, %66 ], [ 0, %67 ], [ -9223372036854775806, %2 ], [ -9223372036854775805, %6 ], [ -9223372036854775806, %._crit_edge ], [ 0, %27 ]
  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

; 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 i64 @UdpIoFreeIo(ptr noundef) local_unnamed_addr #2

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

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

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

declare ptr @RemoveEntryList(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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 280}
!10 = !{!"", !11, 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}
!11 = !{!"", !12, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!12 = !{!"long long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 40}
!15 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!16 = !{!17, !13, i64 0}
!17 = !{!"_MTFTP4_PROTOCOL", !13, i64 0, !18, i64 8, !19, i64 24, !12, i64 88, !7, i64 96, !6, i64 104, !6, i64 112, !20, i64 120, !6, i64 152, !23, i64 160, !22, i64 180, !22, i64 182, !22, i64 184, !18, i64 192, !13, i64 208, !22, i64 212, !22, i64 214, !13, i64 216, !6, i64 224, !6, i64 232, !13, i64 240, !13, i64 244, !13, i64 248, !13, i64 252, !13, i64 256, !22, i64 260, !7, i64 262, !6, i64 264}
!18 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!19 = !{!"_EFI_MTFTP4_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}
!20 = !{!"", !7, i64 0, !21, i64 1, !21, i64 5, !22, i64 10, !21, i64 12, !21, i64 16, !22, i64 20, !22, i64 22, !22, i64 24}
!21 = !{!"", !7, i64 0}
!22 = !{!"short", !7, i64 0}
!23 = !{!"", !22, i64 0, !7, i64 2, !13, i64 4, !13, i64 8, !22, i64 12, !7, i64 14, !13, i64 16}
!24 = !{!25, !13, i64 0}
!25 = !{!"_MTFTP4_SERVICE", !13, i64 0, !26, i64 8, !22, i64 24, !18, i64 32, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80}
!26 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!27 = !{!17, !6, i64 104}
!28 = !{!17, !7, i64 96}
!29 = !{!10, !6, i64 288}
!30 = !{!25, !6, i64 80}
!31 = !{!32, !6, i64 56}
!32 = !{!"_UDP_IO", !13, i64 0, !18, i64 8, !12, i64 24, !7, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !33, i64 64, !18, i64 720, !6, i64 736, !7, i64 744, !7, i64 752}
!33 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !7, i64 40, !21, i64 552, !21, i64 584, !21, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!34 = !{!17, !6, i64 224}
!35 = !{!17, !6, i64 264}
!36 = !{!10, !6, i64 144}
!37 = !{!10, !6, i64 24}
!38 = !{!25, !22, i64 24}
!39 = !{!10, !6, i64 32}


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