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

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

%struct.GUID = type { i32, i16, i16, [8 x i8] }
%struct.TCP_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._EFI_TCP4_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct._EFI_TCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TCP6_LISTEN_TOKEN = type { %struct.EFI_TCP6_COMPLETION_TOKEN, ptr }
%struct.EFI_TCP6_COMPLETION_TOKEN = type { ptr, i64 }

@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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @TcpIoDestroySocket(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 1, 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
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %1
  store i32 1, ptr %10, align 4
  br label %230

14:                                               ; preds = %1
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.TCP_IO, ptr %15, i32 0, i32 0
  %17 = load i8, ptr %16, align 8, !tbaa !9
  store i8 %17, ptr %6, align 1, !tbaa !11
  %18 = load i8, ptr %6, align 1, !tbaa !11
  %19 = zext i8 %18 to i32
  %20 = icmp ne i32 %19, 4
  br i1 %20, label %21, label %26

21:                                               ; preds = %14
  %22 = load i8, ptr %6, align 1, !tbaa !11
  %23 = zext i8 %22 to i32
  %24 = icmp ne i32 %23, 6
  br i1 %24, label %25, label %26

25:                                               ; preds = %21
  store i32 1, ptr %10, align 4
  br label %230

26:                                               ; preds = %21, %14
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.TCP_IO, ptr %27, i32 0, i32 6
  %29 = getelementptr inbounds %struct.EFI_TCP4_CONNECTION_TOKEN, ptr %28, i32 0, i32 0
  %30 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !11
  store ptr %31, ptr %3, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %40

34:                                               ; preds = %26
  %35 = load ptr, ptr @gBS, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %35, i32 0, i32 12
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = call i64 %37(ptr noundef %38)
  br label %40

40:                                               ; preds = %34, %26
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.TCP_IO, ptr %41, i32 0, i32 10
  %43 = getelementptr inbounds %struct.EFI_TCP4_LISTEN_TOKEN, ptr %42, i32 0, i32 0
  %44 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !11
  store ptr %45, ptr %3, align 8, !tbaa !5
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %54

48:                                               ; preds = %40
  %49 = load ptr, ptr @gBS, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %49, i32 0, i32 12
  %51 = load ptr, ptr %50, align 8, !tbaa !12
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = call i64 %51(ptr noundef %52)
  br label %54

54:                                               ; preds = %48, %40
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.TCP_IO, ptr %55, i32 0, i32 7
  %57 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !11
  store ptr %59, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %68

62:                                               ; preds = %54
  %63 = load ptr, ptr @gBS, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %63, i32 0, i32 12
  %65 = load ptr, ptr %64, align 8, !tbaa !12
  %66 = load ptr, ptr %3, align 8, !tbaa !5
  %67 = call i64 %65(ptr noundef %66)
  br label %68

68:                                               ; preds = %62, %54
  %69 = load ptr, ptr %2, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.TCP_IO, ptr %69, i32 0, i32 8
  %71 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !11
  store ptr %73, ptr %3, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %82

76:                                               ; preds = %68
  %77 = load ptr, ptr @gBS, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %77, i32 0, i32 12
  %79 = load ptr, ptr %78, align 8, !tbaa !12
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = call i64 %79(ptr noundef %80)
  br label %82

82:                                               ; preds = %76, %68
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.TCP_IO, ptr %83, i32 0, i32 9
  %85 = getelementptr inbounds %struct.EFI_TCP4_CLOSE_TOKEN, ptr %84, i32 0, i32 0
  %86 = getelementptr inbounds %struct.EFI_TCP4_COMPLETION_TOKEN, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !11
  store ptr %87, ptr %3, align 8, !tbaa !5
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %90, label %96

90:                                               ; preds = %82
  %91 = load ptr, ptr @gBS, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %91, i32 0, i32 12
  %93 = load ptr, ptr %92, align 8, !tbaa !12
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = call i64 %93(ptr noundef %94)
  br label %96

96:                                               ; preds = %90, %82
  %97 = load ptr, ptr %2, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.TCP_IO, ptr %97, i32 0, i32 8
  %99 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !11
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %107

102:                                              ; preds = %96
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.TCP_IO, ptr %103, i32 0, i32 8
  %105 = getelementptr inbounds %struct.EFI_TCP4_IO_TOKEN, ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !11
  call void @FreePool(ptr noundef %106)
  br label %107

107:                                              ; preds = %102, %96
  store ptr null, ptr %4, align 8, !tbaa !5
  store ptr null, ptr %5, align 8, !tbaa !5
  %108 = load i8, ptr %6, align 1, !tbaa !11
  %109 = zext i8 %108 to i32
  %110 = icmp eq i32 %109, 4
  br i1 %110, label %111, label %124

111:                                              ; preds = %107
  store ptr @gEfiTcp4ServiceBindingProtocolGuid, ptr %7, align 8, !tbaa !5
  store ptr @gEfiTcp4ProtocolGuid, ptr %8, align 8, !tbaa !5
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.TCP_IO, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !11
  store ptr %114, ptr %4, align 8, !tbaa !5
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = icmp ne ptr %115, null
  br i1 %116, label %117, label %123

117:                                              ; preds = %111
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._EFI_TCP4_PROTOCOL, ptr %118, i32 0, i32 1
  %120 = load ptr, ptr %119, align 8, !tbaa !17
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = call i64 %120(ptr noundef %121, ptr noundef null)
  br label %123

123:                                              ; preds = %117, %111
  br label %137

124:                                              ; preds = %107
  store ptr @gEfiTcp6ServiceBindingProtocolGuid, ptr %7, align 8, !tbaa !5
  store ptr @gEfiTcp6ProtocolGuid, ptr %8, align 8, !tbaa !5
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.TCP_IO, ptr %125, i32 0, i32 4
  %127 = load ptr, ptr %126, align 8, !tbaa !11
  store ptr %127, ptr %5, align 8, !tbaa !5
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = icmp ne ptr %128, null
  br i1 %129, label %130, label %136

130:                                              ; preds = %124
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._EFI_TCP6_PROTOCOL, ptr %131, i32 0, i32 1
  %133 = load ptr, ptr %132, align 8, !tbaa !19
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = call i64 %133(ptr noundef %134, ptr noundef null)
  br label %136

136:                                              ; preds = %130, %124
  br label %137

137:                                              ; preds = %136, %123
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = icmp ne ptr %138, null
  br i1 %139, label %143, label %140

140:                                              ; preds = %137
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %158

143:                                              ; preds = %140, %137
  %144 = load ptr, ptr @gBS, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %144, i32 0, i32 34
  %146 = load ptr, ptr %145, align 8, !tbaa !21
  %147 = load ptr, ptr %2, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.TCP_IO, ptr %147, i32 0, i32 3
  %149 = load ptr, ptr %148, align 8, !tbaa !22
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = load ptr, ptr %2, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.TCP_IO, ptr %151, i32 0, i32 1
  %153 = load ptr, ptr %152, align 8, !tbaa !23
  %154 = load ptr, ptr %2, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.TCP_IO, ptr %154, i32 0, i32 2
  %156 = load ptr, ptr %155, align 8, !tbaa !24
  %157 = call i64 %146(ptr noundef %149, ptr noundef %150, ptr noundef %153, ptr noundef %156)
  br label %158

158:                                              ; preds = %143, %140
  store ptr null, ptr %9, align 8, !tbaa !5
  %159 = load ptr, ptr %2, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.TCP_IO, ptr %159, i32 0, i32 15
  %161 = load i8, ptr %160, align 4, !tbaa !25
  %162 = icmp ne i8 %161, 0
  br i1 %162, label %163, label %218

163:                                              ; preds = %158
  %164 = load i8, ptr %6, align 1, !tbaa !11
  %165 = zext i8 %164 to i32
  %166 = icmp eq i32 %165, 4
  br i1 %166, label %167, label %184

167:                                              ; preds = %163
  %168 = load ptr, ptr %2, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.TCP_IO, ptr %168, i32 0, i32 5
  %170 = load ptr, ptr %169, align 8, !tbaa !11
  store ptr %170, ptr %4, align 8, !tbaa !5
  %171 = load ptr, ptr %4, align 8, !tbaa !5
  %172 = icmp ne ptr %171, null
  br i1 %172, label %173, label %183

173:                                              ; preds = %167
  %174 = load ptr, ptr %4, 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 !17
  %177 = load ptr, ptr %4, align 8, !tbaa !5
  %178 = call i64 %176(ptr noundef %177, ptr noundef null)
  %179 = load ptr, ptr %2, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.TCP_IO, ptr %179, i32 0, i32 10
  %181 = getelementptr inbounds %struct.EFI_TCP4_LISTEN_TOKEN, ptr %180, i32 0, i32 1
  %182 = load ptr, ptr %181, align 8, !tbaa !11
  store ptr %182, ptr %9, align 8, !tbaa !5
  br label %183

183:                                              ; preds = %173, %167
  br label %201

184:                                              ; preds = %163
  %185 = load ptr, ptr %2, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.TCP_IO, ptr %185, i32 0, i32 5
  %187 = load ptr, ptr %186, align 8, !tbaa !11
  store ptr %187, ptr %5, align 8, !tbaa !5
  %188 = load ptr, ptr %5, align 8, !tbaa !5
  %189 = icmp ne ptr %188, null
  br i1 %189, label %190, label %200

190:                                              ; preds = %184
  %191 = load ptr, ptr %5, align 8, !tbaa !5
  %192 = getelementptr inbounds %struct._EFI_TCP6_PROTOCOL, ptr %191, i32 0, i32 1
  %193 = load ptr, ptr %192, align 8, !tbaa !19
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = call i64 %193(ptr noundef %194, ptr noundef null)
  %196 = load ptr, ptr %2, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.TCP_IO, ptr %196, i32 0, i32 10
  %198 = getelementptr inbounds %struct.EFI_TCP6_LISTEN_TOKEN, ptr %197, i32 0, i32 1
  %199 = load ptr, ptr %198, align 8, !tbaa !11
  store ptr %199, ptr %9, align 8, !tbaa !5
  br label %200

200:                                              ; preds = %190, %184
  br label %201

201:                                              ; preds = %200, %183
  %202 = load ptr, ptr %9, align 8, !tbaa !5
  %203 = icmp ne ptr %202, null
  br i1 %203, label %204, label %217

204:                                              ; preds = %201
  %205 = load ptr, ptr @gBS, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %205, i32 0, i32 34
  %207 = load ptr, ptr %206, align 8, !tbaa !21
  %208 = load ptr, ptr %9, align 8, !tbaa !5
  %209 = load ptr, ptr %8, align 8, !tbaa !5
  %210 = load ptr, ptr %2, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.TCP_IO, ptr %210, i32 0, i32 1
  %212 = load ptr, ptr %211, align 8, !tbaa !23
  %213 = load ptr, ptr %2, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.TCP_IO, ptr %213, i32 0, i32 2
  %215 = load ptr, ptr %214, align 8, !tbaa !24
  %216 = call i64 %207(ptr noundef %208, ptr noundef %209, ptr noundef %212, ptr noundef %215)
  br label %217

217:                                              ; preds = %204, %201
  br label %218

218:                                              ; preds = %217, %158
  %219 = load ptr, ptr %2, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.TCP_IO, ptr %219, i32 0, i32 2
  %221 = load ptr, ptr %220, align 8, !tbaa !24
  %222 = load ptr, ptr %2, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct.TCP_IO, ptr %222, i32 0, i32 1
  %224 = load ptr, ptr %223, align 8, !tbaa !23
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = load ptr, ptr %2, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.TCP_IO, ptr %226, i32 0, i32 3
  %228 = load ptr, ptr %227, align 8, !tbaa !22
  %229 = call i64 @NetLibDestroyServiceChild(ptr noundef %221, ptr noundef %224, ptr noundef %225, ptr noundef %228)
  store i32 0, ptr %10, align 4
  br label %230

230:                                              ; preds = %218, %25, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 1, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  %231 = load i32, ptr %10, align 4
  switch i32 %231, label %233 [
    i32 0, label %232
    i32 1, label %232
  ]

232:                                              ; preds = %230, %230
  ret void

233:                                              ; preds = %230
  unreachable
}

