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

; 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._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], %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._SOCK_IO_TOKEN = type { %struct._SOCK_COMPLETION_TOKEN, %union.SOCK_IO_DATA }
%struct._SOCK_COMPLETION_TOKEN = type { ptr, i64 }
%union.SOCK_IO_DATA = type { ptr }
%struct.EFI_TCP4_TRANSMIT_DATA = type { i8, i8, i32, i32, [1 x %struct.EFI_TCP4_FRAGMENT_DATA] }
%struct.EFI_TCP4_FRAGMENT_DATA = type { i32, ptr }
%struct._SOCK_TOKEN = type { %struct._LIST_ENTRY, ptr, i32, ptr }

@.str.1 = external hidden unnamed_addr constant [156 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [38 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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @SockTokenExisted(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @SockBufferToken(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare zeroext i8 @DebugPrintEnabled() #2

declare zeroext i8 @DebugPrintLevelEnabled(i64 noundef) #2

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

declare zeroext i8 @DebugAssertEnabled() #2

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

declare i64 @EfiAcquireLockOrFail(ptr noundef) #2

declare void @EfiReleaseLock(ptr noundef) #2

declare ptr @RemoveEntryList(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @SockSend(ptr noundef %0, ptr noundef %1) #1 {
  %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 i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = 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 4, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  br label %14

14:                                               ; preds = %2
  %15 = call zeroext i8 @DebugAssertEnabled()
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._SOCKET, ptr %18, i32 0, i32 7
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = icmp eq i32 1, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 513, ptr noundef @.str.11)
  br label %23

23:                                               ; preds = %22, %17
  br label %24

24:                                               ; preds = %23, %14
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._SOCKET, ptr %27, i32 0, i32 10
  %29 = call i64 @EfiAcquireLockOrFail(ptr noundef %28)
  store i64 %29, ptr %10, align 8, !tbaa !17
  %30 = load i64, ptr %10, align 8, !tbaa !17
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %32, label %48

32:                                               ; preds = %26
  br label %33

33:                                               ; preds = %32
  %34 = call zeroext i8 @DebugPrintEnabled()
  %35 = icmp ne i8 %34, 0
  br i1 %35, label %36, label %45

36:                                               ; preds = %33
  br label %37

37:                                               ; preds = %36
  %38 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %39 = icmp ne i8 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  %41 = load i64, ptr %10, align 8, !tbaa !17
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.15, i64 noundef %41)
  br label %42

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

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44, %33
  br label %46

46:                                               ; preds = %45
  br label %47

47:                                               ; preds = %46
  store i64 -9223372036854775793, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %175

48:                                               ; preds = %26
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._SOCKET, ptr %49, i32 0, i32 6
  %51 = load i8, ptr %50, align 8, !tbaa !18
  %52 = zext i8 %51 to i32
  %53 = icmp eq i32 %52, 3
  br i1 %53, label %54, label %55

54:                                               ; preds = %48
  store i64 -9223372036854775791, ptr %10, align 8, !tbaa !17
  br label %171

55:                                               ; preds = %48
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %56, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._SOCK_IO_TOKEN, ptr %57, i32 0, i32 1
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  store ptr %59, ptr %9, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._SOCKET, ptr %60, i32 0, i32 6
  %62 = load i8, ptr %61, align 8, !tbaa !18
  %63 = zext i8 %62 to i32
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %66

65:                                               ; preds = %55
  store i64 -9223372036854775789, ptr %10, align 8, !tbaa !17
  br label %171

66:                                               ; preds = %55
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._SOCKET, ptr %67, i32 0, i32 8
  %69 = load i8, ptr %68, align 8, !tbaa !20
  %70 = zext i8 %69 to i32
  %71 = icmp eq i32 %70, 2
  br i1 %71, label %79, label %72

72:                                               ; preds = %66
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._SOCKET, ptr %73, i32 0, i32 8
  %75 = load i8, ptr %74, align 8, !tbaa !20
  %76 = zext i8 %75 to i32
  %77 = icmp eq i32 %76, 3
  br i1 %77, label %79, label %78

78:                                               ; preds = %72
  store i64 -9223372036854775793, ptr %10, align 8, !tbaa !17
  br label %171

79:                                               ; preds = %72, %66
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._SOCK_IO_TOKEN, ptr %80, i32 0, i32 0
  %82 = getelementptr inbounds %struct._SOCK_COMPLETION_TOKEN, ptr %81, i32 0, i32 0
  %83 = load ptr, ptr %82, align 8, !tbaa !21
  store ptr %83, ptr %7, align 8, !tbaa !5
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = load ptr, ptr %7, align 8, !tbaa !5
  %86 = call zeroext i8 @SockTokenExisted(ptr noundef %84, ptr noundef %85)
  %87 = icmp ne i8 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %79
  store i64 -9223372036854775793, ptr %10, align 8, !tbaa !17
  br label %171

89:                                               ; preds = %79
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.EFI_TCP4_TRANSMIT_DATA, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !24
  store i32 %92, ptr %12, align 4, !tbaa !26
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = call i32 @SockGetFreeSpace(ptr noundef %93, i32 noundef 0)
  store i32 %94, ptr %8, align 4, !tbaa !26
  %95 = load i32, ptr %8, align 4, !tbaa !26
  %96 = load ptr, ptr %4, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._SOCKET, ptr %96, i32 0, i32 11
  %98 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %97, i32 0, i32 1
  %99 = load i32, ptr %98, align 4, !tbaa !27
  %100 = icmp ult i32 %95, %99
  br i1 %100, label %107, label %101

101:                                              ; preds = %89
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._SOCKET, ptr %102, i32 0, i32 8
  %104 = load i8, ptr %103, align 8, !tbaa !20
  %105 = zext i8 %104 to i32
  %106 = icmp eq i32 %105, 3
  br i1 %106, label %118, label %107

107:                                              ; preds = %101, %89
  %108 = load ptr, ptr %4, align 8, !tbaa !5
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._SOCKET, ptr %109, i32 0, i32 21
  %111 = load ptr, ptr %6, align 8, !tbaa !5
  %112 = load i32, ptr %12, align 4, !tbaa !26
  %113 = call ptr @SockBufferToken(ptr noundef %108, ptr noundef %110, ptr noundef %111, i32 noundef %112)
  store ptr %113, ptr %11, align 8, !tbaa !5
  %114 = load ptr, ptr %11, align 8, !tbaa !5
  %115 = icmp eq ptr null, %114
  br i1 %115, label %116, label %117

116:                                              ; preds = %107
  store i64 -9223372036854775799, ptr %10, align 8, !tbaa !17
  br label %117

117:                                              ; preds = %116, %107
  br label %170

118:                                              ; preds = %101
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct._SOCKET, ptr %120, i32 0, i32 22
  %122 = load ptr, ptr %6, align 8, !tbaa !5
  %123 = load i32, ptr %12, align 4, !tbaa !26
  %124 = call ptr @SockBufferToken(ptr noundef %119, ptr noundef %121, ptr noundef %122, i32 noundef %123)
  store ptr %124, ptr %11, align 8, !tbaa !5
  %125 = load ptr, ptr %11, align 8, !tbaa !5
  %126 = icmp eq ptr null, %125
  br i1 %126, label %127, label %143

127:                                              ; preds = %118
  br label %128

128:                                              ; preds = %127
  %129 = call zeroext i8 @DebugPrintEnabled()
  %130 = icmp ne i8 %129, 0
  br i1 %130, label %131, label %140

131:                                              ; preds = %128
  br label %132

132:                                              ; preds = %131
  %133 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %134 = icmp ne i8 %133, 0
  br i1 %134, label %135, label %137

135:                                              ; preds = %132
  %136 = load i64, ptr %10, align 8, !tbaa !17
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.16, i64 noundef %136)
  br label %137

137:                                              ; preds = %135, %132
  br label %138

138:                                              ; preds = %137
  br label %139

139:                                              ; preds = %138
  br label %140

140:                                              ; preds = %139, %128
  br label %141

141:                                              ; preds = %140
  br label %142

142:                                              ; preds = %141
  store i64 -9223372036854775799, ptr %10, align 8, !tbaa !17
  br label %171

143:                                              ; preds = %118
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = call i64 @SockProcessTcpSndData(ptr noundef %144, ptr noundef %145)
  store i64 %146, ptr %10, align 8, !tbaa !17
  %147 = load i64, ptr %10, align 8, !tbaa !17
  %148 = icmp slt i64 %147, 0
  br i1 %148, label %149, label %169

149:                                              ; preds = %143
  br label %150

150:                                              ; preds = %149
  %151 = call zeroext i8 @DebugPrintEnabled()
  %152 = icmp ne i8 %151, 0
  br i1 %152, label %153, label %162

153:                                              ; preds = %150
  br label %154

154:                                              ; preds = %153
  %155 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %156 = icmp ne i8 %155, 0
  br i1 %156, label %157, label %159

157:                                              ; preds = %154
  %158 = load i64, ptr %10, align 8, !tbaa !17
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.17, i64 noundef %158)
  br label %159

159:                                              ; preds = %157, %154
  br label %160

160:                                              ; preds = %159
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161, %150
  br label %163

163:                                              ; preds = %162
  br label %164

164:                                              ; preds = %163
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._SOCK_TOKEN, ptr %165, i32 0, i32 0
  %167 = call ptr @RemoveEntryList(ptr noundef %166)
  %168 = load ptr, ptr %11, align 8, !tbaa !5
  call void @FreePool(ptr noundef %168)
  br label %169

169:                                              ; preds = %164, %143
  br label %170

170:                                              ; preds = %169, %117
  br label %171

171:                                              ; preds = %170, %142, %88, %78, %65, %54
  %172 = load ptr, ptr %4, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._SOCKET, ptr %172, i32 0, i32 10
  call void @EfiReleaseLock(ptr noundef %173)
  %174 = load i64, ptr %10, align 8, !tbaa !17
  store i64 %174, ptr %3, align 8
  store i32 1, ptr %13, align 4
  br label %175

175:                                              ; preds = %171, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  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 4, 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 i32 @SockGetFreeSpace(ptr noundef, i32 noundef) #2

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

declare void @FreePool(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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, !11, i64 60}
!10 = !{!"_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 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 = !{!15, !15, i64 0}
!18 = !{!10, !7, i64 56}
!19 = !{!7, !7, i64 0}
!20 = !{!10, !7, i64 64}
!21 = !{!22, !6, i64 0}
!22 = !{!"_SOCK_IO_TOKEN", !23, i64 0, !7, i64 16}
!23 = !{!"_SOCK_COMPLETION_TOKEN", !6, i64 0, !15, i64 8}
!24 = !{!25, !11, i64 4}
!25 = !{!"", !7, i64 0, !7, i64 1, !11, i64 4, !11, i64 8, !7, i64 16}
!26 = !{!11, !11, i64 0}
!27 = !{!10, !11, i64 100}


; 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"

@.str.1 = external hidden unnamed_addr constant [156 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [74 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @SockTokenExisted(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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 zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare i64 @EfiAcquireLockOrFail(ptr noundef) local_unnamed_addr #1

declare void @EfiReleaseLock(ptr noundef) local_unnamed_addr #1

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @SockSend(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %9, label %4

4:                                                ; preds = %2
  %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.1, i64 noundef 513, ptr noundef nonnull @.str.11) #2
  br label %9

9:                                                ; preds = %4, %8, %2
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = tail call i64 @EfiAcquireLockOrFail(ptr noundef nonnull %10) #2
  %12 = icmp slt i64 %11, 0
  br i1 %12, label %13, label %18

13:                                               ; preds = %9
  %14 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not49 = icmp eq i8 %14, 0
  br i1 %.not49, label %67, label %15

15:                                               ; preds = %13
  %16 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not50 = icmp eq i8 %16, 0
  br i1 %.not50, label %67, label %17

17:                                               ; preds = %15
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.15, i64 noundef %11) #2
  br label %67

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

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %25 = icmp eq i8 %20, 0
  br i1 %25, label %66, label %26

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %0, i64 64
  %28 = load i8, ptr %27, align 8, !tbaa !18
  %29 = and i8 %28, -2
  %switch = icmp eq i8 %29, 2
  br i1 %switch, label %30, label %66

30:                                               ; preds = %26
  %31 = load ptr, ptr %1, align 8, !tbaa !19
  %32 = tail call zeroext i8 @SockTokenExisted(ptr noundef nonnull %0, ptr noundef %31)
  %.not44 = icmp eq i8 %32, 0
  br i1 %.not44, label %33, label %66

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %24, i64 4
  %35 = load i32, ptr %34, align 4, !tbaa !22
  %36 = tail call i32 @SockGetFreeSpace(ptr noundef nonnull %0, i32 noundef 0) #2
  %37 = getelementptr inbounds i8, ptr %0, i64 100
  %38 = load i32, ptr %37, align 4, !tbaa !24
  %39 = icmp ult i32 %36, %38
  br i1 %39, label %43, label %40

40:                                               ; preds = %33
  %41 = load i8, ptr %27, align 8, !tbaa !18
  %42 = icmp eq i8 %41, 3
  br i1 %42, label %47, label %43

43:                                               ; preds = %40, %33
  %44 = getelementptr inbounds i8, ptr %0, i64 208
  %45 = tail call ptr @SockBufferToken(ptr noundef nonnull %0, ptr noundef nonnull %44, ptr noundef nonnull %1, i32 noundef %35)
  %46 = icmp eq ptr %45, null
  %spec.select = select i1 %46, i64 -9223372036854775799, i64 %11
  br label %66

47:                                               ; preds = %40
  %48 = getelementptr inbounds i8, ptr %0, i64 224
  %49 = tail call ptr @SockBufferToken(ptr noundef nonnull %0, ptr noundef nonnull %48, ptr noundef nonnull %1, i32 noundef %35)
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %56

51:                                               ; preds = %47
  %52 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not47 = icmp eq i8 %52, 0
  br i1 %.not47, label %66, label %53

53:                                               ; preds = %51
  %54 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not48 = icmp eq i8 %54, 0
  br i1 %.not48, label %66, label %55

55:                                               ; preds = %53
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.16, i64 noundef %11) #2
  br label %66

56:                                               ; preds = %47
  %57 = tail call i64 @SockProcessTcpSndData(ptr noundef nonnull %0, ptr noundef nonnull %24) #2
  %58 = icmp slt i64 %57, 0
  br i1 %58, label %59, label %66

59:                                               ; preds = %56
  %60 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not45 = icmp eq i8 %60, 0
  br i1 %.not45, label %64, label %61

61:                                               ; preds = %59
  %62 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not46 = icmp eq i8 %62, 0
  br i1 %.not46, label %64, label %63

63:                                               ; preds = %61
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.17, i64 noundef %57) #2
  br label %64

64:                                               ; preds = %61, %63, %59
  %65 = tail call ptr @RemoveEntryList(ptr noundef nonnull %49) #2
  tail call void @FreePool(ptr noundef nonnull %49) #2
  br label %66

66:                                               ; preds = %43, %26, %51, %55, %53, %30, %22, %18, %64, %56
  %.037 = phi i64 [ %57, %64 ], [ %57, %56 ], [ -9223372036854775791, %18 ], [ -9223372036854775789, %22 ], [ -9223372036854775793, %26 ], [ -9223372036854775793, %30 ], [ %spec.select, %43 ], [ -9223372036854775799, %53 ], [ -9223372036854775799, %55 ], [ -9223372036854775799, %51 ]
  tail call void @EfiReleaseLock(ptr noundef nonnull %10) #2
  br label %67

67:                                               ; preds = %13, %17, %15, %66
  %.0 = phi i64 [ %.037, %66 ], [ -9223372036854775793, %15 ], [ -9223372036854775793, %17 ], [ -9223372036854775793, %13 ]
  ret i64 %.0
}

declare i32 @SockGetFreeSpace(ptr noundef, i32 noundef) local_unnamed_addr #1

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

declare void @FreePool(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 = { 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 = !{!"_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 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, !8, i64 56}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !8, i64 64}
!19 = !{!20, !10, i64 0}
!20 = !{!"_SOCK_IO_TOKEN", !21, i64 0, !8, i64 16}
!21 = !{!"_SOCK_COMPLETION_TOKEN", !10, i64 0, !14, i64 8}
!22 = !{!23, !7, i64 4}
!23 = !{!"", !8, i64 0, !8, i64 1, !7, i64 4, !7, i64 8, !8, i64 16}
!24 = !{!6, !7, i64 100}


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