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

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

%union.IP_IO_IP_PROTOCOL = type { ptr }
%struct._IP_IO = type { %struct._LIST_ENTRY, %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, i8, i8, %union.IP_IO_IP_COMPLETION_TOKEN, %struct._LIST_ENTRY, ptr, ptr, ptr, ptr, i8 }
%union.IP_IO_IP_COMPLETION_TOKEN = type { %struct.EFI_IP4_COMPLETION_TOKEN }
%struct.EFI_IP4_COMPLETION_TOKEN = type { ptr, i64, %union.anon }
%union.anon = type { ptr }
%struct._LIST_ENTRY = type { 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 }
%struct.NET_BUF = type { i32, i64, %struct._LIST_ENTRY, %union.NET_IP_HEAD, ptr, ptr, [64 x i8], ptr, i32, i32, [1 x %struct.NET_BLOCK_OP] }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct.EFI_IP4_TRANSMIT_DATA = type { %struct.EFI_IPv4_ADDRESS, ptr, i32, ptr, i32, i32, [1 x %struct.EFI_IP4_FRAGMENT_DATA] }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct.EFI_IP4_FRAGMENT_DATA = type { i32, ptr }
%struct._EFI_IP6_TRANSMIT_DATA = type { %struct.EFI_IPv6_ADDRESS, ptr, i32, ptr, i8, i32, i32, [1 x %struct._EFI_IP6_FRAGMENT_DATA] }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct._EFI_IP6_FRAGMENT_DATA = type { i32, ptr }
%struct._IP_IO_SEND_ENTRY = type { %struct._LIST_ENTRY, ptr, ptr, ptr, %union.IP_IO_IP_PROTOCOL, ptr, %union.IP_IO_IP_COMPLETION_TOKEN }
%struct.EFI_IP6_COMPLETION_TOKEN = type { ptr, i64, %union.anon.0 }
%union.anon.0 = type { ptr }

@gBS = external global ptr, align 8

