; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/MdeModulePkg/Universal (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, i16, i32, %struct.NET_BUF_QUEUE, %struct._TCP4_IO, i32, i32, i32 }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct._TCP4_IO = type { ptr, ptr, ptr, ptr, %struct.EFI_TCP4_CONNECTION_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_CLOSE_TOKEN, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon }
%union.anon = type { ptr }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%struct._ISCSI_ADDTIONAL_HEADER = type { i16, i8, [1 x i8] }
%struct._ISCSI_SESSION = type { i32, %struct._ISCSI_SESSION_CONFIG_DATA, %struct._ISCSI_CHAP_AUTH_DATA, [224 x i8], i64, 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 }
%struct._ISCSI_SESSION_CONFIG_DATA = type { %struct.ISCSI_SESSION_CONFIG_NVDATA, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.ISCSI_SESSION_CONFIG_NVDATA = type <{ i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, [224 x i8], %struct.EFI_IPv4_ADDRESS, i16, [8 x i8], [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._ISCSI_CHAP_AUTH_DATA = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%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 @AllocatePool(i64 noundef) #0

declare ptr @CopyMem(ptr noundef, 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 ptr @ZeroMem(ptr noundef, i64 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 @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 i64
  %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 = sext i32 %45 to i64
  %47 = add i64 %46, 4
  %48 = add i64 %38, %47
  %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 %343

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 %343

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 12
  %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 !45
  %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 !46
  %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 !47
  %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 !49
  %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 !46
  %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 !50
  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 !51
  %215 = zext i8 %214 to i32
  %216 = icmp ne i32 %215, 0
  br i1 %216, label %217, label %315

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 %315

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 !58
  %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 !58
  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 15
  %245 = load i32, ptr %244, align 8, !tbaa !59
  %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 15
  %254 = load i32, ptr %253, align 8, !tbaa !59
  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 = and i32 %259, 255
  %261 = trunc i32 %260 to i8
  %262 = load ptr, ptr %12, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %262, i32 0, i32 4
  %264 = getelementptr inbounds [3 x i8], ptr %263, i64 0, i64 0
  store i8 %261, ptr %264, align 1, !tbaa !11
  %265 = load i32, ptr %18, align 4, !tbaa !16
  %266 = lshr i32 %265, 8
  %267 = and i32 %266, 255
  %268 = trunc i32 %267 to i8
  %269 = load ptr, ptr %12, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %269, i32 0, i32 4
  %271 = getelementptr inbounds [3 x i8], ptr %270, i64 0, i64 1
  store i8 %268, ptr %271, align 1, !tbaa !11
  %272 = load i32, ptr %18, align 4, !tbaa !16
  %273 = and i32 %272, 255
  %274 = trunc i32 %273 to i8
  %275 = load ptr, ptr %12, align 8, !tbaa !5
  %276 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %275, i32 0, i32 4
  %277 = getelementptr inbounds [3 x i8], ptr %276, i64 0, i64 2
  store i8 %274, ptr %277, align 1, !tbaa !11
  br label %278

278:                                              ; preds = %257
  br label %279

279:                                              ; preds = %278
  %280 = load ptr, ptr %5, align 8, !tbaa !5
  %281 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %280, i32 0, i32 2
  %282 = load ptr, ptr %281, align 8, !tbaa !60
  %283 = load i32, ptr %18, align 4, !tbaa !16
  %284 = call ptr @IScsiNewDataSegment(ptr noundef %282, i32 noundef %283, i8 noundef zeroext 0)
  store ptr %284, ptr %11, align 8, !tbaa !5
  %285 = load ptr, ptr %11, align 8, !tbaa !5
  %286 = icmp eq ptr %285, null
  br i1 %286, label %287, label %289

287:                                              ; preds = %279
  %288 = load ptr, ptr %10, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %288)
  store ptr null, ptr %9, align 8, !tbaa !5
  br label %341

289:                                              ; preds = %279
  %290 = call ptr @AllocatePool(i64 noundef 16)
  store ptr %290, ptr %8, align 8, !tbaa !5
  %291 = load ptr, ptr %8, align 8, !tbaa !5
  %292 = icmp eq ptr %291, null
  br i1 %292, label %293, label %296

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

296:                                              ; preds = %289
  %297 = load ptr, ptr %8, align 8, !tbaa !5
  %298 = call ptr @InitializeListHead(ptr noundef %297)
  %299 = load ptr, ptr %8, align 8, !tbaa !5
  %300 = load ptr, ptr %10, align 8, !tbaa !5
  %301 = getelementptr inbounds %struct.NET_BUF, ptr %300, i32 0, i32 2
  %302 = call ptr @InsertTailList(ptr noundef %299, ptr noundef %301)
  %303 = load ptr, ptr %8, align 8, !tbaa !5
  %304 = load ptr, ptr %11, align 8, !tbaa !5
  %305 = getelementptr inbounds %struct.NET_BUF, ptr %304, i32 0, i32 2
  %306 = call ptr @InsertTailList(ptr noundef %303, ptr noundef %305)
  %307 = load ptr, ptr %8, align 8, !tbaa !5
  %308 = load ptr, ptr %8, align 8, !tbaa !5
  %309 = call ptr @NetbufFromBufList(ptr noundef %307, i32 noundef 0, i32 noundef 0, ptr noundef @IScsiFreeNbufList, ptr noundef %308)
  store ptr %309, ptr %9, align 8, !tbaa !5
  %310 = load ptr, ptr %9, align 8, !tbaa !5
  %311 = icmp eq ptr %310, null
  br i1 %311, label %312, label %314

312:                                              ; preds = %296
  %313 = load ptr, ptr %8, align 8, !tbaa !5
  call void @IScsiFreeNbufList(ptr noundef %313)
  br label %314

314:                                              ; preds = %312, %296
  br label %315

315:                                              ; preds = %314, %217, %205
  %316 = load ptr, ptr %17, align 8, !tbaa !5
  %317 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %316, i32 0, i32 18
  %318 = load i8, ptr %317, align 8, !tbaa !61
  %319 = zext i8 %318 to i32
  %320 = icmp ne i32 %319, 0
  br i1 %320, label %333, label %321

321:                                              ; preds = %315
  %322 = load i32, ptr %18, align 4, !tbaa !16
  %323 = load ptr, ptr %17, align 8, !tbaa !5
  %324 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %323, i32 0, i32 21
  %325 = load i32, ptr %324, align 8, !tbaa !58
  %326 = icmp eq i32 %322, %325
  br i1 %326, label %333, label %327

327:                                              ; preds = %321
  %328 = load i32, ptr %18, align 4, !tbaa !16
  %329 = load ptr, ptr %5, align 8, !tbaa !5
  %330 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %329, i32 0, i32 6
  %331 = load i32, ptr %330, align 4, !tbaa !24
  %332 = icmp eq i32 %328, %331
  br i1 %332, label %333, label %340

333:                                              ; preds = %327, %321, %315
  %334 = load ptr, ptr %12, align 8, !tbaa !5
  %335 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %334, i32 0, i32 1
  %336 = load i8, ptr %335, align 1, !tbaa !20
  %337 = zext i8 %336 to i32
  %338 = or i32 %337, 128
  %339 = trunc i32 %338 to i8
  store i8 %339, ptr %335, align 1, !tbaa !20
  br label %340

340:                                              ; preds = %333, %327
  br label %341

341:                                              ; preds = %340, %293, %287
  %342 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %342, ptr %4, align 8
  store i32 1, ptr %19, align 4
  br label %343

343:                                              ; preds = %341, %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
  %344 = load ptr, ptr %4, align 8
  ret ptr %344
}

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, !19, i64 48, !14, i64 52, !40, i64 56, !41, i64 112, !14, i64 240, !14, i64 244, !14, i64 248}
!40 = !{!"", !14, i64 0, !10, i64 8, !32, i64 16, !32, i64 32, !14, i64 48, !14, i64 52}
!41 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !42, i64 32, !44, i64 48, !44, i64 72, !44, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!42 = !{!"", !43, i64 0}
!43 = !{!"", !6, i64 0, !10, i64 8}
!44 = !{!"", !43, i64 0, !7, i64 16}
!45 = !{!23, !14, i64 28}
!46 = !{!13, !6, i64 32}
!47 = !{!48, !19, i64 0}
!48 = !{!"_ISCSI_ADDTIONAL_HEADER", !19, i64 0, !7, i64 2, !7, i64 3}
!49 = !{!48, !7, i64 2}
!50 = !{!39, !6, i64 32}
!51 = !{!52, !7, i64 2961}
!52 = !{!"_ISCSI_SESSION", !14, i64 0, !53, i64 4, !56, i64 276, !7, i64 2648, !10, i64 2872, !7, i64 2880, !7, i64 2881, !19, i64 2888, !14, i64 2892, !14, i64 2896, !14, i64 2900, !14, i64 2904, !19, i64 2908, !32, i64 2912, !14, i64 2928, !32, i64 2936, !19, i64 2952, !14, i64 2956, !7, i64 2960, !7, i64 2961, !14, i64 2964, !14, i64 2968, !14, i64 2972, !14, i64 2976, !19, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!53 = !{!"_ISCSI_SESSION_CONFIG_DATA", !54, i64 0, !55, i64 259, !55, i64 263, !55, i64 267}
!54 = !{!"", !7, i64 0, !7, i64 1, !55, i64 2, !55, i64 6, !55, i64 10, !7, i64 14, !7, i64 15, !55, i64 239, !19, i64 243, !7, i64 245, !7, i64 253}
!55 = !{!"", !7, i64 0}
!56 = !{!"_ISCSI_CHAP_AUTH_DATA", !57, i64 0, !14, i64 292, !7, i64 296, !14, i64 1320, !7, i64 1324, !14, i64 1340, !7, i64 1344, !14, i64 2368}
!57 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!58 = !{!52, !14, i64 2968}
!59 = !{!39, !14, i64 240}
!60 = !{!13, !6, i64 16}
!61 = !{!52, !7, i64 2960}


; 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 @AllocatePool(i64 noundef) local_unnamed_addr #0

declare ptr @CopyMem(ptr noundef, 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 ptr @ZeroMem(ptr noundef, i64 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 @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 = and i8 %11, -4
  %13 = add i8 %12, 4
  %14 = select i1 %10, i8 %13, i8 0
  %.196 = add i8 %14, %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 !41
  %65 = getelementptr inbounds i8, ptr %20, i64 32
  %66 = getelementptr inbounds i8, ptr %0, i64 32
  %67 = load ptr, ptr %66, align 8, !tbaa !42
  %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 !43
  %75 = getelementptr inbounds i8, ptr %.094, i64 2
  store i8 1, ptr %75, align 2, !tbaa !45
  %76 = getelementptr inbounds i8, ptr %.094, i64 4
  %77 = load ptr, ptr %66, align 8, !tbaa !42
  %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 !46
  %87 = getelementptr inbounds i8, ptr %86, i64 2961
  %88 = load i8, ptr %87, align 1, !tbaa !47
  %.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 2968
  %94 = load i32, ptr %93, align 8, !tbaa !54
  %. = call i32 @llvm.umin.i32(i32 %94, i32 %91)
  %95 = getelementptr inbounds i8, ptr %84, i64 240
  %96 = load i32, ptr %95, align 8, !tbaa !55
  %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 !56
  %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 !56
  %104 = trunc i32 %97 to i8
  %105 = getelementptr inbounds i8, ptr %20, i64 7
  store i8 %104, ptr %105, align 1, !tbaa !56
  %106 = getelementptr inbounds i8, ptr %0, i64 16
  %107 = load ptr, ptr %106, align 8, !tbaa !57
  %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 2960
  %126 = load i8, ptr %125, align 8, !tbaa !58
  %.not110 = icmp eq i8 %126, 0
  br i1 %.not110, label %127, label %135

127:                                              ; preds = %124
  %128 = getelementptr inbounds i8, ptr %86, i64 2968
  %129 = load i32, ptr %128, align 8, !tbaa !54
  %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, !16, i64 48, !12, i64 52, !36, i64 56, !37, i64 112, !12, i64 240, !12, i64 244, !12, i64 248}
!36 = !{!"", !12, i64 0, !6, i64 8, !28, i64 16, !28, i64 32, !12, i64 48, !12, i64 52}
!37 = !{!"_TCP4_IO", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !38, i64 32, !40, i64 48, !40, i64 72, !40, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!38 = !{!"", !39, i64 0}
!39 = !{!"", !11, i64 0, !6, i64 8}
!40 = !{!"", !39, i64 0, !7, i64 16}
!41 = !{!20, !12, i64 28}
!42 = !{!10, !11, i64 32}
!43 = !{!44, !16, i64 0}
!44 = !{!"_ISCSI_ADDTIONAL_HEADER", !16, i64 0, !7, i64 2, !7, i64 3}
!45 = !{!44, !7, i64 2}
!46 = !{!35, !11, i64 32}
!47 = !{!48, !7, i64 2961}
!48 = !{!"_ISCSI_SESSION", !12, i64 0, !49, i64 4, !52, i64 276, !7, i64 2648, !6, i64 2872, !7, i64 2880, !7, i64 2881, !16, i64 2888, !12, i64 2892, !12, i64 2896, !12, i64 2900, !12, i64 2904, !16, i64 2908, !28, i64 2912, !12, i64 2928, !28, i64 2936, !16, i64 2952, !12, i64 2956, !7, i64 2960, !7, i64 2961, !12, i64 2964, !12, i64 2968, !12, i64 2972, !12, i64 2976, !16, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!49 = !{!"_ISCSI_SESSION_CONFIG_DATA", !50, i64 0, !51, i64 259, !51, i64 263, !51, i64 267}
!50 = !{!"", !7, i64 0, !7, i64 1, !51, i64 2, !51, i64 6, !51, i64 10, !7, i64 14, !7, i64 15, !51, i64 239, !16, i64 243, !7, i64 245, !7, i64 253}
!51 = !{!"", !7, i64 0}
!52 = !{!"_ISCSI_CHAP_AUTH_DATA", !53, i64 0, !12, i64 292, !7, i64 296, !12, i64 1320, !7, i64 1324, !12, i64 1340, !7, i64 1344, !12, i64 2368}
!53 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!54 = !{!48, !12, i64 2968}
!55 = !{!35, !12, i64 240}
!56 = !{!7, !7, i64 0}
!57 = !{!10, !11, i64 16}
!58 = !{!48, !7, i64 2960}


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