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

; 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._SOCK_INIT_DATA = type { i32, i8, ptr, i32, i32, i32, i8, ptr, ptr, ptr, ptr, ptr, i32, ptr, ptr }
%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.14 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [76 x i8], align 1
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.17 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [70 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 @InsertTailList(ptr noundef, 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

; Function Attrs: nounwind uwtable
define dso_local ptr @SockCreate(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  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
  br label %10

10:                                               ; preds = %1
  %11 = call zeroext i8 @DebugAssertEnabled()
  %12 = icmp ne i8 %11, 0
  br i1 %12, label %13, label %23

13:                                               ; preds = %10
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %16, label %21

16:                                               ; preds = %13
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %17, i32 0, i32 13
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %16, %13
  call void @DebugAssert(ptr noundef @.str, i64 noundef 596, ptr noundef @.str.14)
  br label %22

22:                                               ; preds = %21, %16
  br label %23

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

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = call zeroext i8 @DebugAssertEnabled()
  %28 = icmp ne i8 %27, 0
  br i1 %28, label %29, label %36

29:                                               ; preds = %26
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8, !tbaa !12
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %35, label %34

34:                                               ; preds = %29
  call void @DebugAssert(ptr noundef @.str, i64 noundef 597, ptr noundef @.str.15)
  br label %35

35:                                               ; preds = %34, %29
  br label %36

36:                                               ; preds = %35, %26
  br label %37

37:                                               ; preds = %36
  br label %38

38:                                               ; preds = %37
  br label %39

39:                                               ; preds = %38
  %40 = call zeroext i8 @DebugAssertEnabled()
  %41 = icmp ne i8 %40, 0
  br i1 %41, label %42, label %54

42:                                               ; preds = %39
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %43, i32 0, i32 11
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %52

47:                                               ; preds = %42
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %48, i32 0, i32 12
  %50 = load i32, ptr %49, align 8, !tbaa !14
  %51 = icmp ule i32 %50, 20
  br i1 %51, label %53, label %52

52:                                               ; preds = %47, %42
  call void @DebugAssert(ptr noundef @.str, i64 noundef 598, ptr noundef @.str.16)
  br label %53

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

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

55:                                               ; preds = %54
  br label %56

56:                                               ; preds = %55
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %57, i32 0, i32 6
  %59 = load i8, ptr %58, align 4, !tbaa !15
  %60 = zext i8 %59 to i32
  %61 = icmp eq i32 %60, 4
  br i1 %61, label %62, label %63

62:                                               ; preds = %56
  store ptr @gEfiTcp4ProtocolGuid, ptr %7, align 8, !tbaa !5
  store i64 80, ptr %8, align 8, !tbaa !16
  br label %64

63:                                               ; preds = %56
  store ptr @gEfiTcp6ProtocolGuid, ptr %7, align 8, !tbaa !5
  store i64 72, ptr %8, align 8, !tbaa !16
  br label %64

64:                                               ; preds = %63, %62
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %65, i32 0, i32 2
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  store ptr %67, ptr %5, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %99

70:                                               ; preds = %64
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._TCP_SOCKET, ptr %71, i32 0, i32 16
  %73 = load i32, ptr %72, align 8, !tbaa !19
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._TCP_SOCKET, ptr %74, i32 0, i32 15
  %76 = load i32, ptr %75, align 4, !tbaa !25
  %77 = icmp eq i32 %73, %76
  br i1 %77, label %78, label %99

78:                                               ; preds = %70
  br label %79

79:                                               ; preds = %78
  %80 = call zeroext i8 @DebugPrintEnabled()
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %96

82:                                               ; preds = %79
  br label %83

83:                                               ; preds = %82
  %84 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %85 = icmp ne i8 %84, 0
  br i1 %85, label %86, label %93

86:                                               ; preds = %83
  %87 = load ptr, ptr %5, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._TCP_SOCKET, ptr %87, i32 0, i32 16
  %89 = load i32, ptr %88, align 8, !tbaa !19
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._TCP_SOCKET, ptr %90, i32 0, i32 15
  %92 = load i32, ptr %91, align 4, !tbaa !25
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.17, i32 noundef %89, i32 noundef %92)
  br label %93

93:                                               ; preds = %86, %83
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95, %79
  br label %97

97:                                               ; preds = %96
  br label %98

98:                                               ; preds = %97
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %422

99:                                               ; preds = %70, %64
  %100 = call ptr @AllocateZeroPool(i64 noundef 392)
  store ptr %100, ptr %4, align 8, !tbaa !5
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = icmp eq ptr null, %101
  br i1 %102, label %103, label %118

103:                                              ; preds = %99
  br label %104

104:                                              ; preds = %103
  %105 = call zeroext i8 @DebugPrintEnabled()
  %106 = icmp ne i8 %105, 0
  br i1 %106, label %107, label %115

107:                                              ; preds = %104
  br label %108

108:                                              ; preds = %107
  %109 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %110 = icmp ne i8 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %108
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.18)
  br label %112

112:                                              ; preds = %111, %108
  br label %113

113:                                              ; preds = %112
  br label %114

114:                                              ; preds = %113
  br label %115

115:                                              ; preds = %114, %104
  br label %116

116:                                              ; preds = %115
  br label %117

117:                                              ; preds = %116
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %422

118:                                              ; preds = %99
  %119 = load ptr, ptr %4, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._TCP_SOCKET, ptr %119, i32 0, i32 5
  %121 = call ptr @InitializeListHead(ptr noundef %120)
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._TCP_SOCKET, ptr %122, i32 0, i32 18
  %124 = call ptr @InitializeListHead(ptr noundef %123)
  %125 = load ptr, ptr %4, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._TCP_SOCKET, ptr %125, i32 0, i32 19
  %127 = call ptr @InitializeListHead(ptr noundef %126)
  %128 = load ptr, ptr %4, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._TCP_SOCKET, ptr %128, i32 0, i32 20
  %130 = call ptr @InitializeListHead(ptr noundef %129)
  %131 = load ptr, ptr %4, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._TCP_SOCKET, ptr %131, i32 0, i32 21
  %133 = call ptr @InitializeListHead(ptr noundef %132)
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct._TCP_SOCKET, ptr %134, i32 0, i32 22
  %136 = call ptr @InitializeListHead(ptr noundef %135)
  %137 = load ptr, ptr %4, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct._TCP_SOCKET, ptr %137, i32 0, i32 10
  %139 = call ptr @EfiInitializeLock(ptr noundef %138, i64 noundef 8)
  %140 = call ptr @NetbufQueAlloc()
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._TCP_SOCKET, ptr %141, i32 0, i32 11
  %143 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %142, i32 0, i32 2
  store ptr %140, ptr %143, align 8, !tbaa !26
  %144 = load ptr, ptr %4, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._TCP_SOCKET, ptr %144, i32 0, i32 11
  %146 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %145, i32 0, i32 2
  %147 = load ptr, ptr %146, align 8, !tbaa !26
  %148 = icmp eq ptr null, %147
  br i1 %148, label %149, label %164

149:                                              ; preds = %118
  br label %150

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

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 %158

157:                                              ; preds = %154
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.19)
  br label %158

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

