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

; 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.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET = type { i64, ptr, ptr, ptr, ptr, i32, i32, i8, i8, i8, i8, i8 }
%struct._SCSI_COMMAND = type { i8, i8, i16, i8, [3 x i8], [8 x i8], i32, i32, i32, i32, [16 x i8] }
%struct._ISCSI_BASIC_HEADER = type { i8, i8, i16, i8, [3 x i8], [8 x i8], i32, [7 x i32] }
%struct._ISCSI_BI_EXP_READ_DATA_LEN_AHS = type { i16, i8, i8, i32 }
%struct._ISCSI_TCB = type { %struct._LIST_ENTRY, i8, i32, i8, i8, i32, i32, ptr, i32, i32, i32, %struct._ISCSI_XFER_CONTEXT, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._ISCSI_XFER_CONTEXT = type { 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 }
%struct._ISCSI_ADDTIONAL_HEADER = type { i16, i8, [1 x i8] }
%struct._ISCSI_SESSION = type { i32, ptr, ptr, i8, %union.anon, i8, [6 x i8], i16, i32, i32, i32, i32, i16, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i16, i32, i8, i8, i32, i32, i32, i32, i16, i8, i8, i8 }
%union.anon = type { %struct._ISCSI_CHAP_AUTH_DATA }
%struct._ISCSI_CHAP_AUTH_DATA = type { ptr, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], 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 }

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 ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #0

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

declare void @NetbufFree(ptr noundef) #0

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

declare ptr @NetbufAlloc(i32 noundef) #0

declare zeroext i16 @SwapBytes16(i16 noundef zeroext) #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 @IScsiNewScsiCmdPdu(ptr noundef %0, i64 noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 4, 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  store i8 0, ptr %13, align 1, !tbaa !11
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %20, i32 0, i32 8
  %22 = load i8, ptr %21, align 1, !tbaa !12
  %23 = zext i8 %22 to i32
  %24 = icmp eq i32 %23, 2
  br i1 %24, label %25, label %30

25:                                               ; preds = %3
  %26 = load i8, ptr %13, align 1, !tbaa !11
  %27 = zext i8 %26 to i64
  %28 = add i64 %27, 8
  %29 = trunc i64 %28 to i8
  store i8 %29, ptr %13, align 1, !tbaa !11
  br label %30

30:                                               ; preds = %25, %3
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %31, i32 0, i32 7
  %33 = load i8, ptr %32, align 8, !tbaa !15
  %34 = zext i8 %33 to i32
  %35 = icmp sgt i32 %34, 16
  br i1 %35, label %36, label %50

36:                                               ; preds = %30
  %37 = load i8, ptr %13, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %39, i32 0, i32 7
  %41 = load i8, ptr %40, align 8, !tbaa !15
  %42 = zext i8 %41 to i32
  %43 = sub nsw i32 %42, 16
  %44 = add nsw i32 %43, 3
  %45 = and i32 %44, -4
  %46 = add nsw i32 %38, %45
  %47 = sext i32 %46 to i64
  %48 = add i64 %47, 4
  %49 = trunc i64 %48 to i8
  store i8 %49, ptr %13, align 1, !tbaa !11
  br label %50

50:                                               ; preds = %36, %30
  %51 = load i8, ptr %13, align 1, !tbaa !11
  %52 = zext i8 %51 to i64
  %53 = add i64 48, %52
  %54 = trunc i64 %53 to i32
  store i32 %54, ptr %14, align 4, !tbaa !16
  %55 = load i32, ptr %14, align 4, !tbaa !16
  %56 = call ptr @NetbufAlloc(i32 noundef %55)
  store ptr %56, ptr %10, align 8, !tbaa !5
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %60

59:                                               ; preds = %50
  store ptr null, ptr %4, align 8
  store i32 1, ptr %19, align 4
  br label %349

60:                                               ; preds = %50
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i32, ptr %14, align 4, !tbaa !16
  %63 = call ptr @NetbufAllocSpace(ptr noundef %61, i32 noundef %62, i8 noundef zeroext 0)
  store ptr %63, ptr %12, align 8, !tbaa !5
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = icmp eq ptr %64, null
  br i1 %65, label %66, label %68

66:                                               ; preds = %60
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %67)
  store ptr null, ptr %4, align 8
  store i32 1, ptr %19, align 4
  br label %349

68:                                               ; preds = %60
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %69, i64 1
  store ptr %70, ptr %15, align 8, !tbaa !5
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = load i32, ptr %14, align 4, !tbaa !16
  %73 = zext i32 %72 to i64
  %74 = call ptr @ZeroMem(ptr noundef %71, i64 noundef %73)
  %75 = load ptr, ptr %12, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %75, i32 0, i32 0
  store i8 1, ptr %76, align 4, !tbaa !17
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %77, i32 0, i32 1
  %79 = load i8, ptr %78, align 1, !tbaa !20
  %80 = zext i8 %79 to i32
  %81 = or i32 %80, 1
  %82 = trunc i32 %81 to i8
  store i8 %82, ptr %78, align 1, !tbaa !20
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %83, i32 0, i32 8
  %85 = load i8, ptr %84, align 1, !tbaa !12
  %86 = zext i8 %85 to i32
  switch i32 %86, label %140 [
    i32 0, label %87
    i32 1, label %100
    i32 2, label %113
  ]

87:                                               ; preds = %68
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %88, i32 0, i32 1
  %90 = load i8, ptr %89, align 1, !tbaa !20
  %91 = zext i8 %90 to i32
  %92 = or i32 %91, 64
  %93 = trunc i32 %92 to i8
  store i8 %93, ptr %89, align 1, !tbaa !20
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %94, i32 0, i32 5
  %96 = load i32, ptr %95, align 8, !tbaa !21
  %97 = call i32 @SwapBytes32(i32 noundef %96)
  %98 = load ptr, ptr %12, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %98, i32 0, i32 7
  store i32 %97, ptr %99, align 4, !tbaa !22
  br label %140

100:                                              ; preds = %68
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %101, i32 0, i32 1
  %103 = load i8, ptr %102, align 1, !tbaa !20
  %104 = zext i8 %103 to i32
  %105 = or i32 %104, 32
  %106 = trunc i32 %105 to i8
  store i8 %106, ptr %102, align 1, !tbaa !20
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %107, i32 0, i32 6
  %109 = load i32, ptr %108, align 4, !tbaa !24
  %110 = call i32 @SwapBytes32(i32 noundef %109)
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %111, i32 0, i32 7
  store i32 %110, ptr %112, align 4, !tbaa !22
  br label %140

113:                                              ; preds = %68
  %114 = load ptr, ptr %12, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %114, i32 0, i32 1
  %116 = load i8, ptr %115, align 1, !tbaa !20
  %117 = zext i8 %116 to i32
  %118 = or i32 %117, 96
  %119 = trunc i32 %118 to i8
  store i8 %119, ptr %115, align 1, !tbaa !20
  %120 = load ptr, ptr %5, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %120, i32 0, i32 6
  %122 = load i32, ptr %121, align 4, !tbaa !24
  %123 = call i32 @SwapBytes32(i32 noundef %122)
  %124 = load ptr, ptr %12, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %124, i32 0, i32 7
  store i32 %123, ptr %125, align 4, !tbaa !22
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %126, ptr %16, align 8, !tbaa !5
  %127 = load ptr, ptr %16, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct._ISCSI_BI_EXP_READ_DATA_LEN_AHS, ptr %127, i64 1
  store ptr %128, ptr %15, align 8, !tbaa !5
  %129 = call zeroext i16 @SwapBytes16(i16 noundef zeroext 5)
  %130 = load ptr, ptr %16, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct._ISCSI_BI_EXP_READ_DATA_LEN_AHS, ptr %130, i32 0, i32 0
  store i16 %129, ptr %131, align 4, !tbaa !25
  %132 = load ptr, ptr %16, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._ISCSI_BI_EXP_READ_DATA_LEN_AHS, ptr %132, i32 0, i32 1
  store i8 2, ptr %133, align 2, !tbaa !27
  %134 = load ptr, ptr %5, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %134, i32 0, i32 5
  %136 = load i32, ptr %135, align 8, !tbaa !21
  %137 = call i32 @SwapBytes32(i32 noundef %136)
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._ISCSI_BI_EXP_READ_DATA_LEN_AHS, ptr %138, i32 0, i32 3
  store i32 %137, ptr %139, align 4, !tbaa !28
  br label %140

140:                                              ; preds = %113, %100, %87, %68
  %141 = load i8, ptr %13, align 1, !tbaa !11
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %142, i32 0, i32 3
  store i8 %141, ptr %143, align 4, !tbaa !29
  %144 = load ptr, ptr %12, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %144, i32 0, i32 5
  %146 = getelementptr inbounds [8 x i8], ptr %145, i64 0, i64 0
  %147 = call ptr @CopyMem(ptr noundef %146, ptr noundef %6, i64 noundef 8)
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._ISCSI_TCB, ptr %148, i32 0, i32 8
  %150 = load i32, ptr %149, align 8, !tbaa !30
  %151 = call i32 @SwapBytes32(i32 noundef %150)
  %152 = load ptr, ptr %12, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %152, i32 0, i32 6
  store i32 %151, ptr %153, align 4, !tbaa !34
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct._ISCSI_TCB, ptr %154, i32 0, i32 9
  %156 = load i32, ptr %155, align 4, !tbaa !35
  %157 = call i32 @SwapBytes32(i32 noundef %156)
  %158 = load ptr, ptr %12, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %158, i32 0, i32 8
  store i32 %157, ptr %159, align 4, !tbaa !36
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct._ISCSI_TCB, ptr %160, i32 0, i32 12
  %162 = load ptr, ptr %161, align 8, !tbaa !37
  %163 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %162, i32 0, i32 13
  %164 = load i32, ptr %163, align 4, !tbaa !38
  %165 = call i32 @SwapBytes32(i32 noundef %164)
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %166, i32 0, i32 9
  store i32 %165, ptr %167, align 4, !tbaa !42
  %168 = load ptr, ptr %12, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct._SCSI_COMMAND, ptr %168, i32 0, i32 10
  %170 = getelementptr inbounds [16 x i8], ptr %169, i64 0, i64 0
  %171 = load ptr, ptr %5, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %171, i32 0, i32 4
  %173 = load ptr, ptr %172, align 8, !tbaa !43
  %174 = call ptr @CopyMem(ptr noundef %170, ptr noundef %173, i64 noundef 16)
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %175, i32 0, i32 7
  %177 = load i8, ptr %176, align 8, !tbaa !15
  %178 = zext i8 %177 to i32
  %179 = icmp sgt i32 %178, 16
  br i1 %179, label %180, label %205

180:                                              ; preds = %140
  %181 = load ptr, ptr %5, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %181, i32 0, i32 7
  %183 = load i8, ptr %182, align 8, !tbaa !15
  %184 = zext i8 %183 to i32
  %185 = sub nsw i32 %184, 15
  %186 = trunc i32 %185 to i16
  %187 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %186)
  %188 = load ptr, ptr %15, align 8, !tbaa !5
  %189 = getelementptr inbounds %struct._ISCSI_ADDTIONAL_HEADER, ptr %188, i32 0, i32 0
  store i16 %187, ptr %189, align 2, !tbaa !44
  %190 = load ptr, ptr %15, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._ISCSI_ADDTIONAL_HEADER, ptr %190, i32 0, i32 1
  store i8 1, ptr %191, align 2, !tbaa !46
  %192 = load ptr, ptr %15, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct._ISCSI_ADDTIONAL_HEADER, ptr %192, i64 1
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %194, i32 0, i32 4
  %196 = load ptr, ptr %195, align 8, !tbaa !43
  %197 = getelementptr inbounds i8, ptr %196, i64 16
  %198 = load ptr, ptr %5, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %198, i32 0, i32 7
  %200 = load i8, ptr %199, align 8, !tbaa !15
  %201 = zext i8 %200 to i32
  %202 = sub nsw i32 %201, 16
  %203 = sext i32 %202 to i64
  %204 = call ptr @CopyMem(ptr noundef %193, ptr noundef %197, i64 noundef %203)
  br label %205

205:                                              ; preds = %180, %140
  %206 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %206, ptr %9, align 8, !tbaa !5
  %207 = load ptr, ptr %7, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct._ISCSI_TCB, ptr %207, i32 0, i32 12
  %209 = load ptr, ptr %208, align 8, !tbaa !37
  %210 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %209, i32 0, i32 3
  %211 = load ptr, ptr %210, align 8, !tbaa !47
  store ptr %211, ptr %17, align 8, !tbaa !5
  store i32 0, ptr %18, align 4, !tbaa !16
  %212 = load ptr, ptr %17, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %212, i32 0, i32 19
  %214 = load i8, ptr %213, align 1, !tbaa !48
  %215 = zext i8 %214 to i32
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %321

217:                                              ; preds = %205
  %218 = load ptr, ptr %5, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %218, i32 0, i32 6
  %220 = load i32, ptr %219, align 4, !tbaa !24
  %221 = icmp ne i32 %220, 0
  br i1 %221, label %222, label %321

222:                                              ; preds = %217
  %223 = load ptr, ptr %17, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %223, i32 0, i32 21
  %225 = load i32, ptr %224, align 8, !tbaa !50
  %226 = load ptr, ptr %5, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %226, i32 0, i32 6
  %228 = load i32, ptr %227, align 4, !tbaa !24
  %229 = icmp ult i32 %225, %228
  br i1 %229, label %230, label %234

230:                                              ; preds = %222
  %231 = load ptr, ptr %17, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %231, i32 0, i32 21
  %233 = load i32, ptr %232, align 8, !tbaa !50
  br label %238

234:                                              ; preds = %222
  %235 = load ptr, ptr %5, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %235, i32 0, i32 6
  %237 = load i32, ptr %236, align 4, !tbaa !24
  br label %238

238:                                              ; preds = %234, %230
  %239 = phi i32 [ %233, %230 ], [ %237, %234 ]
  store i32 %239, ptr %18, align 4, !tbaa !16
  %240 = load i32, ptr %18, align 4, !tbaa !16
  %241 = load ptr, ptr %7, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct._ISCSI_TCB, ptr %241, i32 0, i32 12
  %243 = load ptr, ptr %242, align 8, !tbaa !37
  %244 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %243, i32 0, i32 17
  %245 = load i32, ptr %244, align 8, !tbaa !51
  %246 = icmp ult i32 %240, %245
  br i1 %246, label %247, label %249

247:                                              ; preds = %238
  %248 = load i32, ptr %18, align 4, !tbaa !16
  br label %255

249:                                              ; preds = %238
  %250 = load ptr, ptr %7, align 8, !tbaa !5
  %251 = getelementptr inbounds %struct._ISCSI_TCB, ptr %250, i32 0, i32 12
  %252 = load ptr, ptr %251, align 8, !tbaa !37
  %253 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %252, i32 0, i32 17
  %254 = load i32, ptr %253, align 8, !tbaa !51
  br label %255

255:                                              ; preds = %249, %247
  %256 = phi i32 [ %248, %247 ], [ %254, %249 ]
  store i32 %256, ptr %18, align 4, !tbaa !16
  br label %257

257:                                              ; preds = %255
  %258 = load i32, ptr %18, align 4, !tbaa !16
  %259 = lshr i32 %258, 16
  %260 = trunc i32 %259 to i8
  %261 = zext i8 %260 to i32
  %262 = and i32 %261, 255
  %263 = trunc i32 %262 to i8
  %264 = load ptr, ptr %12, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %264, i32 0, i32 4
  %266 = getelementptr inbounds [3 x i8], ptr %265, i64 0, i64 0
  store i8 %263, ptr %266, align 1, !tbaa !11
  %267 = load i32, ptr %18, align 4, !tbaa !16
  %268 = lshr i32 %267, 8
  %269 = trunc i32 %268 to i8
  %270 = zext i8 %269 to i32
  %271 = and i32 %270, 255
  %272 = trunc i32 %271 to i8
  %273 = load ptr, ptr %12, align 8, !tbaa !5
  %274 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %273, i32 0, i32 4
  %275 = getelementptr inbounds [3 x i8], ptr %274, i64 0, i64 1
  store i8 %272, ptr %275, align 1, !tbaa !11
  %276 = load i32, ptr %18, align 4, !tbaa !16
  %277 = trunc i32 %276 to i8
  %278 = zext i8 %277 to i32
  %279 = and i32 %278, 255
  %280 = trunc i32 %279 to i8
  %281 = load ptr, ptr %12, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %281, i32 0, i32 4
  %283 = getelementptr inbounds [3 x i8], ptr %282, i64 0, i64 2
  store i8 %280, ptr %283, align 1, !tbaa !11
  br label %284

284:                                              ; preds = %257
  br label %285

285:                                              ; preds = %284
  %286 = load ptr, ptr %5, align 8, !tbaa !5
  %287 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %286, i32 0, i32 2
  %288 = load ptr, ptr %287, align 8, !tbaa !52
  %289 = load i32, ptr %18, align 4, !tbaa !16
  %290 = call ptr @IScsiNewDataSegment(ptr noundef %288, i32 noundef %289, i8 noundef zeroext 0)
  store ptr %290, ptr %11, align 8, !tbaa !5
  %291 = load ptr, ptr %11, align 8, !tbaa !5
  %292 = icmp eq ptr %291, null
  br i1 %292, label %293, label %295

293:                                              ; preds = %285
  %294 = load ptr, ptr %10, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %294)
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %347

295:                                              ; preds = %285
  %296 = call ptr @AllocatePool(i64 noundef 16)
  store ptr %296, ptr %8, align 8, !tbaa !5
  %297 = load ptr, ptr %8, align 8, !tbaa !5
  %298 = icmp eq ptr %297, null
  br i1 %298, label %299, label %302

299:                                              ; preds = %295
  %300 = load ptr, ptr %10, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %300)
  %301 = load ptr, ptr %11, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %301)
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %347

302:                                              ; preds = %295
  %303 = load ptr, ptr %8, align 8, !tbaa !5
  %304 = call ptr @InitializeListHead(ptr noundef %303)
  %305 = load ptr, ptr %8, align 8, !tbaa !5
  %306 = load ptr, ptr %10, align 8, !tbaa !5
  %307 = getelementptr inbounds %struct.NET_BUF, ptr %306, i32 0, i32 2
  %308 = call ptr @InsertTailList(ptr noundef %305, ptr noundef %307)
  %309 = load ptr, ptr %8, align 8, !tbaa !5
  %310 = load ptr, ptr %11, align 8, !tbaa !5
  %311 = getelementptr inbounds %struct.NET_BUF, ptr %310, i32 0, i32 2
  %312 = call ptr @InsertTailList(ptr noundef %309, ptr noundef %311)
  %313 = load ptr, ptr %8, align 8, !tbaa !5
  %314 = load ptr, ptr %8, align 8, !tbaa !5
  %315 = call ptr @NetbufFromBufList(ptr noundef %313, i32 noundef 0, i32 noundef 0, ptr noundef @IScsiFreeNbufList, ptr noundef %314)
  store ptr %315, ptr %9, align 8, !tbaa !5
  %316 = load ptr, ptr %9, align 8, !tbaa !5
  %317 = icmp eq ptr %316, null
  br i1 %317, label %318, label %320

318:                                              ; preds = %302
  %319 = load ptr, ptr %8, align 8, !tbaa !5
  call void @IScsiFreeNbufList(ptr noundef %319)
  br label %320

320:                                              ; preds = %318, %302
  br label %321

321:                                              ; preds = %320, %217, %205
  %322 = load ptr, ptr %17, align 8, !tbaa !5
  %323 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %322, i32 0, i32 18
  %324 = load i8, ptr %323, align 8, !tbaa !53
  %325 = zext i8 %324 to i32
  %326 = icmp ne i32 %325, 0
  br i1 %326, label %339, label %327

327:                                              ; preds = %321
  %328 = load i32, ptr %18, align 4, !tbaa !16
  %329 = load ptr, ptr %17, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %329, i32 0, i32 21
  %331 = load i32, ptr %330, align 8, !tbaa !50
  %332 = icmp eq i32 %328, %331
  br i1 %332, label %339, label %333

333:                                              ; preds = %327
  %334 = load i32, ptr %18, align 4, !tbaa !16
  %335 = load ptr, ptr %5, align 8, !tbaa !5
  %336 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %335, i32 0, i32 6
  %337 = load i32, ptr %336, align 4, !tbaa !24
  %338 = icmp eq i32 %334, %337
  br i1 %338, label %339, label %346

339:                                              ; preds = %333, %327, %321
  %340 = load ptr, ptr %12, align 8, !tbaa !5
  %341 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %340, i32 0, i32 1
  %342 = load i8, ptr %341, align 1, !tbaa !20
  %343 = zext i8 %342 to i32
  %344 = or i32 %343, 128
  %345 = trunc i32 %344 to i8
  store i8 %345, ptr %341, align 1, !tbaa !20
  br label %346

346:                                              ; preds = %339, %333
  br label %347

347:                                              ; preds = %346, %299, %293
  %348 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %348, ptr %4, align 8
  store i32 1, ptr %19, align 4
  br label %349

349:                                              ; preds = %347, %66, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  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 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %350 = load ptr, ptr %4, align 8
  ret ptr %350
}

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 = !{!"long long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 49}
!13 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !14, i64 40, !14, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!14 = !{!"int", !7, i64 0}
!15 = !{!13, !7, i64 48}
!16 = !{!14, !14, i64 0}
!17 = !{!18, !7, i64 0}
!18 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !19, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !14, i64 16, !7, i64 20}
!19 = !{!"short", !7, i64 0}
!20 = !{!18, !7, i64 1}
!21 = !{!13, !14, i64 40}
!22 = !{!23, !14, i64 20}
!23 = !{!"_SCSI_COMMAND", !7, i64 0, !7, i64 1, !19, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !14, i64 16, !14, i64 20, !14, i64 24, !14, i64 28, !7, i64 32}
!24 = !{!13, !14, i64 44}
!25 = !{!26, !19, i64 0}
!26 = !{!"_ISCSI_BI_EXP_READ_DATA_LEN_AHS", !19, i64 0, !7, i64 2, !7, i64 3, !14, i64 4}
!27 = !{!26, !7, i64 2}
!28 = !{!26, !14, i64 4}
!29 = !{!23, !7, i64 4}
!30 = !{!31, !14, i64 48}
!31 = !{!"_ISCSI_TCB", !32, i64 0, !7, i64 16, !14, i64 20, !7, i64 24, !7, i64 25, !14, i64 28, !14, i64 32, !6, i64 40, !14, i64 48, !14, i64 52, !14, i64 56, !33, i64 60, !6, i64 80}
!32 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!33 = !{!"_ISCSI_XFER_CONTEXT", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12}
!34 = !{!23, !14, i64 16}
!35 = !{!31, !14, i64 52}
!36 = !{!23, !14, i64 24}
!37 = !{!31, !6, i64 80}
!38 = !{!39, !14, i64 52}
!39 = !{!"_ISCSI_CONNECTION", !14, i64 0, !32, 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, !19, i64 48, !14, i64 52, !40, i64 56, !7, i64 112, !41, i64 120, !14, i64 288, !14, i64 292, !14, i64 296}
!40 = !{!"", !14, i64 0, !10, i64 8, !32, i64 16, !32, i64 32, !14, i64 48, !14, i64 52}
!41 = !{!"", !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}
!42 = !{!23, !14, i64 28}
!43 = !{!13, !6, i64 32}
!44 = !{!45, !19, i64 0}
!45 = !{!"_ISCSI_ADDTIONAL_HEADER", !19, i64 0, !7, i64 2, !7, i64 3}
!46 = !{!45, !7, i64 2}
!47 = !{!39, !6, i64 32}
!48 = !{!49, !7, i64 2201}
!49 = !{!"_ISCSI_SESSION", !14, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 32, !7, i64 2120, !7, i64 2121, !19, i64 2128, !14, i64 2132, !14, i64 2136, !14, i64 2140, !14, i64 2144, !19, i64 2148, !32, i64 2152, !14, i64 2168, !32, i64 2176, !19, i64 2192, !14, i64 2196, !7, i64 2200, !7, i64 2201, !14, i64 2204, !14, i64 2208, !14, i64 2212, !14, i64 2216, !19, i64 2220, !7, i64 2222, !7, i64 2223, !7, i64 2224}
!50 = !{!49, !14, i64 2208}
!51 = !{!39, !14, i64 288}
!52 = !{!13, !6, i64 16}
!53 = !{!49, !7, i64 2200}


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

