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

; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }
%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._EFI_MTFTP4_TOKEN = type { i64, ptr, ptr, ptr, ptr, i32, ptr, i64, ptr, ptr, ptr, 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._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] }

@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [155 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4
@gMtftp4DriverBinding = external global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8

; Function Attrs: nounwind uwtable
define dso_local void @Mtftp4CleanOperation(ptr noundef %0, i64 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  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
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %9, i32 0, i32 8
  %11 = load ptr, ptr %10, align 8, !tbaa !11
  store ptr %11, ptr %8, align 8, !tbaa !5
  %12 = load ptr, ptr %8, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %33

14:                                               ; preds = %2
  %15 = load i64, ptr %4, align 8, !tbaa !9
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %16, i32 0, i32 0
  store i64 %15, ptr %17, align 8, !tbaa !20
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %18, i32 0, i32 1
  %20 = load ptr, ptr %19, align 8, !tbaa !22
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %30

22:                                               ; preds = %14
  %23 = load ptr, ptr @gBS, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %23, i32 0, i32 11
  %25 = load ptr, ptr %24, align 8, !tbaa !23
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._EFI_MTFTP4_TOKEN, ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !22
  %29 = call i64 %25(ptr noundef %28)
  br label %30

30:                                               ; preds = %22, %14
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %31, i32 0, i32 8
  store ptr null, ptr %32, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %30, %2
  br label %34

34:                                               ; preds = %33
  %35 = call zeroext i8 @DebugAssertEnabled()
  %36 = icmp ne i8 %35, 0
  br i1 %36, label %37, label %44

37:                                               ; preds = %34
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %38, i32 0, i32 18
  %40 = load ptr, ptr %39, align 8, !tbaa !26
  %41 = icmp ne ptr %40, null
  br i1 %41, label %43, label %42

42:                                               ; preds = %37
  call void @DebugAssert(ptr noundef @.str, i64 noundef 52, ptr noundef @.str.1)
  br label %43

43:                                               ; preds = %42, %37
  br label %44

44:                                               ; preds = %43, %34
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %47, i32 0, i32 18
  %49 = load ptr, ptr %48, align 8, !tbaa !26
  call void @UdpIoCleanIo(ptr noundef %49)
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %50, i32 0, i32 19
  %52 = load ptr, ptr %51, align 8, !tbaa !27
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %60

54:                                               ; preds = %46
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %55, i32 0, i32 19
  %57 = load ptr, ptr %56, align 8, !tbaa !27
  call void @NetbufFree(ptr noundef %57)
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %58, i32 0, i32 19
  store ptr null, ptr %59, align 8, !tbaa !27
  br label %60

60:                                               ; preds = %54, %46
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %61, i32 0, i32 27
  %63 = load ptr, ptr %62, align 8, !tbaa !28
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %85

65:                                               ; preds = %60
  %66 = load ptr, ptr @gBS, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %66, i32 0, i32 34
  %68 = load ptr, ptr %67, align 8, !tbaa !29
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %69, i32 0, i32 27
  %71 = load ptr, ptr %70, align 8, !tbaa !28
  %72 = getelementptr inbounds %struct._UDP_IO, ptr %71, i32 0, i32 6
  %73 = load ptr, ptr %72, align 8, !tbaa !30
  %74 = load ptr, ptr getelementptr inbounds (%struct._EFI_DRIVER_BINDING_PROTOCOL, ptr @gMtftp4DriverBinding, i32 0, i32 5), align 8, !tbaa !33
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %75, i32 0, i32 6
  %77 = load ptr, ptr %76, align 8, !tbaa !35
  %78 = call i64 %68(ptr noundef %73, ptr noundef @gEfiUdp4ProtocolGuid, ptr noundef %74, ptr noundef %77)
  %79 = load ptr, ptr %3, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %79, i32 0, i32 27
  %81 = load ptr, ptr %80, align 8, !tbaa !28
  %82 = call i64 @UdpIoFreeIo(ptr noundef %81)
  %83 = load ptr, ptr %3, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %83, i32 0, i32 27
  store ptr null, ptr %84, align 8, !tbaa !28
  br label %85

85:                                               ; preds = %65, %60
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %86, i32 0, i32 13
  %88 = getelementptr inbounds %struct._LIST_ENTRY, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !36
  store ptr %89, ptr %5, align 8, !tbaa !5
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._LIST_ENTRY, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !37
  store ptr %92, ptr %6, align 8, !tbaa !5
  br label %93

93:                                               ; preds = %106, %85
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = load ptr, ptr %3, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %95, i32 0, i32 13
  %97 = icmp ne ptr %94, %96
  br i1 %97, label %98, label %111

98:                                               ; preds = %93
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  %100 = ptrtoint ptr %99 to i64
  %101 = sub i64 %100, 0
  %102 = inttoptr i64 %101 to ptr
  store ptr %102, ptr %7, align 8, !tbaa !5
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = call ptr @RemoveEntryList(ptr noundef %103)
  %105 = load ptr, ptr %7, align 8, !tbaa !5
  call void @FreePool(ptr noundef %105)
  br label %106

106:                                              ; preds = %98
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %107, ptr %5, align 8, !tbaa !5
  %108 = load ptr, ptr %5, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._LIST_ENTRY, ptr %108, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8, !tbaa !37
  store ptr %110, ptr %6, align 8, !tbaa !5
  br label %93, !llvm.loop !38

111:                                              ; preds = %93
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %112, i32 0, i32 9
  %114 = call ptr @ZeroMem(ptr noundef %113, i64 noundef 20)
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %115, i32 0, i32 10
  store i16 0, ptr %116, align 4, !tbaa !40
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %117, i32 0, i32 11
  store i16 512, ptr %118, align 2, !tbaa !41
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %119, i32 0, i32 12
  store i16 0, ptr %120, align 8, !tbaa !42
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %121, i32 0, i32 14
  store i32 0, ptr %122, align 8, !tbaa !43
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %123, i32 0, i32 15
  store i16 0, ptr %124, align 4, !tbaa !44
  %125 = load ptr, ptr %3, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %125, i32 0, i32 16
  store i16 0, ptr %126, align 2, !tbaa !45
  %127 = load ptr, ptr %3, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %127, i32 0, i32 17
  store i32 0, ptr %128, align 8, !tbaa !46
  %129 = load ptr, ptr %3, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %129, i32 0, i32 20
  store i32 0, ptr %130, align 8, !tbaa !47
  %131 = load ptr, ptr %3, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %131, i32 0, i32 22
  store i32 0, ptr %132, align 8, !tbaa !48
  %133 = load ptr, ptr %3, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %133, i32 0, i32 21
  store i32 0, ptr %134, align 4, !tbaa !49
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %135, i32 0, i32 23
  store i32 0, ptr %136, align 4, !tbaa !50
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %137, i32 0, i32 24
  store i32 0, ptr %138, align 8, !tbaa !51
  %139 = load ptr, ptr %3, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %139, i32 0, i32 25
  store i16 0, ptr %140, align 4, !tbaa !52
  %141 = load ptr, ptr %3, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._MTFTP4_PROTOCOL, ptr %141, i32 0, i32 26
  store i8 1, ptr %142, align 2, !tbaa !53
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

declare zeroext i8 @DebugAssertEnabled() #2

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

declare void @UdpIoCleanIo(ptr noundef) #2

declare void @NetbufFree(ptr noundef) #2

declare i64 @UdpIoFreeIo(ptr noundef) #2

declare ptr @RemoveEntryList(ptr noundef) #2

declare void @FreePool(ptr noundef) #2

declare ptr @ZeroMem(ptr noundef, i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !6, i64 152}
!12 = !{!"_MTFTP4_PROTOCOL", !13, i64 0, !14, i64 8, !15, i64 24, !10, i64 88, !7, i64 96, !6, i64 104, !6, i64 112, !16, i64 120, !6, i64 152, !19, i64 160, !18, i64 180, !18, i64 182, !18, i64 184, !14, i64 192, !13, i64 208, !18, i64 212, !18, 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, !18, i64 260, !7, i64 262, !6, i64 264}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!15 = !{!"_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}
!16 = !{!"", !7, i64 0, !17, i64 1, !17, i64 5, !18, i64 10, !17, i64 12, !17, i64 16, !18, i64 20, !18, i64 22, !18, i64 24}
!17 = !{!"", !7, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = !{!"", !18, i64 0, !7, i64 2, !13, i64 4, !13, i64 8, !18, i64 12, !7, i64 14, !13, i64 16}
!20 = !{!21, !10, i64 0}
!21 = !{!"_EFI_MTFTP4_TOKEN", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !6, i64 48, !10, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96}
!22 = !{!21, !6, i64 8}
!23 = !{!24, !6, i64 104}
!24 = !{!"", !25, 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}
!25 = !{!"", !10, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!26 = !{!12, !6, i64 224}
!27 = !{!12, !6, i64 232}
!28 = !{!12, !6, i64 264}
!29 = !{!24, !6, i64 288}
!30 = !{!31, !6, i64 56}
!31 = !{!"_UDP_IO", !13, i64 0, !14, i64 8, !10, i64 24, !7, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !32, i64 64, !14, i64 720, !6, i64 736, !7, i64 744, !7, i64 752}
!32 = !{!"", !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, !17, i64 552, !17, i64 584, !17, i64 616, !7, i64 648, !7, i64 649, !7, i64 650, !7, i64 651, !7, i64 652}
!33 = !{!34, !6, i64 40}
!34 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !6, i64 32, !6, i64 40}
!35 = !{!12, !6, i64 112}
!36 = !{!12, !6, i64 192}
!37 = !{!14, !6, i64 0}
!38 = distinct !{!38, !39}
!39 = !{!"llvm.loop.mustprogress"}
!40 = !{!12, !18, i64 180}
!41 = !{!12, !18, i64 182}
!42 = !{!12, !18, i64 184}
!43 = !{!12, !13, i64 208}
!44 = !{!12, !18, i64 212}
!45 = !{!12, !18, i64 214}
!46 = !{!12, !13, i64 216}
!47 = !{!12, !13, i64 240}
!48 = !{!12, !13, i64 248}
!49 = !{!12, !13, i64 244}
!50 = !{!12, !13, i64 252}
!51 = !{!12, !13, i64 256}
!52 = !{!12, !18, i64 260}
!53 = !{!12, !7, i64 262}


; 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.GUID = type { i32, i16, i16, [8 x i8] }
%struct._EFI_DRIVER_BINDING_PROTOCOL = type { ptr, ptr, ptr, i32, ptr, ptr }

@gBS = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [155 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [38 x i8], align 1
@gEfiUdp4ProtocolGuid = external global %struct.GUID, align 4
@gMtftp4DriverBinding = external local_unnamed_addr global %struct._EFI_DRIVER_BINDING_PROTOCOL, align 8

; Function Attrs: nounwind uwtable
define dso_local void @Mtftp4CleanOperation(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 152
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %14, label %5

5:                                                ; preds = %2
  store i64 %1, ptr %4, align 8, !tbaa !18
  %6 = getelementptr inbounds i8, ptr %4, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !20
  %.not45 = icmp eq ptr %7, null
  br i1 %.not45, label %13, label %8

8:                                                ; preds = %5
  %9 = load ptr, ptr @gBS, align 8, !tbaa !21
  %10 = getelementptr inbounds i8, ptr %9, i64 104
  %11 = load ptr, ptr %10, align 8, !tbaa !22
  %12 = tail call i64 %11(ptr noundef nonnull %7) #3
  br label %13

13:                                               ; preds = %8, %5
  store ptr null, ptr %3, align 8, !tbaa !5
  br label %14

14:                                               ; preds = %2, %13
  %15 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not46 = icmp eq i8 %15, 0
  br i1 %.not46, label %20, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 224
  %18 = load ptr, ptr %17, align 8, !tbaa !25
  %.not47 = icmp eq ptr %18, null
  br i1 %.not47, label %19, label %20

19:                                               ; preds = %16
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 52, ptr noundef nonnull @.str.1) #3
  br label %20

20:                                               ; preds = %16, %19, %14
  %21 = getelementptr inbounds i8, ptr %0, i64 224
  %22 = load ptr, ptr %21, align 8, !tbaa !25
  tail call void @UdpIoCleanIo(ptr noundef %22) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 232
  %24 = load ptr, ptr %23, align 8, !tbaa !26
  %.not48 = icmp eq ptr %24, null
  br i1 %.not48, label %26, label %25

25:                                               ; preds = %20
  tail call void @NetbufFree(ptr noundef nonnull %24) #3
  store ptr null, ptr %23, align 8, !tbaa !26
  br label %26

26:                                               ; preds = %25, %20
  %27 = getelementptr inbounds i8, ptr %0, i64 264
  %28 = load ptr, ptr %27, align 8, !tbaa !27
  %.not49 = icmp eq ptr %28, null
  br i1 %.not49, label %41, label %29

29:                                               ; preds = %26
  %30 = load ptr, ptr @gBS, align 8, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %30, i64 288
  %32 = load ptr, ptr %31, align 8, !tbaa !28
  %33 = getelementptr inbounds i8, ptr %28, i64 56
  %34 = load ptr, ptr %33, align 8, !tbaa !29
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @gMtftp4DriverBinding, i64 40), align 8, !tbaa !32
  %36 = getelementptr inbounds i8, ptr %0, i64 112
  %37 = load ptr, ptr %36, align 8, !tbaa !34
  %38 = tail call i64 %32(ptr noundef %34, ptr noundef nonnull @gEfiUdp4ProtocolGuid, ptr noundef %35, ptr noundef %37) #3
  %39 = load ptr, ptr %27, align 8, !tbaa !27
  %40 = tail call i64 @UdpIoFreeIo(ptr noundef %39) #3
  store ptr null, ptr %27, align 8, !tbaa !27
  br label %41

41:                                               ; preds = %29, %26
  %42 = getelementptr inbounds i8, ptr %0, i64 192
  %43 = load ptr, ptr %42, align 8, !tbaa !35
  %.not5051 = icmp eq ptr %43, %42
  br i1 %.not5051, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %41, %.lr.ph
  %.052 = phi ptr [ %.040, %.lr.ph ], [ %43, %41 ]
  %.040 = load ptr, ptr %.052, align 8, !tbaa !36
  %44 = tail call ptr @RemoveEntryList(ptr noundef nonnull %.052) #3
  tail call void @FreePool(ptr noundef nonnull %.052) #3
  %.not50 = icmp eq ptr %.040, %42
  br i1 %.not50, label %._crit_edge, label %.lr.ph, !llvm.loop !37

._crit_edge:                                      ; preds = %.lr.ph, %41
  %45 = getelementptr inbounds i8, ptr %0, i64 160
  %46 = tail call ptr @ZeroMem(ptr noundef nonnull %45, i64 noundef 20) #3
  %47 = getelementptr inbounds i8, ptr %0, i64 180
  store i16 0, ptr %47, align 4, !tbaa !39
  %48 = getelementptr inbounds i8, ptr %0, i64 182
  store i16 512, ptr %48, align 2, !tbaa !40
  %49 = getelementptr inbounds i8, ptr %0, i64 184
  store i16 0, ptr %49, align 8, !tbaa !41
  %50 = getelementptr inbounds i8, ptr %0, i64 208
  %51 = getelementptr inbounds i8, ptr %0, i64 240
  %52 = getelementptr inbounds i8, ptr %0, i64 262
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(12) %50, i8 0, i64 12, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(22) %51, i8 0, i64 22, i1 false)
  store i8 1, ptr %52, align 2, !tbaa !42
  ret void
}

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare void @UdpIoCleanIo(ptr noundef) local_unnamed_addr #1

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

declare i64 @UdpIoFreeIo(ptr noundef) local_unnamed_addr #1

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare ptr @ZeroMem(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #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 = { "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 nounwind willreturn memory(argmem: write) }
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, !11, i64 152}
!6 = !{!"_MTFTP4_PROTOCOL", !7, i64 0, !10, i64 8, !12, i64 24, !13, i64 88, !8, i64 96, !11, i64 104, !11, i64 112, !14, i64 120, !11, i64 152, !17, i64 160, !16, i64 180, !16, i64 182, !16, i64 184, !10, i64 192, !7, i64 208, !16, i64 212, !16, i64 214, !7, i64 216, !11, i64 224, !11, i64 232, !7, i64 240, !7, i64 244, !7, i64 248, !7, i64 252, !7, i64 256, !16, i64 260, !8, i64 262, !11, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"_EFI_MTFTP4_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}
!13 = !{!"long long", !8, i64 0}
!14 = !{!"", !8, i64 0, !15, i64 1, !15, i64 5, !16, i64 10, !15, i64 12, !15, i64 16, !16, i64 20, !16, i64 22, !16, i64 24}
!15 = !{!"", !8, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = !{!"", !16, i64 0, !8, i64 2, !7, i64 4, !7, i64 8, !16, i64 12, !8, i64 14, !7, i64 16}
!18 = !{!19, !13, i64 0}
!19 = !{!"_EFI_MTFTP4_TOKEN", !13, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40, !11, i64 48, !13, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96}
!20 = !{!19, !11, i64 8}
!21 = !{!11, !11, i64 0}
!22 = !{!23, !11, i64 104}
!23 = !{!"", !24, 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}
!24 = !{!"", !13, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!25 = !{!6, !11, i64 224}
!26 = !{!6, !11, i64 232}
!27 = !{!6, !11, i64 264}
!28 = !{!23, !11, i64 288}
!29 = !{!30, !11, i64 56}
!30 = !{!"_UDP_IO", !7, i64 0, !10, i64 8, !13, i64 24, !8, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !31, i64 64, !10, i64 720, !11, i64 736, !8, i64 744, !8, i64 752}
!31 = !{!"", !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, !15, i64 552, !15, i64 584, !15, i64 616, !8, i64 648, !8, i64 649, !8, i64 650, !8, i64 651, !8, i64 652}
!32 = !{!33, !11, i64 40}
!33 = !{!"_EFI_DRIVER_BINDING_PROTOCOL", !11, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !11, i64 32, !11, i64 40}
!34 = !{!6, !11, i64 112}
!35 = !{!6, !11, i64 192}
!36 = !{!10, !11, i64 0}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!6, !16, i64 180}
!40 = !{!6, !16, i64 182}
!41 = !{!6, !16, i64 184}
!42 = !{!6, !8, i64 262}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass