; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/Mtftp6Dxe (Mtftp6ServiceBindingDestroyChild)

; 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._MTFTP6_INSTANCE = type { i32, ptr, %struct._LIST_ENTRY, %struct._EFI_MTFTP6_PROTOCOL, ptr, ptr, ptr, %struct.MTFTP6_EXT_OPTION_INFO, i16, i16, %struct._LIST_ENTRY, %struct.EFI_IPv6_ADDRESS, i16, i16, ptr, %struct.EFI_IPv6_ADDRESS, i16, ptr, ptr, i32, i32, i32, i32, i64, i8, i8, i8 }
%struct._EFI_MTFTP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.MTFTP6_EXT_OPTION_INFO = type { i16, i8, i32, %struct.EFI_IPv6_ADDRESS, i16, i8, i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._MTFTP6_SERVICE = type { i32, %struct._EFI_SERVICE_BINDING_PROTOCOL, ptr, ptr, i16, %struct._LIST_ENTRY, 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 }

@gMtftp6DriverBinding = external dso_local global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.str = external hidden unnamed_addr constant [137 x i8], align 1
@gBS = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiUdp6ProtocolGuid = external global %struct.GUID, align 4
@gEfiMtftp6ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local i64 @Mtftp6ServiceBindingDestroyChild(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 %175

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 @gMtftp6DriverBinding, 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 @gEfiMtftp6ProtocolGuid, 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 %175

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._MTFTP6_INSTANCE, ptr null, i32 0, i32 3) to i64)
  %37 = inttoptr i64 %36 to ptr
  %38 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !17
  %40 = icmp ne i32 %39, 1228293709
  br i1 %40, label %41, label %43

41:                                               ; preds = %33
  call void @DebugAssert(ptr noundef @.str, i64 noundef 685, ptr noundef @.str.3)
  %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._MTFTP6_INSTANCE, ptr null, i32 0, i32 3) 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._MTFTP6_SERVICE, ptr null, i32 0, i32 1) to i64)
  %57 = inttoptr i64 %56 to ptr
  %58 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 8, !tbaa !24
  %60 = icmp ne i32 %59, 1396065869
  br i1 %60, label %61, label %63

61:                                               ; preds = %53
  call void @DebugAssert(ptr noundef @.str, i64 noundef 686, ptr noundef @.str.3)
  %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._MTFTP6_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._MTFTP6_INSTANCE, ptr %70, i32 0, i32 4
  %72 = load ptr, ptr %71, align 8, !tbaa !27
  %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 %175

76:                                               ; preds = %68
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %77, i32 0, i32 26
  %79 = load i8, ptr %78, align 2, !tbaa !28
  %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 %175

82:                                               ; preds = %76
  %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 !29
  %86 = call i64 %85(i64 noundef 8)
  store i64 %86, ptr %10, align 8, !tbaa !16
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %87, i32 0, i32 26
  store i8 1, ptr %88, align 2, !tbaa !28
  %89 = load ptr, ptr @gBS, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %89, i32 0, i32 34
  %91 = load ptr, ptr %90, align 8, !tbaa !30
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %92, i32 0, i32 7
  %94 = load ptr, ptr %93, align 8, !tbaa !31
  %95 = getelementptr inbounds %struct._UDP_IO, ptr %94, i32 0, i32 6
  %96 = load ptr, ptr %95, align 8, !tbaa !32
  %97 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp6DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = call i64 %91(ptr noundef %96, ptr noundef @gEfiUdp6ProtocolGuid, ptr noundef %97, ptr noundef %98)
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %100, i32 0, i32 14
  %102 = load ptr, ptr %101, align 8, !tbaa !35
  %103 = icmp ne ptr %102, null
  br i1 %103, label %104, label %118

104:                                              ; preds = %82
  %105 = load ptr, ptr @gBS, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %105, i32 0, i32 34
  %107 = load ptr, ptr %106, align 8, !tbaa !30
  %108 = load ptr, ptr %7, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %108, i32 0, i32 14
  %110 = load ptr, ptr %109, align 8, !tbaa !35
  %111 = getelementptr inbounds %struct._UDP_IO, ptr %110, i32 0, i32 6
  %112 = load ptr, ptr %111, align 8, !tbaa !32
  %113 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp6DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %114 = load ptr, ptr %7, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %114, i32 0, i32 1
  %116 = load ptr, ptr %115, align 8, !tbaa !36
  %117 = call i64 %107(ptr noundef %112, ptr noundef @gEfiUdp6ProtocolGuid, ptr noundef %113, ptr noundef %116)
  br label %118

118:                                              ; preds = %104, %82
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %119, i32 0, i32 17
  %121 = load ptr, ptr %120, align 8, !tbaa !37
  %122 = icmp ne ptr %121, null
  br i1 %122, label %123, label %137