declare void @FreePool(ptr noundef) #2

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"", !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}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !6, i64 112}
!13 = !{!"", !14, 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}
!14 = !{!"", !15, i64 0, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!18, !6, i64 8}
!18 = !{!"_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}
!19 = !{!20, !6, i64 8}
!20 = !{!"_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}
!21 = !{!13, !6, i64 288}
!22 = !{!10, !6, i64 24}
!23 = !{!10, !6, i64 8}
!24 = !{!10, !6, i64 16}
!25 = !{!10, !7, i64 164}


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

@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

; Function Attrs: nounwind uwtable
define dso_local void @TcpIoDestroySocket(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %101, label %3

3:                                                ; preds = %1
  %4 = load i8, ptr %0, align 8, !tbaa !5
  %5 = and i8 %4, -3
  %or.cond.not = icmp eq i8 %5, 4
  br i1 %or.cond.not, label %6, label %101

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 48
  %8 = load ptr, ptr %7, align 8, !tbaa !10
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %14, label %9

9:                                                ; preds = %6
  %10 = load ptr, ptr @gBS, align 8, !tbaa !11
  %11 = getelementptr inbounds i8, ptr %10, i64 112
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = tail call i64 %12(ptr noundef nonnull %8) #2
  br label %14

14:                                               ; preds = %9, %6
  %15 = getelementptr inbounds i8, ptr %0, i64 136
  %16 = load ptr, ptr %15, align 8, !tbaa !10
  %.not76 = icmp eq ptr %16, null
  br i1 %.not76, label %22, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr @gBS, align 8, !tbaa !11
  %19 = getelementptr inbounds i8, ptr %18, i64 112
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  %21 = tail call i64 %20(ptr noundef nonnull %16) #2
  br label %22

22:                                               ; preds = %17, %14
  %23 = getelementptr inbounds i8, ptr %0, i64 64
  %24 = load ptr, ptr %23, align 8, !tbaa !10
  %.not77 = icmp eq ptr %24, null
  br i1 %.not77, label %30, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr @gBS, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %26, i64 112
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %29 = tail call i64 %28(ptr noundef nonnull %24) #2
  br label %30

30:                                               ; preds = %25, %22
  %31 = getelementptr inbounds i8, ptr %0, i64 88
  %32 = load ptr, ptr %31, align 8, !tbaa !10
  %.not78 = icmp eq ptr %32, null
  br i1 %.not78, label %38, label %33

33:                                               ; preds = %30
  %34 = load ptr, ptr @gBS, align 8, !tbaa !11
  %35 = getelementptr inbounds i8, ptr %34, i64 112
  %36 = load ptr, ptr %35, align 8, !tbaa !12
  %37 = tail call i64 %36(ptr noundef nonnull %32) #2
  br label %38

38:                                               ; preds = %33, %30
  %39 = getelementptr inbounds i8, ptr %0, i64 112
  %40 = load ptr, ptr %39, align 8, !tbaa !10
  %.not79 = icmp eq ptr %40, null
  br i1 %.not79, label %46, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr @gBS, align 8, !tbaa !11
  %43 = getelementptr inbounds i8, ptr %42, i64 112
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %45 = tail call i64 %44(ptr noundef nonnull %40) #2
  br label %46

46:                                               ; preds = %41, %38
  %47 = getelementptr inbounds i8, ptr %0, i64 104
  %48 = load ptr, ptr %47, align 8, !tbaa !10
  %.not80 = icmp eq ptr %48, null
  br i1 %.not80, label %50, label %49

49:                                               ; preds = %46
  tail call void @FreePool(ptr noundef nonnull %48) #2
  br label %50

50:                                               ; preds = %49, %46
  %51 = icmp eq i8 %4, 4
  %52 = getelementptr inbounds i8, ptr %0, i64 32
  %53 = load ptr, ptr %52, align 8, !tbaa !10
  %.not82 = icmp eq ptr %53, null
  br i1 %51, label %54, label %55

54:                                               ; preds = %50
  br i1 %.not82, label %.thread108, label %56

55:                                               ; preds = %50
  br i1 %.not82, label %.thread94, label %56

56:                                               ; preds = %55, %54
  %.061.ph = phi ptr [ @gEfiTcp4ServiceBindingProtocolGuid, %54 ], [ @gEfiTcp6ServiceBindingProtocolGuid, %55 ]
  %.060.ph = phi ptr [ @gEfiTcp4ProtocolGuid, %54 ], [ @gEfiTcp6ProtocolGuid, %55 ]
  %57 = getelementptr inbounds i8, ptr %53, i64 8
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = tail call i64 %58(ptr noundef nonnull %53, ptr noundef null) #2
  %60 = load ptr, ptr @gBS, align 8, !tbaa !11
  %61 = getelementptr inbounds i8, ptr %60, i64 288
  %62 = load ptr, ptr %61, align 8, !tbaa !17
  %63 = getelementptr inbounds i8, ptr %0, i64 24
  %64 = load ptr, ptr %63, align 8, !tbaa !18
  %65 = getelementptr inbounds i8, ptr %0, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !19
  %67 = getelementptr inbounds i8, ptr %0, i64 16
  %68 = load ptr, ptr %67, align 8, !tbaa !20
  %69 = tail call i64 %62(ptr noundef %64, ptr noundef nonnull %.060.ph, ptr noundef %66, ptr noundef %68) #2
  %70 = getelementptr inbounds i8, ptr %0, i64 164
  %71 = load i8, ptr %70, align 4, !tbaa !21
  %.not83 = icmp eq i8 %71, 0
  br i1 %.not83, label %.thread118, label %76

.thread108:                                       ; preds = %54
  %72 = getelementptr inbounds i8, ptr %0, i64 164
  %73 = load i8, ptr %72, align 4, !tbaa !21
  %.not83111 = icmp eq i8 %73, 0
  br i1 %.not83111, label %.thread118, label %.thread112

.thread94:                                        ; preds = %55
  %74 = getelementptr inbounds i8, ptr %0, i64 164
  %75 = load i8, ptr %74, align 4, !tbaa !21
  %.not8397 = icmp eq i8 %75, 0
  br i1 %.not8397, label %.thread118, label %.thread101

76:                                               ; preds = %56
  br i1 %51, label %.thread112, label %.thread101

.thread112:                                       ; preds = %.thread108, %76
  %.0609398116 = phi ptr [ %.060.ph, %76 ], [ @gEfiTcp4ProtocolGuid, %.thread108 ]
  %.0619099115 = phi ptr [ %.061.ph, %76 ], [ @gEfiTcp4ServiceBindingProtocolGuid, %.thread108 ]
  %77 = getelementptr inbounds i8, ptr %0, i64 40
  %78 = load ptr, ptr %77, align 8, !tbaa !10
  %.not85 = icmp eq ptr %78, null
  br i1 %.not85, label %.thread118, label %81

.thread101:                                       ; preds = %.thread94, %76
  %.0609398107 = phi ptr [ %.060.ph, %76 ], [ @gEfiTcp6ProtocolGuid, %.thread94 ]
  %.0619099105 = phi ptr [ %.061.ph, %76 ], [ @gEfiTcp6ServiceBindingProtocolGuid, %.thread94 ]
  %79 = getelementptr inbounds i8, ptr %0, i64 40
  %80 = load ptr, ptr %79, align 8, !tbaa !10
  %.not84 = icmp eq ptr %80, null
  br i1 %.not84, label %.thread118, label %81

81:                                               ; preds = %.thread101, %.thread112
  %.sink126 = phi ptr [ %78, %.thread112 ], [ %80, %.thread101 ]
  %.0609398106 = phi ptr [ %.0609398116, %.thread112 ], [ %.0609398107, %.thread101 ]
  %.0619099104 = phi ptr [ %.0619099115, %.thread112 ], [ %.0619099105, %.thread101 ]
  %82 = getelementptr inbounds i8, ptr %.sink126, i64 8
  %83 = load ptr, ptr %82, align 8, !tbaa !11
  %84 = tail call i64 %83(ptr noundef nonnull %.sink126, ptr noundef null) #2
  %.0.in = getelementptr inbounds i8, ptr %0, i64 152
  %.0 = load ptr, ptr %.0.in, align 8, !tbaa !10
  %.not86 = icmp eq ptr %.0, null
  br i1 %.not86, label %.thread118, label %85

85:                                               ; preds = %81
  %86 = load ptr, ptr @gBS, align 8, !tbaa !11
  %87 = getelementptr inbounds i8, ptr %86, i64 288
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = getelementptr inbounds i8, ptr %0, i64 8
  %90 = load ptr, ptr %89, align 8, !tbaa !19
  %91 = getelementptr inbounds i8, ptr %0, i64 16
  %92 = load ptr, ptr %91, align 8, !tbaa !20
  %93 = tail call i64 %88(ptr noundef nonnull %.0, ptr noundef nonnull %.0609398106, ptr noundef %90, ptr noundef %92) #2
  br label %.thread118

.thread118:                                       ; preds = %.thread101, %.thread112, %.thread108, %.thread94, %81, %85, %56
  %.06190100 = phi ptr [ @gEfiTcp6ServiceBindingProtocolGuid, %.thread94 ], [ %.0619099104, %81 ], [ %.0619099104, %85 ], [ %.061.ph, %56 ], [ @gEfiTcp4ServiceBindingProtocolGuid, %.thread108 ], [ %.0619099105, %.thread101 ], [ %.0619099115, %.thread112 ]
  %94 = getelementptr inbounds i8, ptr %0, i64 16
  %95 = load ptr, ptr %94, align 8, !tbaa !20
  %96 = getelementptr inbounds i8, ptr %0, i64 8
  %97 = load ptr, ptr %96, align 8, !tbaa !19
  %98 = getelementptr inbounds i8, ptr %0, i64 24
  %99 = load ptr, ptr %98, align 8, !tbaa !18
  %100 = tail call i64 @NetLibDestroyServiceChild(ptr noundef %95, ptr noundef %97, ptr noundef nonnull %.06190100, ptr noundef %99) #2
  br label %101

101:                                              ; preds = %3, %1, %.thread118
  ret void
}

declare void @FreePool(ptr noundef) local_unnamed_addr #1

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 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 = !{!7, !7, i64 0}
!11 = !{!9, !9, i64 0}
!12 = !{!13, !9, i64 112}
!13 = !{!"", !14, 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}
!14 = !{!"", !15, i64 0, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!13, !9, i64 288}
!18 = !{!6, !9, i64 24}
!19 = !{!6, !9, i64 8}
!20 = !{!6, !9, i64 16}
!21 = !{!6, !7, i64 164}


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