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

; 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._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._LIST_ENTRY = type { ptr, ptr }
%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.EFI_IPv6_ADDRESS = type { [16 x i8] }
%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
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@gEfiMtftp6ProtocolGuid = external global %struct.GUID, align 4

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

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

30:                                               ; preds = %22
  call void @DebugAssert(ptr noundef @.str, i64 noundef 569, ptr noundef @.str.3)
  %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._MTFTP6_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 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call i64 @Mtftp6CreateInstance(ptr noundef %39, ptr noundef %7)
  store i64 %40, ptr %8, align 8, !tbaa !15
  %41 = load i64, ptr %8, align 8, !tbaa !15
  %42 = icmp slt i64 %41, 0
  br i1 %42, label %43, label %45

43:                                               ; preds = %37
  %44 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %44, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %118

45:                                               ; preds = %37
  br label %46

46:                                               ; preds = %45
  %47 = call zeroext i8 @DebugAssertEnabled()
  %48 = icmp ne i8 %47, 0
  br i1 %48, label %49, label %54

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %53, label %52

52:                                               ; preds = %49
  call void @DebugAssert(ptr noundef @.str, i64 noundef 577, ptr noundef @.str.4)
  br label %53

53:                                               ; preds = %52, %49
  br label %54

54:                                               ; preds = %53, %46
  br label %55

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr @gBS, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %57, i32 0, i32 39
  %59 = load ptr, ptr %58, align 8, !tbaa !17
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %61, i32 0, i32 3
  %63 = call i64 (ptr, ...) %59(ptr noundef %60, ptr noundef @gEfiMtftp6ProtocolGuid, ptr noundef %62, ptr noundef null)
  store i64 %63, ptr %8, align 8, !tbaa !15
  %64 = load i64, ptr %8, align 8, !tbaa !15
  %65 = icmp slt i64 %64, 0
  br i1 %65, label %66, label %67

66:                                               ; preds = %56
  br label %115

67:                                               ; preds = %56
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %70, i32 0, i32 1
  store ptr %69, ptr %71, align 8, !tbaa !20
  %72 = load ptr, ptr @gBS, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %72, i32 0, i32 33
  %74 = load ptr, ptr %73, align 8, !tbaa !25
  %75 = load ptr, ptr %6, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %75, i32 0, i32 7
  %77 = load ptr, ptr %76, align 8, !tbaa !26
  %78 = getelementptr inbounds %struct._UDP_IO, ptr %77, i32 0, i32 6
  %79 = load ptr, ptr %78, align 8, !tbaa !27
  %80 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp6DriverBinding, i32 0, i32 5), align 8, !tbaa !30
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %81, i32 0, i32 1
  %83 = load ptr, ptr %82, align 8, !tbaa !20
  %84 = call i64 %74(ptr noundef %79, ptr noundef @gEfiUdp6ProtocolGuid, ptr noundef %10, ptr noundef %80, ptr noundef %83, i32 noundef 8)
  store i64 %84, ptr %8, align 8, !tbaa !15
  %85 = load i64, ptr %8, align 8, !tbaa !15
  %86 = icmp slt i64 %85, 0
  br i1 %86, label %87, label %97

87:                                               ; preds = %67
  %88 = load ptr, ptr @gBS, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %88, i32 0, i32 40
  %90 = load ptr, ptr %89, align 8, !tbaa !32
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !20
  %94 = load ptr, ptr %7, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %94, i32 0, i32 3
  %96 = call i64 (ptr, ...) %90(ptr noundef %93, ptr noundef @gEfiMtftp6ProtocolGuid, ptr noundef %95, ptr noundef null)
  br label %115

97:                                               ; preds = %67
  %98 = load ptr, ptr @gBS, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !33
  %101 = call i64 %100(i64 noundef 8)
  store i64 %101, ptr %9, align 8, !tbaa !15
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %102, i32 0, i32 5
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._MTFTP6_INSTANCE, ptr %104, i32 0, i32 2
  %106 = call ptr @InsertTailList(ptr noundef %103, ptr noundef %105)
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._MTFTP6_SERVICE, ptr %107, i32 0, i32 4
  %109 = load i16, ptr %108, align 8, !tbaa !34
  %110 = add i16 %109, 1
  store i16 %110, ptr %108, align 8, !tbaa !34
  %111 = load ptr, ptr @gBS, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %111, i32 0, i32 2
  %113 = load ptr, ptr %112, align 8, !tbaa !35
  %114 = load i64, ptr %9, align 8, !tbaa !15
  call void %113(i64 noundef %114)
  store i64 0, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %118

115:                                              ; preds = %87, %66
  %116 = load ptr, ptr %7, align 8, !tbaa !5
  call void @Mtftp6DestroyInstance(ptr noundef %116)
  %117 = load i64, ptr %8, align 8, !tbaa !15
  store i64 %117, ptr %3, align 8
  store i32 1, ptr %11, align 4
  br label %118

