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

; 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._TCP_SOCKET = type { i32, ptr, ptr, ptr, ptr, %struct._LIST_ENTRY, i8, i32, i8, i16, %struct.EFI_LOCK, %struct._SOCK_BUFFER, %struct._SOCK_BUFFER, i64, i8, i32, i32, ptr, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, [20 x i8], i8, %union._NET_PROTOCOL, ptr, ptr, ptr }
%struct.EFI_LOCK = type { i64, i64, i32 }
%struct._SOCK_BUFFER = type { i32, i32, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%union._NET_PROTOCOL = type { %struct._EFI_TCP4_PROTOCOL }
%struct._EFI_TCP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, 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 }

@.str = external hidden unnamed_addr constant [130 x i8], align 1
@gBS = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.25 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [63 x i8], align 1

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

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

declare zeroext i8 @DebugAssertEnabled() #1

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

declare ptr @RemoveEntryList(ptr noundef) #1

declare void @FreePool(ptr noundef) #1

declare zeroext i8 @DebugPrintEnabled() #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #1

declare void @DebugPrint(i64 noundef, ptr noundef, ...) #1

declare void @NetbufQueFree(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @SockDestroy(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  br label %6

6:                                                ; preds = %1
  %7 = call zeroext i8 @DebugAssertEnabled()
  %8 = icmp ne i8 %7, 0
  br i1 %8, label %9, label %16

9:                                                ; preds = %6
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct._TCP_SOCKET, ptr %10, i32 0, i32 7
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = icmp eq i32 1, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %9
  call void @DebugAssert(ptr noundef @.str, i64 noundef 772, ptr noundef @.str.6)
  br label %15

15:                                               ; preds = %14, %9
  br label %16

16:                                               ; preds = %15, %6
  br label %17

17:                                               ; preds = %16
  br label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._TCP_SOCKET, ptr %19, i32 0, i32 30
  %21 = load ptr, ptr %20, align 8, !tbaa !17
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %31

23:                                               ; preds = %18
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct._TCP_SOCKET, ptr %24, i32 0, i32 30
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct._TCP_SOCKET, ptr %28, i32 0, i32 31
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  call void %26(ptr noundef %27, ptr noundef %30)
  br label %31

31:                                               ; preds = %23, %18
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct._TCP_SOCKET, ptr %32, i32 0, i32 6
  %34 = load i8, ptr %33, align 8, !tbaa !19
  %35 = zext i8 %34 to i32
  %36 = icmp eq i32 %35, 0
  br i1 %36, label %42, label %37

37:                                               ; preds = %31
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  call void @SockConnFlush(ptr noundef %38)
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  call void @SockSetState(ptr noundef %39, i8 noundef zeroext 0)
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._TCP_SOCKET, ptr %40, i32 0, i32 6
  store i8 0, ptr %41, align 8, !tbaa !19
  br label %42

42:                                               ; preds = %37, %31
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._TCP_SOCKET, ptr %43, i32 0, i32 12
  %45 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %44, i32 0, i32 2
  %46 = load ptr, ptr %45, align 8, !tbaa !20
  call void @NetbufQueFree(ptr noundef %46)
  %47 = load ptr, ptr %2, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct._TCP_SOCKET, ptr %47, i32 0, i32 11
  %49 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  call void @NetbufQueFree(ptr noundef %50)
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._TCP_SOCKET, ptr %51, i32 0, i32 17
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %86

55:                                               ; preds = %42
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct._TCP_SOCKET, ptr %56, i32 0, i32 18
  %58 = call ptr @RemoveEntryList(ptr noundef %57)
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct._TCP_SOCKET, ptr %59, i32 0, i32 17
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = getelementptr inbounds %struct._TCP_SOCKET, ptr %61, i32 0, i32 16
  %63 = load i32, ptr %62, align 8, !tbaa !23
  %64 = add i32 %63, -1
  store i32 %64, ptr %62, align 8, !tbaa !23
  br label %65

65:                                               ; preds = %55
  %66 = call zeroext i8 @DebugPrintEnabled()
  %67 = icmp ne i8 %66, 0
  br i1 %67, label %68, label %81

68:                                               ; preds = %65
  br label %69

69:                                               ; preds = %68
  %70 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2)
  %71 = icmp ne i8 %70, 0
  br i1 %71, label %72, label %78

72:                                               ; preds = %69
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._TCP_SOCKET, ptr %73, i32 0, i32 17
  %75 = load ptr, ptr %74, align 8, !tbaa !22
  %76 = getelementptr inbounds %struct._TCP_SOCKET, ptr %75, i32 0, i32 16
  %77 = load i32, ptr %76, align 8, !tbaa !23
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2, ptr noundef @.str.25, i32 noundef %77)
  br label %78