; 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 ptr @IpIoCreateSndEntry(ptr noundef %0, ptr noundef %1, ptr %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #1 {
  %8 = alloca ptr, align 8
  %9 = alloca %union.IP_IO_IP_PROTOCOL, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = getelementptr inbounds %union.IP_IO_IP_PROTOCOL, ptr %9, i32 0, i32 0
  store ptr %2, ptr %26, align 8
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %3, ptr %12, align 8, !tbaa !5
  store ptr %4, ptr %13, align 8, !tbaa !5
  store ptr %5, ptr %14, align 8, !tbaa !5
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #4
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._IP_IO, ptr %27, i32 0, i32 14
  %29 = load i8, ptr %28, align 8, !tbaa !9
  %30 = zext i8 %29 to i32
  %31 = icmp ne i32 %30, 4
  br i1 %31, label %32, label %39

32:                                               ; preds = %7
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._IP_IO, ptr %33, i32 0, i32 14
  %35 = load i8, ptr %34, align 8, !tbaa !9
  %36 = zext i8 %35 to i32
  %37 = icmp ne i32 %36, 6
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  store ptr null, ptr %8, align 8
  store i32 1, ptr %25, align 4
  br label %215

39:                                               ; preds = %32, %7
  store ptr null, ptr %17, align 8, !tbaa !5
  store ptr null, ptr %22, align 8, !tbaa !5
  store ptr null, ptr %21, align 8, !tbaa !5
  %40 = call ptr @AllocatePool(i64 noundef 80)
  store ptr %40, ptr %16, align 8, !tbaa !5
  %41 = load ptr, ptr %16, align 8, !tbaa !5
  %42 = icmp eq ptr null, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %39
  store ptr null, ptr %8, align 8
  store i32 1, ptr %25, align 4
  br label %215

44:                                               ; preds = %39
  %45 = load ptr, ptr @gBS, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %45, i32 0, i32 8
  %47 = load ptr, ptr %46, align 8, !tbaa !12
  %48 = load ptr, ptr %16, align 8, !tbaa !5
  %49 = call i64 %47(i32 noundef 512, i64 noundef 16, ptr noundef @IpIoTransmitHandler, ptr noundef %48, ptr noundef %17)
  store i64 %49, ptr %18, align 8, !tbaa !17
  %50 = load i64, ptr %18, align 8, !tbaa !17
  %51 = icmp slt i64 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %44
  br label %190

53:                                               ; preds = %44
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.NET_BUF, ptr %54, i32 0, i32 8
  %56 = load i32, ptr %55, align 8, !tbaa !18
  store i32 %56, ptr %20, align 4, !tbaa !20
  %57 = load i32, ptr %20, align 4, !tbaa !20
  %58 = sub i32 %57, 1
  %59 = zext i32 %58 to i64
  %60 = mul i64 16, %59
  %61 = add i64 72, %60
  %62 = call ptr @AllocatePool(i64 noundef %61)
  store ptr %62, ptr %22, align 8, !tbaa !5
  %63 = load ptr, ptr %22, align 8, !tbaa !5
  %64 = icmp eq ptr null, %63
  br i1 %64, label %65, label %66

65:                                               ; preds = %53
  br label %190

66:                                               ; preds = %53
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct._IP_IO, ptr %67, i32 0, i32 14
  %69 = load i8, ptr %68, align 8, !tbaa !9
  %70 = zext i8 %69 to i32
  %71 = icmp eq i32 %70, 4
  br i1 %71, label %72, label %76

72:                                               ; preds = %66
  %73 = load ptr, ptr %22, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %73, i32 0, i32 6
  %75 = getelementptr inbounds [1 x %struct.EFI_IP4_FRAGMENT_DATA], ptr %74, i64 0, i64 0
  store ptr %75, ptr %19, align 8, !tbaa !5
  br label %80

76:                                               ; preds = %66
  %77 = load ptr, ptr %22, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %77, i32 0, i32 7
  %79 = getelementptr inbounds [1 x %struct._EFI_IP6_FRAGMENT_DATA], ptr %78, i64 0, i64 0
  store ptr %79, ptr %19, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %76, %72
  %81 = load ptr, ptr %11, align 8, !tbaa !5
  %82 = load ptr, ptr %19, align 8, !tbaa !5
  %83 = call i64 @NetbufBuildExt(ptr noundef %81, ptr noundef %82, ptr noundef %20)
  %84 = load ptr, ptr %15, align 8, !tbaa !5
  %85 = icmp ne ptr null, %84
  br i1 %85, label %86, label %93

86:                                               ; preds = %80
  %87 = load ptr, ptr %15, align 8, !tbaa !5
  %88 = call ptr @AllocateCopyPool(i64 noundef 12, ptr noundef %87)
  store ptr %88, ptr %21, align 8, !tbaa !5
  %89 = load ptr, ptr %21, align 8, !tbaa !5
  %90 = icmp eq ptr null, %89
  br i1 %90, label %91, label %92

91:                                               ; preds = %86
  br label %190

92:                                               ; preds = %86
  br label %93

93:                                               ; preds = %92, %80
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._IP_IO, ptr %94, i32 0, i32 14
  %96 = load i8, ptr %95, align 8, !tbaa !9
  %97 = zext i8 %96 to i32
  %98 = icmp eq i32 %97, 4
  br i1 %98, label %99, label %128

99:                                               ; preds = %93
  %100 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %100, ptr %23, align 8, !tbaa !5
  %101 = load ptr, ptr %23, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %101, i32 0, i32 0
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = call ptr @CopyMem(ptr noundef %102, ptr noundef %103, i64 noundef 4)
  %105 = load ptr, ptr %21, align 8, !tbaa !5
  %106 = load ptr, ptr %23, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %106, i32 0, i32 1
  store ptr %105, ptr %107, align 8, !tbaa !21
  %108 = load ptr, ptr %23, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %108, i32 0, i32 2
  store i32 0, ptr %109, align 8, !tbaa !24
  %110 = load ptr, ptr %23, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %110, i32 0, i32 3
  store ptr null, ptr %111, align 8, !tbaa !25
  %112 = load ptr, ptr %11, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.NET_BUF, ptr %112, i32 0, i32 9
  %114 = load i32, ptr %113, align 4, !tbaa !26
  %115 = load ptr, ptr %23, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %115, i32 0, i32 4
  store i32 %114, ptr %116, align 8, !tbaa !27
  %117 = load i32, ptr %20, align 4, !tbaa !20
  %118 = load ptr, ptr %23, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.EFI_IP4_TRANSMIT_DATA, ptr %118, i32 0, i32 5
  store i32 %117, ptr %119, align 4, !tbaa !28
  %120 = load ptr, ptr %17, align 8, !tbaa !5
  %121 = load ptr, ptr %16, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %121, i32 0, i32 6
  %123 = getelementptr inbounds %struct.EFI_IP4_COMPLETION_TOKEN, ptr %122, i32 0, i32 0
  store ptr %120, ptr %123, align 8, !tbaa !29
  %124 = load ptr, ptr %23, align 8, !tbaa !5
  %125 = load ptr, ptr %16, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %125, i32 0, i32 6
  %127 = getelementptr inbounds %struct.EFI_IP4_COMPLETION_TOKEN, ptr %126, i32 0, i32 2
  store ptr %124, ptr %127, align 8, !tbaa !29
  br label %165

128:                                              ; preds = %93
  %129 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %129, ptr %24, align 8, !tbaa !5
  %130 = load ptr, ptr %14, align 8, !tbaa !5
  %131 = icmp ne ptr %130, null
  br i1 %131, label %132, label %137

132:                                              ; preds = %128
  %133 = load ptr, ptr %24, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %14, align 8, !tbaa !5
  %136 = call ptr @CopyMem(ptr noundef %134, ptr noundef %135, i64 noundef 16)
  br label %141

137:                                              ; preds = %128
  %138 = load ptr, ptr %24, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %138, i32 0, i32 0
  %140 = call ptr @ZeroMem(ptr noundef %139, i64 noundef 16)
  br label %141

141:                                              ; preds = %137, %132
  %142 = load ptr, ptr %21, align 8, !tbaa !5
  %143 = load ptr, ptr %24, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %143, i32 0, i32 1
  store ptr %142, ptr %144, align 8, !tbaa !30
  %145 = load ptr, ptr %11, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.NET_BUF, ptr %145, i32 0, i32 9
  %147 = load i32, ptr %146, align 4, !tbaa !26
  %148 = load ptr, ptr %24, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %148, i32 0, i32 5
  store i32 %147, ptr %149, align 4, !tbaa !32
  %150 = load i32, ptr %20, align 4, !tbaa !20
  %151 = load ptr, ptr %24, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %151, i32 0, i32 6
  store i32 %150, ptr %152, align 8, !tbaa !33
  %153 = load ptr, ptr %24, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %153, i32 0, i32 2
  store i32 0, ptr %154, align 8, !tbaa !34
  %155 = load ptr, ptr %24, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._EFI_IP6_TRANSMIT_DATA, ptr %155, i32 0, i32 3
  store ptr null, ptr %156, align 8, !tbaa !35
  %157 = load ptr, ptr %17, align 8, !tbaa !5
  %158 = load ptr, ptr %16, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %158, i32 0, i32 6
  %160 = getelementptr inbounds %struct.EFI_IP6_COMPLETION_TOKEN, ptr %159, i32 0, i32 0
  store ptr %157, ptr %160, align 8, !tbaa !29
  %161 = load ptr, ptr %24, align 8, !tbaa !5
  %162 = load ptr, ptr %16, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %162, i32 0, i32 6
  %164 = getelementptr inbounds %struct.EFI_IP6_COMPLETION_TOKEN, ptr %163, i32 0, i32 2
  store ptr %161, ptr %164, align 8, !tbaa !29
  br label %165

165:                                              ; preds = %141, %99
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = load ptr, ptr %16, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %167, i32 0, i32 1
  store ptr %166, ptr %168, align 8, !tbaa !36
  %169 = load ptr, ptr %16, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %169, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %170, ptr align 8 %9, i64 8, i1 false), !tbaa.struct !38
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = load ptr, ptr %16, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %172, i32 0, i32 2
  store ptr %171, ptr %173, align 8, !tbaa !39
  %174 = load ptr, ptr %13, align 8, !tbaa !5
  %175 = load ptr, ptr %16, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %175, i32 0, i32 3
  store ptr %174, ptr %176, align 8, !tbaa !40
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = load ptr, ptr %16, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %178, i32 0, i32 5
  store ptr %177, ptr %179, align 8, !tbaa !41
  %180 = load ptr, ptr %11, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.NET_BUF, ptr %180, i32 0, i32 1
  %182 = load i64, ptr %181, align 8, !tbaa !42
  %183 = add nsw i64 %182, 1
  store i64 %183, ptr %181, align 8, !tbaa !42
  %184 = load ptr, ptr %10, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct._IP_IO, ptr %184, i32 0, i32 9
  %186 = load ptr, ptr %16, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._IP_IO_SEND_ENTRY, ptr %186, i32 0, i32 0
  %188 = call ptr @InsertTailList(ptr noundef %185, ptr noundef %187)
  %189 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %189, ptr %8, align 8
  store i32 1, ptr %25, align 4
  br label %215

190:                                              ; preds = %91, %65, %52
  %191 = load ptr, ptr %21, align 8, !tbaa !5
  %192 = icmp ne ptr %191, null
  br i1 %192, label %193, label %195

193:                                              ; preds = %190
  %194 = load ptr, ptr %21, align 8, !tbaa !5
  call void @FreePool(ptr noundef %194)
  br label %195

195:                                              ; preds = %193, %190
  %196 = load ptr, ptr %22, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %200

198:                                              ; preds = %195
  %199 = load ptr, ptr %22, align 8, !tbaa !5
  call void @FreePool(ptr noundef %199)
  br label %200

200:                                              ; preds = %198, %195
  %201 = load ptr, ptr %16, align 8, !tbaa !5
  %202 = icmp ne ptr %201, null
  br i1 %202, label %203, label %205

203:                                              ; preds = %200
  %204 = load ptr, ptr %16, align 8, !tbaa !5
  call void @FreePool(ptr noundef %204)
  br label %205

205:                                              ; preds = %203, %200
  %206 = load ptr, ptr %17, align 8, !tbaa !5
  %207 = icmp ne ptr %206, null
  br i1 %207, label %208, label %214

208:                                              ; preds = %205
  %209 = load ptr, ptr @gBS, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %209, i32 0, i32 12
  %211 = load ptr, ptr %210, align 8, !tbaa !43
  %212 = load ptr, ptr %17, align 8, !tbaa !5
  %213 = call i64 %211(ptr noundef %212)
  br label %214

214:                                              ; preds = %208, %205
  store ptr null, ptr %8, align 8
  store i32 1, ptr %25, align 4
  br label %215

215:                                              ; preds = %214, %165, %43, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %216 = load ptr, ptr %8, align 8
  ret ptr %216
}

declare ptr @AllocatePool(i64 noundef) #2

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare ptr @InsertTailList(ptr noundef, ptr noundef) #2

declare void @FreePool(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 144}
!10 = !{!"_IP_IO", !11, i64 0, !11, i64 16, !6, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !7, i64 64, !7, i64 65, !7, i64 72, !11, i64 96, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!11 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!12 = !{!13, !6, i64 80}
!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 = !{!15, !15, i64 0}
!18 = !{!19, !16, i64 128}
!19 = !{!"", !16, i64 0, !15, i64 8, !11, i64 16, !7, i64 32, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 120, !16, i64 128, !16, i64 132, !7, i64 136}
!20 = !{!16, !16, i64 0}
!21 = !{!22, !6, i64 8}
!22 = !{!"", !23, i64 0, !6, i64 8, !16, i64 16, !6, i64 24, !16, i64 32, !16, i64 36, !7, i64 40}
!23 = !{!"", !7, i64 0}
!24 = !{!22, !16, i64 16}
!25 = !{!22, !6, i64 24}
!26 = !{!19, !16, i64 132}
!27 = !{!22, !16, i64 32}
!28 = !{!22, !16, i64 36}
!29 = !{!7, !7, i64 0}
!30 = !{!31, !6, i64 16}
!31 = !{!"_EFI_IP6_TRANSMIT_DATA", !23, i64 0, !6, i64 16, !16, i64 24, !6, i64 32, !7, i64 40, !16, i64 44, !16, i64 48, !7, i64 56}
!32 = !{!31, !16, i64 44}
!33 = !{!31, !16, i64 48}
!34 = !{!31, !16, i64 24}
!35 = !{!31, !6, i64 32}
!36 = !{!37, !6, i64 16}
!37 = !{!"_IP_IO_SEND_ENTRY", !11, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 48, !7, i64 56}
!38 = !{i64 0, i64 8, !29}
!39 = !{!37, !6, i64 24}
!40 = !{!37, !6, i64 32}
!41 = !{!37, !6, i64 48}
!42 = !{!19, !15, i64 8}
!43 = !{!13, !6, i64 112}


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

@gBS = external local_unnamed_addr global ptr, align 8

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

; Function Attrs: mustprogress 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 ptr @IpIoCreateSndEntry(ptr noundef %0, ptr noundef %1, ptr %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) local_unnamed_addr #1 {
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #3
  %10 = getelementptr inbounds i8, ptr %0, i64 144
  %11 = load i8, ptr %10, align 8, !tbaa !5
  switch i8 %11, label %84 [
    i8 4, label %12
    i8 6, label %12
  ]

12:                                               ; preds = %7, %7
  store ptr null, ptr %8, align 8, !tbaa !11
  %13 = tail call ptr @AllocatePool(i64 noundef 80) #3
  %14 = icmp eq ptr %13, null
  br i1 %14, label %84, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr @gBS, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %16, i64 80
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = call i64 %18(i32 noundef 512, i64 noundef 16, ptr noundef nonnull @IpIoTransmitHandler, ptr noundef nonnull %13, ptr noundef nonnull %8) #3
  %20 = icmp slt i64 %19, 0
  br i1 %20, label %.thread, label %21

21:                                               ; preds = %15
  %22 = getelementptr inbounds i8, ptr %1, i64 128
  %23 = load i32, ptr %22, align 8, !tbaa !17
  store i32 %23, ptr %9, align 4, !tbaa !19
  %24 = add i32 %23, -1
  %25 = zext i32 %24 to i64
  %26 = shl nuw nsw i64 %25, 4
  %27 = add nuw nsw i64 %26, 72
  %28 = call ptr @AllocatePool(i64 noundef %27) #3
  %29 = icmp eq ptr %28, null
  br i1 %29, label %.thread, label %30

30:                                               ; preds = %21
  %31 = load i8, ptr %10, align 8, !tbaa !5
  %32 = icmp eq i8 %31, 4
  %.063.v = select i1 %32, i64 40, i64 56
  %.063 = getelementptr inbounds i8, ptr %28, i64 %.063.v
  %33 = call i64 @NetbufBuildExt(ptr noundef nonnull %1, ptr noundef nonnull %.063, ptr noundef nonnull %9) #3
  %.not76 = icmp eq ptr %6, null
  br i1 %.not76, label %37, label %34

34:                                               ; preds = %30
  %35 = call ptr @AllocateCopyPool(i64 noundef 12, ptr noundef nonnull %6) #3
  %36 = icmp eq ptr %35, null
  br i1 %36, label %77, label %37

37:                                               ; preds = %34, %30
  %.065 = phi ptr [ %35, %34 ], [ null, %30 ]
  %38 = load i8, ptr %10, align 8, !tbaa !5
  %39 = icmp eq i8 %38, 4
  br i1 %39, label %40, label %50

40:                                               ; preds = %37
  %41 = call ptr @CopyMem(ptr noundef nonnull %28, ptr noundef %5, i64 noundef 4) #3
  %42 = getelementptr inbounds i8, ptr %28, i64 8
  store ptr %.065, ptr %42, align 8, !tbaa !20
  %43 = getelementptr inbounds i8, ptr %28, i64 16
  store i32 0, ptr %43, align 8, !tbaa !23
  %44 = getelementptr inbounds i8, ptr %28, i64 24
  store ptr null, ptr %44, align 8, !tbaa !24
  %45 = getelementptr inbounds i8, ptr %1, i64 132
  %46 = load i32, ptr %45, align 4, !tbaa !25
  %47 = getelementptr inbounds i8, ptr %28, i64 32
  store i32 %46, ptr %47, align 8, !tbaa !26
  %48 = load i32, ptr %9, align 4, !tbaa !19
  %49 = getelementptr inbounds i8, ptr %28, i64 36
  store i32 %48, ptr %49, align 4, !tbaa !27
  br label %64

50:                                               ; preds = %37
  %.not77 = icmp eq ptr %5, null
  br i1 %.not77, label %53, label %51

51:                                               ; preds = %50
  %52 = call ptr @CopyMem(ptr noundef nonnull %28, ptr noundef nonnull %5, i64 noundef 16) #3
  br label %55

53:                                               ; preds = %50
  %54 = call ptr @ZeroMem(ptr noundef nonnull %28, i64 noundef 16) #3
  br label %55

55:                                               ; preds = %53, %51
  %56 = getelementptr inbounds i8, ptr %28, i64 16
  store ptr %.065, ptr %56, align 8, !tbaa !28
  %57 = getelementptr inbounds i8, ptr %1, i64 132
  %58 = load i32, ptr %57, align 4, !tbaa !25
  %59 = getelementptr inbounds i8, ptr %28, i64 44
  store i32 %58, ptr %59, align 4, !tbaa !30
  %60 = load i32, ptr %9, align 4, !tbaa !19
  %61 = getelementptr inbounds i8, ptr %28, i64 48
  store i32 %60, ptr %61, align 8, !tbaa !31
  %62 = getelementptr inbounds i8, ptr %28, i64 24
  store i32 0, ptr %62, align 8, !tbaa !32
  %63 = getelementptr inbounds i8, ptr %28, i64 32
  store ptr null, ptr %63, align 8, !tbaa !33
  br label %64

64:                                               ; preds = %55, %40
  %.sink = load ptr, ptr %8, align 8, !tbaa !11
  %65 = getelementptr inbounds i8, ptr %13, i64 56
  store ptr %.sink, ptr %65, align 8, !tbaa !34
  %66 = getelementptr inbounds i8, ptr %13, i64 72
  store ptr %28, ptr %66, align 8, !tbaa !34
  %67 = getelementptr inbounds i8, ptr %13, i64 16
  store ptr %0, ptr %67, align 8, !tbaa !35
  %68 = getelementptr inbounds i8, ptr %13, i64 40
  store ptr %2, ptr %68, align 8, !tbaa !34
  %69 = getelementptr inbounds i8, ptr %13, i64 24
  store ptr %3, ptr %69, align 8, !tbaa !37
  %70 = getelementptr inbounds i8, ptr %13, i64 32
  store ptr %4, ptr %70, align 8, !tbaa !38
  %71 = getelementptr inbounds i8, ptr %13, i64 48
  store ptr %1, ptr %71, align 8, !tbaa !39
  %72 = getelementptr inbounds i8, ptr %1, i64 8
  %73 = load i64, ptr %72, align 8, !tbaa !40
  %74 = add nsw i64 %73, 1
  store i64 %74, ptr %72, align 8, !tbaa !40
  %75 = getelementptr inbounds i8, ptr %0, i64 96
  %76 = call ptr @InsertTailList(ptr noundef nonnull %75, ptr noundef nonnull %13) #3
  br label %84

77:                                               ; preds = %34
  call void @FreePool(ptr noundef nonnull %28) #3
  br label %.thread

.thread:                                          ; preds = %21, %15, %77
  call void @FreePool(ptr noundef nonnull %13) #3
  %78 = load ptr, ptr %8, align 8, !tbaa !11
  %.not79 = icmp eq ptr %78, null
  br i1 %.not79, label %84, label %79

79:                                               ; preds = %.thread
  %80 = load ptr, ptr @gBS, align 8, !tbaa !11
  %81 = getelementptr inbounds i8, ptr %80, i64 112
  %82 = load ptr, ptr %81, align 8, !tbaa !41
  %83 = call i64 %82(ptr noundef nonnull %78) #3
  br label %84

84:                                               ; preds = %.thread, %79, %12, %7, %64
  %.0 = phi ptr [ %13, %64 ], [ null, %7 ], [ null, %12 ], [ null, %79 ], [ null, %.thread ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  ret ptr %.0
}

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #2

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

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

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

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

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

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

declare void @FreePool(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress 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, !9, i64 144}
!6 = !{!"_IP_IO", !7, i64 0, !7, i64 16, !8, i64 32, !8, i64 40, !8, i64 48, !9, i64 56, !9, i64 64, !9, i64 65, !9, i64 72, !7, i64 96, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !9, i64 144}
!7 = !{!"_LIST_ENTRY", !8, i64 0, !8, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!8, !8, i64 0}
!12 = !{!13, !8, i64 80}
!13 = !{!"", !14, i64 0, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !8, i64 120, !8, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !8, i64 160, !8, i64 168, !8, i64 176, !8, i64 184, !8, i64 192, !8, i64 200, !8, i64 208, !8, i64 216, !8, i64 224, !8, i64 232, !8, i64 240, !8, i64 248, !8, i64 256, !8, i64 264, !8, i64 272, !8, i64 280, !8, i64 288, !8, i64 296, !8, i64 304, !8, i64 312, !8, i64 320, !8, i64 328, !8, i64 336, !8, i64 344, !8, i64 352, !8, i64 360, !8, i64 368}
!14 = !{!"", !15, i64 0, !16, i64 8, !16, i64 12, !16, i64 16, !16, i64 20}
!15 = !{!"long long", !9, i64 0}
!16 = !{!"int", !9, i64 0}
!17 = !{!18, !16, i64 128}
!18 = !{!"", !16, i64 0, !15, i64 8, !7, i64 16, !9, i64 32, !8, i64 40, !8, i64 48, !9, i64 56, !8, i64 120, !16, i64 128, !16, i64 132, !9, i64 136}
!19 = !{!16, !16, i64 0}
!20 = !{!21, !8, i64 8}
!21 = !{!"", !22, i64 0, !8, i64 8, !16, i64 16, !8, i64 24, !16, i64 32, !16, i64 36, !9, i64 40}
!22 = !{!"", !9, i64 0}
!23 = !{!21, !16, i64 16}
!24 = !{!21, !8, i64 24}
!25 = !{!18, !16, i64 132}
!26 = !{!21, !16, i64 32}
!27 = !{!21, !16, i64 36}
!28 = !{!29, !8, i64 16}
!29 = !{!"_EFI_IP6_TRANSMIT_DATA", !22, i64 0, !8, i64 16, !16, i64 24, !8, i64 32, !9, i64 40, !16, i64 44, !16, i64 48, !9, i64 56}
!30 = !{!29, !16, i64 44}
!31 = !{!29, !16, i64 48}
!32 = !{!29, !16, i64 24}
!33 = !{!29, !8, i64 32}
!34 = !{!9, !9, i64 0}
!35 = !{!36, !8, i64 16}
!36 = !{!"_IP_IO_SEND_ENTRY", !7, i64 0, !8, i64 16, !8, i64 24, !8, i64 32, !9, i64 40, !8, i64 48, !9, i64 56}
!37 = !{!36, !8, i64 24}
!38 = !{!36, !8, i64 32}
!39 = !{!36, !8, i64 48}
!40 = !{!18, !15, i64 8}
!41 = !{!13, !8, i64 112}


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