118:                                              ; preds = %115, %97, %43, %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
  %119 = load i64, ptr %3, align 8
  ret i64 %119
}

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp6CreateInstance(ptr noundef, ptr noundef) #0

declare ptr @InsertTailList(ptr noundef, 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, !11, i64 0}
!10 = !{!"_MTFTP6_SERVICE", !11, i64 0, !12, i64 8, !6, i64 24, !6, i64 32, !13, i64 40, !14, i64 48, !6, i64 64, !6, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_EFI_SERVICE_BINDING_PROTOCOL", !6, i64 0, !6, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = !{!18, !6, i64 328}
!18 = !{!"", !19, 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}
!19 = !{!"", !16, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!20 = !{!21, !6, i64 8}
!21 = !{!"_MTFTP6_INSTANCE", !11, i64 0, !6, i64 8, !14, i64 16, !22, i64 32, !6, i64 96, !6, i64 104, !6, i64 112, !23, i64 120, !13, i64 152, !13, i64 154, !14, i64 160, !24, i64 176, !13, i64 192, !13, i64 194, !6, i64 200, !24, i64 208, !13, i64 224, !6, i64 232, !6, i64 240, !11, i64 248, !11, i64 252, !11, i64 256, !11, i64 260, !16, i64 264, !7, i64 272, !7, i64 273, !7, i64 274}
!22 = !{!"_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}
!23 = !{!"", !13, i64 0, !7, i64 2, !11, i64 4, !24, i64 8, !13, i64 24, !7, i64 26, !11, i64 28}
!24 = !{!"", !7, i64 0}
!25 = !{!18, !6, i64 280}
!26 = !{!10, !6, i64 72}
!27 = !{!28, !6, i64 56}
!28 = !{!"_UDP_IO", !11, i64 0, !14, i64 8, !16, i64 24, !7, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !29, i64 64, !14, i64 720, !6, i64 736, !7, i64 744, !7, i64 752}
!29 = !{!"", !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, !24, i64 552, !24, i64 584, !24, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!30 = !{!31, !6, i64 40}
!31 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!32 = !{!18, !6, i64 336}
!33 = !{!18, !6, i64 24}
!34 = !{!10, !13, i64 40}
!35 = !{!18, !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] }

@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
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@gEfiMtftp6ProtocolGuid = external global %struct.GUID, align 4

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

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

9:                                                ; preds = %7
  %10 = load i32, ptr %.pre30, align 8, !tbaa !5
  %.not26 = icmp eq i32 %10, 1396065869
  br i1 %.not26, label %._crit_edge, label %11

11:                                               ; preds = %9
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 569, ptr noundef nonnull @.str.3) #3
  br label %._crit_edge

._crit_edge:                                      ; preds = %7, %9, %11
  %12 = phi ptr [ %0, %11 ], [ %.pre30, %9 ], [ %.pre30, %7 ]
  %13 = call i64 @Mtftp6CreateInstance(ptr noundef %12, ptr noundef nonnull %3)
  %14 = icmp slt i64 %13, 0
  br i1 %14, label %68, label %15

15:                                               ; preds = %._crit_edge
  %16 = call zeroext i8 @DebugAssertEnabled() #3
  %17 = icmp eq i8 %16, 0
  %18 = load ptr, ptr %3, align 8
  %19 = icmp ne ptr %18, null
  %or.cond3 = select i1 %17, i1 true, i1 %19
  br i1 %or.cond3, label %21, label %20

20:                                               ; preds = %15
  call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 577, ptr noundef nonnull @.str.4) #3
  %.pre = load ptr, ptr %3, align 8, !tbaa !14
  br label %21

21:                                               ; preds = %20, %15
  %22 = phi ptr [ %.pre, %20 ], [ %18, %15 ]
  %23 = load ptr, ptr @gBS, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %23, i64 328
  %25 = load ptr, ptr %24, align 8, !tbaa !15
  %26 = getelementptr inbounds i8, ptr %22, i64 32
  %27 = call i64 (ptr, ...) %25(ptr noundef nonnull %1, ptr noundef nonnull @gEfiMtftp6ProtocolGuid, ptr noundef nonnull %26, ptr noundef null) #3
  %28 = icmp slt i64 %27, 0
  br i1 %28, label %66, label %29

29:                                               ; preds = %21
  %30 = load ptr, ptr %1, align 8, !tbaa !14
  %31 = load ptr, ptr %3, align 8, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  store ptr %30, ptr %32, align 8, !tbaa !19
  %33 = load ptr, ptr @gBS, align 8, !tbaa !14
  %34 = getelementptr inbounds i8, ptr %33, i64 280
  %35 = load ptr, ptr %34, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %12, i64 72
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %38 = getelementptr inbounds i8, ptr %37, i64 56
  %39 = load ptr, ptr %38, align 8, !tbaa !26
  %40 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp6DriverBinding, i64 40), align 8, !tbaa !29
  %41 = call i64 %35(ptr noundef %39, ptr noundef nonnull @gEfiUdp6ProtocolGuid, ptr noundef nonnull %4, ptr noundef %40, ptr noundef %30, i32 noundef 8) #3
  %42 = icmp slt i64 %41, 0
  %43 = load ptr, ptr @gBS, align 8, !tbaa !14
  br i1 %42, label %44, label %52

44:                                               ; preds = %29
  %45 = getelementptr inbounds i8, ptr %43, i64 336
  %46 = load ptr, ptr %45, align 8, !tbaa !31
  %47 = load ptr, ptr %3, align 8, !tbaa !14
  %48 = getelementptr inbounds i8, ptr %47, i64 8
  %49 = load ptr, ptr %48, align 8, !tbaa !19
  %50 = getelementptr inbounds i8, ptr %47, i64 32
  %51 = call i64 (ptr, ...) %46(ptr noundef %49, ptr noundef nonnull @gEfiMtftp6ProtocolGuid, ptr noundef nonnull %50, ptr noundef null) #3
  br label %66

52:                                               ; preds = %29
  %53 = getelementptr inbounds i8, ptr %43, i64 24
  %54 = load ptr, ptr %53, align 8, !tbaa !32
  %55 = call i64 %54(i64 noundef 8) #3
  %56 = getelementptr inbounds i8, ptr %12, i64 48
  %57 = load ptr, ptr %3, align 8, !tbaa !14
  %58 = getelementptr inbounds i8, ptr %57, i64 16
  %59 = call ptr @InsertTailList(ptr noundef nonnull %56, ptr noundef nonnull %58) #3
  %60 = getelementptr inbounds i8, ptr %12, i64 40
  %61 = load i16, ptr %60, align 8, !tbaa !33
  %62 = add i16 %61, 1
  store i16 %62, ptr %60, align 8, !tbaa !33
  %63 = load ptr, ptr @gBS, align 8, !tbaa !14
  %64 = getelementptr inbounds i8, ptr %63, i64 32
  %65 = load ptr, ptr %64, align 8, !tbaa !34
  call void %65(i64 noundef %55) #3
  br label %68

66:                                               ; preds = %21, %44
  %.020 = phi i64 [ %27, %21 ], [ %41, %44 ]
  %67 = load ptr, ptr %3, align 8, !tbaa !14
  call void @Mtftp6DestroyInstance(ptr noundef %67)
  br label %68

68:                                               ; preds = %._crit_edge, %2, %66, %52
  %.0 = phi i64 [ %.020, %66 ], [ 0, %52 ], [ -9223372036854775806, %2 ], [ %13, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  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

; Function Attrs: nounwind uwtable
declare dso_local i64 @Mtftp6CreateInstance(ptr noundef, ptr noundef) local_unnamed_addr #0

declare ptr @InsertTailList(ptr noundef, 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, !7, i64 0}
!6 = !{!"_MTFTP6_SERVICE", !7, i64 0, !10, i64 8, !11, i64 24, !11, i64 32, !12, i64 40, !13, i64 48, !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 = !{!"short", !8, i64 0}
!13 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !11, i64 328}
!16 = !{!"", !17, 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}
!17 = !{!"", !18, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!18 = !{!"long long", !8, i64 0}
!19 = !{!20, !11, i64 8}
!20 = !{!"_MTFTP6_INSTANCE", !7, i64 0, !11, i64 8, !13, i64 16, !21, i64 32, !11, i64 96, !11, i64 104, !11, i64 112, !22, i64 120, !12, i64 152, !12, i64 154, !13, i64 160, !23, i64 176, !12, i64 192, !12, i64 194, !11, i64 200, !23, i64 208, !12, i64 224, !11, i64 232, !11, i64 240, !7, i64 248, !7, i64 252, !7, i64 256, !7, i64 260, !18, i64 264, !8, i64 272, !8, i64 273, !8, i64 274}
!21 = !{!"_EFI_MTFTP6_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}
!22 = !{!"", !12, i64 0, !8, i64 2, !7, i64 4, !23, i64 8, !12, i64 24, !8, i64 26, !7, i64 28}
!23 = !{!"", !8, i64 0}
!24 = !{!16, !11, i64 280}
!25 = !{!6, !11, i64 72}
!26 = !{!27, !11, i64 56}
!27 = !{!"_UDP_IO", !7, i64 0, !13, i64 8, !18, i64 24, !8, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !28, i64 64, !13, i64 720, !11, i64 736, !8, i64 744, !8, i64 752}
!28 = !{!"", !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, !23, i64 552, !23, i64 584, !23, i64 616, !8, i64 648, !8, i64 649, !8, i64 650, !8, i64 651, !8, i64 652}
!29 = !{!30, !11, i64 40}
!30 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !11, i64 32, !11, i64 40}
!31 = !{!16, !11, i64 336}
!32 = !{!16, !11, i64 24}
!33 = !{!6, !12, i64 40}
!34 = !{!16, !11, i64 32}


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