78:                                               ; preds = %72, %69
  br label %79

79:                                               ; preds = %78
  br label %80

80:                                               ; preds = %79
  br label %81

81:                                               ; preds = %80, %65
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._TCP_SOCKET, ptr %84, i32 0, i32 17
  store ptr null, ptr %85, align 8, !tbaa !22
  br label %86

86:                                               ; preds = %83, %42
  %87 = load ptr, ptr %2, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._TCP_SOCKET, ptr %87, i32 0, i32 27
  %89 = load i8, ptr %88, align 4, !tbaa !24
  %90 = zext i8 %89 to i32
  %91 = icmp eq i32 %90, 4
  br i1 %91, label %92, label %93

92:                                               ; preds = %86
  store ptr @gEfiTcp4ProtocolGuid, ptr %4, align 8, !tbaa !5
  br label %94

93:                                               ; preds = %86
  store ptr @gEfiTcp6ProtocolGuid, ptr %4, align 8, !tbaa !5
  br label %94

94:                                               ; preds = %93, %92
  %95 = load ptr, ptr @gBS, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %95, i32 0, i32 33
  %97 = load ptr, ptr %96, align 8, !tbaa !25
  %98 = load ptr, ptr %2, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._TCP_SOCKET, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !28
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = load ptr, ptr %2, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._TCP_SOCKET, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !29
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct._TCP_SOCKET, ptr %105, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !28
  %108 = call i64 %97(ptr noundef %100, ptr noundef %101, ptr noundef %3, ptr noundef %104, ptr noundef %107, i32 noundef 2)
  store i64 %108, ptr %5, align 8, !tbaa !30
  %109 = load i64, ptr %5, align 8, !tbaa !30
  %110 = icmp slt i64 %109, 0
  br i1 %110, label %111, label %127

111:                                              ; preds = %94
  br label %112

112:                                              ; preds = %111
  %113 = call zeroext i8 @DebugPrintEnabled()
  %114 = icmp ne i8 %113, 0
  br i1 %114, label %115, label %124

115:                                              ; preds = %112
  br label %116

116:                                              ; preds = %115
  %117 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %118 = icmp ne i8 %117, 0
  br i1 %118, label %119, label %121

119:                                              ; preds = %116
  %120 = load i64, ptr %5, align 8, !tbaa !30
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.26, i64 noundef %120)
  br label %121

121:                                              ; preds = %119, %116
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122
  br label %124

124:                                              ; preds = %123, %112
  br label %125

125:                                              ; preds = %124
  br label %126

126:                                              ; preds = %125
  br label %137

127:                                              ; preds = %94
  %128 = load ptr, ptr @gBS, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %128, i32 0, i32 40
  %130 = load ptr, ptr %129, align 8, !tbaa !31
  %131 = load ptr, ptr %2, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._TCP_SOCKET, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !28
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = load ptr, ptr %3, align 8, !tbaa !5
  %136 = call i64 (ptr, ...) %130(ptr noundef %133, ptr noundef %134, ptr noundef %135, ptr noundef null)
  br label %137

137:                                              ; preds = %127, %126
  %138 = load ptr, ptr %2, align 8, !tbaa !5
  call void @FreePool(ptr noundef %138)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @SockConnFlush(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @SockSetState(ptr noundef, i8 noundef zeroext) #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 60}
!10 = !{!"_TCP_SOCKET", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !12, i64 40, !7, i64 56, !11, i64 60, !7, i64 64, !13, i64 66, !14, i64 72, !16, i64 96, !16, i64 112, !15, i64 128, !7, i64 136, !11, i64 140, !11, i64 144, !6, i64 152, !12, i64 160, !12, i64 176, !12, i64 192, !12, i64 208, !12, i64 224, !6, i64 240, !6, i64 248, !6, i64 256, !7, i64 264, !7, i64 284, !7, i64 288, !6, i64 368, !6, i64 376, !6, i64 384}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !15, i64 0, !15, i64 8, !11, i64 16}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"_SOCK_BUFFER", !11, i64 0, !11, i64 4, !6, i64 8}
!17 = !{!10, !6, i64 376}
!18 = !{!10, !6, i64 384}
!19 = !{!10, !7, i64 56}
!20 = !{!10, !6, i64 120}
!21 = !{!10, !6, i64 104}
!22 = !{!10, !6, i64 152}
!23 = !{!10, !11, i64 144}
!24 = !{!10, !7, i64 284}
!25 = !{!26, !6, i64 280}
!26 = !{!"", !27, 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}
!27 = !{!"", !15, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!28 = !{!10, !6, i64 8}
!29 = !{!10, !6, i64 16}
!30 = !{!15, !15, i64 0}
!31 = !{!26, !6, i64 336}


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

@.str = external hidden unnamed_addr constant [130 x i8], align 1
@gBS = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.25 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [63 x i8], align 1

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

declare void @FreePool(ptr noundef) local_unnamed_addr #1

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #1

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) local_unnamed_addr #1

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

declare void @NetbufQueFree(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @SockDestroy(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  %3 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %9, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 60
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %6, 1
  br i1 %7, label %9, label %8

8:                                                ; preds = %4
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 772, ptr noundef nonnull @.str.6) #3
  br label %9

9:                                                ; preds = %4, %8, %1
  %10 = getelementptr inbounds i8, ptr %0, i64 376
  %11 = load ptr, ptr %10, align 8, !tbaa !16
  %.not27 = icmp eq ptr %11, null
  br i1 %.not27, label %15, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 384
  %14 = load ptr, ptr %13, align 8, !tbaa !17
  tail call void %11(ptr noundef nonnull %0, ptr noundef %14) #3
  br label %15

15:                                               ; preds = %12, %9
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = load i8, ptr %16, align 8, !tbaa !18
  %18 = icmp eq i8 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  tail call void @SockConnFlush(ptr noundef nonnull %0)
  tail call void @SockSetState(ptr noundef nonnull %0, i8 noundef zeroext 0)
  store i8 0, ptr %16, align 8, !tbaa !18
  br label %20

20:                                               ; preds = %19, %15
  %21 = getelementptr inbounds i8, ptr %0, i64 120
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  tail call void @NetbufQueFree(ptr noundef %22) #3
  %23 = getelementptr inbounds i8, ptr %0, i64 104
  %24 = load ptr, ptr %23, align 8, !tbaa !20
  tail call void @NetbufQueFree(ptr noundef %24) #3
  %25 = getelementptr inbounds i8, ptr %0, i64 152
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %.not28 = icmp eq ptr %26, null
  br i1 %.not28, label %42, label %27

27:                                               ; preds = %20
  %28 = getelementptr inbounds i8, ptr %0, i64 160
  %29 = tail call ptr @RemoveEntryList(ptr noundef nonnull %28) #3
  %30 = load ptr, ptr %25, align 8, !tbaa !21
  %31 = getelementptr inbounds i8, ptr %30, i64 144
  %32 = load i32, ptr %31, align 8, !tbaa !22
  %33 = add i32 %32, -1
  store i32 %33, ptr %31, align 8, !tbaa !22
  %34 = tail call zeroext i8 @DebugPrintEnabled() #3
  %.not29 = icmp eq i8 %34, 0
  br i1 %.not29, label %41, label %35

35:                                               ; preds = %27
  %36 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2) #3
  %.not30 = icmp eq i8 %36, 0
  br i1 %.not30, label %41, label %37