159:                                              ; preds = %158
  br label %160

160:                                              ; preds = %159
  br label %161

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

162:                                              ; preds = %161
  br label %163

163:                                              ; preds = %162
  br label %382

164:                                              ; preds = %118
  %165 = call ptr @NetbufQueAlloc()
  %166 = load ptr, ptr %4, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._TCP_SOCKET, ptr %166, i32 0, i32 12
  %168 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %167, i32 0, i32 2
  store ptr %165, ptr %168, align 8, !tbaa !27
  %169 = load ptr, ptr %4, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._TCP_SOCKET, ptr %169, i32 0, i32 12
  %171 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %170, i32 0, i32 2
  %172 = load ptr, ptr %171, align 8, !tbaa !27
  %173 = icmp eq ptr null, %172
  br i1 %173, label %174, label %189

174:                                              ; preds = %164
  br label %175

175:                                              ; preds = %174
  %176 = call zeroext i8 @DebugPrintEnabled()
  %177 = icmp ne i8 %176, 0
  br i1 %177, label %178, label %186

178:                                              ; preds = %175
  br label %179

179:                                              ; preds = %178
  %180 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %181 = icmp ne i8 %180, 0
  br i1 %181, label %182, label %183

182:                                              ; preds = %179
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.20)
  br label %183

183:                                              ; preds = %182, %179
  br label %184

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184
  br label %186

186:                                              ; preds = %185, %175
  br label %187

187:                                              ; preds = %186
  br label %188

188:                                              ; preds = %187
  br label %382

