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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.EFI_TCP4_OPTION = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONFIG_DATA = type { i8, i8, %struct.EFI_TCP4_ACCESS_POINT, ptr }
%struct.EFI_TCP4_ACCESS_POINT = type { i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16, i8 }
%struct.EFI_TCP6_CONFIG_DATA = type { i8, i8, %struct.EFI_TCP6_ACCESS_POINT, ptr }
%struct.EFI_TCP6_ACCESS_POINT = type { %struct.EFI_IPv6_ADDRESS, i16, %struct.EFI_IPv6_ADDRESS, i16, i8 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.TCP_IO = type { i8, ptr, ptr, ptr, %union.TCP_IO_PROTOCOL, %union.TCP_IO_PROTOCOL, %union.TCP_IO_CONNECTION_TOKEN, %union.TCP_IO_IO_TOKEN, %union.TCP_IO_IO_TOKEN, %union.TCP_IO_CLOSE_TOKEN, %union.TCP_IO_LISTEN_TOKEN, i8, i8, i8, i8, i8 }
%union.TCP_IO_PROTOCOL = type { ptr }
%union.TCP_IO_CONNECTION_TOKEN = type { %struct.EFI_TCP4_CONNECTION_TOKEN }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%union.TCP_IO_IO_TOKEN = type { %struct.EFI_TCP4_IO_TOKEN }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon }
%union.anon = type { ptr }
%union.TCP_IO_CLOSE_TOKEN = type { %struct.EFI_TCP4_CLOSE_TOKEN }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%union.TCP_IO_LISTEN_TOKEN = type { %struct.EFI_TCP4_LISTEN_TOKEN }
%struct.EFI_TCP4_LISTEN_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, ptr }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }
%struct.TCP4_IO_CONFIG_DATA = type { %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16, i8 }
%struct._EFI_TCP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.TCP6_IO_CONFIG_DATA = type { i16, %struct.EFI_IPv6_ADDRESS, i16, i8 }
%struct._EFI_TCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@gBS = external global ptr, align 8
@gEfiTcp4ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [148 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@mZeroIp4Addr = external global %struct.EFI_IPv4_ADDRESS, align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @TcpIoCommonNotify(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @TcpIoGetMapping(ptr noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @TcpIoCreateSocket(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i64, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca %struct.EFI_TCP4_OPTION, align 4
  %18 = alloca %struct.EFI_TCP4_CONFIG_DATA, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %struct.EFI_TCP6_CONFIG_DATA, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i8 %2, ptr %9, align 1, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = icmp eq ptr %26, null
  br i1 %27, label %37, label %28

28:                                               ; preds = %5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %37, label %31

31:                                               ; preds = %28
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %37, label %34

34:                                               ; preds = %31
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %34, %31, %28, %5
  store i64 -9223372036854775806, ptr %6, align 8
  store i32 1, ptr %25, align 4
  br label %341

38:                                               ; preds = %34
  store ptr null, ptr %20, align 8, !tbaa !5
  store ptr null, ptr %23, align 8, !tbaa !5
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = call ptr @ZeroMem(ptr noundef %39, i64 noundef 168)
  %41 = load i8, ptr %9, align 1, !tbaa !9
  %42 = zext i8 %41 to i32
  %43 = icmp eq i32 %42, 4
  br i1 %43, label %44, label %47

44:                                               ; preds = %38
  store ptr @gEfiTcp4ServiceBindingProtocolGuid, ptr %14, align 8, !tbaa !5
  store ptr @gEfiTcp4ProtocolGuid, ptr %15, align 8, !tbaa !5
  %45 = load ptr, ptr %11, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.TCP_IO, ptr %45, i32 0, i32 4
  store ptr %46, ptr %16, align 8, !tbaa !5
  br label %56

47:                                               ; preds = %38
  %48 = load i8, ptr %9, align 1, !tbaa !9
  %49 = zext i8 %48 to i32
  %50 = icmp eq i32 %49, 6
  br i1 %50, label %51, label %54

51:                                               ; preds = %47
  store ptr @gEfiTcp6ServiceBindingProtocolGuid, ptr %14, align 8, !tbaa !5
  store ptr @gEfiTcp6ProtocolGuid, ptr %15, align 8, !tbaa !5
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.TCP_IO, ptr %52, i32 0, i32 4
  store ptr %53, ptr %16, align 8, !tbaa !5
  br label %55

54:                                               ; preds = %47
  store i64 -9223372036854775805, ptr %6, align 8
  store i32 1, ptr %25, align 4
  br label %341

55:                                               ; preds = %51
  br label %56

56:                                               ; preds = %55, %44
  %57 = load i8, ptr %9, align 1, !tbaa !9
  %58 = load ptr, ptr %11, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.TCP_IO, ptr %58, i32 0, i32 0
  store i8 %57, ptr %59, align 8, !tbaa !10
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = load ptr, ptr %14, align 8, !tbaa !5
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.TCP_IO, ptr %63, i32 0, i32 3
  %65 = call i64 @NetLibCreateServiceChild(ptr noundef %60, ptr noundef %61, ptr noundef %62, ptr noundef %64)
  store i64 %65, ptr %12, align 8, !tbaa !12
  %66 = load i64, ptr %12, align 8, !tbaa !12
  %67 = icmp slt i64 %66, 0
  br i1 %67, label %68, label %70

68:                                               ; preds = %56
  %69 = load i64, ptr %12, align 8, !tbaa !12
  store i64 %69, ptr %6, align 8
  store i32 1, ptr %25, align 4
  br label %341

70:                                               ; preds = %56
  %71 = load ptr, ptr @gBS, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %71, i32 0, i32 33
  %73 = load ptr, ptr %72, align 8, !tbaa !14
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.TCP_IO, ptr %74, i32 0, i32 3
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = call i64 %73(ptr noundef %76, ptr noundef %77, ptr noundef %78, ptr noundef %79, ptr noundef %80, i32 noundef 16)
  store i64 %81, ptr %12, align 8, !tbaa !12
  %82 = load i64, ptr %12, align 8, !tbaa !12
  %83 = icmp slt i64 %82, 0
  br i1 %83, label %88, label %84

84:                                               ; preds = %70
  %85 = load ptr, ptr %16, align 8, !tbaa !5
  %86 = load ptr, ptr %85, align 8, !tbaa !5
  %87 = icmp eq ptr %86, null
  br i1 %87, label %88, label %89

88:                                               ; preds = %84, %70
  br label %338

89:                                               ; preds = %84
  %90 = load i8, ptr %9, align 1, !tbaa !9
  %91 = zext i8 %90 to i32
  %92 = icmp eq i32 %91, 4
  br i1 %92, label %93, label %97

93:                                               ; preds = %89
  %94 = load ptr, ptr %11, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.TCP_IO, ptr %94, i32 0, i32 4
  %96 = load ptr, ptr %95, align 8, !tbaa !9
  store ptr %96, ptr %20, align 8, !tbaa !5
  br label %101

97:                                               ; preds = %89
  %98 = load ptr, ptr %11, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.TCP_IO, ptr %98, i32 0, i32 4
  %100 = load ptr, ptr %99, align 8, !tbaa !9
  store ptr %100, ptr %23, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %97, %93
  %102 = load ptr, ptr %7, align 8, !tbaa !5
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.TCP_IO, ptr %103, i32 0, i32 1
  store ptr %102, ptr %104, align 8, !tbaa !19
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = load ptr, ptr %11, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.TCP_IO, ptr %106, i32 0, i32 2
  store ptr %105, ptr %107, align 8, !tbaa !20
  %108 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 0
  store i32 2097152, ptr %108, align 4, !tbaa !21
  %109 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 1
  store i32 2097152, ptr %109, align 4, !tbaa !23
  %110 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 2
  store i32 0, ptr %110, align 4, !tbaa !24
  %111 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 3
  store i32 0, ptr %111, align 4, !tbaa !25
  %112 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 4
  store i32 6, ptr %112, align 4, !tbaa !26
  %113 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 5
  store i32 0, ptr %113, align 4, !tbaa !27
  %114 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 6
  store i32 0, ptr %114, align 4, !tbaa !28
  %115 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 7
  store i32 4, ptr %115, align 4, !tbaa !29
  %116 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 8
  store i32 0, ptr %116, align 4, !tbaa !30
  %117 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 9
  store i32 0, ptr %117, align 4, !tbaa !31
  %118 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 10
  store i8 0, ptr %118, align 4, !tbaa !32
  %119 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 11
  store i8 0, ptr %119, align 1, !tbaa !33
  %120 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 12
  store i8 1, ptr %120, align 2, !tbaa !34
  %121 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 13
  store i8 0, ptr %121, align 1, !tbaa !35
  %122 = getelementptr inbounds %struct.EFI_TCP4_OPTION, ptr %17, i32 0, i32 14
  store i8 0, ptr %122, align 4, !tbaa !36
  %123 = load i8, ptr %9, align 1, !tbaa !9
  %124 = zext i8 %123 to i32
  %125 = icmp eq i32 %124, 4
  br i1 %125, label %126, label %200

126:                                              ; preds = %101
  %127 = getelementptr inbounds %struct.EFI_TCP4_CONFIG_DATA, ptr %18, i32 0, i32 0
  store i8 8, ptr %127, align 8, !tbaa !37
  %128 = getelementptr inbounds %struct.EFI_TCP4_CONFIG_DATA, ptr %18, i32 0, i32 1
  store i8 -1, ptr %128, align 1, !tbaa !42
  %129 = getelementptr inbounds %struct.EFI_TCP4_CONFIG_DATA, ptr %18, i32 0, i32 3
  store ptr %17, ptr %129, align 8, !tbaa !43
  %130 = getelementptr inbounds %struct.EFI_TCP4_CONFIG_DATA, ptr %18, i32 0, i32 2
  store ptr %130, ptr %19, align 8, !tbaa !5
  %131 = load ptr, ptr %19, align 8, !tbaa !5
  %132 = call ptr @ZeroMem(ptr noundef %131, i64 noundef 20)
  %133 = load ptr, ptr %10, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %133, i32 0, i32 3
  %135 = load i16, ptr %134, align 2, !tbaa !9
  %136 = load ptr, ptr %19, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %136, i32 0, i32 3
  store i16 %135, ptr %137, align 2, !tbaa !44
  %138 = load ptr, ptr %10, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %138, i32 0, i32 5
  %140 = load i16, ptr %139, align 2, !tbaa !9
  %141 = load ptr, ptr %19, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %141, i32 0, i32 5
  store i16 %140, ptr %142, align 2, !tbaa !45
  %143 = load ptr, ptr %10, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %143, i32 0, i32 6
  %145 = load i8, ptr %144, align 2, !tbaa !9
  %146 = load ptr, ptr %19, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %146, i32 0, i32 6
  store i8 %145, ptr %147, align 2, !tbaa !46
  %148 = load ptr, ptr %19, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %148, i32 0, i32 1
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %150, i32 0, i32 0
  %152 = call ptr @CopyMem(ptr noundef %149, ptr noundef %151, i64 noundef 4)
  %153 = load ptr, ptr %19, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %153, i32 0, i32 2
  %155 = load ptr, ptr %10, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %155, i32 0, i32 1
  %157 = call ptr @CopyMem(ptr noundef %154, ptr noundef %156, i64 noundef 4)
  %158 = load ptr, ptr %19, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.EFI_TCP4_ACCESS_POINT, ptr %158, i32 0, i32 4
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %160, i32 0, i32 4
  %162 = call ptr @CopyMem(ptr noundef %159, ptr noundef %161, i64 noundef 4)
  br label %163

163:                                              ; preds = %126
  %164 = call zeroext i8 @DebugAssertEnabled()
  %165 = icmp ne i8 %164, 0
  br i1 %165, label %166, label %171

166:                                              ; preds = %163
  %167 = load ptr, ptr %20, align 8, !tbaa !5
  %168 = icmp ne ptr %167, null
  br i1 %168, label %170, label %169

169:                                              ; preds = %166
  call void @DebugAssert(ptr noundef @.str, i64 noundef 258, ptr noundef @.str.1)
  br label %170

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

171:                                              ; preds = %170, %163
  br label %172

172:                                              ; preds = %171
  br label %173

173:                                              ; preds = %172
  %174 = load ptr, ptr %20, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct._EFI_TCP4_PROTOCOL, ptr %174, i32 0, i32 1
  %176 = load ptr, ptr %175, align 8, !tbaa !47
  %177 = load ptr, ptr %20, align 8, !tbaa !5
  %178 = call i64 %176(ptr noundef %177, ptr noundef %18)
  store i64 %178, ptr %12, align 8, !tbaa !12
  %179 = load i64, ptr %12, align 8, !tbaa !12
  %180 = icmp slt i64 %179, 0
  br i1 %180, label %181, label %182

181:                                              ; preds = %173
  br label %338

182:                                              ; preds = %173
  %183 = load ptr, ptr %10, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %183, i32 0, i32 2
  %185 = call i64 @CompareMem(ptr noundef %184, ptr noundef @mZeroIp4Addr, i64 noundef 4)
  %186 = icmp eq i64 %185, 0
  br i1 %186, label %199, label %187

187:                                              ; preds = %182
  %188 = load ptr, ptr %20, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct._EFI_TCP4_PROTOCOL, ptr %188, i32 0, i32 2
  %190 = load ptr, ptr %189, align 8, !tbaa !49
  %191 = load ptr, ptr %20, align 8, !tbaa !5
  %192 = load ptr, ptr %10, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.TCP4_IO_CONFIG_DATA, ptr %192, i32 0, i32 2
  %194 = call i64 %190(ptr noundef %191, i8 noundef zeroext 0, ptr noundef @mZeroIp4Addr, ptr noundef @mZeroIp4Addr, ptr noundef %193)
  store i64 %194, ptr %12, align 8, !tbaa !12
  %195 = load i64, ptr %12, align 8, !tbaa !12
  %196 = icmp slt i64 %195, 0
  br i1 %196, label %197, label %198

197:                                              ; preds = %187
  br label %338

198:                                              ; preds = %187
  br label %199

199:                                              ; preds = %198, %182
  br label %253

200:                                              ; preds = %101
  %201 = getelementptr inbounds %struct.EFI_TCP6_CONFIG_DATA, ptr %21, i32 0, i32 0
  store i8 0, ptr %201, align 8, !tbaa !50
  %202 = getelementptr inbounds %struct.EFI_TCP6_CONFIG_DATA, ptr %21, i32 0, i32 1
  store i8 -1, ptr %202, align 1, !tbaa !53
  %203 = getelementptr inbounds %struct.EFI_TCP6_CONFIG_DATA, ptr %21, i32 0, i32 3
  store ptr %17, ptr %203, align 8, !tbaa !54
  %204 = getelementptr inbounds %struct.EFI_TCP6_CONFIG_DATA, ptr %21, i32 0, i32 2
  store ptr %204, ptr %22, align 8, !tbaa !5
  %205 = load ptr, ptr %22, align 8, !tbaa !5
  %206 = call ptr @ZeroMem(ptr noundef %205, i64 noundef 38)
  %207 = load ptr, ptr %10, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.TCP6_IO_CONFIG_DATA, ptr %207, i32 0, i32 0
  %209 = load i16, ptr %208, align 2, !tbaa !9
  %210 = load ptr, ptr %22, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.EFI_TCP6_ACCESS_POINT, ptr %210, i32 0, i32 1
  store i16 %209, ptr %211, align 2, !tbaa !55
  %212 = load ptr, ptr %10, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.TCP6_IO_CONFIG_DATA, ptr %212, i32 0, i32 2
  %214 = load i16, ptr %213, align 2, !tbaa !9
  %215 = load ptr, ptr %22, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.EFI_TCP6_ACCESS_POINT, ptr %215, i32 0, i32 3
  store i16 %214, ptr %216, align 2, !tbaa !56
  %217 = load ptr, ptr %10, align 8, !tbaa !5
  %218 = getelementptr inbounds %struct.TCP6_IO_CONFIG_DATA, ptr %217, i32 0, i32 3
  %219 = load i8, ptr %218, align 2, !tbaa !9
  %220 = load ptr, ptr %22, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.EFI_TCP6_ACCESS_POINT, ptr %220, i32 0, i32 4
  store i8 %219, ptr %221, align 2, !tbaa !57
  %222 = load ptr, ptr %22, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.EFI_TCP6_ACCESS_POINT, ptr %222, i32 0, i32 2
  %224 = load ptr, ptr %10, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.TCP6_IO_CONFIG_DATA, ptr %224, i32 0, i32 1
  %226 = call ptr @CopyMem(ptr noundef %223, ptr noundef %225, i64 noundef 16)
  br label %227

227:                                              ; preds = %200
  %228 = call zeroext i8 @DebugAssertEnabled()
  %229 = icmp ne i8 %228, 0
  br i1 %229, label %230, label %235

230:                                              ; preds = %227
  %231 = load ptr, ptr %23, align 8, !tbaa !5
  %232 = icmp ne ptr %231, null
  br i1 %232, label %234, label %233

233:                                              ; preds = %230
  call void @DebugAssert(ptr noundef @.str, i64 noundef 298, ptr noundef @.str.2)
  br label %234

234:                                              ; preds = %233, %230
  br label %235

235:                                              ; preds = %234, %227
  br label %236

236:                                              ; preds = %235
  br label %237

237:                                              ; preds = %236
  %238 = load ptr, ptr %23, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct._EFI_TCP6_PROTOCOL, ptr %238, i32 0, i32 1
  %240 = load ptr, ptr %239, align 8, !tbaa !58
  %241 = load ptr, ptr %23, align 8, !tbaa !5
  %242 = call i64 %240(ptr noundef %241, ptr noundef %21)
  store i64 %242, ptr %12, align 8, !tbaa !12
  %243 = load i64, ptr %12, align 8, !tbaa !12
  %244 = icmp eq i64 %243, -9223372036854775791
  br i1 %244, label %245, label %248

245:                                              ; preds = %237
  %246 = load ptr, ptr %23, align 8, !tbaa !5
  %247 = call i64 @TcpIoGetMapping(ptr noundef %246, ptr noundef %21)
  store i64 %247, ptr %12, align 8, !tbaa !12
  br label %248

248:                                              ; preds = %245, %237
  %249 = load i64, ptr %12, align 8, !tbaa !12
  %250 = icmp slt i64 %249, 0
  br i1 %250, label %251, label %252

251:                                              ; preds = %248
  br label %338

252:                                              ; preds = %248
  br label %253

253:                                              ; preds = %252, %199
  %254 = load ptr, ptr @gBS, align 8, !tbaa !5
  %255 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %254, i32 0, i32 8
  %256 = load ptr, ptr %255, align 8, !tbaa !60
  %257 = load ptr, ptr %11, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.TCP_IO, ptr %257, i32 0, i32 11
  %259 = call i64 %256(i32 noundef 512, i64 noundef 16, ptr noundef @TcpIoCommonNotify, ptr noundef %258, ptr noundef %13)
  store i64 %259, ptr %12, align 8, !tbaa !12
  %260 = load i64, ptr %12, align 8, !tbaa !12
  %261 = icmp slt i64 %260, 0
  br i1 %261, label %262, label %263

262:                                              ; preds = %253
  br label %338

263:                                              ; preds = %253
  %264 = load ptr, ptr %13, align 8, !tbaa !5
  %265 = load ptr, ptr %11, align 8, !tbaa !5
  %266 = getelementptr inbounds %struct.TCP_IO, ptr %265, i32 0, i32 6
  %267 = getelementptr inbounds %struct.EFI_TCP4_CONNECTION_TOKEN, ptr %266, i32 0, i32 0
  %268 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %267, i32 0, i32 0
  store ptr %264, ptr %268, align 8, !tbaa !9
  %269 = load ptr, ptr @gBS, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %269, i32 0, i32 8
  %271 = load ptr, ptr %270, align 8, !tbaa !60
  %272 = load ptr, ptr %11, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct.TCP_IO, ptr %272, i32 0, i32 15
  %274 = call i64 %271(i32 noundef 512, i64 noundef 16, ptr noundef @TcpIoCommonNotify, ptr noundef %273, ptr noundef %13)
  store i64 %274, ptr %12, align 8, !tbaa !12
  %275 = load i64, ptr %12, align 8, !tbaa !12
  %276 = icmp slt i64 %275, 0
  br i1 %276, label %277, label %278

277:                                              ; preds = %263
  br label %338

278:                                              ; preds = %263
  %279 = load ptr, ptr %13, align 8, !tbaa !5
  %280 = load ptr, ptr %11, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.TCP_IO, ptr %280, i32 0, i32 10
  %282 = getelementptr inbounds %struct.EFI_TCP4_LISTEN_TOKEN, ptr %281, i32 0, i32 0
  %283 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %282, i32 0, i32 0
  store ptr %279, ptr %283, align 8, !tbaa !9
  %284 = load ptr, ptr @gBS, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %284, i32 0, i32 8
  %286 = load ptr, ptr %285, align 8, !tbaa !60
  %287 = load ptr, ptr %11, align 8, !tbaa !5
  %288 = getelementptr inbounds %struct.TCP_IO, ptr %287, i32 0, i32 12
  %289 = call i64 %286(i32 noundef 512, i64 noundef 16, ptr noundef @TcpIoCommonNotify, ptr noundef %288, ptr noundef %13)
  store i64 %289, ptr %12, align 8, !tbaa !12
  %290 = load i64, ptr %12, align 8, !tbaa !12
  %291 = icmp slt i64 %290, 0
  br i1 %291, label %292, label %293

292:                                              ; preds = %278
  br label %338

293:                                              ; preds = %278
  %294 = load ptr, ptr %13, align 8, !tbaa !5
  %295 = load ptr, ptr %11, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct.TCP_IO, ptr %295, i32 0, i32 7
  %297 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %296, i32 0, i32 0
  %298 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %297, i32 0, i32 0
  store ptr %294, ptr %298, align 8, !tbaa !9
  %299 = load ptr, ptr @gBS, align 8, !tbaa !5
  %300 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %299, i32 0, i32 8
  %301 = load ptr, ptr %300, align 8, !tbaa !60
  %302 = load ptr, ptr %11, align 8, !tbaa !5
  %303 = getelementptr inbounds %struct.TCP_IO, ptr %302, i32 0, i32 13
  %304 = call i64 %301(i32 noundef 512, i64 noundef 16, ptr noundef @TcpIoCommonNotify, ptr noundef %303, ptr noundef %13)
  store i64 %304, ptr %12, align 8, !tbaa !12
  %305 = load i64, ptr %12, align 8, !tbaa !12
  %306 = icmp slt i64 %305, 0
  br i1 %306, label %307, label %308

307:                                              ; preds = %293
  br label %338

308:                                              ; preds = %293
  %309 = load ptr, ptr %13, align 8, !tbaa !5
  %310 = load ptr, ptr %11, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.TCP_IO, ptr %310, i32 0, i32 8
  %312 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %311, i32 0, i32 0
  %313 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %312, i32 0, i32 0
  store ptr %309, ptr %313, align 8, !tbaa !9
  %314 = call ptr @AllocateZeroPool(i64 noundef 32)
  store ptr %314, ptr %24, align 8, !tbaa !5
  %315 = load ptr, ptr %24, align 8, !tbaa !5
  %316 = icmp eq ptr %315, null
  br i1 %316, label %317, label %318

317:                                              ; preds = %308
  store i64 -9223372036854775799, ptr %12, align 8, !tbaa !12
  br label %338

318:                                              ; preds = %308
  %319 = load ptr, ptr %24, align 8, !tbaa !5
  %320 = load ptr, ptr %11, align 8, !tbaa !5
  %321 = getelementptr inbounds %struct.TCP_IO, ptr %320, i32 0, i32 8
  %322 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %321, i32 0, i32 1
  store ptr %319, ptr %322, align 8, !tbaa !9
  %323 = load ptr, ptr @gBS, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %323, i32 0, i32 8
  %325 = load ptr, ptr %324, align 8, !tbaa !60
  %326 = load ptr, ptr %11, align 8, !tbaa !5
  %327 = getelementptr inbounds %struct.TCP_IO, ptr %326, i32 0, i32 14
  %328 = call i64 %325(i32 noundef 512, i64 noundef 16, ptr noundef @TcpIoCommonNotify, ptr noundef %327, ptr noundef %13)
  store i64 %328, ptr %12, align 8, !tbaa !12
  %329 = load i64, ptr %12, align 8, !tbaa !12
  %330 = icmp slt i64 %329, 0
  br i1 %330, label %331, label %332

331:                                              ; preds = %318
  br label %338

332:                                              ; preds = %318
  %333 = load ptr, ptr %13, align 8, !tbaa !5
  %334 = load ptr, ptr %11, align 8, !tbaa !5
  %335 = getelementptr inbounds %struct.TCP_IO, ptr %334, i32 0, i32 9
  %336 = getelementptr inbounds %struct.EFI_TCP4_CLOSE_TOKEN, ptr %335, i32 0, i32 0
  %337 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %336, i32 0, i32 0
  store ptr %333, ptr %337, align 8, !tbaa !9
  store i64 0, ptr %6, align 8
  store i32 1, ptr %25, align 4
  br label %341

338:                                              ; preds = %331, %317, %307, %292, %277, %262, %251, %197, %181, %88
  %339 = load ptr, ptr %11, align 8, !tbaa !5
  call void @TcpIoDestroySocket(ptr noundef %339)
  %340 = load i64, ptr %12, align 8, !tbaa !12
  store i64 %340, ptr %6, align 8
  store i32 1, ptr %25, align 4
  br label %341

341:                                              ; preds = %338, %332, %68, %54, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %342 = load i64, ptr %6, align 8
  ret i64 %342
}

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

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

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

declare zeroext i8 @DebugAssertEnabled() #2

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

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

declare ptr @AllocateZeroPool(i64 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local void @TcpIoDestroySocket(ptr noundef) #0

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !7, i64 0}
!11 = !{!"", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 64, !7, i64 88, !7, i64 112, !7, i64 136, !7, i64 160, !7, i64 161, !7, i64 162, !7, i64 163, !7, i64 164}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = !{!15, !6, i64 280}
!15 = !{!"", !16, 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}
!16 = !{!"", !13, i64 0, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20}
!17 = !{!"int", !7, i64 0}
!18 = !{!11, !6, i64 24}
!19 = !{!11, !6, i64 8}
!20 = !{!11, !6, i64 16}
!21 = !{!22, !17, i64 0}
!22 = !{!"", !17, i64 0, !17, i64 4, !17, i64 8, !17, i64 12, !17, i64 16, !17, i64 20, !17, i64 24, !17, i64 28, !17, i64 32, !17, i64 36, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44}
!23 = !{!22, !17, i64 4}
!24 = !{!22, !17, i64 8}
!25 = !{!22, !17, i64 12}
!26 = !{!22, !17, i64 16}
!27 = !{!22, !17, i64 20}
!28 = !{!22, !17, i64 24}
!29 = !{!22, !17, i64 28}
!30 = !{!22, !17, i64 32}
!31 = !{!22, !17, i64 36}
!32 = !{!22, !7, i64 40}
!33 = !{!22, !7, i64 41}
!34 = !{!22, !7, i64 42}
!35 = !{!22, !7, i64 43}
!36 = !{!22, !7, i64 44}
!37 = !{!38, !7, i64 0}
!38 = !{!"", !7, i64 0, !7, i64 1, !39, i64 2, !6, i64 24}
!39 = !{!"", !7, i64 0, !40, i64 1, !40, i64 5, !41, i64 10, !40, i64 12, !41, i64 16, !7, i64 18}
!40 = !{!"", !7, i64 0}
!41 = !{!"short", !7, i64 0}
!42 = !{!38, !7, i64 1}
!43 = !{!38, !6, i64 24}
!44 = !{!39, !41, i64 10}
!45 = !{!39, !41, i64 16}
!46 = !{!39, !7, i64 18}
!47 = !{!48, !6, i64 8}
!48 = !{!"_EFI_TCP4_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!49 = !{!48, !6, i64 16}
!50 = !{!51, !7, i64 0}
!51 = !{!"", !7, i64 0, !7, i64 1, !52, i64 2, !6, i64 40}
!52 = !{!"", !40, i64 0, !41, i64 16, !40, i64 18, !41, i64 34, !7, i64 36}
!53 = !{!51, !7, i64 1}
!54 = !{!51, !6, i64 40}
!55 = !{!52, !41, i64 16}
!56 = !{!52, !41, i64 34}
!57 = !{!52, !7, i64 36}
!58 = !{!59, !6, i64 8}
!59 = !{!"_EFI_TCP6_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!60 = !{!15, !6, i64 80}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.EFI_TCP4_OPTION = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i8, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONFIG_DATA = type { i8, i8, %struct.EFI_TCP4_ACCESS_POINT, ptr }
%struct.EFI_TCP4_ACCESS_POINT = type { i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16, %struct.EFI_IPv4_ADDRESS, i16, i8 }
%struct.EFI_TCP6_CONFIG_DATA = type { i8, i8, %struct.EFI_TCP6_ACCESS_POINT, ptr }
%struct.EFI_TCP6_ACCESS_POINT = type { %struct.EFI_IPv6_ADDRESS, i16, %struct.EFI_IPv6_ADDRESS, i16, i8 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }

@gBS = external local_unnamed_addr global ptr, align 8
@gEfiTcp4ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ServiceBindingProtocolGuid = external global %struct.GUID, align 4
@gEfiTcp6ProtocolGuid = external global %struct.GUID, align 4
@mZeroIp4Addr = external global %struct.EFI_IPv4_ADDRESS, align 1

; Function Attrs: nounwind uwtable
declare dso_local void @TcpIoCommonNotify(ptr noundef, ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @TcpIoCreateSocket(ptr noundef %0, ptr noundef %1, i8 noundef zeroext %2, ptr noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca %struct.EFI_TCP4_OPTION, align 16
  %8 = alloca %struct.EFI_TCP4_CONFIG_DATA, align 8
  %9 = alloca %struct.EFI_TCP6_CONFIG_DATA, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #4
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %8) #4
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %9) #4
  %10 = insertelement <4 x ptr> poison, ptr %0, i64 0
  %11 = insertelement <4 x ptr> %10, ptr %1, i64 1
  %12 = insertelement <4 x ptr> %11, ptr %3, i64 2
  %13 = insertelement <4 x ptr> %12, ptr %4, i64 3
  %14 = icmp eq <4 x ptr> %13, zeroinitializer
  %15 = bitcast <4 x i1> %14 to i4
  %.not = icmp eq i4 %15, 0
  br i1 %.not, label %16, label %155

16:                                               ; preds = %5
  %17 = tail call ptr @ZeroMem(ptr noundef nonnull %4, i64 noundef 168) #4
  %18 = icmp eq i8 %2, 4
  br i1 %18, label %21, label %19

19:                                               ; preds = %16
  %20 = icmp eq i8 %2, 6
  br i1 %20, label %21, label %155

21:                                               ; preds = %19, %16
  %.0103 = phi ptr [ @gEfiTcp4ProtocolGuid, %16 ], [ @gEfiTcp6ProtocolGuid, %19 ]
  %.0101 = phi ptr [ @gEfiTcp4ServiceBindingProtocolGuid, %16 ], [ @gEfiTcp6ServiceBindingProtocolGuid, %19 ]
  %.0102 = getelementptr inbounds i8, ptr %4, i64 32
  store i8 %2, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %4, i64 24
  %23 = tail call i64 @NetLibCreateServiceChild(ptr noundef nonnull %1, ptr noundef nonnull %0, ptr noundef nonnull %.0101, ptr noundef nonnull %22) #4
  %24 = icmp slt i64 %23, 0
  br i1 %24, label %155, label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr @gBS, align 8, !tbaa !10
  %27 = getelementptr inbounds i8, ptr %26, i64 280
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %22, align 8, !tbaa !16
  %30 = tail call i64 %28(ptr noundef %29, ptr noundef nonnull %.0103, ptr noundef nonnull %.0102, ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef 16) #4
  %31 = icmp slt i64 %30, 0
  br i1 %31, label %154, label %32

32:                                               ; preds = %25
  %33 = load ptr, ptr %.0102, align 8, !tbaa !17
  %34 = icmp eq ptr %33, null
  br i1 %34, label %154, label %35

35:                                               ; preds = %32
  %36 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %0, ptr %36, align 8, !tbaa !18
  %37 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr %1, ptr %37, align 8, !tbaa !19
  store <4 x i32> <i32 2097152, i32 2097152, i32 0, i32 0>, ptr %7, align 16, !tbaa !20
  %38 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> <i32 6, i32 0, i32 0, i32 4>, ptr %38, align 16, !tbaa !20
  %39 = getelementptr inbounds i8, ptr %7, i64 32
  %40 = getelementptr inbounds i8, ptr %7, i64 42
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10) %39, i8 0, i64 10, i1 false)
  store i8 1, ptr %40, align 2, !tbaa !21
  %41 = getelementptr inbounds i8, ptr %7, i64 43
  store i8 0, ptr %41, align 1, !tbaa !23
  %42 = getelementptr inbounds i8, ptr %7, i64 44
  store i8 0, ptr %42, align 4, !tbaa !24
  br i1 %18, label %43, label %79

43:                                               ; preds = %35
  store i8 8, ptr %8, align 8, !tbaa !25
  %44 = getelementptr inbounds i8, ptr %8, i64 1
  store i8 -1, ptr %44, align 1, !tbaa !30
  %45 = getelementptr inbounds i8, ptr %8, i64 24
  store ptr %7, ptr %45, align 8, !tbaa !31
  %46 = getelementptr inbounds i8, ptr %8, i64 2
  %47 = call ptr @ZeroMem(ptr noundef nonnull %46, i64 noundef 20) #4
  %48 = getelementptr inbounds i8, ptr %3, i64 12
  %49 = load i16, ptr %48, align 2, !tbaa !17
  %50 = getelementptr inbounds i8, ptr %8, i64 12
  store i16 %49, ptr %50, align 4, !tbaa !32
  %51 = getelementptr inbounds i8, ptr %3, i64 18
  %52 = load i16, ptr %51, align 2, !tbaa !17
  %53 = getelementptr inbounds i8, ptr %8, i64 18
  store i16 %52, ptr %53, align 2, !tbaa !33
  %54 = getelementptr inbounds i8, ptr %3, i64 20
  %55 = load i8, ptr %54, align 2, !tbaa !17
  %56 = getelementptr inbounds i8, ptr %8, i64 20
  store i8 %55, ptr %56, align 4, !tbaa !34
  %57 = getelementptr inbounds i8, ptr %8, i64 3
  %58 = call ptr @CopyMem(ptr noundef nonnull %57, ptr noundef nonnull %3, i64 noundef 4) #4
  %59 = getelementptr inbounds i8, ptr %8, i64 7
  %60 = getelementptr inbounds i8, ptr %3, i64 4
  %61 = call ptr @CopyMem(ptr noundef nonnull %59, ptr noundef nonnull %60, i64 noundef 4) #4
  %62 = getelementptr inbounds i8, ptr %8, i64 14
  %63 = getelementptr inbounds i8, ptr %3, i64 14
  %64 = call ptr @CopyMem(ptr noundef nonnull %62, ptr noundef nonnull %63, i64 noundef 4) #4
  %65 = call zeroext i8 @DebugAssertEnabled() #4
  %66 = getelementptr inbounds i8, ptr %33, i64 8
  %67 = load ptr, ptr %66, align 8, !tbaa !35
  %68 = call i64 %67(ptr noundef nonnull %33, ptr noundef nonnull %8) #4
  %69 = icmp slt i64 %68, 0
  br i1 %69, label %154, label %70

70:                                               ; preds = %43
  %71 = getelementptr inbounds i8, ptr %3, i64 8
  %72 = call i64 @CompareMem(ptr noundef nonnull %71, ptr noundef nonnull @mZeroIp4Addr, i64 noundef 4) #4
  %73 = icmp eq i64 %72, 0
  br i1 %73, label %104, label %74

74:                                               ; preds = %70
  %75 = getelementptr inbounds i8, ptr %33, i64 16
  %76 = load ptr, ptr %75, align 8, !tbaa !37
  %77 = call i64 %76(ptr noundef nonnull %33, i8 noundef zeroext 0, ptr noundef nonnull @mZeroIp4Addr, ptr noundef nonnull @mZeroIp4Addr, ptr noundef nonnull %71) #4
  %78 = icmp slt i64 %77, 0
  br i1 %78, label %154, label %104

79:                                               ; preds = %35
  store i8 0, ptr %9, align 8, !tbaa !38
  %80 = getelementptr inbounds i8, ptr %9, i64 1
  store i8 -1, ptr %80, align 1, !tbaa !41
  %81 = getelementptr inbounds i8, ptr %9, i64 40
  store ptr %7, ptr %81, align 8, !tbaa !42
  %82 = getelementptr inbounds i8, ptr %9, i64 2
  %83 = call ptr @ZeroMem(ptr noundef nonnull %82, i64 noundef 38) #4
  %84 = load i16, ptr %3, align 2, !tbaa !17
  %85 = getelementptr inbounds i8, ptr %9, i64 18
  store i16 %84, ptr %85, align 2, !tbaa !43
  %86 = getelementptr inbounds i8, ptr %3, i64 18
  %87 = load i16, ptr %86, align 2, !tbaa !17
  %88 = getelementptr inbounds i8, ptr %9, i64 36
  store i16 %87, ptr %88, align 4, !tbaa !44
  %89 = getelementptr inbounds i8, ptr %3, i64 20
  %90 = load i8, ptr %89, align 2, !tbaa !17
  %91 = getelementptr inbounds i8, ptr %9, i64 38
  store i8 %90, ptr %91, align 2, !tbaa !45
  %92 = getelementptr inbounds i8, ptr %9, i64 20
  %93 = getelementptr inbounds i8, ptr %3, i64 2
  %94 = call ptr @CopyMem(ptr noundef nonnull %92, ptr noundef nonnull %93, i64 noundef 16) #4
  %95 = call zeroext i8 @DebugAssertEnabled() #4
  %96 = getelementptr inbounds i8, ptr %33, i64 8
  %97 = load ptr, ptr %96, align 8, !tbaa !46
  %98 = call i64 %97(ptr noundef nonnull %33, ptr noundef nonnull %9) #4
  %99 = icmp eq i64 %98, -9223372036854775791
  br i1 %99, label %100, label %102

100:                                              ; preds = %79
  %101 = call i64 @TcpIoGetMapping(ptr noundef nonnull %33, ptr noundef nonnull %9)
  br label %102

102:                                              ; preds = %100, %79
  %.099 = phi i64 [ %101, %100 ], [ %98, %79 ]
  %103 = icmp slt i64 %.099, 0
  br i1 %103, label %154, label %104

104:                                              ; preds = %102, %70, %74
  %105 = load ptr, ptr @gBS, align 8, !tbaa !10
  %106 = getelementptr inbounds i8, ptr %105, i64 80
  %107 = load ptr, ptr %106, align 8, !tbaa !48
  %108 = getelementptr inbounds i8, ptr %4, i64 160
  %109 = call i64 %107(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @TcpIoCommonNotify, ptr noundef nonnull %108, ptr noundef nonnull %6) #4
  %110 = icmp slt i64 %109, 0
  br i1 %110, label %154, label %111

111:                                              ; preds = %104
  %112 = load ptr, ptr %6, align 8, !tbaa !10
  %113 = getelementptr inbounds i8, ptr %4, i64 48
  store ptr %112, ptr %113, align 8, !tbaa !17
  %114 = load ptr, ptr @gBS, align 8, !tbaa !10
  %115 = getelementptr inbounds i8, ptr %114, i64 80
  %116 = load ptr, ptr %115, align 8, !tbaa !48
  %117 = getelementptr inbounds i8, ptr %4, i64 164
  %118 = call i64 %116(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @TcpIoCommonNotify, ptr noundef nonnull %117, ptr noundef nonnull %6) #4
  %119 = icmp slt i64 %118, 0
  br i1 %119, label %154, label %120

120:                                              ; preds = %111
  %121 = load ptr, ptr %6, align 8, !tbaa !10
  %122 = getelementptr inbounds i8, ptr %4, i64 136
  store ptr %121, ptr %122, align 8, !tbaa !17
  %123 = load ptr, ptr @gBS, align 8, !tbaa !10
  %124 = getelementptr inbounds i8, ptr %123, i64 80
  %125 = load ptr, ptr %124, align 8, !tbaa !48
  %126 = getelementptr inbounds i8, ptr %4, i64 161
  %127 = call i64 %125(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @TcpIoCommonNotify, ptr noundef nonnull %126, ptr noundef nonnull %6) #4
  %128 = icmp slt i64 %127, 0
  br i1 %128, label %154, label %129

129:                                              ; preds = %120
  %130 = load ptr, ptr %6, align 8, !tbaa !10
  %131 = getelementptr inbounds i8, ptr %4, i64 64
  store ptr %130, ptr %131, align 8, !tbaa !17
  %132 = load ptr, ptr @gBS, align 8, !tbaa !10
  %133 = getelementptr inbounds i8, ptr %132, i64 80
  %134 = load ptr, ptr %133, align 8, !tbaa !48
  %135 = getelementptr inbounds i8, ptr %4, i64 162
  %136 = call i64 %134(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @TcpIoCommonNotify, ptr noundef nonnull %135, ptr noundef nonnull %6) #4
  %137 = icmp slt i64 %136, 0
  br i1 %137, label %154, label %138

138:                                              ; preds = %129
  %139 = load ptr, ptr %6, align 8, !tbaa !10
  %140 = getelementptr inbounds i8, ptr %4, i64 88
  store ptr %139, ptr %140, align 8, !tbaa !17
  %141 = call ptr @AllocateZeroPool(i64 noundef 32) #4
  %142 = icmp eq ptr %141, null
  br i1 %142, label %154, label %143

143:                                              ; preds = %138
  %144 = getelementptr inbounds i8, ptr %4, i64 104
  store ptr %141, ptr %144, align 8, !tbaa !17
  %145 = load ptr, ptr @gBS, align 8, !tbaa !10
  %146 = getelementptr inbounds i8, ptr %145, i64 80
  %147 = load ptr, ptr %146, align 8, !tbaa !48
  %148 = getelementptr inbounds i8, ptr %4, i64 163
  %149 = call i64 %147(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @TcpIoCommonNotify, ptr noundef nonnull %148, ptr noundef nonnull %6) #4
  %150 = icmp slt i64 %149, 0
  br i1 %150, label %154, label %151

151:                                              ; preds = %143
  %152 = load ptr, ptr %6, align 8, !tbaa !10
  %153 = getelementptr inbounds i8, ptr %4, i64 112
  store ptr %152, ptr %153, align 8, !tbaa !17
  br label %155

154:                                              ; preds = %138, %143, %129, %120, %111, %104, %102, %74, %43, %25, %32
  %.1 = phi i64 [ %30, %25 ], [ %30, %32 ], [ %68, %43 ], [ %109, %104 ], [ %118, %111 ], [ %127, %120 ], [ %136, %129 ], [ %149, %143 ], [ %77, %74 ], [ %.099, %102 ], [ -9223372036854775799, %138 ]
  call void @TcpIoDestroySocket(ptr noundef nonnull %4)
  br label %155

155:                                              ; preds = %21, %19, %5, %154, %151
  %.0 = phi i64 [ %.1, %154 ], [ 0, %151 ], [ -9223372036854775806, %5 ], [ -9223372036854775805, %19 ], [ %23, %21 ]
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %9) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret i64 %.0
}

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

declare i64 @NetLibCreateServiceChild(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #2

declare i64 @CompareMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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 0}
!6 = !{!"", !7, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 64, !7, i64 88, !7, i64 112, !7, i64 136, !7, i64 160, !7, i64 161, !7, i64 162, !7, i64 163, !7, i64 164}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"any pointer", !7, i64 0}
!10 = !{!9, !9, i64 0}
!11 = !{!12, !9, i64 280}
!12 = !{!"", !13, i64 0, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72, !9, i64 80, !9, i64 88, !9, i64 96, !9, i64 104, !9, i64 112, !9, i64 120, !9, i64 128, !9, i64 136, !9, i64 144, !9, i64 152, !9, i64 160, !9, i64 168, !9, i64 176, !9, i64 184, !9, i64 192, !9, i64 200, !9, i64 208, !9, i64 216, !9, i64 224, !9, i64 232, !9, i64 240, !9, i64 248, !9, i64 256, !9, i64 264, !9, i64 272, !9, i64 280, !9, i64 288, !9, i64 296, !9, i64 304, !9, i64 312, !9, i64 320, !9, i64 328, !9, i64 336, !9, i64 344, !9, i64 352, !9, i64 360, !9, i64 368}
!13 = !{!"", !14, i64 0, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20}
!14 = !{!"long long", !7, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!6, !9, i64 24}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !9, i64 8}
!19 = !{!6, !9, i64 16}
!20 = !{!15, !15, i64 0}
!21 = !{!22, !7, i64 42}
!22 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8, !15, i64 12, !15, i64 16, !15, i64 20, !15, i64 24, !15, i64 28, !15, i64 32, !15, i64 36, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44}
!23 = !{!22, !7, i64 43}
!24 = !{!22, !7, i64 44}
!25 = !{!26, !7, i64 0}
!26 = !{!"", !7, i64 0, !7, i64 1, !27, i64 2, !9, i64 24}
!27 = !{!"", !7, i64 0, !28, i64 1, !28, i64 5, !29, i64 10, !28, i64 12, !29, i64 16, !7, i64 18}
!28 = !{!"", !7, i64 0}
!29 = !{!"short", !7, i64 0}
!30 = !{!26, !7, i64 1}
!31 = !{!26, !9, i64 24}
!32 = !{!27, !29, i64 10}
!33 = !{!27, !29, i64 16}
!34 = !{!27, !7, i64 18}
!35 = !{!36, !9, i64 8}
!36 = !{!"_EFI_TCP4_PROTOCOL", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64, !9, i64 72}
!37 = !{!36, !9, i64 16}
!38 = !{!39, !7, i64 0}
!39 = !{!"", !7, i64 0, !7, i64 1, !40, i64 2, !9, i64 40}
!40 = !{!"", !28, i64 0, !29, i64 16, !28, i64 18, !29, i64 34, !7, i64 36}
!41 = !{!39, !7, i64 1}
!42 = !{!39, !9, i64 40}
!43 = !{!40, !29, i64 16}
!44 = !{!40, !29, i64 34}
!45 = !{!40, !7, i64 36}
!46 = !{!47, !9, i64 8}
!47 = !{!"_EFI_TCP6_PROTOCOL", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !9, i64 32, !9, i64 40, !9, i64 48, !9, i64 56, !9, i64 64}
!48 = !{!12, !9, i64 80}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalDCEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass