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

; 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.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] }
%struct._LIST_ENTRY = type { ptr, ptr }
%union.NET_IP_HEAD = type { ptr }
%struct.NET_BLOCK_OP = type { ptr, ptr, ptr, ptr, i32 }
%struct._ISCSI_TCB = type { %struct._LIST_ENTRY, i8, i32, i8, i8, i32, i32, ptr, i32, i32, i32, %struct._ISCSI_XFER_CONTEXT, ptr }
%struct._ISCSI_XFER_CONTEXT = type { i32, i32, i32, i32 }
%struct._ISCSI_BASIC_HEADER = type { i8, i8, i16, i8, [3 x i8], [8 x i8], i32, [7 x i32] }
%struct._ISCSI_SCSI_DATA_OUT = type { i8, [3 x i8], i8, [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, i32 }
%struct._ISCSI_CONNECTION = type { i32, %struct._LIST_ENTRY, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i16, i32, %struct.NET_BUF_QUEUE, i8, %struct.TCP_IO, i32, i32, i32 }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%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.0 }
%union.anon.0 = 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 }

@.str.1 = external hidden unnamed_addr constant [134 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [27 x i8], align 1

declare ptr @InsertTailList(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

declare void @FreePool(ptr noundef) #0

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

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

declare zeroext i8 @DebugAssertEnabled() #0

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

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 noundef zeroext) #0

declare ptr @NetbufAlloc(i32 noundef) #0

declare i32 @SwapBytes32(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @IScsiFreeNbufList(ptr noundef) #2

declare ptr @AllocatePool(i64 noundef) #0

declare ptr @InitializeListHead(ptr noundef) #0

declare ptr @NetbufFromBufList(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @IScsiNewDataSegment(ptr noundef, i32 noundef, i8 noundef zeroext) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiNewDataOutPdu(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i64 noundef %4) #2 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i64, 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 i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i64 %4, ptr %11, align 8, !tbaa !11
  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 8, ptr %17) #3
  %19 = call ptr @AllocatePool(i64 noundef 16)
  store ptr %19, ptr %12, align 8, !tbaa !5
  %20 = load ptr, ptr %12, align 8, !tbaa !5
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %5
  store ptr null, ptr %6, align 8
  store i32 1, ptr %18, align 4
  br label %144

23:                                               ; preds = %5
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = call ptr @InitializeListHead(ptr noundef %24)
  %26 = call ptr @NetbufAlloc(i32 noundef 48)
  store ptr %26, ptr %13, align 8, !tbaa !5
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %23
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %30)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %18, align 4
  br label %144

31:                                               ; preds = %23
  %32 = load ptr, ptr %12, align 8, !tbaa !5
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.NET_BUF, ptr %33, i32 0, i32 2
  %35 = call ptr @InsertTailList(ptr noundef %32, ptr noundef %34)
  %36 = load ptr, ptr %13, align 8, !tbaa !5
  %37 = call ptr @NetbufAllocSpace(ptr noundef %36, i32 noundef 48, i8 noundef zeroext 0)
  store ptr %37, ptr %16, align 8, !tbaa !5
  br label %38

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

41:                                               ; preds = %38
  %42 = load ptr, ptr %16, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %45, label %44

44:                                               ; preds = %41
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 2319, ptr noundef @.str.35)
  br label %45

45:                                               ; preds = %44, %41
  br label %46

46:                                               ; preds = %45, %38
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._ISCSI_TCB, ptr %49, i32 0, i32 11
  store ptr %50, ptr %17, align 8, !tbaa !5
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  %52 = call ptr @ZeroMem(ptr noundef %51, i64 noundef 48)
  %53 = load ptr, ptr %16, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %53, i32 0, i32 0
  store i8 5, ptr %54, align 4, !tbaa !13
  br label %55

55:                                               ; preds = %48
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = lshr i32 %56, 16
  %58 = trunc i32 %57 to i8
  %59 = zext i8 %58 to i32
  %60 = and i32 %59, 255
  %61 = trunc i32 %60 to i8
  %62 = load ptr, ptr %16, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %62, i32 0, i32 4
  %64 = getelementptr inbounds [3 x i8], ptr %63, i64 0, i64 0
  store i8 %61, ptr %64, align 1, !tbaa !16
  %65 = load i32, ptr %8, align 4, !tbaa !9
  %66 = lshr i32 %65, 8
  %67 = trunc i32 %66 to i8
  %68 = zext i8 %67 to i32
  %69 = and i32 %68, 255
  %70 = trunc i32 %69 to i8
  %71 = load ptr, ptr %16, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %71, i32 0, i32 4
  %73 = getelementptr inbounds [3 x i8], ptr %72, i64 0, i64 1
  store i8 %70, ptr %73, align 1, !tbaa !16
  %74 = load i32, ptr %8, align 4, !tbaa !9
  %75 = trunc i32 %74 to i8
  %76 = zext i8 %75 to i32
  %77 = and i32 %76, 255
  %78 = trunc i32 %77 to i8
  %79 = load ptr, ptr %16, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %79, i32 0, i32 4
  %81 = getelementptr inbounds [3 x i8], ptr %80, i64 0, i64 2
  store i8 %78, ptr %81, align 1, !tbaa !16
  br label %82

