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

; 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._ISCSI_IN_BUFFER_CONTEXT = type { ptr, i32 }
%struct._ISCSI_DRIVER_DATA = type { i32, ptr, ptr, %struct._ISCSI_PRIVATE_PROTOCOL, ptr, ptr, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, ptr, ptr, %struct._ISCSI_SESSION }
%struct._ISCSI_PRIVATE_PROTOCOL = type { i32 }
%struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_EXT_SCSI_PASS_THRU_MODE = type { i32, i32, i32 }
%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._LIST_ENTRY = type { ptr, ptr }
%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.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET = type { i64, ptr, ptr, ptr, ptr, i32, i32, i8, i8, i8, i8, i8 }
%struct._ISCSI_TCB = type { %struct._LIST_ENTRY, i8, i32, i8, i8, i32, i32, ptr, i32, i32, i32, %struct._ISCSI_XFER_CONTEXT, ptr }
%struct._ISCSI_XFER_CONTEXT = type { i32, i32, i32, i32 }
%struct._ISCSI_BASIC_HEADER = type { i8, i8, i16, i8, [3 x i8], [8 x i8], i32, [7 x i32] }
%struct.EFI_BOOT_SERVICES = type { %struct.EFI_TABLE_HEADER, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_TABLE_HEADER = type { i64, i32, i32, i32, i32 }

@gBS = external global ptr, align 8
@.str = external hidden unnamed_addr constant [154 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1

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

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

declare i64 @Tcp4IoTransmit(ptr noundef, ptr noundef) #1

declare void @NetbufFree(ptr noundef) #1

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

declare zeroext i8 @DebugAssertEnabled() #1

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

declare ptr @NetbufGetByte(ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiNewTcb(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @IScsiNewScsiCmdPdu(ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiSendDataOutPduSequence(ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnDataInRcvd(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnR2TRcvd(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnScsiRspRcvd(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnNopInRcvd(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiExecuteScsiCommand(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca %struct._ISCSI_IN_BUFFER_CONTEXT, align 8
  %19 = alloca i64, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i64 %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  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 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  %21 = call zeroext i8 @DebugAssertEnabled()
  %22 = zext i8 %21 to i32
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %24, label %34

24:                                               ; preds = %4
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = ptrtoint ptr %25 to i64
  %27 = sub i64 %26, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_DRIVER_DATA, ptr null, i32 0, i32 6) to i64)
  %28 = inttoptr i64 %27 to ptr
  %29 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !11
  %31 = icmp ne i32 %30, 1094996809
  br i1 %31, label %32, label %34

32:                                               ; preds = %24
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2533, ptr noundef @.str.34)
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  br label %39

34:                                               ; preds = %24, %4
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = ptrtoint ptr %35 to i64
  %37 = sub i64 %36, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_DRIVER_DATA, ptr null, i32 0, i32 6) to i64)
  %38 = inttoptr i64 %37 to ptr
  br label %39

39:                                               ; preds = %34, %32
  %40 = phi ptr [ %33, %32 ], [ %38, %34 ]
  store ptr %40, ptr %10, align 8, !tbaa !5
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %41, i32 0, i32 10
  store ptr %42, ptr %11, align 8, !tbaa !5
  store i64 0, ptr %9, align 8, !tbaa !9
  store ptr null, ptr %14, align 8, !tbaa !5
  store ptr null, ptr %12, align 8, !tbaa !5
  store i64 0, ptr %19, align 8, !tbaa !9
  %43 = load ptr, ptr %11, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %43, i32 0, i32 5
  %45 = load i8, ptr %44, align 8, !tbaa !25
  %46 = zext i8 %45 to i32
  %47 = icmp ne i32 %46, 1
  br i1 %47, label %48, label %49

48:                                               ; preds = %39
  store i64 -9223372036854775801, ptr %9, align 8, !tbaa !9
  br label %291

49:                                               ; preds = %39
  %50 = call zeroext i8 @DebugAssertEnabled()
  %51 = zext i8 %50 to i32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %69

53:                                               ; preds = %49
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %54, i32 0, i32 13
  %56 = getelementptr inbounds %struct._LIST_ENTRY, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !26
  %58 = ptrtoint ptr %57 to i64
  %59 = sub i64 %58, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %60 = inttoptr i64 %59 to ptr
  %61 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %60, i32 0, i32 0
  %62 = load i32, ptr %61, align 8, !tbaa !27
  %63 = icmp ne i32 %62, 1313035081
  br i1 %63, label %64, label %69

64:                                               ; preds = %53
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2550, ptr noundef @.str.34)
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %65, i32 0, i32 13
  %67 = getelementptr inbounds %struct._LIST_ENTRY, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !26
  br label %77

69:                                               ; preds = %53, %49
  %70 = load ptr, ptr %11, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %70, i32 0, i32 13
  %72 = getelementptr inbounds %struct._LIST_ENTRY, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !26
  %74 = ptrtoint ptr %73 to i64
  %75 = sub i64 %74, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %76 = inttoptr i64 %75 to ptr
  br label %77

77:                                               ; preds = %69, %64
  %78 = phi ptr [ %68, %64 ], [ %76, %69 ]
  store ptr %78, ptr %13, align 8, !tbaa !5
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %79, i32 0, i32 0
  %81 = load i64, ptr %80, align 8, !tbaa !34
  %82 = icmp ne i64 %81, 0
  br i1 %82, label %83, label %88

83:                                               ; preds = %77
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %84, i32 0, i32 0
  %86 = load i64, ptr %85, align 8, !tbaa !34
  %87 = call i64 @MultU64x32(i64 noundef %86, i32 noundef 2)
  store i64 %87, ptr %19, align 8, !tbaa !9
  br label %88

88:                                               ; preds = %83, %77
  %89 = load ptr, ptr %13, align 8, !tbaa !5
  %90 = call i64 @IScsiNewTcb(ptr noundef %89, ptr noundef %14)
  store i64 %90, ptr %9, align 8, !tbaa !9
  %91 = load i64, ptr %9, align 8, !tbaa !9
  %92 = icmp slt i64 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %88
  br label %291

94:                                               ; preds = %88
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  %96 = load i64, ptr %7, align 8, !tbaa !9
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = call ptr @IScsiNewScsiCmdPdu(ptr noundef %95, i64 noundef %96, ptr noundef %97)
  store ptr %98, ptr %15, align 8, !tbaa !5
  %99 = load ptr, ptr %15, align 8, !tbaa !5
  %100 = icmp eq ptr %99, null
  br i1 %100, label %101, label %102

101:                                              ; preds = %94
  store i64 -9223372036854775799, ptr %9, align 8, !tbaa !9
  br label %291

102:                                              ; preds = %94
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct._ISCSI_TCB, ptr %103, i32 0, i32 11
  store ptr %104, ptr %16, align 8, !tbaa !5
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = call ptr @NetbufGetByte(ptr noundef %105, i32 noundef 0, ptr noundef null)
  store ptr %106, ptr %20, align 8, !tbaa !5
  %107 = load ptr, ptr %20, align 8, !tbaa !5
  %108 = icmp eq ptr %107, null
  br i1 %108, label %109, label %111

109:                                              ; preds = %102
  store i64 -9223372036854775784, ptr %9, align 8, !tbaa !9
  %110 = load ptr, ptr %15, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %110)
  br label %291

111:                                              ; preds = %102
  %112 = load ptr, ptr %20, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %112, i32 0, i32 4
  %114 = getelementptr inbounds [3 x i8], ptr %113, i64 0, i64 0
  %115 = load i8, ptr %114, align 1, !tbaa !36
  %116 = zext i8 %115 to i32
  %117 = shl i32 %116, 16
  %118 = load ptr, ptr %20, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %118, i32 0, i32 4
  %120 = getelementptr inbounds [3 x i8], ptr %119, i64 0, i64 1
  %121 = load i8, ptr %120, align 1, !tbaa !36
  %122 = zext i8 %121 to i32
  %123 = shl i32 %122, 8
  %124 = or i32 %117, %123
  %125 = load ptr, ptr %20, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %125, i32 0, i32 4
  %127 = getelementptr inbounds [3 x i8], ptr %126, i64 0, i64 2
  %128 = load i8, ptr %127, align 1, !tbaa !36
  %129 = zext i8 %128 to i32
  %130 = or i32 %124, %129
  %131 = load ptr, ptr %16, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %131, i32 0, i32 1
  store i32 %130, ptr %132, align 4, !tbaa !37
  %133 = load ptr, ptr %13, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %133, i32 0, i32 14
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  %136 = call i64 @Tcp4IoTransmit(ptr noundef %134, ptr noundef %135)
  store i64 %136, ptr %9, align 8, !tbaa !9
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %137)
  %138 = load i64, ptr %9, align 8, !tbaa !9
  %139 = icmp slt i64 %138, 0
  br i1 %139, label %140, label %141

140:                                              ; preds = %111
  br label %291

141:                                              ; preds = %111
  %142 = load ptr, ptr %11, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %142, i32 0, i32 18
  %144 = load i8, ptr %143, align 8, !tbaa !39
  %145 = icmp ne i8 %144, 0
  br i1 %145, label %208, label %146

146:                                              ; preds = %141
  %147 = load ptr, ptr %16, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !37
  %150 = load ptr, ptr %11, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %150, i32 0, i32 21
  %152 = load i32, ptr %151, align 8, !tbaa !40
  %153 = icmp ult i32 %149, %152
  br i1 %153, label %154, label %208

154:                                              ; preds = %146
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %155, i32 0, i32 1
  %157 = load i32, ptr %156, align 4, !tbaa !37
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %158, i32 0, i32 6
  %160 = load i32, ptr %159, align 4, !tbaa !41
  %161 = icmp ult i32 %157, %160
  br i1 %161, label %162, label %208

162:                                              ; preds = %154
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %163, i32 0, i32 0
  store i32 -1, ptr %164, align 4, !tbaa !42
  %165 = load ptr, ptr %11, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %165, i32 0, i32 21
  %167 = load i32, ptr %166, align 8, !tbaa !40
  %168 = load ptr, ptr %8, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %168, i32 0, i32 6
  %170 = load i32, ptr %169, align 4, !tbaa !41
  %171 = load ptr, ptr %16, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %171, i32 0, i32 1
  %173 = load i32, ptr %172, align 4, !tbaa !37
  %174 = sub i32 %170, %173
  %175 = icmp ult i32 %167, %174
  br i1 %175, label %176, label %180

176:                                              ; preds = %162
  %177 = load ptr, ptr %11, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %177, i32 0, i32 21
  %179 = load i32, ptr %178, align 8, !tbaa !40
  br label %188

180:                                              ; preds = %162
  %181 = load ptr, ptr %8, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %181, i32 0, i32 6
  %183 = load i32, ptr %182, align 4, !tbaa !41
  %184 = load ptr, ptr %16, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %184, i32 0, i32 1
  %186 = load i32, ptr %185, align 4, !tbaa !37
  %187 = sub i32 %183, %186
  br label %188

188:                                              ; preds = %180, %176
  %189 = phi i32 [ %179, %176 ], [ %187, %180 ]
  %190 = load ptr, ptr %16, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %190, i32 0, i32 2
  store i32 %189, ptr %191, align 4, !tbaa !43
  %192 = load ptr, ptr %8, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %192, i32 0, i32 2
  %194 = load ptr, ptr %193, align 8, !tbaa !44
  %195 = load ptr, ptr %16, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %195, i32 0, i32 1
  %197 = load i32, ptr %196, align 4, !tbaa !37
  %198 = zext i32 %197 to i64
  %199 = getelementptr inbounds i8, ptr %194, i64 %198
  store ptr %199, ptr %17, align 8, !tbaa !5
  %200 = load ptr, ptr %17, align 8, !tbaa !5
  %201 = load i64, ptr %7, align 8, !tbaa !9
  %202 = load ptr, ptr %14, align 8, !tbaa !5
  %203 = call i64 @IScsiSendDataOutPduSequence(ptr noundef %200, i64 noundef %201, ptr noundef %202)
  store i64 %203, ptr %9, align 8, !tbaa !9
  %204 = load i64, ptr %9, align 8, !tbaa !9
  %205 = icmp slt i64 %204, 0
  br i1 %205, label %206, label %207

206:                                              ; preds = %188
  br label %291

207:                                              ; preds = %188
  br label %208

208:                                              ; preds = %207, %154, %146, %141
  %209 = load ptr, ptr %8, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %209, i32 0, i32 1
  %211 = load ptr, ptr %210, align 8, !tbaa !45
  %212 = getelementptr inbounds %struct._ISCSI_IN_BUFFER_CONTEXT, ptr %18, i32 0, i32 0
  store ptr %211, ptr %212, align 8, !tbaa !46
  %213 = load ptr, ptr %8, align 8, !tbaa !5
  %214 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %213, i32 0, i32 5
  %215 = load i32, ptr %214, align 8, !tbaa !48
  %216 = getelementptr inbounds %struct._ISCSI_IN_BUFFER_CONTEXT, ptr %18, i32 0, i32 1
  store i32 %215, ptr %216, align 8, !tbaa !49
  br label %217

217:                                              ; preds = %289, %208
  %218 = load ptr, ptr %14, align 8, !tbaa !5
  %219 = getelementptr inbounds %struct._ISCSI_TCB, ptr %218, i32 0, i32 4
  %220 = load i8, ptr %219, align 1, !tbaa !50
  %221 = icmp ne i8 %220, 0
  %222 = xor i1 %221, true
  br i1 %222, label %223, label %290

223:                                              ; preds = %217
  %224 = load i64, ptr %19, align 8, !tbaa !9
  %225 = icmp ne i64 %224, 0
  br i1 %225, label %226, label %242

226:                                              ; preds = %223
  %227 = load ptr, ptr @gBS, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %227, i32 0, i32 9
  %229 = load ptr, ptr %228, align 8, !tbaa !52
  %230 = load ptr, ptr %13, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %230, i32 0, i32 2
  %232 = load ptr, ptr %231, align 8, !tbaa !55
  %233 = load i64, ptr %19, align 8, !tbaa !9
  %234 = call i64 %229(ptr noundef %232, i32 noundef 2, i64 noundef %233)
  store i64 %234, ptr %9, align 8, !tbaa !9
  %235 = load i64, ptr %9, align 8, !tbaa !9
  %236 = icmp slt i64 %235, 0
  br i1 %236, label %237, label %238

237:                                              ; preds = %226
  br label %291

238:                                              ; preds = %226
  %239 = load ptr, ptr %13, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %239, i32 0, i32 2
  %241 = load ptr, ptr %240, align 8, !tbaa !55
  store ptr %241, ptr %12, align 8, !tbaa !5
  br label %242

242:                                              ; preds = %238, %223
  %243 = load ptr, ptr %13, align 8, !tbaa !5
  %244 = load ptr, ptr %12, align 8, !tbaa !5
  %245 = call i64 @IScsiReceivePdu(ptr noundef %243, ptr noundef %15, ptr noundef %18, i8 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef %244)
  store i64 %245, ptr %9, align 8, !tbaa !9
  %246 = load i64, ptr %9, align 8, !tbaa !9
  %247 = icmp slt i64 %246, 0
  br i1 %247, label %248, label %249

248:                                              ; preds = %242
  br label %291

249:                                              ; preds = %242
  %250 = load ptr, ptr %15, align 8, !tbaa !5
  %251 = call ptr @NetbufGetByte(ptr noundef %250, i32 noundef 0, ptr noundef null)
  store ptr %251, ptr %20, align 8, !tbaa !5
  %252 = load ptr, ptr %20, align 8, !tbaa !5
  %253 = icmp eq ptr %252, null
  br i1 %253, label %254, label %256

254:                                              ; preds = %249
  store i64 -9223372036854775784, ptr %9, align 8, !tbaa !9
  %255 = load ptr, ptr %15, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %255)
  br label %291

256:                                              ; preds = %249
  %257 = load ptr, ptr %20, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %257, i32 0, i32 0
  %259 = load i8, ptr %258, align 4, !tbaa !56
  %260 = zext i8 %259 to i32
  %261 = and i32 %260, 63
  switch i32 %261, label %283 [
    i32 37, label %262
    i32 49, label %267
    i32 33, label %273
    i32 32, label %278
    i32 60, label %282
    i32 61, label %282
    i32 62, label %282
  ]

262:                                              ; preds = %256
  %263 = load ptr, ptr %15, align 8, !tbaa !5
  %264 = load ptr, ptr %14, align 8, !tbaa !5
  %265 = load ptr, ptr %8, align 8, !tbaa !5
  %266 = call i64 @IScsiOnDataInRcvd(ptr noundef %263, ptr noundef %264, ptr noundef %265)
  store i64 %266, ptr %9, align 8, !tbaa !9
  br label %284

267:                                              ; preds = %256
  %268 = load ptr, ptr %15, align 8, !tbaa !5
  %269 = load ptr, ptr %14, align 8, !tbaa !5
  %270 = load i64, ptr %7, align 8, !tbaa !9
  %271 = load ptr, ptr %8, align 8, !tbaa !5
  %272 = call i64 @IScsiOnR2TRcvd(ptr noundef %268, ptr noundef %269, i64 noundef %270, ptr noundef %271)
  store i64 %272, ptr %9, align 8, !tbaa !9
  br label %284

273:                                              ; preds = %256
  %274 = load ptr, ptr %15, align 8, !tbaa !5
  %275 = load ptr, ptr %14, align 8, !tbaa !5
  %276 = load ptr, ptr %8, align 8, !tbaa !5
  %277 = call i64 @IScsiOnScsiRspRcvd(ptr noundef %274, ptr noundef %275, ptr noundef %276)
  store i64 %277, ptr %9, align 8, !tbaa !9
  br label %284

278:                                              ; preds = %256
  %279 = load ptr, ptr %15, align 8, !tbaa !5
  %280 = load ptr, ptr %14, align 8, !tbaa !5
  %281 = call i64 @IScsiOnNopInRcvd(ptr noundef %279, ptr noundef %280)
  store i64 %281, ptr %9, align 8, !tbaa !9
  br label %284

282:                                              ; preds = %256, %256, %256
  br label %284

283:                                              ; preds = %256
  store i64 -9223372036854775784, ptr %9, align 8, !tbaa !9
  br label %284

284:                                              ; preds = %283, %282, %278, %273, %267, %262
  %285 = load ptr, ptr %15, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %285)
  %286 = load i64, ptr %9, align 8, !tbaa !9
  %287 = icmp slt i64 %286, 0
  br i1 %287, label %288, label %289

288:                                              ; preds = %284
  br label %290

289:                                              ; preds = %284
  br label %217, !llvm.loop !58

290:                                              ; preds = %288, %217
  br label %291

291:                                              ; preds = %290, %254, %248, %237, %206, %140, %109, %101, %93, %48
  %292 = load ptr, ptr %12, align 8, !tbaa !5
  %293 = icmp ne ptr %292, null
  br i1 %293, label %294, label %300

294:                                              ; preds = %291
  %295 = load ptr, ptr @gBS, align 8, !tbaa !5
  %296 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %295, i32 0, i32 9
  %297 = load ptr, ptr %296, align 8, !tbaa !52
  %298 = load ptr, ptr %12, align 8, !tbaa !5
  %299 = call i64 %297(ptr noundef %298, i32 noundef 0, i64 noundef 0)
  br label %300

300:                                              ; preds = %294, %291
  %301 = load ptr, ptr %14, align 8, !tbaa !5
  %302 = icmp ne ptr %301, null
  br i1 %302, label %303, label %305

303:                                              ; preds = %300
  %304 = load ptr, ptr %14, align 8, !tbaa !5
  call void @IScsiDelTcb(ptr noundef %304)
  br label %305

305:                                              ; preds = %303, %300
  %306 = load i64, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 16, 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 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  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
  ret i64 %306
}