37:                                               ; preds = %35
  %38 = load ptr, ptr %25, align 8, !tbaa !21
  %39 = getelementptr inbounds i8, ptr %38, i64 144
  %40 = load i32, ptr %39, align 8, !tbaa !22
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2, ptr noundef nonnull @.str.25, i32 noundef %40) #3
  br label %41

41:                                               ; preds = %35, %37, %27
  store ptr null, ptr %25, align 8, !tbaa !21
  br label %42

42:                                               ; preds = %41, %20
  %43 = getelementptr inbounds i8, ptr %0, i64 284
  %44 = load i8, ptr %43, align 4, !tbaa !23
  %45 = icmp eq i8 %44, 4
  %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid = select i1 %45, ptr @gEfiTcp4ProtocolGuid, ptr @gEfiTcp6ProtocolGuid
  %46 = load ptr, ptr @gBS, align 8, !tbaa !24
  %47 = getelementptr inbounds i8, ptr %46, i64 280
  %48 = load ptr, ptr %47, align 8, !tbaa !25
  %49 = getelementptr inbounds i8, ptr %0, i64 8
  %50 = load ptr, ptr %49, align 8, !tbaa !28
  %51 = getelementptr inbounds i8, ptr %0, i64 16
  %52 = load ptr, ptr %51, align 8, !tbaa !29
  %53 = call i64 %48(ptr noundef %50, ptr noundef nonnull %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid, ptr noundef nonnull %2, ptr noundef %52, ptr noundef %50, i32 noundef 2) #3
  %54 = icmp slt i64 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %42
  %56 = call zeroext i8 @DebugPrintEnabled() #3
  %.not31 = icmp eq i8 %56, 0
  br i1 %.not31, label %67, label %57

57:                                               ; preds = %55
  %58 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #3
  %.not32 = icmp eq i8 %58, 0
  br i1 %.not32, label %67, label %59

59:                                               ; preds = %57
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.26, i64 noundef %53) #3
  br label %67

60:                                               ; preds = %42
  %61 = load ptr, ptr @gBS, align 8, !tbaa !24
  %62 = getelementptr inbounds i8, ptr %61, i64 336
  %63 = load ptr, ptr %62, align 8, !tbaa !30
  %64 = load ptr, ptr %49, align 8, !tbaa !28
  %65 = load ptr, ptr %2, align 8, !tbaa !24
  %66 = call i64 (ptr, ...) %63(ptr noundef %64, ptr noundef nonnull %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid, ptr noundef %65, ptr noundef null) #3
  br label %67

67:                                               ; preds = %55, %59, %57, %60
  call void @FreePool(ptr noundef nonnull %0) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  ret void
}

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

; Function Attrs: nounwind uwtable
declare dso_local void @SockSetState(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 60}
!6 = !{!"_TCP_SOCKET", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !8, i64 56, !7, i64 60, !8, i64 64, !12, i64 66, !13, i64 72, !15, i64 96, !15, i64 112, !14, i64 128, !8, i64 136, !7, i64 140, !7, i64 144, !10, i64 152, !11, i64 160, !11, i64 176, !11, i64 192, !11, i64 208, !11, i64 224, !10, i64 240, !10, i64 248, !10, i64 256, !8, i64 264, !8, i64 284, !8, i64 288, !10, i64 368, !10, i64 376, !10, i64 384}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!12 = !{!"short", !8, i64 0}
!13 = !{!"", !14, i64 0, !14, i64 8, !7, i64 16}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"_SOCK_BUFFER", !7, i64 0, !7, i64 4, !10, i64 8}
!16 = !{!6, !10, i64 376}
!17 = !{!6, !10, i64 384}
!18 = !{!6, !8, i64 56}
!19 = !{!6, !10, i64 120}
!20 = !{!6, !10, i64 104}
!21 = !{!6, !10, i64 152}
!22 = !{!6, !7, i64 144}
!23 = !{!6, !8, i64 284}
!24 = !{!10, !10, i64 0}
!25 = !{!26, !10, i64 280}
!26 = !{!"", !27, i64 0, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368}
!27 = !{!"", !14, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!28 = !{!6, !10, i64 8}
!29 = !{!6, !10, i64 16}
!30 = !{!26, !10, i64 336}


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