189:                                              ; preds = %164
  %190 = load ptr, ptr %4, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._TCP_SOCKET, ptr %190, i32 0, i32 0
  store i32 1262702419, ptr %191, align 8, !tbaa !28
  %192 = load ptr, ptr %5, align 8, !tbaa !5
  %193 = load ptr, ptr %4, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct._TCP_SOCKET, ptr %193, i32 0, i32 17
  store ptr %192, ptr %194, align 8, !tbaa !29
  %195 = load ptr, ptr %3, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %195, i32 0, i32 3
  %197 = load i32, ptr %196, align 8, !tbaa !30
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct._TCP_SOCKET, ptr %198, i32 0, i32 15
  store i32 %197, ptr %199, align 4, !tbaa !25
  %200 = load ptr, ptr %3, align 8, !tbaa !5
  %201 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %200, i32 0, i32 13
  %202 = load ptr, ptr %201, align 8, !tbaa !9
  %203 = load ptr, ptr %4, align 8, !tbaa !5
  %204 = getelementptr inbounds %struct._TCP_SOCKET, ptr %203, i32 0, i32 25
  store ptr %202, ptr %204, align 8, !tbaa !31
  %205 = load ptr, ptr %3, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %205, i32 0, i32 4
  %207 = load i32, ptr %206, align 4, !tbaa !32
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = getelementptr inbounds %struct._TCP_SOCKET, ptr %208, i32 0, i32 11
  %210 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %209, i32 0, i32 0
  store i32 %207, ptr %210, align 8, !tbaa !33
  %211 = load ptr, ptr %3, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %211, i32 0, i32 5
  %213 = load i32, ptr %212, align 8, !tbaa !34
  %214 = load ptr, ptr %4, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct._TCP_SOCKET, ptr %214, i32 0, i32 12
  %216 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %215, i32 0, i32 0
  store i32 %213, ptr %216, align 8, !tbaa !35
  %217 = load ptr, ptr %3, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %217, i32 0, i32 0
  %219 = load i32, ptr %218, align 8, !tbaa !12
  %220 = load ptr, ptr %4, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct._TCP_SOCKET, ptr %220, i32 0, i32 7
  store i32 %219, ptr %221, align 4, !tbaa !36
  %222 = load ptr, ptr %3, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %222, i32 0, i32 14
  %224 = load ptr, ptr %223, align 8, !tbaa !37
  %225 = load ptr, ptr %4, align 8, !tbaa !5
  %226 = getelementptr inbounds %struct._TCP_SOCKET, ptr %225, i32 0, i32 2
  store ptr %224, ptr %226, align 8, !tbaa !38
  %227 = load ptr, ptr %3, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %227, i32 0, i32 1
  %229 = load i8, ptr %228, align 4, !tbaa !39
  %230 = load ptr, ptr %4, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct._TCP_SOCKET, ptr %230, i32 0, i32 8
  store i8 %229, ptr %231, align 8, !tbaa !40
  %232 = load ptr, ptr %3, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %232, i32 0, i32 8
  %234 = load ptr, ptr %233, align 8, !tbaa !41
  %235 = load ptr, ptr %4, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct._TCP_SOCKET, ptr %235, i32 0, i32 29
  store ptr %234, ptr %236, align 8, !tbaa !42
  %237 = load ptr, ptr %3, align 8, !tbaa !5
  %238 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %237, i32 0, i32 9
  %239 = load ptr, ptr %238, align 8, !tbaa !43
  %240 = load ptr, ptr %4, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct._TCP_SOCKET, ptr %240, i32 0, i32 30
  store ptr %239, ptr %241, align 8, !tbaa !44
  %242 = load ptr, ptr %3, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %242, i32 0, i32 10
  %244 = load ptr, ptr %243, align 8, !tbaa !45
  %245 = load ptr, ptr %4, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct._TCP_SOCKET, ptr %245, i32 0, i32 31
  store ptr %244, ptr %246, align 8, !tbaa !46
  %247 = load ptr, ptr %4, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct._TCP_SOCKET, ptr %247, i32 0, i32 13
  store i64 -9223372036854775787, ptr %248, align 8, !tbaa !47
  %249 = load ptr, ptr %4, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct._TCP_SOCKET, ptr %249, i32 0, i32 11
  %251 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %250, i32 0, i32 1
  store i32 2048, ptr %251, align 4, !tbaa !48
  %252 = load ptr, ptr %4, align 8, !tbaa !5
  %253 = getelementptr inbounds %struct._TCP_SOCKET, ptr %252, i32 0, i32 12
  %254 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %253, i32 0, i32 1
  store i32 2048, ptr %254, align 4, !tbaa !49
  %255 = load ptr, ptr %3, align 8, !tbaa !5
  %256 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %255, i32 0, i32 6
  %257 = load i8, ptr %256, align 4, !tbaa !15
  %258 = load ptr, ptr %4, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct._TCP_SOCKET, ptr %258, i32 0, i32 27
  store i8 %257, ptr %259, align 4, !tbaa !50
  %260 = load ptr, ptr %4, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct._TCP_SOCKET, ptr %260, i32 0, i32 28
  %262 = load ptr, ptr %3, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %262, i32 0, i32 7
  %264 = load ptr, ptr %263, align 8, !tbaa !51
  %265 = load i64, ptr %8, align 8, !tbaa !16
  %266 = call ptr @CopyMem(ptr noundef %261, ptr noundef %264, i64 noundef %265)
  %267 = load ptr, ptr %4, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct._TCP_SOCKET, ptr %267, i32 0, i32 26
  %269 = getelementptr inbounds [20 x i8], ptr %268, i64 0, i64 0
  %270 = load ptr, ptr %3, align 8, !tbaa !5
  %271 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %270, i32 0, i32 11
  %272 = load ptr, ptr %271, align 8, !tbaa !13
  %273 = load ptr, ptr %3, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct._SOCK_INIT_DATA, ptr %273, i32 0, i32 12
  %275 = load i32, ptr %274, align 8, !tbaa !14
  %276 = zext i32 %275 to i64
  %277 = call ptr @CopyMem(ptr noundef %269, ptr noundef %272, i64 noundef %276)
  %278 = load ptr, ptr @gBS, align 8, !tbaa !5
  %279 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %278, i32 0, i32 39
  %280 = load ptr, ptr %279, align 8, !tbaa !52
  %281 = load ptr, ptr %4, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct._TCP_SOCKET, ptr %281, i32 0, i32 1
  %283 = load ptr, ptr %7, align 8, !tbaa !5
  %284 = load ptr, ptr %4, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct._TCP_SOCKET, ptr %284, i32 0, i32 28
  %286 = call i64 (ptr, ...) %280(ptr noundef %282, ptr noundef %283, ptr noundef %285, ptr noundef null)
  store i64 %286, ptr %6, align 8, !tbaa !16
  %287 = load i64, ptr %6, align 8, !tbaa !16
  %288 = icmp slt i64 %287, 0
  br i1 %288, label %289, label %305

289:                                              ; preds = %189
  br label %290

290:                                              ; preds = %289
  %291 = call zeroext i8 @DebugPrintEnabled()
  %292 = icmp ne i8 %291, 0
  br i1 %292, label %293, label %302

293:                                              ; preds = %290
  br label %294

294:                                              ; preds = %293
  %295 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648)
  %296 = icmp ne i8 %295, 0
  br i1 %296, label %297, label %299

297:                                              ; preds = %294
  %298 = load i64, ptr %6, align 8, !tbaa !16
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef @.str.21, i64 noundef %298)
  br label %299

299:                                              ; preds = %297, %294
  br label %300

300:                                              ; preds = %299
  br label %301

301:                                              ; preds = %300
  br label %302

302:                                              ; preds = %301, %290
  br label %303

303:                                              ; preds = %302
  br label %304

304:                                              ; preds = %303
  br label %382

305:                                              ; preds = %189
  %306 = load ptr, ptr %5, align 8, !tbaa !5
  %307 = icmp ne ptr %306, null
  br i1 %307, label %308, label %362

308:                                              ; preds = %305
  br label %309

309:                                              ; preds = %308
  %310 = call zeroext i8 @DebugAssertEnabled()
  %311 = icmp ne i8 %310, 0
  br i1 %311, label %312, label %319

312:                                              ; preds = %309
  %313 = load ptr, ptr %5, align 8, !tbaa !5
  %314 = getelementptr inbounds %struct._TCP_SOCKET, ptr %313, i32 0, i32 15
  %315 = load i32, ptr %314, align 4, !tbaa !25
  %316 = icmp ugt i32 %315, 0
  br i1 %316, label %318, label %317

317:                                              ; preds = %312
  call void @DebugAssert(ptr noundef @.str, i64 noundef 706, ptr noundef @.str.22)
  br label %318

318:                                              ; preds = %317, %312
  br label %319

319:                                              ; preds = %318, %309
  br label %320

320:                                              ; preds = %319
  br label %321

321:                                              ; preds = %320
  br label %322

322:                                              ; preds = %321
  %323 = call zeroext i8 @DebugAssertEnabled()
  %324 = icmp ne i8 %323, 0
  br i1 %324, label %325, label %333

325:                                              ; preds = %322
  %326 = load ptr, ptr %5, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct._TCP_SOCKET, ptr %326, i32 0, i32 8
  %328 = load i8, ptr %327, align 8, !tbaa !40
  %329 = zext i8 %328 to i32
  %330 = icmp eq i32 %329, 1
  br i1 %330, label %332, label %331

331:                                              ; preds = %325
  call void @DebugAssert(ptr noundef @.str, i64 noundef 707, ptr noundef @.str.23)
  br label %332

332:                                              ; preds = %331, %325
  br label %333

333:                                              ; preds = %332, %322
  br label %334

334:                                              ; preds = %333
  br label %335

335:                                              ; preds = %334
  %336 = load ptr, ptr %5, align 8, !tbaa !5
  %337 = getelementptr inbounds %struct._TCP_SOCKET, ptr %336, i32 0, i32 16
  %338 = load i32, ptr %337, align 8, !tbaa !19
  %339 = add i32 %338, 1
  store i32 %339, ptr %337, align 8, !tbaa !19
  br label %340

340:                                              ; preds = %335
  %341 = call zeroext i8 @DebugPrintEnabled()
  %342 = icmp ne i8 %341, 0
  br i1 %342, label %343, label %354

343:                                              ; preds = %340
  br label %344

344:                                              ; preds = %343
  %345 = call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64)
  %346 = icmp ne i8 %345, 0
  br i1 %346, label %347, label %351

347:                                              ; preds = %344
  %348 = load ptr, ptr %5, align 8, !tbaa !5
  %349 = getelementptr inbounds %struct._TCP_SOCKET, ptr %348, i32 0, i32 16
  %350 = load i32, ptr %349, align 8, !tbaa !19
  call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef @.str.24, i32 noundef %350)
  br label %351

351:                                              ; preds = %347, %344
  br label %352

352:                                              ; preds = %351
  br label %353

353:                                              ; preds = %352
  br label %354

354:                                              ; preds = %353, %340
  br label %355

355:                                              ; preds = %354
  br label %356

356:                                              ; preds = %355
  %357 = load ptr, ptr %5, align 8, !tbaa !5
  %358 = getelementptr inbounds %struct._TCP_SOCKET, ptr %357, i32 0, i32 18
  %359 = load ptr, ptr %4, align 8, !tbaa !5
  %360 = getelementptr inbounds %struct._TCP_SOCKET, ptr %359, i32 0, i32 18
  %361 = call ptr @InsertTailList(ptr noundef %358, ptr noundef %360)
  br label %362

362:                                              ; preds = %356, %305
  %363 = load ptr, ptr %4, align 8, !tbaa !5
  %364 = getelementptr inbounds %struct._TCP_SOCKET, ptr %363, i32 0, i32 29
  %365 = load ptr, ptr %364, align 8, !tbaa !42
  %366 = icmp ne ptr %365, null
  br i1 %366, label %367, label %380

367:                                              ; preds = %362
  %368 = load ptr, ptr %4, align 8, !tbaa !5
  %369 = getelementptr inbounds %struct._TCP_SOCKET, ptr %368, i32 0, i32 29
  %370 = load ptr, ptr %369, align 8, !tbaa !42
  %371 = load ptr, ptr %4, align 8, !tbaa !5
  %372 = load ptr, ptr %4, align 8, !tbaa !5
  %373 = getelementptr inbounds %struct._TCP_SOCKET, ptr %372, i32 0, i32 31
  %374 = load ptr, ptr %373, align 8, !tbaa !46
  %375 = call i64 %370(ptr noundef %371, ptr noundef %374)
  store i64 %375, ptr %6, align 8, !tbaa !16
  %376 = load i64, ptr %6, align 8, !tbaa !16
  %377 = icmp slt i64 %376, 0
  br i1 %377, label %378, label %379

378:                                              ; preds = %367
  br label %382

379:                                              ; preds = %367
  br label %380

380:                                              ; preds = %379, %362
  %381 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %381, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %422

382:                                              ; preds = %378, %304, %188, %163
  %383 = load ptr, ptr %4, align 8, !tbaa !5
  %384 = getelementptr inbounds %struct._TCP_SOCKET, ptr %383, i32 0, i32 1
  %385 = load ptr, ptr %384, align 8, !tbaa !55
  %386 = icmp ne ptr %385, null
  br i1 %386, label %387, label %398

387:                                              ; preds = %382
  %388 = load ptr, ptr @gBS, align 8, !tbaa !5
  %389 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %388, i32 0, i32 40
  %390 = load ptr, ptr %389, align 8, !tbaa !56
  %391 = load ptr, ptr %4, align 8, !tbaa !5
  %392 = getelementptr inbounds %struct._TCP_SOCKET, ptr %391, i32 0, i32 1
  %393 = load ptr, ptr %392, align 8, !tbaa !55
  %394 = load ptr, ptr %7, align 8, !tbaa !5
  %395 = load ptr, ptr %4, align 8, !tbaa !5
  %396 = getelementptr inbounds %struct._TCP_SOCKET, ptr %395, i32 0, i32 28
  %397 = call i64 (ptr, ...) %390(ptr noundef %393, ptr noundef %394, ptr noundef %396, ptr noundef null)
  br label %398