123:                                              ; preds = %118
  %124 = load ptr, ptr @gBS, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %124, i32 0, i32 34
  %126 = load ptr, ptr %125, align 8, !tbaa !30
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %127, i32 0, i32 17
  %129 = load ptr, ptr %128, align 8, !tbaa !37
  %130 = getelementptr inbounds %struct._UDP_IO, ptr %129, i32 0, i32 6
  %131 = load ptr, ptr %130, align 8, !tbaa !32
  %132 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp6DriverBinding, i32 0, i32 5), align 8, !tbaa !14
  %133 = load ptr, ptr %7, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %133, i32 0, i32 1
  %135 = load ptr, ptr %134, align 8, !tbaa !36
  %136 = call i64 %126(ptr noundef %131, ptr noundef @gEfiUdp6ProtocolGuid, ptr noundef %132, ptr noundef %135)
  br label %137

137:                                              ; preds = %123, %118
  %138 = load ptr, ptr @gBS, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %138, i32 0, i32 2
  %140 = load ptr, ptr %139, align 8, !tbaa !38
  %141 = load i64, ptr %10, align 8, !tbaa !16
  call void %140(i64 noundef %141)
  %142 = load ptr, ptr @gBS, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %142, i32 0, i32 16
  %144 = load ptr, ptr %143, align 8, !tbaa !39
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = call i64 %144(ptr noundef %145, ptr noundef @gEfiMtftp6ProtocolGuid, ptr noundef %146)
  store i64 %147, ptr %9, align 8, !tbaa !16
  %148 = load ptr, ptr @gBS, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %148, i32 0, i32 1
  %150 = load ptr, ptr %149, align 8, !tbaa !29
  %151 = call i64 %150(i64 noundef 8)
  store i64 %151, ptr %10, align 8, !tbaa !16
  %152 = load i64, ptr %9, align 8, !tbaa !16
  %153 = icmp slt i64 %152, 0
  br i1 %153, label %154, label %162

154:                                              ; preds = %137
  %155 = load ptr, ptr %7, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %155, i32 0, i32 26
  store i8 0, ptr %156, align 2, !tbaa !28
  %157 = load ptr, ptr @gBS, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %157, i32 0, i32 2
  %159 = load ptr, ptr %158, align 8, !tbaa !38
  %160 = load i64, ptr %10, align 8, !tbaa !16
  call void %159(i64 noundef %160)
  %161 = load i64, ptr %9, align 8, !tbaa !16
  store i64 %161, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %175

162:                                              ; preds = %137
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %163, i32 0, i32 2
  %165 = call ptr @RemoveEntryList(ptr noundef %164)
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %166, i32 0, i32 4
  %168 = load i16, ptr %167, align 8, !tbaa !40
  %169 = add i16 %168, -1
  store i16 %169, ptr %167, align 8, !tbaa !40
  %170 = load ptr, ptr @gBS, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %171, align 8, !tbaa !38
  %173 = load i64, ptr %10, align 8, !tbaa !16
  call void %172(i64 noundef %173)
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  call void @Mtftp6DestroyInstance(ptr noundef %174)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %175

175:                                              ; preds = %162, %154, %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
  %176 = load i64, ptr %3, align 8
  ret i64 %176
}

declare zeroext i8 @DebugAssertEnabled() #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Mtftp6DestroyInstance(ptr noundef) #0

declare ptr @RemoveEntryList(ptr noundef) #1

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"_MTFTP6_INSTANCE", !13, i64 0, !6, i64 8, !19, i64 16, !20, i64 32, !6, i64 96, !6, i64 104, !6, i64 112, !21, i64 120, !22, i64 152, !22, i64 154, !19, i64 160, !23, i64 176, !22, i64 192, !22, i64 194, !6, i64 200, !23, i64 208, !22, i64 224, !6, i64 232, !6, i64 240, !13, i64 248, !13, i64 252, !13, i64 256, !13, i64 260, !12, i64 264, !7, i64 272, !7, i64 273, !7, i64 274}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"_EFI_MTFTP6_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 = !{!"", !22, i64 0, !7, i64 2, !13, i64 4, !23, i64 8, !22, i64 24, !7, i64 26, !13, i64 28}
!22 = !{!"short", !7, i64 0}
!23 = !{!"", !7, i64 0}
!24 = !{!25, !13, i64 0}
!25 = !{!"_MTFTP6_SERVICE", !13, i64 0, !26, i64 8, !6, i64 24, !6, i64 32, !22, i64 40, !19, i64 48, !6, i64 64, !6, i64 72}
!26 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!27 = !{!18, !6, i64 96}
!28 = !{!18, !7, i64 274}
!29 = !{!10, !6, i64 24}
!30 = !{!10, !6, i64 288}
!31 = !{!25, !6, i64 72}
!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, !23, i64 552, !23, i64 584, !23, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!35 = !{!18, !6, i64 200}
!36 = !{!18, !6, i64 8}
!37 = !{!18, !6, i64 232}
!38 = !{!10, !6, i64 32}
!39 = !{!10, !6, i64 144}
!40 = !{!25, !22, i64 40}


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

@gMtftp6DriverBinding = external dso_local local_unnamed_addr global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8
@.str = external hidden unnamed_addr constant [137 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@gEfiUdp6ProtocolGuid = external global %struct.GUID, align 4
@gEfiMtftp6ProtocolGuid = external global %struct.GUID, align 4

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @Mtftp6ServiceBindingDestroyChild(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 %96, 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 @gMtftp6DriverBinding, i64 40), align 8, !tbaa !14
  %11 = call i64 %9(ptr noundef nonnull %1, ptr noundef nonnull @gEfiMtftp6ProtocolGuid, 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 %96, 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
  %.pre45 = ptrtoint ptr %.pre to i64
  %.pre46 = add i64 %.pre45, -32
  %.pre48 = inttoptr i64 %.pre46 to ptr
  br i1 %.not, label %._crit_edge44, label %15

15:                                               ; preds = %13
  %16 = load i32, ptr %.pre48, align 8, !tbaa !16
  %.not37 = icmp eq i32 %16, 1228293709
  br i1 %.not37, label %._crit_edge44, label %17

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

._crit_edge44:                                    ; preds = %13, %15, %17
  %19 = phi ptr [ %18, %17 ], [ %.pre48, %15 ], [ %.pre48, %13 ]
  %20 = call zeroext i8 @DebugAssertEnabled() #3
  %.not38 = icmp eq i8 %20, 0
  %.pre50 = ptrtoint ptr %0 to i64
  %.pre52 = add i64 %.pre50, -8
  %.pre54 = inttoptr i64 %.pre52 to ptr
  br i1 %.not38, label %._crit_edge, label %21

21:                                               ; preds = %._crit_edge44
  %22 = load i32, ptr %.pre54, align 8, !tbaa !23
  %.not39 = icmp eq i32 %22, 1396065869
  br i1 %.not39, label %._crit_edge, label %23

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

._crit_edge:                                      ; preds = %._crit_edge44, %21, %23
  %24 = phi ptr [ %0, %23 ], [ %.pre54, %21 ], [ %.pre54, %._crit_edge44 ]
  %25 = getelementptr inbounds i8, ptr %19, i64 96
  %26 = load ptr, ptr %25, align 8, !tbaa !26
  %.not40 = icmp eq ptr %26, %24
  br i1 %.not40, label %27, label %96

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

30:                                               ; preds = %27
  %31 = load ptr, ptr @gBS, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !28
  %34 = call i64 %33(i64 noundef 8) #3
  store i8 1, ptr %28, align 2, !tbaa !27
  %35 = load ptr, ptr @gBS, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 288
  %37 = load ptr, ptr %36, align 8, !tbaa !29
  %38 = getelementptr inbounds i8, ptr %24, i64 72
  %39 = load ptr, ptr %38, align 8, !tbaa !30
  %40 = getelementptr inbounds i8, ptr %39, i64 56
  %41 = load ptr, ptr %40, align 8, !tbaa !31
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp6DriverBinding, i64 40), align 8, !tbaa !14
  %43 = call i64 %37(ptr noundef %41, ptr noundef nonnull @gEfiUdp6ProtocolGuid, ptr noundef %42, ptr noundef nonnull %1) #3
  %44 = getelementptr inbounds i8, ptr %19, i64 200
  %45 = load ptr, ptr %44, align 8, !tbaa !34
  %.not42 = icmp eq ptr %45, null
  br i1 %.not42, label %56, label %46

46:                                               ; preds = %30
  %47 = load ptr, ptr @gBS, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 288
  %49 = load ptr, ptr %48, align 8, !tbaa !29
  %50 = getelementptr inbounds i8, ptr %45, i64 56
  %51 = load ptr, ptr %50, align 8, !tbaa !31
  %52 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp6DriverBinding, i64 40), align 8, !tbaa !14
  %53 = getelementptr inbounds i8, ptr %19, i64 8
  %54 = load ptr, ptr %53, align 8, !tbaa !35
  %55 = call i64 %49(ptr noundef %51, ptr noundef nonnull @gEfiUdp6ProtocolGuid, ptr noundef %52, ptr noundef %54) #3
  br label %56

56:                                               ; preds = %46, %30
  %57 = getelementptr inbounds i8, ptr %19, i64 232
  %58 = load ptr, ptr %57, align 8, !tbaa !36
  %.not43 = icmp eq ptr %58, null
  br i1 %.not43, label %69, label %59

59:                                               ; preds = %56
  %60 = load ptr, ptr @gBS, align 8, !tbaa !5
  %61 = getelementptr inbounds i8, ptr %60, i64 288
  %62 = load ptr, ptr %61, align 8, !tbaa !29
  %63 = getelementptr inbounds i8, ptr %58, i64 56
  %64 = load ptr, ptr %63, align 8, !tbaa !31
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp6DriverBinding, i64 40), align 8, !tbaa !14
  %66 = getelementptr inbounds i8, ptr %19, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !35
  %68 = call i64 %62(ptr noundef %64, ptr noundef nonnull @gEfiUdp6ProtocolGuid, ptr noundef %65, ptr noundef %67) #3
  br label %69

69:                                               ; preds = %59, %56
  %70 = load ptr, ptr @gBS, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 32
  %72 = load ptr, ptr %71, align 8, !tbaa !37
  call void %72(i64 noundef %34) #3
  %73 = load ptr, ptr @gBS, align 8, !tbaa !5
  %74 = getelementptr inbounds i8, ptr %73, i64 144
  %75 = load ptr, ptr %74, align 8, !tbaa !38
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = call i64 %75(ptr noundef nonnull %1, ptr noundef nonnull @gEfiMtftp6ProtocolGuid, ptr noundef %76) #3
  %78 = load ptr, ptr @gBS, align 8, !tbaa !5
  %79 = getelementptr inbounds i8, ptr %78, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !28
  %81 = call i64 %80(i64 noundef 8) #3
  %82 = icmp slt i64 %77, 0
  br i1 %82, label %83, label %87

83:                                               ; preds = %69
  store i8 0, ptr %28, align 2, !tbaa !27
  %84 = load ptr, ptr @gBS, align 8, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %84, i64 32
  %86 = load ptr, ptr %85, align 8, !tbaa !37
  call void %86(i64 noundef %81) #3
  br label %96

87:                                               ; preds = %69
  %88 = getelementptr inbounds i8, ptr %19, i64 16
  %89 = call ptr @RemoveEntryList(ptr noundef nonnull %88) #3
  %90 = getelementptr inbounds i8, ptr %24, i64 40
  %91 = load i16, ptr %90, align 8, !tbaa !39
  %92 = add i16 %91, -1
  store i16 %92, ptr %90, align 8, !tbaa !39
  %93 = load ptr, ptr @gBS, align 8, !tbaa !5
  %94 = getelementptr inbounds i8, ptr %93, i64 32
  %95 = load ptr, ptr %94, align 8, !tbaa !37
  call void %95(i64 noundef %81) #3
  call void @Mtftp6DestroyInstance(ptr noundef nonnull %19)
  br label %96

96:                                               ; preds = %27, %._crit_edge, %6, %2, %87, %83
  %.0 = phi i64 [ %77, %83 ], [ 0, %87 ], [ -9223372036854775806, %2 ], [ -9223372036854775805, %6 ], [ -9223372036854775806, %._crit_edge ], [ 0, %27 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i64 %.0
}

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @Mtftp6DestroyInstance(ptr noundef) local_unnamed_addr #0

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"_MTFTP6_INSTANCE", !13, i64 0, !6, i64 8, !18, i64 16, !19, i64 32, !6, i64 96, !6, i64 104, !6, i64 112, !20, i64 120, !21, i64 152, !21, i64 154, !18, i64 160, !22, i64 176, !21, i64 192, !21, i64 194, !6, i64 200, !22, i64 208, !21, i64 224, !6, i64 232, !6, i64 240, !13, i64 248, !13, i64 252, !13, i64 256, !13, i64 260, !12, i64 264, !7, i64 272, !7, i64 273, !7, i64 274}
!18 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!19 = !{!"_EFI_MTFTP6_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 = !{!"", !21, i64 0, !7, i64 2, !13, i64 4, !22, i64 8, !21, i64 24, !7, i64 26, !13, i64 28}
!21 = !{!"short", !7, i64 0}
!22 = !{!"", !7, i64 0}
!23 = !{!24, !13, i64 0}
!24 = !{!"_MTFTP6_SERVICE", !13, i64 0, !25, i64 8, !6, i64 24, !6, i64 32, !21, i64 40, !18, i64 48, !6, i64 64, !6, i64 72}
!25 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!26 = !{!17, !6, i64 96}
!27 = !{!17, !7, i64 274}
!28 = !{!10, !6, i64 24}
!29 = !{!10, !6, i64 288}
!30 = !{!24, !6, i64 72}
!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, !22, i64 552, !22, i64 584, !22, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!34 = !{!17, !6, i64 200}
!35 = !{!17, !6, i64 8}
!36 = !{!17, !6, i64 232}
!37 = !{!10, !6, i64 32}
!38 = !{!10, !6, i64 144}
!39 = !{!24, !21, i64 40}


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