declare ptr @InsertTailList(ptr noundef, 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 void @NetbufFree(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 zeroext i16 @SwapBytes16(i16 noundef zeroext) 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 @IScsiNewScsiCmdPdu(ptr nocapture noundef readonly %0, i64 noundef %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %4 = alloca i64, align 8
  store i64 %1, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 49
  %6 = load i8, ptr %5, align 1, !tbaa !9
  %7 = icmp eq i8 %6, 2
  %spec.select = select i1 %7, i8 8, i8 0
  %8 = getelementptr inbounds i8, ptr %0, i64 48
  %9 = load i8, ptr %8, align 8, !tbaa !13
  %10 = icmp ugt i8 %9, 16
  %11 = add i8 %9, -13
  %12 = add i8 %11, %spec.select
  %13 = and i8 %12, -4
  %14 = add i8 %13, 4
  %.196 = select i1 %10, i8 %14, i8 %spec.select
  %15 = zext i8 %.196 to i32
  %16 = add nuw nsw i32 %15, 48
  %17 = tail call ptr @NetbufAlloc(i32 noundef %16) #3
  %18 = icmp eq ptr %17, null
  br i1 %18, label %138, label %19

19:                                               ; preds = %3
  %20 = tail call ptr @NetbufAllocSpace(ptr noundef nonnull %17, i32 noundef %16, i8 noundef zeroext 0) #3
  %21 = icmp eq ptr %20, null
  br i1 %21, label %22, label %23

22:                                               ; preds = %19
  tail call void @NetbufFree(ptr noundef nonnull %17) #3
  br label %138

23:                                               ; preds = %19
  %24 = getelementptr inbounds i8, ptr %20, i64 48
  %25 = zext nneg i32 %16 to i64
  %26 = tail call ptr @ZeroMem(ptr noundef nonnull %20, i64 noundef %25) #3
  store i8 1, ptr %20, align 4, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %20, i64 1
  %28 = load i8, ptr %27, align 1, !tbaa !17
  %29 = or i8 %28, 1
  store i8 %29, ptr %27, align 1, !tbaa !17
  %30 = load i8, ptr %5, align 1, !tbaa !9
  switch i8 %30, label %47 [
    i8 0, label %31
    i8 1, label %33
    i8 2, label %35
  ]

31:                                               ; preds = %23
  %32 = or i8 %28, 65
  store i8 %32, ptr %27, align 1, !tbaa !17
  br label %.sink.split

33:                                               ; preds = %23
  %34 = or i8 %28, 33
  store i8 %34, ptr %27, align 1, !tbaa !17
  br label %.sink.split

35:                                               ; preds = %23
  %36 = or i8 %28, 97
  store i8 %36, ptr %27, align 1, !tbaa !17
  %37 = getelementptr inbounds i8, ptr %0, i64 44
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = tail call i32 @SwapBytes32(i32 noundef %38) #3
  %40 = getelementptr inbounds i8, ptr %20, i64 20
  store i32 %39, ptr %40, align 4, !tbaa !19
  %41 = getelementptr inbounds i8, ptr %20, i64 56
  %42 = tail call zeroext i16 @SwapBytes16(i16 noundef zeroext 5) #3
  store i16 %42, ptr %24, align 4, !tbaa !21
  %43 = getelementptr inbounds i8, ptr %20, i64 50
  store i8 2, ptr %43, align 2, !tbaa !23
  br label %.sink.split

.sink.split:                                      ; preds = %31, %33, %35
  %.sink = phi i64 [ 40, %31 ], [ 44, %33 ], [ 40, %35 ]
  %.sink112 = phi i64 [ 20, %31 ], [ 20, %33 ], [ 52, %35 ]
  %.094.ph = phi ptr [ %24, %31 ], [ %24, %33 ], [ %41, %35 ]
  %44 = getelementptr inbounds i8, ptr %0, i64 %.sink
  %.sink113 = load i32, ptr %44, align 4, !tbaa !24
  %45 = tail call i32 @SwapBytes32(i32 noundef %.sink113) #3
  %46 = getelementptr inbounds i8, ptr %20, i64 %.sink112
  store i32 %45, ptr %46, align 4, !tbaa !24
  br label %47

47:                                               ; preds = %.sink.split, %23
  %.094 = phi ptr [ %24, %23 ], [ %.094.ph, %.sink.split ]
  %48 = getelementptr inbounds i8, ptr %20, i64 4
  store i8 %.196, ptr %48, align 4, !tbaa !25
  %49 = getelementptr inbounds i8, ptr %20, i64 8
  %50 = call ptr @CopyMem(ptr noundef nonnull %49, ptr noundef nonnull %4, i64 noundef 8) #3
  %51 = getelementptr inbounds i8, ptr %2, i64 48
  %52 = load i32, ptr %51, align 8, !tbaa !26
  %53 = call i32 @SwapBytes32(i32 noundef %52) #3
  %54 = getelementptr inbounds i8, ptr %20, i64 16
  store i32 %53, ptr %54, align 4, !tbaa !30
  %55 = getelementptr inbounds i8, ptr %2, i64 52
  %56 = load i32, ptr %55, align 4, !tbaa !31
  %57 = call i32 @SwapBytes32(i32 noundef %56) #3
  %58 = getelementptr inbounds i8, ptr %20, i64 24
  store i32 %57, ptr %58, align 4, !tbaa !32
  %59 = getelementptr inbounds i8, ptr %2, i64 80
  %60 = load ptr, ptr %59, align 8, !tbaa !33
  %61 = getelementptr inbounds i8, ptr %60, i64 52
  %62 = load i32, ptr %61, align 4, !tbaa !34
  %63 = call i32 @SwapBytes32(i32 noundef %62) #3
  %64 = getelementptr inbounds i8, ptr %20, i64 28
  store i32 %63, ptr %64, align 4, !tbaa !38
  %65 = getelementptr inbounds i8, ptr %20, i64 32
  %66 = getelementptr inbounds i8, ptr %0, i64 32
  %67 = load ptr, ptr %66, align 8, !tbaa !39
  %68 = call ptr @CopyMem(ptr noundef nonnull %65, ptr noundef %67, i64 noundef 16) #3
  %69 = load i8, ptr %8, align 8, !tbaa !13
  %70 = icmp ugt i8 %69, 16
  br i1 %70, label %71, label %83

71:                                               ; preds = %47
  %72 = zext i8 %69 to i16
  %73 = add nsw i16 %72, -15
  %74 = call zeroext i16 @SwapBytes16(i16 noundef zeroext %73) #3
  store i16 %74, ptr %.094, align 2, !tbaa !40
  %75 = getelementptr inbounds i8, ptr %.094, i64 2
  store i8 1, ptr %75, align 2, !tbaa !42
  %76 = getelementptr inbounds i8, ptr %.094, i64 4
  %77 = load ptr, ptr %66, align 8, !tbaa !39
  %78 = getelementptr inbounds i8, ptr %77, i64 16
  %79 = load i8, ptr %8, align 8, !tbaa !13
  %80 = zext i8 %79 to i64
  %81 = add nsw i64 %80, -16
  %82 = call ptr @CopyMem(ptr noundef nonnull %76, ptr noundef nonnull %78, i64 noundef %81) #3
  br label %83

83:                                               ; preds = %71, %47
  %84 = load ptr, ptr %59, align 8, !tbaa !33
  %85 = getelementptr inbounds i8, ptr %84, i64 32
  %86 = load ptr, ptr %85, align 8, !tbaa !43
  %87 = getelementptr inbounds i8, ptr %86, i64 2201
  %88 = load i8, ptr %87, align 1, !tbaa !44
  %.not = icmp eq i8 %88, 0
  br i1 %.not, label %124, label %89

89:                                               ; preds = %83
  %90 = getelementptr inbounds i8, ptr %0, i64 44
  %91 = load i32, ptr %90, align 4, !tbaa !18
  %.not109 = icmp eq i32 %91, 0
  br i1 %.not109, label %124, label %92

92:                                               ; preds = %89
  %93 = getelementptr inbounds i8, ptr %86, i64 2208
  %94 = load i32, ptr %93, align 8, !tbaa !46
  %. = call i32 @llvm.umin.i32(i32 %94, i32 %91)
  %95 = getelementptr inbounds i8, ptr %84, i64 288
  %96 = load i32, ptr %95, align 8, !tbaa !47
  %97 = call i32 @llvm.umin.i32(i32 %., i32 %96)
  %98 = lshr i32 %97, 16
  %99 = trunc i32 %98 to i8
  %100 = getelementptr inbounds i8, ptr %20, i64 5
  store i8 %99, ptr %100, align 1, !tbaa !48
  %101 = lshr i32 %97, 8
  %102 = trunc i32 %101 to i8
  %103 = getelementptr inbounds i8, ptr %20, i64 6
  store i8 %102, ptr %103, align 1, !tbaa !48
  %104 = trunc i32 %97 to i8
  %105 = getelementptr inbounds i8, ptr %20, i64 7
  store i8 %104, ptr %105, align 1, !tbaa !48
  %106 = getelementptr inbounds i8, ptr %0, i64 16
  %107 = load ptr, ptr %106, align 8, !tbaa !49
  %108 = call ptr @IScsiNewDataSegment(ptr noundef %107, i32 noundef %97, i8 noundef zeroext 0)
  %109 = icmp eq ptr %108, null
  br i1 %109, label %110, label %111

110:                                              ; preds = %92
  call void @NetbufFree(ptr noundef nonnull %17) #3
  br label %138

111:                                              ; preds = %92
  %112 = call ptr @AllocatePool(i64 noundef 16) #3
  %113 = icmp eq ptr %112, null
  br i1 %113, label %114, label %115

114:                                              ; preds = %111
  call void @NetbufFree(ptr noundef nonnull %17) #3
  call void @NetbufFree(ptr noundef nonnull %108) #3
  br label %138

115:                                              ; preds = %111
  %116 = call ptr @InitializeListHead(ptr noundef nonnull %112) #3
  %117 = getelementptr inbounds i8, ptr %17, i64 16
  %118 = call ptr @InsertTailList(ptr noundef nonnull %112, ptr noundef nonnull %117) #3
  %119 = getelementptr inbounds i8, ptr %108, i64 16
  %120 = call ptr @InsertTailList(ptr noundef nonnull %112, ptr noundef nonnull %119) #3
  %121 = call ptr @NetbufFromBufList(ptr noundef nonnull %112, i32 noundef 0, i32 noundef 0, ptr noundef nonnull @IScsiFreeNbufList, ptr noundef nonnull %112) #3
  %122 = icmp eq ptr %121, null
  br i1 %122, label %123, label %124

123:                                              ; preds = %115
  call void @IScsiFreeNbufList(ptr noundef nonnull %112)
  br label %124

124:                                              ; preds = %115, %123, %89, %83
  %.093 = phi ptr [ null, %123 ], [ %121, %115 ], [ %17, %89 ], [ %17, %83 ]
  %.0 = phi i32 [ %97, %123 ], [ %97, %115 ], [ 0, %89 ], [ 0, %83 ]
  %125 = getelementptr inbounds i8, ptr %86, i64 2200
  %126 = load i8, ptr %125, align 8, !tbaa !50
  %.not110 = icmp eq i8 %126, 0
  br i1 %.not110, label %127, label %135

127:                                              ; preds = %124
  %128 = getelementptr inbounds i8, ptr %86, i64 2208
  %129 = load i32, ptr %128, align 8, !tbaa !46
  %130 = icmp eq i32 %.0, %129
  br i1 %130, label %135, label %131

131:                                              ; preds = %127
  %132 = getelementptr inbounds i8, ptr %0, i64 44
  %133 = load i32, ptr %132, align 4, !tbaa !18
  %134 = icmp eq i32 %.0, %133
  br i1 %134, label %135, label %138

135:                                              ; preds = %131, %127, %124
  %136 = load i8, ptr %27, align 1, !tbaa !17
  %137 = or i8 %136, -128
  store i8 %137, ptr %27, align 1, !tbaa !17
  br label %138

138:                                              ; preds = %110, %114, %135, %131, %3, %22
  %.092 = phi ptr [ null, %22 ], [ null, %3 ], [ null, %110 ], [ null, %114 ], [ %.093, %135 ], [ %.093, %131 ]
  ret ptr %.092
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #2

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !7, i64 49}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !12, i64 40, !12, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!10, !7, i64 48}
!14 = !{!15, !7, i64 0}
!15 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !16, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !12, i64 16, !7, i64 20}
!16 = !{!"short", !7, i64 0}
!17 = !{!15, !7, i64 1}
!18 = !{!10, !12, i64 44}
!19 = !{!20, !12, i64 20}
!20 = !{!"_SCSI_COMMAND", !7, i64 0, !7, i64 1, !16, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !7, i64 32}
!21 = !{!22, !16, i64 0}
!22 = !{!"_ISCSI_BI_EXP_READ_DATA_LEN_AHS", !16, i64 0, !7, i64 2, !7, i64 3, !12, i64 4}
!23 = !{!22, !7, i64 2}
!24 = !{!12, !12, i64 0}
!25 = !{!20, !7, i64 4}
!26 = !{!27, !12, i64 48}
!27 = !{!"_ISCSI_TCB", !28, i64 0, !7, i64 16, !12, i64 20, !7, i64 24, !7, i64 25, !12, i64 28, !12, i64 32, !11, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !29, i64 60, !11, i64 80}
!28 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!29 = !{!"_ISCSI_XFER_CONTEXT", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12}
!30 = !{!20, !12, i64 16}
!31 = !{!27, !12, i64 52}
!32 = !{!20, !12, i64 24}
!33 = !{!27, !11, i64 80}
!34 = !{!35, !12, i64 52}
!35 = !{!"_ISCSI_CONNECTION", !12, i64 0, !28, i64 8, !11, i64 24, !11, 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, !16, i64 48, !12, i64 52, !36, i64 56, !7, i64 112, !37, i64 120, !12, i64 288, !12, i64 292, !12, i64 296}
!36 = !{!"", !12, i64 0, !6, i64 8, !28, i64 16, !28, i64 32, !12, i64 48, !12, i64 52}
!37 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16, !11, 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}
!38 = !{!20, !12, i64 28}
!39 = !{!10, !11, i64 32}
!40 = !{!41, !16, i64 0}
!41 = !{!"_ISCSI_ADDTIONAL_HEADER", !16, i64 0, !7, i64 2, !7, i64 3}
!42 = !{!41, !7, i64 2}
!43 = !{!35, !11, i64 32}
!44 = !{!45, !7, i64 2201}
!45 = !{!"_ISCSI_SESSION", !12, i64 0, !11, i64 8, !11, i64 16, !7, i64 24, !7, i64 32, !7, i64 2120, !7, i64 2121, !16, i64 2128, !12, i64 2132, !12, i64 2136, !12, i64 2140, !12, i64 2144, !16, i64 2148, !28, i64 2152, !12, i64 2168, !28, i64 2176, !16, i64 2192, !12, i64 2196, !7, i64 2200, !7, i64 2201, !12, i64 2204, !12, i64 2208, !12, i64 2212, !12, i64 2216, !16, i64 2220, !7, i64 2222, !7, i64 2223, !7, i64 2224}
!46 = !{!45, !12, i64 2208}
!47 = !{!35, !12, i64 288}
!48 = !{!7, !7, i64 0}
!49 = !{!10, !11, i64 16}
!50 = !{!45, !7, i64 2200}


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