398:                                              ; preds = %387, %382
  %399 = load ptr, ptr %4, align 8, !tbaa !5
  %400 = getelementptr inbounds %struct._TCP_SOCKET, ptr %399, i32 0, i32 11
  %401 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %400, i32 0, i32 2
  %402 = load ptr, ptr %401, align 8, !tbaa !26
  %403 = icmp ne ptr null, %402
  br i1 %403, label %404, label %409

404:                                              ; preds = %398
  %405 = load ptr, ptr %4, align 8, !tbaa !5
  %406 = getelementptr inbounds %struct._TCP_SOCKET, ptr %405, i32 0, i32 11
  %407 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %406, i32 0, i32 2
  %408 = load ptr, ptr %407, align 8, !tbaa !26
  call void @NetbufQueFree(ptr noundef %408)
  br label %409

409:                                              ; preds = %404, %398
  %410 = load ptr, ptr %4, align 8, !tbaa !5
  %411 = getelementptr inbounds %struct._TCP_SOCKET, ptr %410, i32 0, i32 12
  %412 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %411, i32 0, i32 2
  %413 = load ptr, ptr %412, align 8, !tbaa !27
  %414 = icmp ne ptr null, %413
  br i1 %414, label %415, label %420

415:                                              ; preds = %409
  %416 = load ptr, ptr %4, align 8, !tbaa !5
  %417 = getelementptr inbounds %struct._TCP_SOCKET, ptr %416, i32 0, i32 12
  %418 = getelementptr inbounds %struct._SOCK_BUFFER, ptr %417, i32 0, i32 2
  %419 = load ptr, ptr %418, align 8, !tbaa !27
  call void @NetbufQueFree(ptr noundef %419)
  br label %420

420:                                              ; preds = %415, %409
  %421 = load ptr, ptr %4, align 8, !tbaa !5
  call void @FreePool(ptr noundef %421)
  store ptr null, ptr %2, align 8
  store i32 1, ptr %9, align 4
  br label %422

422:                                              ; preds = %420, %380, %117, %98
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %423 = load ptr, ptr %2, align 8
  ret ptr %423
}

declare ptr @AllocateZeroPool(i64 noundef) #1

declare ptr @InitializeListHead(ptr noundef) #1

declare ptr @EfiInitializeLock(ptr noundef, i64 noundef) #1

declare ptr @NetbufQueAlloc() #1

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #1

declare void @NetbufQueFree(ptr noundef) #1

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, !6, i64 80}
!10 = !{!"_SOCK_INIT_DATA", !11, i64 0, !7, i64 4, !6, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !7, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72, !6, i64 80, !6, i64 88}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !6, i64 64}
!14 = !{!10, !11, i64 72}
!15 = !{!10, !7, i64 28}
!16 = !{!17, !17, i64 0}
!17 = !{!"long long", !7, i64 0}
!18 = !{!10, !6, i64 8}
!19 = !{!20, !11, i64 144}
!20 = !{!"_TCP_SOCKET", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !21, i64 40, !7, i64 56, !11, i64 60, !7, i64 64, !22, i64 66, !23, i64 72, !24, i64 96, !24, i64 112, !17, i64 128, !7, i64 136, !11, i64 140, !11, i64 144, !6, i64 152, !21, i64 160, !21, i64 176, !21, i64 192, !21, i64 208, !21, 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}
!21 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!22 = !{!"short", !7, i64 0}
!23 = !{!"", !17, i64 0, !17, i64 8, !11, i64 16}
!24 = !{!"_SOCK_BUFFER", !11, i64 0, !11, i64 4, !6, i64 8}
!25 = !{!20, !11, i64 140}
!26 = !{!20, !6, i64 104}
!27 = !{!20, !6, i64 120}
!28 = !{!20, !11, i64 0}
!29 = !{!20, !6, i64 152}
!30 = !{!10, !11, i64 16}
!31 = !{!20, !6, i64 256}
!32 = !{!10, !11, i64 20}
!33 = !{!20, !11, i64 96}
!34 = !{!10, !11, i64 24}
!35 = !{!20, !11, i64 112}
!36 = !{!20, !11, i64 60}
!37 = !{!10, !6, i64 88}
!38 = !{!20, !6, i64 16}
!39 = !{!10, !7, i64 4}
!40 = !{!20, !7, i64 64}
!41 = !{!10, !6, i64 40}
!42 = !{!20, !6, i64 368}
!43 = !{!10, !6, i64 48}
!44 = !{!20, !6, i64 376}
!45 = !{!10, !6, i64 56}
!46 = !{!20, !6, i64 384}
!47 = !{!20, !17, i64 128}
!48 = !{!20, !11, i64 100}
!49 = !{!20, !11, i64 116}
!50 = !{!20, !7, i64 284}
!51 = !{!10, !6, i64 32}
!52 = !{!53, !6, i64 328}
!53 = !{!"", !54, 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}
!54 = !{!"", !17, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!55 = !{!20, !6, i64 8}
!56 = !{!53, !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.14 = external hidden unnamed_addr constant [79 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [76 x i8], align 1
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@.str.17 = external hidden unnamed_addr constant [91 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [70 x i8], align 1

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

declare ptr @InsertTailList(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @FreePool(ptr noundef) local_unnamed_addr #0

declare zeroext i8 @DebugPrintEnabled() local_unnamed_addr #0

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

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

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

3:                                                ; preds = %1
  %.not95 = icmp eq ptr %0, null
  br i1 %.not95, label %7, label %4

4:                                                ; preds = %3
  %5 = getelementptr inbounds i8, ptr %0, i64 80
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %.not96 = icmp eq ptr %6, null
  br i1 %.not96, label %7, label %8

7:                                                ; preds = %4, %3
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 596, ptr noundef nonnull @.str.14) #2
  br label %8

8:                                                ; preds = %1, %7, %4
  %9 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not97 = icmp eq i8 %9, 0
  br i1 %.not97, label %14, label %10

10:                                               ; preds = %8
  %11 = load i32, ptr %0, align 8, !tbaa !11
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 597, ptr noundef nonnull @.str.15) #2
  br label %14

14:                                               ; preds = %8, %13, %10
  %15 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not98 = icmp eq i8 %15, 0
  br i1 %.not98, label %24, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 64
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %.not99 = icmp eq ptr %18, null
  br i1 %.not99, label %23, label %19

19:                                               ; preds = %16
  %20 = getelementptr inbounds i8, ptr %0, i64 72
  %21 = load i32, ptr %20, align 8, !tbaa !13
  %22 = icmp ult i32 %21, 21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19, %16
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 598, ptr noundef nonnull @.str.16) #2
  br label %24

24:                                               ; preds = %19, %23, %14
  %25 = getelementptr inbounds i8, ptr %0, i64 28
  %26 = load i8, ptr %25, align 4, !tbaa !14
  %27 = icmp eq i8 %26, 4
  %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid = select i1 %27, ptr @gEfiTcp4ProtocolGuid, ptr @gEfiTcp6ProtocolGuid
  %. = select i1 %27, i64 80, i64 72
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %.not100 = icmp eq ptr %29, null
  br i1 %.not100, label %43, label %30

30:                                               ; preds = %24
  %31 = getelementptr inbounds i8, ptr %29, i64 144
  %32 = load i32, ptr %31, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %29, i64 140
  %34 = load i32, ptr %33, align 4, !tbaa !23
  %35 = icmp eq i32 %32, %34
  br i1 %35, label %36, label %43

36:                                               ; preds = %30
  %37 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not118 = icmp eq i8 %37, 0
  br i1 %.not118, label %187, label %38

38:                                               ; preds = %36
  %39 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not119 = icmp eq i8 %39, 0
  br i1 %.not119, label %187, label %40

40:                                               ; preds = %38
  %41 = load i32, ptr %31, align 8, !tbaa !16
  %42 = load i32, ptr %33, align 4, !tbaa !23
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.17, i32 noundef %41, i32 noundef %42) #2
  br label %187

43:                                               ; preds = %30, %24
  %44 = tail call ptr @AllocateZeroPool(i64 noundef 392) #2
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %51

46:                                               ; preds = %43
  %47 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not116 = icmp eq i8 %47, 0
  br i1 %.not116, label %187, label %48

48:                                               ; preds = %46
  %49 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not117 = icmp eq i8 %49, 0
  br i1 %.not117, label %187, label %50

50:                                               ; preds = %48
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.18) #2
  br label %187

51:                                               ; preds = %43
  %52 = getelementptr inbounds i8, ptr %44, i64 40
  %53 = tail call ptr @InitializeListHead(ptr noundef nonnull %52) #2
  %54 = getelementptr inbounds i8, ptr %44, i64 160
  %55 = tail call ptr @InitializeListHead(ptr noundef nonnull %54) #2
  %56 = getelementptr inbounds i8, ptr %44, i64 176
  %57 = tail call ptr @InitializeListHead(ptr noundef nonnull %56) #2
  %58 = getelementptr inbounds i8, ptr %44, i64 192
  %59 = tail call ptr @InitializeListHead(ptr noundef nonnull %58) #2
  %60 = getelementptr inbounds i8, ptr %44, i64 208
  %61 = tail call ptr @InitializeListHead(ptr noundef nonnull %60) #2
  %62 = getelementptr inbounds i8, ptr %44, i64 224
  %63 = tail call ptr @InitializeListHead(ptr noundef nonnull %62) #2
  %64 = getelementptr inbounds i8, ptr %44, i64 72
  %65 = tail call ptr @EfiInitializeLock(ptr noundef nonnull %64, i64 noundef 8) #2
  %66 = tail call ptr @NetbufQueAlloc() #2
  %67 = getelementptr inbounds i8, ptr %44, i64 96
  %68 = getelementptr inbounds i8, ptr %44, i64 104
  store ptr %66, ptr %68, align 8, !tbaa !24
  %69 = icmp eq ptr %66, null
  br i1 %69, label %70, label %75

70:                                               ; preds = %51
  %71 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not111 = icmp eq i8 %71, 0
  br i1 %.not111, label %170, label %72

72:                                               ; preds = %70
  %73 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not112 = icmp eq i8 %73, 0
  br i1 %.not112, label %170, label %74

74:                                               ; preds = %72
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.19) #2
  br label %170

75:                                               ; preds = %51
  %76 = tail call ptr @NetbufQueAlloc() #2
  %77 = getelementptr inbounds i8, ptr %44, i64 120
  store ptr %76, ptr %77, align 8, !tbaa !25
  %78 = icmp eq ptr %76, null
  br i1 %78, label %79, label %84

79:                                               ; preds = %75
  %80 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not109 = icmp eq i8 %80, 0
  br i1 %.not109, label %170, label %81

81:                                               ; preds = %79
  %82 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not110 = icmp eq i8 %82, 0
  br i1 %.not110, label %170, label %83

83:                                               ; preds = %81
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.20) #2
  br label %170

84:                                               ; preds = %75
  %85 = getelementptr inbounds i8, ptr %44, i64 112
  store i32 1262702419, ptr %44, align 8, !tbaa !26
  %86 = getelementptr inbounds i8, ptr %44, i64 152
  store ptr %29, ptr %86, align 8, !tbaa !27
  %87 = getelementptr inbounds i8, ptr %0, i64 16
  %88 = load i32, ptr %87, align 8, !tbaa !28
  %89 = getelementptr inbounds i8, ptr %44, i64 140
  store i32 %88, ptr %89, align 4, !tbaa !23
  %90 = getelementptr inbounds i8, ptr %0, i64 80
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = getelementptr inbounds i8, ptr %44, i64 256
  store ptr %91, ptr %92, align 8, !tbaa !29
  %93 = getelementptr inbounds i8, ptr %0, i64 20
  %94 = load i32, ptr %93, align 4, !tbaa !30
  store i32 %94, ptr %67, align 8, !tbaa !31
  %95 = getelementptr inbounds i8, ptr %0, i64 24
  %96 = load i32, ptr %95, align 8, !tbaa !32
  store i32 %96, ptr %85, align 8, !tbaa !33
  %97 = load i32, ptr %0, align 8, !tbaa !11
  %98 = getelementptr inbounds i8, ptr %44, i64 60
  store i32 %97, ptr %98, align 4, !tbaa !34
  %99 = getelementptr inbounds i8, ptr %0, i64 88
  %100 = load ptr, ptr %99, align 8, !tbaa !35
  %101 = getelementptr inbounds i8, ptr %44, i64 16
  store ptr %100, ptr %101, align 8, !tbaa !36
  %102 = getelementptr inbounds i8, ptr %0, i64 4
  %103 = load i8, ptr %102, align 4, !tbaa !37
  %104 = getelementptr inbounds i8, ptr %44, i64 64
  store i8 %103, ptr %104, align 8, !tbaa !38
  %105 = getelementptr inbounds i8, ptr %0, i64 40
  %106 = getelementptr inbounds i8, ptr %44, i64 368
  %107 = load <2 x ptr>, ptr %105, align 8, !tbaa !39
  store <2 x ptr> %107, ptr %106, align 8, !tbaa !39
  %108 = getelementptr inbounds i8, ptr %0, i64 56
  %109 = load ptr, ptr %108, align 8, !tbaa !40
  %110 = getelementptr inbounds i8, ptr %44, i64 384
  store ptr %109, ptr %110, align 8, !tbaa !41
  %111 = getelementptr inbounds i8, ptr %44, i64 128
  store i64 -9223372036854775787, ptr %111, align 8, !tbaa !42
  %112 = getelementptr inbounds i8, ptr %44, i64 100
  store i32 2048, ptr %112, align 4, !tbaa !43
  %113 = getelementptr inbounds i8, ptr %44, i64 116
  store i32 2048, ptr %113, align 4, !tbaa !44
  %114 = load i8, ptr %25, align 4, !tbaa !14
  %115 = getelementptr inbounds i8, ptr %44, i64 284
  store i8 %114, ptr %115, align 4, !tbaa !45
  %116 = getelementptr inbounds i8, ptr %44, i64 288
  %117 = getelementptr inbounds i8, ptr %0, i64 32
  %118 = load ptr, ptr %117, align 8, !tbaa !46
  %119 = tail call ptr @CopyMem(ptr noundef nonnull %116, ptr noundef %118, i64 noundef %.) #2
  %120 = getelementptr inbounds i8, ptr %44, i64 264
  %121 = getelementptr inbounds i8, ptr %0, i64 64
  %122 = load ptr, ptr %121, align 8, !tbaa !12
  %123 = getelementptr inbounds i8, ptr %0, i64 72
  %124 = load i32, ptr %123, align 8, !tbaa !13
  %125 = zext i32 %124 to i64
  %126 = tail call ptr @CopyMem(ptr noundef nonnull %120, ptr noundef %122, i64 noundef %125) #2
  %127 = load ptr, ptr @gBS, align 8, !tbaa !39
  %128 = getelementptr inbounds i8, ptr %127, i64 328
  %129 = load ptr, ptr %128, align 8, !tbaa !47
  %130 = getelementptr inbounds i8, ptr %44, i64 8
  %131 = tail call i64 (ptr, ...) %129(ptr noundef nonnull %130, ptr noundef nonnull %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid, ptr noundef nonnull %116, ptr noundef null) #2
  %132 = icmp slt i64 %131, 0
  br i1 %132, label %133, label %138

133:                                              ; preds = %84
  %134 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not107 = icmp eq i8 %134, 0
  br i1 %.not107, label %170, label %135

135:                                              ; preds = %133
  %136 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 2147483648) #2
  %.not108 = icmp eq i8 %136, 0
  br i1 %.not108, label %170, label %137

137:                                              ; preds = %135
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 2147483648, ptr noundef nonnull @.str.21, i64 noundef %131) #2
  br label %170

138:                                              ; preds = %84
  br i1 %.not100, label %164, label %139

139:                                              ; preds = %138
  %140 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not101 = icmp eq i8 %140, 0
  br i1 %.not101, label %145, label %141

141:                                              ; preds = %139
  %142 = getelementptr inbounds i8, ptr %29, i64 140
  %143 = load i32, ptr %142, align 4, !tbaa !23
  %.not102 = icmp eq i32 %143, 0
  br i1 %.not102, label %144, label %145

144:                                              ; preds = %141
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 706, ptr noundef nonnull @.str.22) #2
  br label %145

145:                                              ; preds = %139, %144, %141
  %146 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not103 = icmp eq i8 %146, 0
  br i1 %.not103, label %152, label %147

147:                                              ; preds = %145
  %148 = getelementptr inbounds i8, ptr %29, i64 64
  %149 = load i8, ptr %148, align 8, !tbaa !38
  %150 = icmp eq i8 %149, 1
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 707, ptr noundef nonnull @.str.23) #2
  br label %152

152:                                              ; preds = %147, %151, %145
  %153 = getelementptr inbounds i8, ptr %29, i64 144
  %154 = load i32, ptr %153, align 8, !tbaa !16
  %155 = add i32 %154, 1
  store i32 %155, ptr %153, align 8, !tbaa !16
  %156 = tail call zeroext i8 @DebugPrintEnabled() #2
  %.not104 = icmp eq i8 %156, 0
  br i1 %.not104, label %161, label %157

157:                                              ; preds = %152
  %158 = tail call zeroext i8 @DebugPrintLevelEnabled(i64 noundef 64) #2
  %.not105 = icmp eq i8 %158, 0
  br i1 %.not105, label %161, label %159

159:                                              ; preds = %157
  %160 = load i32, ptr %153, align 8, !tbaa !16
  tail call void (i64, ptr, ...) @DebugPrint(i64 noundef 64, ptr noundef nonnull @.str.24, i32 noundef %160) #2
  br label %161

161:                                              ; preds = %157, %159, %152
  %162 = getelementptr inbounds i8, ptr %29, i64 160
  %163 = tail call ptr @InsertTailList(ptr noundef nonnull %162, ptr noundef nonnull %54) #2
  br label %164

164:                                              ; preds = %161, %138
  %165 = load ptr, ptr %106, align 8, !tbaa !50
  %.not106 = icmp eq ptr %165, null
  br i1 %.not106, label %187, label %166

166:                                              ; preds = %164
  %167 = load ptr, ptr %110, align 8, !tbaa !41
  %168 = tail call i64 %165(ptr noundef nonnull %44, ptr noundef %167) #2
  %169 = icmp slt i64 %168, 0
  br i1 %169, label %170, label %187

170:                                              ; preds = %166, %133, %137, %135, %79, %83, %81, %70, %74, %72
  %171 = getelementptr inbounds i8, ptr %44, i64 8
  %172 = load ptr, ptr %171, align 8, !tbaa !51
  %.not113 = icmp eq ptr %172, null
  br i1 %.not113, label %179, label %173

173:                                              ; preds = %170
  %174 = load ptr, ptr @gBS, align 8, !tbaa !39
  %175 = getelementptr inbounds i8, ptr %174, i64 336
  %176 = load ptr, ptr %175, align 8, !tbaa !52
  %177 = getelementptr inbounds i8, ptr %44, i64 288
  %178 = tail call i64 (ptr, ...) %176(ptr noundef nonnull %172, ptr noundef nonnull %gEfiTcp4ProtocolGuid.gEfiTcp6ProtocolGuid, ptr noundef nonnull %177, ptr noundef null) #2
  br label %179

179:                                              ; preds = %173, %170
  %180 = load ptr, ptr %68, align 8, !tbaa !24
  %.not114 = icmp eq ptr %180, null
  br i1 %.not114, label %182, label %181

181:                                              ; preds = %179
  tail call void @NetbufQueFree(ptr noundef nonnull %180) #2
  br label %182

182:                                              ; preds = %181, %179
  %183 = getelementptr inbounds i8, ptr %44, i64 120
  %184 = load ptr, ptr %183, align 8, !tbaa !25
  %.not115 = icmp eq ptr %184, null
  br i1 %.not115, label %186, label %185

185:                                              ; preds = %182
  tail call void @NetbufQueFree(ptr noundef nonnull %184) #2
  br label %186

186:                                              ; preds = %185, %182
  tail call void @FreePool(ptr noundef nonnull %44) #2
  br label %187

187:                                              ; preds = %164, %166, %46, %50, %48, %36, %40, %38, %186
  %.086 = phi ptr [ null, %186 ], [ null, %38 ], [ null, %40 ], [ null, %36 ], [ null, %48 ], [ null, %50 ], [ null, %46 ], [ %44, %166 ], [ %44, %164 ]
  ret ptr %.086
}

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #0

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #0

declare ptr @EfiInitializeLock(ptr noundef, i64 noundef) local_unnamed_addr #0

declare ptr @NetbufQueAlloc() local_unnamed_addr #0

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

declare void @NetbufQueFree(ptr noundef) local_unnamed_addr #0

attributes #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 = { 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 = { 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, !10, i64 80}
!6 = !{!"_SOCK_INIT_DATA", !7, i64 0, !8, i64 4, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !8, i64 28, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !10, i64 88}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !10, i64 64}
!13 = !{!6, !7, i64 72}
!14 = !{!6, !8, i64 28}
!15 = !{!6, !10, i64 8}
!16 = !{!17, !7, i64 144}
!17 = !{!"_TCP_SOCKET", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !18, i64 40, !8, i64 56, !7, i64 60, !8, i64 64, !19, i64 66, !20, i64 72, !22, i64 96, !22, i64 112, !21, i64 128, !8, i64 136, !7, i64 140, !7, i64 144, !10, i64 152, !18, i64 160, !18, i64 176, !18, i64 192, !18, i64 208, !18, 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}
!18 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!19 = !{!"short", !8, i64 0}
!20 = !{!"", !21, i64 0, !21, i64 8, !7, i64 16}
!21 = !{!"long long", !8, i64 0}
!22 = !{!"_SOCK_BUFFER", !7, i64 0, !7, i64 4, !10, i64 8}
!23 = !{!17, !7, i64 140}
!24 = !{!17, !10, i64 104}
!25 = !{!17, !10, i64 120}
!26 = !{!17, !7, i64 0}
!27 = !{!17, !10, i64 152}
!28 = !{!6, !7, i64 16}
!29 = !{!17, !10, i64 256}
!30 = !{!6, !7, i64 20}
!31 = !{!17, !7, i64 96}
!32 = !{!6, !7, i64 24}
!33 = !{!17, !7, i64 112}
!34 = !{!17, !7, i64 60}
!35 = !{!6, !10, i64 88}
!36 = !{!17, !10, i64 16}
!37 = !{!6, !8, i64 4}
!38 = !{!17, !8, i64 64}
!39 = !{!10, !10, i64 0}
!40 = !{!6, !10, i64 56}
!41 = !{!17, !10, i64 384}
!42 = !{!17, !21, i64 128}
!43 = !{!17, !7, i64 100}
!44 = !{!17, !7, i64 116}
!45 = !{!17, !8, i64 284}
!46 = !{!6, !10, i64 32}
!47 = !{!48, !10, i64 328}
!48 = !{!"", !49, 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}
!49 = !{!"", !21, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!50 = !{!17, !10, i64 368}
!51 = !{!17, !10, i64 8}
!52 = !{!48, !10, i64 336}


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