; LLVM IR from thalium/icebox :: third_party/virtualbox/src/VBox/Devices/EFI/Firmware/NetworkPkg/IScsiDxe (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, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, ptr, ptr, ptr, ptr }
%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, ptr, ptr, i8, %union.anon, i8, [6 x i8], i16, i32, i32, i32, i32, i16, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i16, i32, i8, i8, i32, i32, i32, i32, i16, i8, i8, i8 }
%union.anon = type { %struct._ISCSI_CHAP_AUTH_DATA }
%struct._ISCSI_CHAP_AUTH_DATA = type { ptr, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._ISCSI_CONNECTION = type { i32, %struct._LIST_ENTRY, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i8, i16, i32, %struct.NET_BUF_QUEUE, i8, %struct.TCP_IO, i32, i32, i32 }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct.TCP_IO = type { i8, ptr, ptr, ptr, %union.TCP_IO_PROTOCOL, %union.TCP_IO_PROTOCOL, %union.TCP_IO_CONNECTION_TOKEN, %union.TCP_IO_IO_TOKEN, %union.TCP_IO_IO_TOKEN, %union.TCP_IO_CLOSE_TOKEN, %union.TCP_IO_LISTEN_TOKEN, i8, i8, i8, i8, i8 }
%union.TCP_IO_PROTOCOL = type { ptr }
%union.TCP_IO_CONNECTION_TOKEN = type { %struct.EFI_TCP4_CONNECTION_TOKEN }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%union.TCP_IO_IO_TOKEN = type { %struct.EFI_TCP4_IO_TOKEN }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon.0 }
%union.anon.0 = type { ptr }
%union.TCP_IO_CLOSE_TOKEN = type { %struct.EFI_TCP4_CLOSE_TOKEN }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%union.TCP_IO_LISTEN_TOKEN = type { %struct.EFI_TCP4_LISTEN_TOKEN }
%struct.EFI_TCP4_LISTEN_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, ptr }
%struct.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.1 = external hidden unnamed_addr constant [134 x i8], align 1
@.str.36 = 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 zeroext i8 @DebugAssertEnabled() #1

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

declare i64 @TcpIoTransmit(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 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 5) 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.1, i64 noundef 2850, ptr noundef @.str.36)
  %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 5) 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
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  store ptr %43, 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
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %44, i32 0, i32 5
  %46 = load i8, ptr %45, align 8, !tbaa !18
  %47 = zext i8 %46 to i32
  %48 = icmp ne i32 %47, 1
  br i1 %48, label %49, label %50

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

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

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

65:                                               ; preds = %54
  call void @DebugAssert(ptr noundef @.str.1, i64 noundef 2867, ptr noundef @.str.36)
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %66, i32 0, i32 13
  %68 = getelementptr inbounds %struct._LIST_ENTRY, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !22
  br label %78

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

78:                                               ; preds = %70, %65
  %79 = phi ptr [ %69, %65 ], [ %77, %70 ]
  store ptr %79, ptr %13, align 8, !tbaa !5
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %80, i32 0, i32 0
  %82 = load i64, ptr %81, align 8, !tbaa !27
  %83 = icmp ne i64 %82, 0
  br i1 %83, label %84, label %89

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

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

94:                                               ; preds = %89
  br label %292

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

102:                                              ; preds = %95
  store i64 -9223372036854775799, ptr %9, align 8, !tbaa !9
  br label %292

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

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

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

141:                                              ; preds = %112
  br label %292

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

147:                                              ; preds = %142
  %148 = load ptr, ptr %16, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %148, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !30
  %151 = load ptr, ptr %11, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %151, i32 0, i32 21
  %153 = load i32, ptr %152, align 8, !tbaa !33
  %154 = icmp ult i32 %150, %153
  br i1 %154, label %155, label %209

155:                                              ; preds = %147
  %156 = load ptr, ptr %16, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %156, i32 0, i32 1
  %158 = load i32, ptr %157, align 4, !tbaa !30
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %159, i32 0, i32 6
  %161 = load i32, ptr %160, align 4, !tbaa !34
  %162 = icmp ult i32 %158, %161
  br i1 %162, label %163, label %209

163:                                              ; preds = %155
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %164, i32 0, i32 0
  store i32 -1, ptr %165, align 4, !tbaa !35
  %166 = load ptr, ptr %11, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %166, i32 0, i32 21
  %168 = load i32, ptr %167, align 8, !tbaa !33
  %169 = load ptr, ptr %8, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %169, i32 0, i32 6
  %171 = load i32, ptr %170, align 4, !tbaa !34
  %172 = load ptr, ptr %16, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %172, i32 0, i32 1
  %174 = load i32, ptr %173, align 4, !tbaa !30
  %175 = sub i32 %171, %174
  %176 = icmp ult i32 %168, %175
  br i1 %176, label %177, label %181

177:                                              ; preds = %163
  %178 = load ptr, ptr %11, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %178, i32 0, i32 21
  %180 = load i32, ptr %179, align 8, !tbaa !33
  br label %189

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

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

207:                                              ; preds = %189
  br label %292

208:                                              ; preds = %189
  br label %209

209:                                              ; preds = %208, %155, %147, %142
  %210 = load ptr, ptr %8, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %210, i32 0, i32 1
  %212 = load ptr, ptr %211, align 8, !tbaa !38
  %213 = getelementptr inbounds %struct._ISCSI_IN_BUFFER_CONTEXT, ptr %18, i32 0, i32 0
  store ptr %212, ptr %213, align 8, !tbaa !39
  %214 = load ptr, ptr %8, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %214, i32 0, i32 5
  %216 = load i32, ptr %215, align 8, !tbaa !41
  %217 = getelementptr inbounds %struct._ISCSI_IN_BUFFER_CONTEXT, ptr %18, i32 0, i32 1
  store i32 %216, ptr %217, align 8, !tbaa !42
  br label %218

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

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

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

238:                                              ; preds = %227
  br label %292

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

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

249:                                              ; preds = %243
  br label %292

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

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

257:                                              ; preds = %250
  %258 = load ptr, ptr %20, align 8, !tbaa !5
  %259 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %258, i32 0, i32 0
  %260 = load i8, ptr %259, align 4, !tbaa !49
  %261 = zext i8 %260 to i32
  %262 = and i32 %261, 63
  switch i32 %262, label %284 [
    i32 37, label %263
    i32 49, label %268
    i32 33, label %274
    i32 32, label %279
    i32 60, label %283
    i32 61, label %283
    i32 62, label %283
  ]

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

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

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

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

283:                                              ; preds = %257, %257, %257
  br label %285

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

285:                                              ; preds = %284, %283, %279, %274, %268, %263
  %286 = load ptr, ptr %15, align 8, !tbaa !5
  call void @NetbufFree(ptr noundef %286)
  %287 = load i64, ptr %9, align 8, !tbaa !9
  %288 = icmp slt i64 %287, 0
  br i1 %288, label %289, label %290

289:                                              ; preds = %285
  br label %291

290:                                              ; preds = %285
  br label %218, !llvm.loop !51

291:                                              ; preds = %289, %218
  br label %292

292:                                              ; preds = %291, %255, %249, %238, %207, %141, %110, %102, %94, %49
  %293 = load ptr, ptr %12, align 8, !tbaa !5
  %294 = icmp ne ptr %293, null
  br i1 %294, label %295, label %301

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

301:                                              ; preds = %295, %292
  %302 = load ptr, ptr %14, align 8, !tbaa !5
  %303 = icmp ne ptr %302, null
  br i1 %303, label %304, label %306

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

306:                                              ; preds = %304, %301
  %307 = 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 %307
}

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, !15, i64 40, !16, i64 104, !6, i64 120, !6, i64 128, !6, i64 136, !6, 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 = !{!12, !6, i64 144}
!18 = !{!19, !7, i64 2120}
!19 = !{!"_ISCSI_SESSION", !13, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 32, !7, i64 2120, !7, i64 2121, !20, i64 2128, !13, i64 2132, !13, i64 2136, !13, i64 2140, !13, i64 2144, !20, i64 2148, !21, i64 2152, !13, i64 2168, !21, i64 2176, !20, i64 2192, !13, i64 2196, !7, i64 2200, !7, i64 2201, !13, i64 2204, !13, i64 2208, !13, i64 2212, !13, i64 2216, !20, i64 2220, !7, i64 2222, !7, i64 2223, !7, i64 2224}
!20 = !{!"short", !7, i64 0}
!21 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!22 = !{!19, !6, i64 2152}
!23 = !{!24, !13, i64 0}
!24 = !{!"_ISCSI_CONNECTION", !13, i64 0, !21, i64 8, !6, i64 24, !6, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !7, i64 45, !7, i64 46, !7, i64 47, !20, i64 48, !13, i64 52, !25, i64 56, !7, i64 112, !26, i64 120, !13, i64 288, !13, i64 292, !13, i64 296}
!25 = !{!"", !13, i64 0, !10, i64 8, !21, i64 16, !21, i64 32, !13, i64 48, !13, i64 52}
!26 = !{!"", !7, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 64, !7, i64 88, !7, i64 112, !7, i64 136, !7, i64 160, !7, i64 161, !7, i64 162, !7, i64 163, !7, i64 164}
!27 = !{!28, !10, i64 0}
!28 = !{!"", !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}
!29 = !{!7, !7, i64 0}
!30 = !{!31, !13, i64 4}
!31 = !{!"_ISCSI_XFER_CONTEXT", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!32 = !{!19, !7, i64 2200}
!33 = !{!19, !13, i64 2208}
!34 = !{!28, !13, i64 44}
!35 = !{!31, !13, i64 0}
!36 = !{!31, !13, i64 8}
!37 = !{!28, !6, i64 16}
!38 = !{!28, !6, i64 8}
!39 = !{!40, !6, i64 0}
!40 = !{!"_ISCSI_IN_BUFFER_CONTEXT", !6, i64 0, !13, i64 8}
!41 = !{!28, !13, i64 40}
!42 = !{!40, !13, i64 8}
!43 = !{!44, !7, i64 25}
!44 = !{!"_ISCSI_TCB", !21, 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, !31, i64 60, !6, i64 80}
!45 = !{!46, !6, i64 88}
!46 = !{!"", !47, 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}
!47 = !{!"", !10, i64 0, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!48 = !{!24, !6, i64 24}
!49 = !{!50, !7, i64 0}
!50 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !20, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !13, i64 16, !7, i64 20}
!51 = distinct !{!51, !52}
!52 = !{!"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.1 = external hidden unnamed_addr constant [134 x i8], align 1
@.str.36 = 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 zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare i64 @TcpIoTransmit(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 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, -40
  %.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.1, i64 noundef 2850, ptr noundef nonnull @.str.36) #4
  br label %._crit_edge116

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

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

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

21:                                               ; preds = %19
  tail call void @DebugAssert(ptr noundef nonnull @.str.1, i64 noundef 2867, ptr noundef nonnull @.str.36) #4
  %22 = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !20
  br label %._crit_edge

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

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

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

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

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

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

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

59:                                               ; preds = %40
  %60 = getelementptr inbounds i8, ptr %14, i64 2200
  %61 = load i8, ptr %60, align 8, !tbaa !31
  %.not83 = icmp eq i8 %61, 0
  br i1 %.not83, label %62, label %81

62:                                               ; preds = %59
  %63 = load i32, ptr %54, align 4, !tbaa !29
  %64 = getelementptr inbounds i8, ptr %14, i64 2208
  %65 = load i32, ptr %64, align 8, !tbaa !32
  %66 = icmp ult i32 %63, %65
  br i1 %66, label %67, label %81

67:                                               ; preds = %62
  %68 = getelementptr inbounds i8, ptr %3, i64 44
  %69 = load i32, ptr %68, align 4, !tbaa !33
  %70 = icmp ult i32 %63, %69
  br i1 %70, label %71, label %81

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

81:                                               ; preds = %71, %67, %62, %59
  %.058 = phi i64 [ %56, %59 ], [ %79, %71 ], [ %56, %67 ], [ %56, %62 ]
  %82 = getelementptr inbounds i8, ptr %3, i64 8
  %83 = load ptr, ptr %82, align 8, !tbaa !37
  store ptr %83, ptr %7, align 8, !tbaa !38
  %84 = getelementptr inbounds i8, ptr %3, i64 40
  %85 = load i32, ptr %84, align 8, !tbaa !40
  %86 = getelementptr inbounds i8, ptr %7, i64 8
  store i32 %85, ptr %86, align 8, !tbaa !41
  %87 = load ptr, ptr %5, align 8, !tbaa !15
  %88 = getelementptr inbounds i8, ptr %87, i64 25
  %89 = load i8, ptr %88, align 1, !tbaa !42
  %.not8498 = icmp eq i8 %89, 0
  br i1 %.not8498, label %.lr.ph, label %.thread89.thread129

.lr.ph:                                           ; preds = %81
  %.not85 = icmp eq i64 %.0, 0
  %90 = getelementptr inbounds i8, ptr %23, i64 24
  br label %95

91:                                               ; preds = %.thread123, %132
  %.2125 = phi i64 [ %106, %.thread123 ], [ %.2, %132 ]
  %92 = load ptr, ptr %5, align 8, !tbaa !15
  %93 = getelementptr inbounds i8, ptr %92, i64 25
  %94 = load i8, ptr %93, align 1, !tbaa !42
  %.not84 = icmp eq i8 %94, 0
  br i1 %.not84, label %95, label %.loopexit, !llvm.loop !44

95:                                               ; preds = %.lr.ph, %91
  %.05999 = phi ptr [ null, %.lr.ph ], [ %.160, %91 ]
  br i1 %.not85, label %105, label %96

96:                                               ; preds = %95
  %97 = load ptr, ptr @gBS, align 8, !tbaa !15
  %98 = getelementptr inbounds i8, ptr %97, i64 88
  %99 = load ptr, ptr %98, align 8, !tbaa !46
  %100 = load ptr, ptr %90, align 8, !tbaa !49
  %101 = call i64 %99(ptr noundef %100, i32 noundef 2, i64 noundef %.0) #4
  %102 = icmp slt i64 %101, 0
  br i1 %102, label %.loopexit, label %103

103:                                              ; preds = %96
  %104 = load ptr, ptr %90, align 8, !tbaa !49
  br label %105

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

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

112:                                              ; preds = %108
  %113 = load i8, ptr %110, align 4, !tbaa !50
  %114 = and i8 %113, 63
  switch i8 %114, label %.loopexit.sink.split [
    i8 37, label %115
    i8 49, label %119
    i8 33, label %123
    i8 32, label %127
    i8 60, label %.thread123
    i8 61, label %.thread123
    i8 62, label %.thread123
  ]

115:                                              ; preds = %112
  %116 = load ptr, ptr %6, align 8, !tbaa !15
  %117 = load ptr, ptr %5, align 8, !tbaa !15
  %118 = call i64 @IScsiOnDataInRcvd(ptr noundef %116, ptr noundef %117, ptr noundef nonnull %3)
  br label %132

119:                                              ; preds = %112
  %120 = load ptr, ptr %6, align 8, !tbaa !15
  %121 = load ptr, ptr %5, align 8, !tbaa !15
  %122 = call i64 @IScsiOnR2TRcvd(ptr noundef %120, ptr noundef %121, i64 noundef %2, ptr noundef nonnull %3)
  br label %132

123:                                              ; preds = %112
  %124 = load ptr, ptr %6, align 8, !tbaa !15
  %125 = load ptr, ptr %5, align 8, !tbaa !15
  %126 = call i64 @IScsiOnScsiRspRcvd(ptr noundef %124, ptr noundef %125, ptr noundef nonnull %3)
  br label %132

127:                                              ; preds = %112
  %128 = load ptr, ptr %6, align 8, !tbaa !15
  %129 = load ptr, ptr %5, align 8, !tbaa !15
  %130 = call i64 @IScsiOnNopInRcvd(ptr noundef %128, ptr noundef %129)
  br label %132

.thread123:                                       ; preds = %112, %112, %112
  %131 = load ptr, ptr %6, align 8, !tbaa !15
  call void @NetbufFree(ptr noundef %131) #4
  br label %91

132:                                              ; preds = %127, %123, %119, %115
  %.2 = phi i64 [ %130, %127 ], [ %126, %123 ], [ %122, %119 ], [ %118, %115 ]
  %133 = load ptr, ptr %6, align 8, !tbaa !15
  call void @NetbufFree(ptr noundef %133) #4
  %134 = icmp slt i64 %.2, 0
  br i1 %134, label %.loopexit, label %91, !llvm.loop !44

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

.loopexit:                                        ; preds = %96, %105, %132, %91, %.loopexit.sink.split
  %.261 = phi ptr [ %.160, %.loopexit.sink.split ], [ %.05999, %96 ], [ %.160, %105 ], [ %.160, %132 ], [ %.160, %91 ]
  %.3 = phi i64 [ -9223372036854775784, %.loopexit.sink.split ], [ %101, %96 ], [ %106, %105 ], [ %.2, %132 ], [ %.2125, %91 ]
  %.not86 = icmp eq ptr %.261, null
  br i1 %.not86, label %.thread89, label %135

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

.thread89:                                        ; preds = %30, %71, %40, %39, %27, %135, %.loopexit
  %.393.ph.ph = phi i64 [ %.3, %135 ], [ %.3, %.loopexit ], [ -9223372036854775799, %30 ], [ %79, %71 ], [ %56, %40 ], [ -9223372036854775784, %39 ], [ %28, %27 ]
  %.pr.pr = load ptr, ptr %5, align 8, !tbaa !15
  %.not87 = icmp eq ptr %.pr.pr, null
  br i1 %.not87, label %.thread89.thread, label %.thread89.thread129

.thread89.thread129:                              ; preds = %81, %.thread89
  %.393.ph134 = phi i64 [ %.393.ph.ph, %.thread89 ], [ %.058, %81 ]
  %.pr133 = phi ptr [ %.pr.pr, %.thread89 ], [ %87, %81 ]
  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, !12, i64 40, !13, i64 104, !10, i64 120, !10, i64 128, !10, i64 136, !10, 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 = !{!6, !10, i64 144}
!15 = !{!10, !10, i64 0}
!16 = !{!17, !8, i64 2120}
!17 = !{!"_ISCSI_SESSION", !7, i64 0, !10, i64 8, !10, i64 16, !8, i64 24, !8, i64 32, !8, i64 2120, !8, i64 2121, !18, i64 2128, !7, i64 2132, !7, i64 2136, !7, i64 2140, !7, i64 2144, !18, i64 2148, !19, i64 2152, !7, i64 2168, !19, i64 2176, !18, i64 2192, !7, i64 2196, !8, i64 2200, !8, i64 2201, !7, i64 2204, !7, i64 2208, !7, i64 2212, !7, i64 2216, !18, i64 2220, !8, i64 2222, !8, i64 2223, !8, i64 2224}
!18 = !{!"short", !8, i64 0}
!19 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!20 = !{!17, !10, i64 2152}
!21 = !{!22, !7, i64 0}
!22 = !{!"_ISCSI_CONNECTION", !7, i64 0, !19, 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, !8, i64 47, !18, i64 48, !7, i64 52, !23, i64 56, !8, i64 112, !25, i64 120, !7, i64 288, !7, i64 292, !7, i64 296}
!23 = !{!"", !7, i64 0, !24, i64 8, !19, i64 16, !19, i64 32, !7, i64 48, !7, i64 52}
!24 = !{!"long long", !8, i64 0}
!25 = !{!"", !8, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 64, !8, i64 88, !8, i64 112, !8, i64 136, !8, i64 160, !8, i64 161, !8, i64 162, !8, i64 163, !8, i64 164}
!26 = !{!27, !24, i64 0}
!27 = !{!"", !24, 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}
!28 = !{!8, !8, i64 0}
!29 = !{!30, !7, i64 4}
!30 = !{!"_ISCSI_XFER_CONTEXT", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!31 = !{!17, !8, i64 2200}
!32 = !{!17, !7, i64 2208}
!33 = !{!27, !7, i64 44}
!34 = !{!30, !7, i64 0}
!35 = !{!30, !7, i64 8}
!36 = !{!27, !10, i64 16}
!37 = !{!27, !10, i64 8}
!38 = !{!39, !10, i64 0}
!39 = !{!"_ISCSI_IN_BUFFER_CONTEXT", !10, i64 0, !7, i64 8}
!40 = !{!27, !7, i64 40}
!41 = !{!39, !7, i64 8}
!42 = !{!43, !8, i64 25}
!43 = !{!"_ISCSI_TCB", !19, 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, !30, i64 60, !10, i64 80}
!44 = distinct !{!44, !45}
!45 = !{!"llvm.loop.mustprogress"}
!46 = !{!47, !10, i64 88}
!47 = !{!"", !48, 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}
!48 = !{!"", !24, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!49 = !{!22, !10, i64 24}
!50 = !{!51, !8, i64 0}
!51 = !{!"_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