82:                                               ; preds = %55
  br label %83

83:                                               ; preds = %82
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct._ISCSI_TCB, ptr %84, i32 0, i32 8
  %86 = load i32, ptr %85, align 8, !tbaa !17
  %87 = call i32 @SwapBytes32(i32 noundef %86)
  %88 = load ptr, ptr %16, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %88, i32 0, i32 5
  store i32 %87, ptr %89, align 4, !tbaa !21
  %90 = load ptr, ptr %17, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %90, i32 0, i32 0
  %92 = load i32, ptr %91, align 4, !tbaa !23
  %93 = call i32 @SwapBytes32(i32 noundef %92)
  %94 = load ptr, ptr %16, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %94, i32 0, i32 6
  store i32 %93, ptr %95, align 4, !tbaa !24
  %96 = load ptr, ptr %10, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct._ISCSI_TCB, ptr %96, i32 0, i32 12
  %98 = load ptr, ptr %97, align 8, !tbaa !25
  %99 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %98, i32 0, i32 13
  %100 = load i32, ptr %99, align 4, !tbaa !26
  %101 = call i32 @SwapBytes32(i32 noundef %100)
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %102, i32 0, i32 8
  store i32 %101, ptr %103, align 4, !tbaa !30
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = call i32 @SwapBytes32(i32 noundef %104)
  %106 = load ptr, ptr %16, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %106, i32 0, i32 10
  store i32 %105, ptr %107, align 4, !tbaa !31
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %108, i32 0, i32 1
  %110 = load i32, ptr %109, align 4, !tbaa !32
  %111 = call i32 @SwapBytes32(i32 noundef %110)
  %112 = load ptr, ptr %16, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %112, i32 0, i32 11
  store i32 %111, ptr %113, align 4, !tbaa !33
  %114 = load ptr, ptr %17, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !23
  %117 = icmp ne i32 %116, -1
  br i1 %117, label %118, label %122

118:                                              ; preds = %83
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._ISCSI_SCSI_DATA_OUT, ptr %119, i32 0, i32 4
  %121 = call ptr @CopyMem(ptr noundef %120, ptr noundef %11, i64 noundef 8)
  br label %122

122:                                              ; preds = %118, %83
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = load i32, ptr %8, align 4, !tbaa !9
  %125 = call ptr @IScsiNewDataSegment(ptr noundef %123, i32 noundef %124, i8 noundef zeroext 0)
  store ptr %125, ptr %14, align 8, !tbaa !5
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = icmp eq ptr %126, null
  br i1 %127, label %128, label %130

128:                                              ; preds = %122
  %129 = load ptr, ptr %12, align 8, !tbaa !5
  call void @IScsiFreeNbufList(ptr noundef %129)
  store ptr null, ptr %6, align 8
  store i32 1, ptr %18, align 4
  br label %144

130:                                              ; preds = %122
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = load ptr, ptr %14, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.NET_BUF, ptr %132, i32 0, i32 2
  %134 = call ptr @InsertTailList(ptr noundef %131, ptr noundef %133)
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = load ptr, ptr %12, align 8, !tbaa !5
  %137 = call ptr @NetbufFromBufList(ptr noundef %135, i32 noundef 0, i32 noundef 0, ptr noundef @IScsiFreeNbufList, ptr noundef %136)
  store ptr %137, ptr %15, align 8, !tbaa !5
  %138 = load ptr, ptr %15, align 8, !tbaa !5
  %139 = icmp eq ptr %138, null
  br i1 %139, label %140, label %142

140:                                              ; preds = %130
  %141 = load ptr, ptr %12, align 8, !tbaa !5
  call void @IScsiFreeNbufList(ptr noundef %141)
  br label %142

142:                                              ; preds = %140, %130
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %143, ptr %6, align 8
  store i32 1, ptr %18, align 4
  br label %144

144:                                              ; preds = %142, %128, %29, %22
  call void @llvm.lifetime.end.p0(i64 8, 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
  %145 = load ptr, ptr %6, align 8
  ret ptr %145
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !7, i64 0}
!14 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !15, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !10, i64 16, !7, i64 20}
!15 = !{!"short", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !10, i64 48}
!18 = !{!"_ISCSI_TCB", !19, i64 0, !7, i64 16, !10, i64 20, !7, i64 24, !7, i64 25, !10, i64 28, !10, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !20, i64 60, !6, i64 80}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!"_ISCSI_XFER_CONTEXT", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!21 = !{!22, !10, i64 16}
!22 = !{!"_ISCSI_SCSI_DATA_OUT", !7, i64 0, !7, i64 1, !7, i64 4, !7, i64 5, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44}
!23 = !{!20, !10, i64 0}
!24 = !{!22, !10, i64 20}
!25 = !{!18, !6, i64 80}
!26 = !{!27, !10, i64 52}
!27 = !{!"_ISCSI_CONNECTION", !10, i64 0, !19, i64 8, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !15, i64 48, !10, i64 52, !28, i64 56, !7, i64 112, !29, i64 120, !10, i64 288, !10, i64 292, !10, i64 296}
!28 = !{!"", !10, i64 0, !12, i64 8, !19, i64 16, !19, i64 32, !10, i64 48, !10, i64 52}
!29 = !{!"", !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}
!30 = !{!22, !10, i64 28}
!31 = !{!22, !10, i64 36}
!32 = !{!20, !10, i64 4}
!33 = !{!22, !10, i64 40}


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

@.str.1 = external hidden unnamed_addr constant [134 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [27 x i8], align 1

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

declare void @FreePool(ptr noundef) local_unnamed_addr #0

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #0

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

declare ptr @NetbufAllocSpace(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

declare ptr @NetbufAlloc(i32 noundef) local_unnamed_addr #0

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #0

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #0

declare ptr @InitializeListHead(ptr noundef) local_unnamed_addr #0

declare ptr @NetbufFromBufList(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @IScsiNewDataSegment(ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiNewDataOutPdu(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i64 noundef %4) local_unnamed_addr #1 {
  %6 = alloca i64, align 8
  store i64 %4, ptr %6, align 8, !tbaa !5
  %7 = tail call ptr @AllocatePool(i64 noundef 16) #2
  %8 = icmp eq ptr %7, null
  br i1 %8, label %66, label %9

9:                                                ; preds = %5
  %10 = tail call ptr @InitializeListHead(ptr noundef nonnull %7) #2
  %11 = tail call ptr @NetbufAlloc(i32 noundef 48) #2
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %9
  tail call void @FreePool(ptr noundef nonnull %7) #2
  br label %66

14:                                               ; preds = %9
  %15 = getelementptr inbounds i8, ptr %11, i64 16
  %16 = tail call ptr @InsertTailList(ptr noundef nonnull %7, ptr noundef nonnull %15) #2
  %17 = tail call ptr @NetbufAllocSpace(ptr noundef nonnull %11, i32 noundef 48, i8 noundef zeroext 0) #2
  %18 = tail call zeroext i8 @DebugAssertEnabled() #2
  %19 = icmp eq i8 %18, 0
  %20 = icmp ne ptr %17, null
  %or.cond = select i1 %19, i1 true, i1 %20
  br i1 %or.cond, label %22, label %21

21:                                               ; preds = %14
  tail call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 2319, ptr noundef nonnull @.str.35) #2
  br label %22

22:                                               ; preds = %21, %14
  %23 = getelementptr inbounds i8, ptr %3, i64 60
  %24 = tail call ptr @ZeroMem(ptr noundef %17, i64 noundef 48) #2
  store i8 5, ptr %17, align 4, !tbaa !9
  %25 = lshr i32 %1, 16
  %26 = trunc i32 %25 to i8
  %27 = getelementptr inbounds i8, ptr %17, i64 5
  store i8 %26, ptr %27, align 1, !tbaa !13
  %28 = lshr i32 %1, 8
  %29 = trunc i32 %28 to i8
  %30 = getelementptr inbounds i8, ptr %17, i64 6
  store i8 %29, ptr %30, align 1, !tbaa !13
  %31 = trunc i32 %1 to i8
  %32 = getelementptr inbounds i8, ptr %17, i64 7
  store i8 %31, ptr %32, align 1, !tbaa !13
  %33 = getelementptr inbounds i8, ptr %3, i64 48
  %34 = load i32, ptr %33, align 8, !tbaa !14
  %35 = tail call i32 @SwapBytes32(i32 noundef %34) #2
  %36 = getelementptr inbounds i8, ptr %17, i64 16
  store i32 %35, ptr %36, align 4, !tbaa !19
  %37 = load i32, ptr %23, align 4, !tbaa !21
  %38 = tail call i32 @SwapBytes32(i32 noundef %37) #2
  %39 = getelementptr inbounds i8, ptr %17, i64 20
  store i32 %38, ptr %39, align 4, !tbaa !22
  %40 = getelementptr inbounds i8, ptr %3, i64 80
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = getelementptr inbounds i8, ptr %41, i64 52
  %43 = load i32, ptr %42, align 4, !tbaa !24
  %44 = tail call i32 @SwapBytes32(i32 noundef %43) #2
  %45 = getelementptr inbounds i8, ptr %17, i64 28
  store i32 %44, ptr %45, align 4, !tbaa !28
  %46 = tail call i32 @SwapBytes32(i32 noundef %2) #2
  %47 = getelementptr inbounds i8, ptr %17, i64 36
  store i32 %46, ptr %47, align 4, !tbaa !29
  %48 = getelementptr inbounds i8, ptr %3, i64 64
  %49 = load i32, ptr %48, align 4, !tbaa !30
  %50 = tail call i32 @SwapBytes32(i32 noundef %49) #2
  %51 = getelementptr inbounds i8, ptr %17, i64 40
  store i32 %50, ptr %51, align 4, !tbaa !31
  %52 = load i32, ptr %23, align 4, !tbaa !21
  %.not = icmp eq i32 %52, -1
  br i1 %.not, label %56, label %53

53:                                               ; preds = %22
  %54 = getelementptr inbounds i8, ptr %17, i64 8
  %55 = call ptr @CopyMem(ptr noundef nonnull %54, ptr noundef nonnull %6, i64 noundef 8) #2
  br label %56

56:                                               ; preds = %53, %22
  %57 = call ptr @IScsiNewDataSegment(ptr noundef %0, i32 noundef %1, i8 noundef zeroext 0)
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %56
  call void @IScsiFreeNbufList(ptr noundef nonnull %7)
  br label %66

60:                                               ; preds = %56
  %61 = getelementptr inbounds i8, ptr %57, i64 16
  %62 = call ptr @InsertTailList(ptr noundef nonnull %7, ptr noundef nonnull %61) #2
  %63 = call ptr @NetbufFromBufList(ptr noundef nonnull %7, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @IScsiFreeNbufList, ptr noundef nonnull %7) #2
  %64 = icmp eq ptr %63, null
  br i1 %64, label %65, label %66

65:                                               ; preds = %60
  call void @IScsiFreeNbufList(ptr noundef nonnull %7)
  br label %66

66:                                               ; preds = %60, %65, %5, %59, %13
  %.0 = phi ptr [ null, %13 ], [ null, %59 ], [ null, %5 ], [ null, %65 ], [ %63, %60 ]
  ret ptr %.0
}

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 0}
!10 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !11, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !12, i64 16, !7, i64 20}
!11 = !{!"short", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !12, i64 48}
!15 = !{!"_ISCSI_TCB", !16, i64 0, !7, i64 16, !12, i64 20, !7, i64 24, !7, i64 25, !12, i64 28, !12, i64 32, !17, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !18, i64 60, !17, i64 80}
!16 = !{!"_LIST_ENTRY", !17, i64 0, !17, i64 8}
!17 = !{!"any pointer", !7, i64 0}
!18 = !{!"_ISCSI_XFER_CONTEXT", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!19 = !{!20, !12, i64 16}
!20 = !{!"_ISCSI_SCSI_DATA_OUT", !7, i64 0, !7, i64 1, !7, i64 4, !7, i64 5, !7, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44}
!21 = !{!18, !12, i64 0}
!22 = !{!20, !12, i64 20}
!23 = !{!15, !17, i64 80}
!24 = !{!25, !12, i64 52}
!25 = !{!"_ISCSI_CONNECTION", !12, i64 0, !16, i64 8, !17, i64 24, !17, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !11, i64 48, !12, i64 52, !26, i64 56, !7, i64 112, !27, i64 120, !12, i64 288, !12, i64 292, !12, i64 296}
!26 = !{!"", !12, i64 0, !6, i64 8, !16, i64 16, !16, i64 32, !12, i64 48, !12, i64 52}
!27 = !{!"", !7, i64 0, !17, i64 8, !17, i64 16, !17, 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}
!28 = !{!20, !12, i64 28}
!29 = !{!20, !12, i64 36}
!30 = !{!18, !12, i64 4}
!31 = !{!20, !12, i64 40}


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