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

; 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.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%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.1 = external hidden unnamed_addr constant [156 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@gBS = external global ptr, align 8
@.str.18 = external hidden unnamed_addr constant [50 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

; Function Attrs: nounwind uwtable
define dso_local i64 @SockRcv(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 i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = 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 4, 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
  br label %11

11:                                               ; preds = %2
  %12 = call zeroext i8 @DebugAssertEnabled()
  %13 = icmp ne i8 %12, 0
  br i1 %13, label %14, label %21

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

19:                                               ; preds = %14
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 636, ptr noundef @.str.11)
  br label %20

20:                                               ; preds = %19, %14
  br label %21

21:                                               ; preds = %20, %11
  br label %22

22:                                               ; preds = %21
  br label %23

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

29:                                               ; preds = %23
  br label %30

30:                                               ; preds = %29
  %31 = call zeroext i8 @DebugPrintEnabled()
  %32 = icmp ne i8 %31, 0
  br i1 %32, label %33, label %42

33:                                               ; preds = %30
  br label %34

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

37:                                               ; preds = %34
  %38 = load i64, ptr %8, align 8, !tbaa !17
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.18, i64 noundef %38)
  br label %39

39:                                               ; preds = %37, %34
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41, %30
  br label %43

43:                                               ; preds = %42
  br label %44

44:                                               ; preds = %43
  store i64 -9223372036854775793, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %157

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

51:                                               ; preds = %45
  store i64 -9223372036854775791, ptr %8, align 8, !tbaa !17
  br label %153

52:                                               ; preds = %45
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._SOCKET, ptr %53, i32 0, i32 6
  %55 = load i8, ptr %54, align 8, !tbaa !18
  %56 = zext i8 %55 to i32
  %57 = icmp eq i32 %56, 0
  br i1 %57, label %58, label %59

58:                                               ; preds = %52
  store i64 -9223372036854775789, ptr %8, align 8, !tbaa !17
  br label %153

59:                                               ; preds = %52
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._SOCKET, ptr %60, i32 0, i32 8
  %62 = load i8, ptr %61, align 8, !tbaa !19
  %63 = zext i8 %62 to i32
  %64 = icmp eq i32 %63, 3
  br i1 %64, label %72, label %65

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

71:                                               ; preds = %65
  store i64 -9223372036854775793, ptr %8, align 8, !tbaa !17
  br label %153

72:                                               ; preds = %65, %59
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %73, ptr %6, align 8, !tbaa !5
  %74 = load ptr, ptr %6, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._SOCK_IO_TOKEN, ptr %74, i32 0, i32 0
  %76 = getelementptr inbounds %struct._SOCK_COMPLETION_TOKEN, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !20
  store ptr %77, ptr %9, align 8, !tbaa !5
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  %80 = call zeroext i8 @SockTokenExisted(ptr noundef %78, ptr noundef %79)
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %83

82:                                               ; preds = %72
  store i64 -9223372036854775793, ptr %8, align 8, !tbaa !17
  br label %153

83:                                               ; preds = %72
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %84, ptr %6, align 8, !tbaa !5
  %85 = load ptr, ptr %4, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct._SOCKET, ptr %85, i32 0, i32 12
  %87 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %86, i32 0, i32 2
  %88 = load ptr, ptr %87, align 8, !tbaa !23
  %89 = getelementptr inbounds %struct.NET_BUF_QUEUE, ptr %88, i32 0, i32 4
  %90 = load i32, ptr %89, align 8, !tbaa !24
  store i32 %90, ptr %7, align 4, !tbaa !26
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct._SOCKET, ptr %91, i32 0, i32 13
  %93 = load i64, ptr %92, align 8, !tbaa !27
  %94 = icmp ne i64 -9223372036854775787, %93
  br i1 %94, label %95, label %115

95:                                               ; preds = %83
  br label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._SOCKET, ptr %97, i32 0, i32 13
  %99 = load i64, ptr %98, align 8, !tbaa !27
  %100 = load ptr, ptr %6, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._SOCK_IO_TOKEN, ptr %100, i32 0, i32 0
  %102 = getelementptr inbounds %struct._SOCK_COMPLETION_TOKEN, ptr %101, i32 0, i32 1
  store i64 %99, ptr %102, align 8, !tbaa !28
  %103 = load ptr, ptr @gBS, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %103, i32 0, i32 11
  %105 = load ptr, ptr %104, align 8, !tbaa !29
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._SOCK_IO_TOKEN, ptr %106, i32 0, i32 0
  %108 = getelementptr inbounds %struct._SOCK_COMPLETION_TOKEN, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !20
  %110 = call i64 %105(ptr noundef %109)
  br label %111

111:                                              ; preds = %96
  br label %112

112:                                              ; preds = %111
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct._SOCKET, ptr %113, i32 0, i32 13
  store i64 -9223372036854775787, ptr %114, align 8, !tbaa !27
  br label %153

115:                                              ; preds = %83
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._SOCKET, ptr %116, i32 0, i32 9
  %118 = load i16, ptr %117, align 2, !tbaa !32
  %119 = zext i16 %118 to i32
  %120 = and i32 %119, 1
  %121 = icmp ne i32 0, %120
  br i1 %121, label %122, label %126

122:                                              ; preds = %115
  %123 = load i32, ptr %7, align 4, !tbaa !26
  %124 = icmp eq i32 0, %123
  br i1 %124, label %125, label %126

125:                                              ; preds = %122
  store i64 -9223372036854775704, ptr %8, align 8, !tbaa !17
  br label %153

126:                                              ; preds = %122, %115
  %127 = load i32, ptr %7, align 4, !tbaa !26
  %128 = icmp ne i32 %127, 0
  br i1 %128, label %129, label %143

129:                                              ; preds = %126
  %130 = load ptr, ptr %4, align 8, !tbaa !5
  %131 = load ptr, ptr %6, align 8, !tbaa !5
  %132 = call i32 @SockProcessRcvToken(ptr noundef %130, ptr noundef %131)
  %133 = zext i32 %132 to i64
  store i64 %133, ptr %8, align 8, !tbaa !17
  %134 = load i64, ptr %8, align 8, !tbaa !17
  %135 = icmp slt i64 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %129
  br label %153

137:                                              ; preds = %129
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._SOCKET, ptr %138, i32 0, i32 25
  %140 = load ptr, ptr %139, align 8, !tbaa !33
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = call i64 %140(ptr noundef %141, i8 noundef zeroext 7, ptr noundef null)
  store i64 %142, ptr %8, align 8, !tbaa !17
  br label %152

143:                                              ; preds = %126
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct._SOCKET, ptr %145, i32 0, i32 20
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = call ptr @SockBufferToken(ptr noundef %144, ptr noundef %146, ptr noundef %147, i32 noundef 0)
  %149 = icmp eq ptr null, %148
  br i1 %149, label %150, label %151

150:                                              ; preds = %143
  store i64 -9223372036854775799, ptr %8, align 8, !tbaa !17
  br label %151

151:                                              ; preds = %150, %143
  br label %152

152:                                              ; preds = %151, %137
  br label %153

153:                                              ; preds = %152, %136, %125, %112, %82, %71, %58, %51
  %154 = load ptr, ptr %4, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._SOCKET, ptr %154, i32 0, i32 10
  call void @EfiReleaseLock(ptr noundef %155)
  %156 = load i64, ptr %8, align 8, !tbaa !17
  store i64 %156, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %157

157:                                              ; preds = %153, %44
  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 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %158 = load i64, ptr %3, align 8
  ret i64 %158
}

declare i32 @SockProcessRcvToken(ptr noundef, 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 = !{!10, !7, i64 64}
!20 = !{!21, !6, i64 0}
!21 = !{!"_SOCK_IO_TOKEN", !22, i64 0, !7, i64 16}
!22 = !{!"_SOCK_COMPLETION_TOKEN", !6, i64 0, !15, i64 8}
!23 = !{!10, !6, i64 120}
!24 = !{!25, !11, i64 48}
!25 = !{!"", !11, i64 0, !15, i64 8, !12, i64 16, !12, i64 32, !11, i64 48, !11, i64 52}
!26 = !{!11, !11, i64 0}
!27 = !{!10, !15, i64 128}
!28 = !{!21, !15, i64 8}
!29 = !{!30, !6, i64 104}
!30 = !{!"", !31, 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}
!31 = !{!"", !15, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!32 = !{!10, !13, i64 66}
!33 = !{!10, !6, i64 256}


; 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
@gBS = external local_unnamed_addr global ptr, align 8
@.str.18 = external hidden unnamed_addr constant [50 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

; Function Attrs: nounwind uwtable
define dso_local i64 @SockRcv(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 636, 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
  %.not41 = icmp eq i8 %14, 0
  br i1 %.not41, label %60, label %15

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

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

18:                                               ; preds = %9
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  %20 = load i8, ptr %19, align 8, !tbaa !16
  switch i8 %20, label %22 [
    i8 3, label %59
    i8 0, label %21
  ]

21:                                               ; preds = %18
  br label %59

22:                                               ; preds = %18
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = load i8, ptr %23, align 8, !tbaa !17
  %25 = and i8 %24, -2
  %switch = icmp eq i8 %25, 2
  br i1 %switch, label %26, label %59

26:                                               ; preds = %22
  %27 = load ptr, ptr %1, align 8, !tbaa !18
  %28 = tail call zeroext i8 @SockTokenExisted(ptr noundef nonnull %0, ptr noundef %27)
  %.not38 = icmp eq i8 %28, 0
  br i1 %.not38, label %29, label %59

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %0, i64 128
  %31 = load i64, ptr %30, align 8, !tbaa !21
  %.not39 = icmp eq i64 %31, -9223372036854775787
  br i1 %.not39, label %39, label %32

32:                                               ; preds = %29
  %33 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %31, ptr %33, align 8, !tbaa !22
  %34 = load ptr, ptr @gBS, align 8, !tbaa !23
  %35 = getelementptr inbounds i8, ptr %34, i64 104
  %36 = load ptr, ptr %35, align 8, !tbaa !24
  %37 = load ptr, ptr %1, align 8, !tbaa !18
  %38 = tail call i64 %36(ptr noundef %37) #2
  store i64 -9223372036854775787, ptr %30, align 8, !tbaa !21
  br label %59

39:                                               ; preds = %29
  %40 = getelementptr inbounds i8, ptr %0, i64 120
  %41 = load ptr, ptr %40, align 8, !tbaa !27
  %42 = getelementptr inbounds i8, ptr %41, i64 48
  %43 = load i32, ptr %42, align 8, !tbaa !28
  %44 = getelementptr inbounds i8, ptr %0, i64 66
  %45 = load i16, ptr %44, align 2, !tbaa !30
  %46 = and i16 %45, 1
  %47 = icmp ne i16 %46, 0
  %48 = icmp eq i32 %43, 0
  %or.cond = select i1 %47, i1 %48, i1 false
  br i1 %or.cond, label %59, label %49

49:                                               ; preds = %39
  br i1 %48, label %55, label %50

50:                                               ; preds = %49
  %51 = tail call i32 @SockProcessRcvToken(ptr noundef nonnull %0, ptr noundef nonnull %1) #2
  %52 = getelementptr inbounds i8, ptr %0, i64 256
  %53 = load ptr, ptr %52, align 8, !tbaa !31
  %54 = tail call i64 %53(ptr noundef nonnull %0, i8 noundef zeroext 7, ptr noundef null) #2
  br label %59

55:                                               ; preds = %49
  %56 = getelementptr inbounds i8, ptr %0, i64 192
  %57 = tail call ptr @SockBufferToken(ptr noundef nonnull %0, ptr noundef nonnull %56, ptr noundef nonnull %1, i32 noundef 0)
  %58 = icmp eq ptr %57, null
  %spec.select = select i1 %58, i64 -9223372036854775799, i64 %11
  br label %59

59:                                               ; preds = %55, %22, %39, %26, %18, %50, %32, %21
  %.033 = phi i64 [ -9223372036854775789, %21 ], [ %11, %32 ], [ %54, %50 ], [ -9223372036854775791, %18 ], [ -9223372036854775793, %22 ], [ -9223372036854775793, %26 ], [ -9223372036854775704, %39 ], [ %spec.select, %55 ]
  tail call void @EfiReleaseLock(ptr noundef nonnull %10) #2
  br label %60

60:                                               ; preds = %13, %17, %15, %59
  %.0 = phi i64 [ %.033, %59 ], [ -9223372036854775793, %15 ], [ -9223372036854775793, %17 ], [ -9223372036854775793, %13 ]
  ret i64 %.0
}

declare i32 @SockProcessRcvToken(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 = { 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 = !{!6, !8, i64 64}
!18 = !{!19, !10, i64 0}
!19 = !{!"_SOCK_IO_TOKEN", !20, i64 0, !8, i64 16}
!20 = !{!"_SOCK_COMPLETION_TOKEN", !10, i64 0, !14, i64 8}
!21 = !{!6, !14, i64 128}
!22 = !{!19, !14, i64 8}
!23 = !{!10, !10, i64 0}
!24 = !{!25, !10, i64 104}
!25 = !{!"", !26, 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}
!26 = !{!"", !14, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!27 = !{!6, !10, i64 120}
!28 = !{!29, !7, i64 48}
!29 = !{!"", !7, i64 0, !14, i64 8, !11, i64 16, !11, i64 32, !7, i64 48, !7, i64 52}
!30 = !{!6, !12, i64 66}
!31 = !{!6, !10, i64 256}


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