declare i64 @MultU64x32(i64 noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = !{!12, !13, i64 0}
!12 = !{!"_ISCSI_DRIVER_DATA", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40, !15, i64 48, !16, i64 112, !6, i64 128, !6, i64 136, !17, i64 144}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_ISCSI_PRIVATE_PROTOCOL", !13, i64 0}
!15 = !{!"_EFI_EXT_SCSI_PASS_THRU_PROTOCOL", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!16 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8}
!17 = !{!"_ISCSI_SESSION", !13, i64 0, !18, i64 4, !22, i64 276, !7, i64 2648, !10, i64 2872, !7, i64 2880, !7, i64 2881, !21, i64 2888, !13, i64 2892, !13, i64 2896, !13, i64 2900, !13, i64 2904, !21, i64 2908, !24, i64 2912, !13, i64 2928, !24, i64 2936, !21, i64 2952, !13, i64 2956, !7, i64 2960, !7, i64 2961, !13, i64 2964, !13, i64 2968, !13, i64 2972, !13, i64 2976, !21, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!18 = !{!"_ISCSI_SESSION_CONFIG_DATA", !19, i64 0, !20, i64 259, !20, i64 263, !20, i64 267}
!19 = !{!"", !7, i64 0, !7, i64 1, !20, i64 2, !20, i64 6, !20, i64 10, !7, i64 14, !7, i64 15, !20, i64 239, !21, i64 243, !7, i64 245, !7, i64 253}
!20 = !{!"", !7, i64 0}
!21 = !{!"short", !7, i64 0}
!22 = !{!"_ISCSI_CHAP_AUTH_DATA", !23, i64 0, !13, i64 292, !7, i64 296, !13, i64 1320, !7, i64 1324, !13, i64 1340, !7, i64 1344, !13, i64 2368}
!23 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!24 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!25 = !{!17, !7, i64 2880}
!26 = !{!17, !6, i64 2912}
!27 = !{!28, !13, i64 0}
!28 = !{!"_ISCSI_CONNECTION", !13, i64 0, !24, 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, !21, i64 48, !13, i64 52, !29, i64 56, !30, i64 112, !13, i64 240, !13, i64 244, !13, i64 248}
!29 = !{!"", !13, i64 0, !10, i64 8, !24, i64 16, !24, i64 32, !13, i64 48, !13, i64 52}
!30 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !31, i64 32, !33, i64 48, !33, i64 72, !33, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!31 = !{!"", !32, i64 0}
!32 = !{!"", !6, i64 0, !10, i64 8}
!33 = !{!"", !32, i64 0, !7, i64 16}
!34 = !{!35, !10, i64 0}
!35 = !{!"", !10, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !13, i64 40, !13, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!36 = !{!7, !7, i64 0}
!37 = !{!38, !13, i64 4}
!38 = !{!"_ISCSI_XFER_CONTEXT", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!39 = !{!17, !7, i64 2960}
!40 = !{!17, !13, i64 2968}
!41 = !{!35, !13, i64 44}
!42 = !{!38, !13, i64 0}
!43 = !{!38, !13, i64 8}
!44 = !{!35, !6, i64 16}
!45 = !{!35, !6, i64 8}
!46 = !{!47, !6, i64 0}
!47 = !{!"_ISCSI_IN_BUFFER_CONTEXT", !6, i64 0, !13, i64 8}
!48 = !{!35, !13, i64 40}
!49 = !{!47, !13, i64 8}
!50 = !{!51, !7, i64 25}
!51 = !{!"_ISCSI_TCB", !24, i64 0, !7, i64 16, !13, i64 20, !7, i64 24, !7, i64 25, !13, i64 28, !13, i64 32, !6, i64 40, !13, i64 48, !13, i64 52, !13, i64 56, !38, i64 60, !6, i64 80}
!52 = !{!53, !6, i64 88}
!53 = !{!"", !54, i64 0, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200, !6, i64 208, !6, i64 216, !6, i64 224, !6, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !6, i64 264, !6, i64 272, !6, i64 280, !6, i64 288, !6, i64 296, !6, i64 304, !6, i64 312, !6, i64 320, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368}
!54 = !{!"", !10, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!55 = !{!28, !6, i64 24}
!56 = !{!57, !7, i64 0}
!57 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !21, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !13, i64 16, !7, i64 20}
!58 = distinct !{!58, !59}
!59 = !{!"llvm.loop.mustprogress"}


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

%struct._ISCSI_IN_BUFFER_CONTEXT = type { ptr, i32 }

@gBS = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [154 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1

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

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

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

declare void @NetbufFree(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiReceivePdu(ptr noundef, ptr noundef, ptr noundef, i8 noundef zeroext, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare ptr @NetbufGetByte(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiNewTcb(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @IScsiNewScsiCmdPdu(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiSendDataOutPduSequence(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnDataInRcvd(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnR2TRcvd(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnScsiRspRcvd(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiOnNopInRcvd(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiExecuteScsiCommand(ptr noundef %0, ptr nocapture noundef readnone %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct._ISCSI_IN_BUFFER_CONTEXT, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  %8 = tail call zeroext i8 @DebugAssertEnabled() #4
  %.not = icmp eq i8 %8, 0
  %.pre117 = ptrtoint ptr %0 to i64
  %.pre119 = add i64 %.pre117, -48
  %.pre121 = inttoptr i64 %.pre119 to ptr
  br i1 %.not, label %._crit_edge116, label %9

9:                                                ; preds = %4
  %10 = load i32, ptr %.pre121, align 8, !tbaa !5
  %.not78 = icmp eq i32 %10, 1094996809
  br i1 %.not78, label %._crit_edge116, label %11

11:                                               ; preds = %9
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2533, ptr noundef nonnull @.str.34) #4
  br label %._crit_edge116

._crit_edge116:                                   ; preds = %4, %9, %11
  %12 = phi ptr [ %0, %11 ], [ %.pre121, %9 ], [ %.pre121, %4 ]
  store ptr null, ptr %5, align 8, !tbaa !23
  %13 = getelementptr inbounds i8, ptr %12, i64 3024
  %14 = load i8, ptr %13, align 8, !tbaa !24
  %.not79 = icmp eq i8 %14, 1
  br i1 %.not79, label %15, label %.thread89.thread

15:                                               ; preds = %._crit_edge116
  %16 = tail call zeroext i8 @DebugAssertEnabled() #4
  %.not80 = icmp eq i8 %16, 0
  %.phi.trans.insert = getelementptr inbounds i8, ptr %12, i64 3056
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !25
  %.pre111 = ptrtoint ptr %.pre to i64
  %.pre112 = add i64 %.pre111, -8
  %.pre114 = inttoptr i64 %.pre112 to ptr
  br i1 %.not80, label %._crit_edge, label %17

17:                                               ; preds = %15
  %18 = load i32, ptr %.pre114, align 8, !tbaa !26
  %.not81 = icmp eq i32 %18, 1313035081
  br i1 %.not81, label %._crit_edge, label %19

19:                                               ; preds = %17
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2550, ptr noundef nonnull @.str.34) #4
  %20 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !25
  br label %._crit_edge

._crit_edge:                                      ; preds = %15, %17, %19
  %21 = phi ptr [ %20, %19 ], [ %.pre114, %17 ], [ %.pre114, %15 ]
  %22 = load i64, ptr %3, align 8, !tbaa !33
  %.not82 = icmp eq i64 %22, 0
  br i1 %.not82, label %25, label %23

23:                                               ; preds = %._crit_edge
  %24 = tail call i64 @MultU64x32(i64 noundef %22, i32 noundef 2) #4
  br label %25

25:                                               ; preds = %23, %._crit_edge
  %.0 = phi i64 [ %24, %23 ], [ 0, %._crit_edge ]
  %26 = call i64 @IScsiNewTcb(ptr noundef %21, ptr noundef nonnull %5)
  %27 = icmp slt i64 %26, 0
  br i1 %27, label %.thread89, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !23
  %30 = call ptr @IScsiNewScsiCmdPdu(ptr noundef nonnull %3, i64 noundef %2, ptr noundef %29)
  store ptr %30, ptr %6, align 8, !tbaa !23
  %31 = icmp eq ptr %30, null
  br i1 %31, label %.thread89, label %32

32:                                               ; preds = %28
  %33 = load ptr, ptr %5, align 8, !tbaa !23
  %34 = getelementptr inbounds i8, ptr %33, i64 60
  %35 = call ptr @NetbufGetByte(ptr noundef nonnull %30, i32 noundef 0, ptr noundef null) #4
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %32
  call void @NetbufFree(ptr noundef nonnull %30) #4
  br label %.thread89

38:                                               ; preds = %32
  %39 = getelementptr inbounds i8, ptr %35, i64 5
  %40 = load i8, ptr %39, align 1, !tbaa !35
  %41 = zext i8 %40 to i32
  %42 = shl nuw nsw i32 %41, 16
  %43 = getelementptr inbounds i8, ptr %35, i64 6
  %44 = load i8, ptr %43, align 1, !tbaa !35
  %45 = zext i8 %44 to i32
  %46 = shl nuw nsw i32 %45, 8
  %47 = or disjoint i32 %46, %42
  %48 = getelementptr inbounds i8, ptr %35, i64 7
  %49 = load i8, ptr %48, align 1, !tbaa !35
  %50 = zext i8 %49 to i32
  %51 = or disjoint i32 %47, %50
  %52 = getelementptr inbounds i8, ptr %33, i64 64
  store i32 %51, ptr %52, align 4, !tbaa !36
  %53 = getelementptr inbounds i8, ptr %21, i64 112
  %54 = call i64 @Tcp4IoTransmit(ptr noundef nonnull %53, ptr noundef nonnull %30) #4
  %55 = load ptr, ptr %6, align 8, !tbaa !23
  call void @NetbufFree(ptr noundef %55) #4
  %56 = icmp slt i64 %54, 0
  br i1 %56, label %.thread89, label %57

57:                                               ; preds = %38
  %58 = getelementptr inbounds i8, ptr %12, i64 3104
  %59 = load i8, ptr %58, align 8, !tbaa !38
  %.not83 = icmp eq i8 %59, 0
  br i1 %.not83, label %60, label %79

60:                                               ; preds = %57
  %61 = load i32, ptr %52, align 4, !tbaa !36
  %62 = getelementptr inbounds i8, ptr %12, i64 3112
  %63 = load i32, ptr %62, align 8, !tbaa !39
  %64 = icmp ult i32 %61, %63
  br i1 %64, label %65, label %79

65:                                               ; preds = %60
  %66 = getelementptr inbounds i8, ptr %3, i64 44
  %67 = load i32, ptr %66, align 4, !tbaa !40
  %68 = icmp ult i32 %61, %67
  br i1 %68, label %69, label %79

69:                                               ; preds = %65
  store i32 -1, ptr %34, align 4, !tbaa !41
  %70 = sub i32 %67, %61
  %. = call i32 @llvm.umin.i32(i32 %63, i32 %70)
  %71 = getelementptr inbounds i8, ptr %33, i64 68
  store i32 %., ptr %71, align 4, !tbaa !42
  %72 = getelementptr inbounds i8, ptr %3, i64 16
  %73 = load ptr, ptr %72, align 8, !tbaa !43
  %74 = zext i32 %61 to i64
  %75 = getelementptr inbounds i8, ptr %73, i64 %74
  %76 = load ptr, ptr %5, align 8, !tbaa !23
  %77 = call i64 @IScsiSendDataOutPduSequence(ptr noundef %75, i64 noundef %2, ptr noundef %76)
  %78 = icmp slt i64 %77, 0
  br i1 %78, label %.thread89, label %79

79:                                               ; preds = %69, %65, %60, %57
  %.058 = phi i64 [ %54, %57 ], [ %77, %69 ], [ %54, %65 ], [ %54, %60 ]
  %80 = getelementptr inbounds i8, ptr %3, i64 8
  %81 = load ptr, ptr %80, align 8, !tbaa !44
  store ptr %81, ptr %7, align 8, !tbaa !45
  %82 = getelementptr inbounds i8, ptr %3, i64 40
  %83 = load i32, ptr %82, align 8, !tbaa !47
  %84 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %83, ptr %84, align 8, !tbaa !48
  %85 = load ptr, ptr %5, align 8, !tbaa !23
  %86 = getelementptr inbounds i8, ptr %85, i64 25
  %87 = load i8, ptr %86, align 1, !tbaa !49
  %.not8498 = icmp eq i8 %87, 0
  br i1 %.not8498, label %.lr.ph, label %.thread89.thread129

.lr.ph:                                           ; preds = %79
  %.not85 = icmp eq i64 %.0, 0
  %88 = getelementptr inbounds i8, ptr %21, i64 24
  br label %93

89:                                               ; preds = %.thread123, %130
  %.2125 = phi i64 [ %104, %.thread123 ], [ %.2, %130 ]
  %90 = load ptr, ptr %5, align 8, !tbaa !23
  %91 = getelementptr inbounds i8, ptr %90, i64 25
  %92 = load i8, ptr %91, align 1, !tbaa !49
  %.not84 = icmp eq i8 %92, 0
  br i1 %.not84, label %93, label %.loopexit, !llvm.loop !51

93:                                               ; preds = %.lr.ph, %89
  %.05999 = phi ptr [ null, %.lr.ph ], [ %.160, %89 ]
  br i1 %.not85, label %103, label %94

94:                                               ; preds = %93
  %95 = load ptr, ptr @gBS, align 8, !tbaa !23
  %96 = getelementptr inbounds i8, ptr %95, i64 88
  %97 = load ptr, ptr %96, align 8, !tbaa !53
  %98 = load ptr, ptr %88, align 8, !tbaa !56
  %99 = call i64 %97(ptr noundef %98, i32 noundef 2, i64 noundef %.0) #4
  %100 = icmp slt i64 %99, 0
  br i1 %100, label %.loopexit, label %101

101:                                              ; preds = %94
  %102 = load ptr, ptr %88, align 8, !tbaa !56
  br label %103

103:                                              ; preds = %101, %93
  %.160 = phi ptr [ %102, %101 ], [ %.05999, %93 ]
  %104 = call i64 @IScsiReceivePdu(ptr noundef %21, ptr noundef nonnull %6, ptr noundef nonnull %7, i8 noundef zeroext 0, i8 noundef zeroext 0, ptr noundef %.160)
  %105 = icmp slt i64 %104, 0
  br i1 %105, label %.loopexit, label %106

106:                                              ; preds = %103
  %107 = load ptr, ptr %6, align 8, !tbaa !23
  %108 = call ptr @NetbufGetByte(ptr noundef %107, i32 noundef 0, ptr noundef null) #4
  %109 = icmp eq ptr %108, null
  br i1 %109, label %.loopexit.sink.split, label %110

110:                                              ; preds = %106
  %111 = load i8, ptr %108, align 4, !tbaa !57
  %112 = and i8 %111, 63
  switch i8 %112, label %.loopexit.sink.split [
    i8 37, label %113
    i8 49, label %117
    i8 33, label %121
    i8 32, label %125
    i8 60, label %.thread123
    i8 61, label %.thread123
    i8 62, label %.thread123
  ]

113:                                              ; preds = %110
  %114 = load ptr, ptr %6, align 8, !tbaa !23
  %115 = load ptr, ptr %5, align 8, !tbaa !23
  %116 = call i64 @IScsiOnDataInRcvd(ptr noundef %114, ptr noundef %115, ptr noundef nonnull %3)
  br label %130

117:                                              ; preds = %110
  %118 = load ptr, ptr %6, align 8, !tbaa !23
  %119 = load ptr, ptr %5, align 8, !tbaa !23
  %120 = call i64 @IScsiOnR2TRcvd(ptr noundef %118, ptr noundef %119, i64 noundef %2, ptr noundef nonnull %3)
  br label %130

121:                                              ; preds = %110
  %122 = load ptr, ptr %6, align 8, !tbaa !23
  %123 = load ptr, ptr %5, align 8, !tbaa !23
  %124 = call i64 @IScsiOnScsiRspRcvd(ptr noundef %122, ptr noundef %123, ptr noundef nonnull %3)
  br label %130

125:                                              ; preds = %110
  %126 = load ptr, ptr %6, align 8, !tbaa !23
  %127 = load ptr, ptr %5, align 8, !tbaa !23
  %128 = call i64 @IScsiOnNopInRcvd(ptr noundef %126, ptr noundef %127)
  br label %130

.thread123:                                       ; preds = %110, %110, %110
  %129 = load ptr, ptr %6, align 8, !tbaa !23
  call void @NetbufFree(ptr noundef %129) #4
  br label %89

130:                                              ; preds = %125, %121, %117, %113
  %.2 = phi i64 [ %128, %125 ], [ %124, %121 ], [ %120, %117 ], [ %116, %113 ]
  %131 = load ptr, ptr %6, align 8, !tbaa !23
  call void @NetbufFree(ptr noundef %131) #4
  %132 = icmp slt i64 %.2, 0
  br i1 %132, label %.loopexit, label %89, !llvm.loop !51

.loopexit.sink.split:                             ; preds = %110, %106
  %.sink = load ptr, ptr %6, align 8, !tbaa !23
  call void @NetbufFree(ptr noundef %.sink) #4
  br label %.loopexit

.loopexit:                                        ; preds = %94, %103, %130, %89, %.loopexit.sink.split
  %.261 = phi ptr [ %.160, %.loopexit.sink.split ], [ %.05999, %94 ], [ %.160, %103 ], [ %.160, %130 ], [ %.160, %89 ]
  %.3 = phi i64 [ -9223372036854775784, %.loopexit.sink.split ], [ %99, %94 ], [ %104, %103 ], [ %.2, %130 ], [ %.2125, %89 ]
  %.not86 = icmp eq ptr %.261, null
  br i1 %.not86, label %.thread89, label %133

133:                                              ; preds = %.loopexit
  %134 = load ptr, ptr @gBS, align 8, !tbaa !23
  %135 = getelementptr inbounds i8, ptr %134, i64 88
  %136 = load ptr, ptr %135, align 8, !tbaa !53
  %137 = call i64 %136(ptr noundef nonnull %.261, i32 noundef 0, i64 noundef 0) #4
  br label %.thread89

.thread89:                                        ; preds = %28, %69, %38, %37, %25, %133, %.loopexit
  %.393.ph.ph = phi i64 [ %.3, %133 ], [ %.3, %.loopexit ], [ -9223372036854775799, %28 ], [ %77, %69 ], [ %54, %38 ], [ -9223372036854775784, %37 ], [ %26, %25 ]
  %.pr.pr = load ptr, ptr %5, align 8, !tbaa !23
  %.not87 = icmp eq ptr %.pr.pr, null
  br i1 %.not87, label %.thread89.thread, label %.thread89.thread129

.thread89.thread129:                              ; preds = %79, %.thread89
  %.393.ph134 = phi i64 [ %.393.ph.ph, %.thread89 ], [ %.058, %79 ]
  %.pr133 = phi ptr [ %.pr.pr, %.thread89 ], [ %85, %79 ]
  call void @IScsiDelTcb(ptr noundef nonnull %.pr133)
  br label %.thread89.thread

.thread89.thread:                                 ; preds = %._crit_edge116, %.thread89.thread129, %.thread89
  %.39396 = phi i64 [ %.393.ph134, %.thread89.thread129 ], [ %.393.ph.ph, %.thread89 ], [ -9223372036854775801, %._crit_edge116 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret i64 %.39396
}

declare i64 @MultU64x32(i64 noundef, i32 noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"_ISCSI_DRIVER_DATA", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !10, i64 32, !10, i64 40, !12, i64 48, !13, i64 112, !10, i64 128, !10, i64 136, !14, i64 144}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_ISCSI_PRIVATE_PROTOCOL", !7, i64 0}
!12 = !{!"_EFI_EXT_SCSI_PASS_THRU_PROTOCOL", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56}
!13 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!14 = !{!"_ISCSI_SESSION", !7, i64 0, !15, i64 4, !19, i64 276, !8, i64 2648, !21, i64 2872, !8, i64 2880, !8, i64 2881, !18, i64 2888, !7, i64 2892, !7, i64 2896, !7, i64 2900, !7, i64 2904, !18, i64 2908, !22, i64 2912, !7, i64 2928, !22, i64 2936, !18, i64 2952, !7, i64 2956, !8, i64 2960, !8, i64 2961, !7, i64 2964, !7, i64 2968, !7, i64 2972, !7, i64 2976, !18, i64 2980, !8, i64 2982, !8, i64 2983, !8, i64 2984}
!15 = !{!"_ISCSI_SESSION_CONFIG_DATA", !16, i64 0, !17, i64 259, !17, i64 263, !17, i64 267}
!16 = !{!"", !8, i64 0, !8, i64 1, !17, i64 2, !17, i64 6, !17, i64 10, !8, i64 14, !8, i64 15, !17, i64 239, !18, i64 243, !8, i64 245, !8, i64 253}
!17 = !{!"", !8, i64 0}
!18 = !{!"short", !8, i64 0}
!19 = !{!"_ISCSI_CHAP_AUTH_DATA", !20, i64 0, !7, i64 292, !8, i64 296, !7, i64 1320, !8, i64 1324, !7, i64 1340, !8, i64 1344, !7, i64 2368}
!20 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !8, i64 0, !8, i64 1, !8, i64 128, !8, i64 145, !8, i64 272}
!21 = !{!"long long", !8, i64 0}
!22 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!23 = !{!10, !10, i64 0}
!24 = !{!14, !8, i64 2880}
!25 = !{!14, !10, i64 2912}
!26 = !{!27, !7, i64 0}
!27 = !{!"_ISCSI_CONNECTION", !7, i64 0, !22, i64 8, !10, i64 24, !10, i64 32, !8, i64 40, !8, i64 41, !8, i64 42, !8, i64 43, !8, i64 44, !8, i64 45, !8, i64 46, !18, i64 48, !7, i64 52, !28, i64 56, !29, i64 112, !7, i64 240, !7, i64 244, !7, i64 248}
!28 = !{!"", !7, i64 0, !21, i64 8, !22, i64 16, !22, i64 32, !7, i64 48, !7, i64 52}
!29 = !{!"_TCP4_IO", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !30, i64 32, !32, i64 48, !32, i64 72, !32, i64 96, !8, i64 120, !8, i64 121, !8, i64 122, !8, i64 123}
!30 = !{!"", !31, i64 0}
!31 = !{!"", !10, i64 0, !21, i64 8}
!32 = !{!"", !31, i64 0, !8, i64 16}
!33 = !{!34, !21, i64 0}
!34 = !{!"", !21, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !7, i64 40, !7, i64 44, !8, i64 48, !8, i64 49, !8, i64 50, !8, i64 51, !8, i64 52}
!35 = !{!8, !8, i64 0}
!36 = !{!37, !7, i64 4}
!37 = !{!"_ISCSI_XFER_CONTEXT", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!38 = !{!14, !8, i64 2960}
!39 = !{!14, !7, i64 2968}
!40 = !{!34, !7, i64 44}
!41 = !{!37, !7, i64 0}
!42 = !{!37, !7, i64 8}
!43 = !{!34, !10, i64 16}
!44 = !{!34, !10, i64 8}
!45 = !{!46, !10, i64 0}
!46 = !{!"_ISCSI_IN_BUFFER_CONTEXT", !10, i64 0, !7, i64 8}
!47 = !{!34, !7, i64 40}
!48 = !{!46, !7, i64 8}
!49 = !{!50, !8, i64 25}
!50 = !{!"_ISCSI_TCB", !22, i64 0, !8, i64 16, !7, i64 20, !8, i64 24, !8, i64 25, !7, i64 28, !7, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !37, i64 60, !10, i64 80}
!51 = distinct !{!51, !52}
!52 = !{!"llvm.loop.mustprogress"}
!53 = !{!54, !10, i64 88}
!54 = !{!"", !55, i64 0, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200, !10, i64 208, !10, i64 216, !10, i64 224, !10, i64 232, !10, i64 240, !10, i64 248, !10, i64 256, !10, i64 264, !10, i64 272, !10, i64 280, !10, i64 288, !10, i64 296, !10, i64 304, !10, i64 312, !10, i64 320, !10, i64 328, !10, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368}
!55 = !{!"", !21, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!56 = !{!27, !10, i64 24}
!57 = !{!58, !8, i64 0}
!58 = !{!"_ISCSI_BASIC_HEADER", !8, i64 0, !8, i64 1, !18, i64 2, !8, i64 4, !8, i64 5, !8, i64 8, !7, i64 16, !8, i64 20}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass