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

; 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_READY_TO_TRANSFER = type { i8, [3 x i8], i8, [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, i32 }
%struct._ISCSI_TCB = type { %struct._LIST_ENTRY, i8, i32, i8, i8, i32, i32, ptr, i32, i32, i32, %struct._ISCSI_XFER_CONTEXT, ptr }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._ISCSI_XFER_CONTEXT = type { i32, i32, i32, i32 }
%struct._ISCSI_CONNECTION = type { i32, %struct._LIST_ENTRY, ptr, ptr, i8, i8, i8, i8, i8, i8, i8, i16, i32, %struct.NET_BUF_QUEUE, %struct._TCP4_IO, i32, i32, i32 }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct._TCP4_IO = type { ptr, ptr, ptr, ptr, %struct.EFI_TCP4_CONNECTION_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_CLOSE_TOKEN, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon }
%union.anon = type { ptr }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET = type { i64, ptr, ptr, ptr, ptr, i32, i32, i8, i8, i8, i8, i8 }
%struct._ISCSI_SESSION = type { i32, %struct._ISCSI_SESSION_CONFIG_DATA, %struct._ISCSI_CHAP_AUTH_DATA, [224 x i8], i64, i8, [6 x i8], i16, i32, i32, i32, i32, i16, %struct._LIST_ENTRY, i32, %struct._LIST_ENTRY, i16, i32, i8, i8, i32, i32, i32, i32, i16, i8, i8, i8 }
%struct._ISCSI_SESSION_CONFIG_DATA = type { %struct.ISCSI_SESSION_CONFIG_NVDATA, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS }
%struct.ISCSI_SESSION_CONFIG_NVDATA = type <{ i8, i8, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i8, [224 x i8], %struct.EFI_IPv4_ADDRESS, i16, [8 x i8], [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%struct._ISCSI_CHAP_AUTH_DATA = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiCheckSN(ptr noundef, i32 noundef) #0

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

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

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

declare i32 @SwapBytes32(i32 noundef) #2

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

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

19:                                               ; preds = %4
  store i64 -9223372036854775784, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %142

20:                                               ; preds = %4
  %21 = load ptr, ptr %10, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %21, i32 0, i32 5
  %23 = load i32, ptr %22, align 4, !tbaa !11
  %24 = call i32 @SwapBytes32(i32 noundef %23)
  %25 = load ptr, ptr %10, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %25, i32 0, i32 5
  store i32 %24, ptr %26, align 4, !tbaa !11
  %27 = load ptr, ptr %10, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %27, i32 0, i32 6
  %29 = load i32, ptr %28, align 4, !tbaa !14
  %30 = call i32 @SwapBytes32(i32 noundef %29)
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %31, i32 0, i32 6
  store i32 %30, ptr %32, align 4, !tbaa !14
  %33 = load ptr, ptr %10, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %33, i32 0, i32 7
  %35 = load i32, ptr %34, align 4, !tbaa !15
  %36 = call i32 @SwapBytes32(i32 noundef %35)
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %37, i32 0, i32 7
  store i32 %36, ptr %38, align 4, !tbaa !15
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %39, i32 0, i32 10
  %41 = load i32, ptr %40, align 4, !tbaa !16
  %42 = call i32 @SwapBytes32(i32 noundef %41)
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %43, i32 0, i32 10
  store i32 %42, ptr %44, align 4, !tbaa !16
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %45, i32 0, i32 11
  %47 = load i32, ptr %46, align 4, !tbaa !17
  %48 = call i32 @SwapBytes32(i32 noundef %47)
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %49, i32 0, i32 11
  store i32 %48, ptr %50, align 4, !tbaa !17
  %51 = load ptr, ptr %10, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %51, i32 0, i32 12
  %53 = load i32, ptr %52, align 4, !tbaa !18
  %54 = call i32 @SwapBytes32(i32 noundef %53)
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %55, i32 0, i32 12
  store i32 %54, ptr %56, align 4, !tbaa !18
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %57, i32 0, i32 5
  %59 = load i32, ptr %58, align 4, !tbaa !11
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct._ISCSI_TCB, ptr %60, i32 0, i32 8
  %62 = load i32, ptr %61, align 8, !tbaa !19
  %63 = icmp ne i32 %59, %62
  br i1 %63, label %74, label %64

64:                                               ; preds = %20
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %65, i32 0, i32 7
  %67 = load i32, ptr %66, align 4, !tbaa !15
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct._ISCSI_TCB, ptr %68, i32 0, i32 12
  %70 = load ptr, ptr %69, align 8, !tbaa !23
  %71 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %70, i32 0, i32 12
  %72 = load i32, ptr %71, align 4, !tbaa !24
  %73 = icmp eq i32 %67, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %64, %20
  store i64 -9223372036854775784, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %142

75:                                               ; preds = %64
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct._ISCSI_TCB, ptr %76, i32 0, i32 2
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %78, i32 0, i32 10
  %80 = load i32, ptr %79, align 4, !tbaa !16
  %81 = call i64 @IScsiCheckSN(ptr noundef %77, i32 noundef %80)
  store i64 %81, ptr %11, align 8, !tbaa !9
  %82 = load i64, ptr %11, align 8, !tbaa !9
  %83 = icmp slt i64 %82, 0
  br i1 %83, label %84, label %86

84:                                               ; preds = %75
  %85 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %85, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %142

86:                                               ; preds = %75
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._ISCSI_TCB, ptr %87, i32 0, i32 11
  store ptr %88, ptr %12, align 8, !tbaa !5
  %89 = load ptr, ptr %10, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %89, i32 0, i32 6
  %91 = load i32, ptr %90, align 4, !tbaa !14
  %92 = load ptr, ptr %12, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %92, i32 0, i32 0
  store i32 %91, ptr %93, align 4, !tbaa !32
  %94 = load ptr, ptr %10, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %94, i32 0, i32 11
  %96 = load i32, ptr %95, align 4, !tbaa !17
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %97, i32 0, i32 1
  store i32 %96, ptr %98, align 4, !tbaa !33
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct._ISCSI_READY_TO_TRANSFER, ptr %99, i32 0, i32 12
  %101 = load i32, ptr %100, align 4, !tbaa !18
  %102 = load ptr, ptr %12, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %102, i32 0, i32 2
  store i32 %101, ptr %103, align 4, !tbaa !34
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %104, i32 0, i32 1
  %106 = load i32, ptr %105, align 4, !tbaa !33
  %107 = load ptr, ptr %12, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %107, i32 0, i32 2
  %109 = load i32, ptr %108, align 4, !tbaa !34
  %110 = add i32 %106, %109
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %111, i32 0, i32 6
  %113 = load i32, ptr %112, align 4, !tbaa !35
  %114 = icmp ugt i32 %110, %113
  br i1 %114, label %127, label %115

115:                                              ; preds = %86
  %116 = load ptr, ptr %12, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %116, i32 0, i32 2
  %118 = load i32, ptr %117, align 4, !tbaa !34
  %119 = load ptr, ptr %7, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct._ISCSI_TCB, ptr %119, i32 0, i32 12
  %121 = load ptr, ptr %120, align 8, !tbaa !23
  %122 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %121, i32 0, i32 3
  %123 = load ptr, ptr %122, align 8, !tbaa !37
  %124 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %123, i32 0, i32 20
  %125 = load i32, ptr %124, align 4, !tbaa !38
  %126 = icmp ugt i32 %118, %125
  br i1 %126, label %127, label %128

127:                                              ; preds = %115, %86
  store i64 -9223372036854775784, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %142

128:                                              ; preds = %115
  %129 = load ptr, ptr %9, align 8, !tbaa !5
  %130 = getelementptr inbounds %struct.EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET, ptr %129, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !45
  %132 = load ptr, ptr %12, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct._ISCSI_XFER_CONTEXT, ptr %132, i32 0, i32 1
  %134 = load i32, ptr %133, align 4, !tbaa !33
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds i8, ptr %131, i64 %135
  store ptr %136, ptr %13, align 8, !tbaa !5
  %137 = load ptr, ptr %13, align 8, !tbaa !5
  %138 = load i64, ptr %8, align 8, !tbaa !9
  %139 = load ptr, ptr %7, align 8, !tbaa !5
  %140 = call i64 @IScsiSendDataOutPduSequence(ptr noundef %137, i64 noundef %138, ptr noundef %139)
  store i64 %140, ptr %11, align 8, !tbaa !9
  %141 = load i64, ptr %11, align 8, !tbaa !9
  store i64 %141, ptr %5, align 8
  store i32 1, ptr %14, align 4
  br label %142

142:                                              ; preds = %128, %127, %84, %74, %19
  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
  %143 = load i64, ptr %5, align 8
  ret i64 %143
}

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 16}
!12 = !{!"_ISCSI_READY_TO_TRANSFER", !7, i64 0, !7, i64 1, !7, i64 4, !7, i64 5, !7, i64 8, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 20}
!15 = !{!12, !13, i64 24}
!16 = !{!12, !13, i64 36}
!17 = !{!12, !13, i64 40}
!18 = !{!12, !13, i64 44}
!19 = !{!20, !13, i64 48}
!20 = !{!"_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, !22, i64 60, !6, i64 80}
!21 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!22 = !{!"_ISCSI_XFER_CONTEXT", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12}
!23 = !{!20, !6, i64 80}
!24 = !{!25, !13, i64 52}
!25 = !{!"_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, !26, i64 48, !13, i64 52, !27, i64 56, !28, i64 112, !13, i64 240, !13, i64 244, !13, i64 248}
!26 = !{!"short", !7, i64 0}
!27 = !{!"", !13, i64 0, !10, i64 8, !21, i64 16, !21, i64 32, !13, i64 48, !13, i64 52}
!28 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !29, i64 32, !31, i64 48, !31, i64 72, !31, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!29 = !{!"", !30, i64 0}
!30 = !{!"", !6, i64 0, !10, i64 8}
!31 = !{!"", !30, i64 0, !7, i64 16}
!32 = !{!22, !13, i64 0}
!33 = !{!22, !13, i64 4}
!34 = !{!22, !13, i64 8}
!35 = !{!36, !13, i64 44}
!36 = !{!"", !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}
!37 = !{!25, !6, i64 32}
!38 = !{!39, !13, i64 2964}
!39 = !{!"_ISCSI_SESSION", !13, i64 0, !40, i64 4, !43, i64 276, !7, i64 2648, !10, i64 2872, !7, i64 2880, !7, i64 2881, !26, i64 2888, !13, i64 2892, !13, i64 2896, !13, i64 2900, !13, i64 2904, !26, i64 2908, !21, i64 2912, !13, i64 2928, !21, i64 2936, !26, i64 2952, !13, i64 2956, !7, i64 2960, !7, i64 2961, !13, i64 2964, !13, i64 2968, !13, i64 2972, !13, i64 2976, !26, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!40 = !{!"_ISCSI_SESSION_CONFIG_DATA", !41, i64 0, !42, i64 259, !42, i64 263, !42, i64 267}
!41 = !{!"", !7, i64 0, !7, i64 1, !42, i64 2, !42, i64 6, !42, i64 10, !7, i64 14, !7, i64 15, !42, i64 239, !26, i64 243, !7, i64 245, !7, i64 253}
!42 = !{!"", !7, i64 0}
!43 = !{!"_ISCSI_CHAP_AUTH_DATA", !44, i64 0, !13, i64 292, !7, i64 296, !13, i64 1320, !7, i64 1324, !13, i64 1340, !7, i64 1344, !13, i64 2368}
!44 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!45 = !{!36, !6, i64 16}


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

; Function Attrs: nounwind uwtable
declare dso_local i64 @IScsiCheckSN(ptr noundef, i32 noundef) local_unnamed_addr #0

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

declare i32 @SwapBytes32(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiOnR2TRcvd(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = tail call ptr @NetbufGetByte(ptr noundef %0, i32 noundef 0, ptr noundef null) #2
  %6 = icmp eq ptr %5, null
  br i1 %6, label %65, label %7

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %5, i64 16
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = tail call i32 @SwapBytes32(i32 noundef %9) #2
  store i32 %10, ptr %8, align 4, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %5, i64 20
  %12 = load i32, ptr %11, align 4, !tbaa !10
  %13 = tail call i32 @SwapBytes32(i32 noundef %12) #2
  store i32 %13, ptr %11, align 4, !tbaa !10
  %14 = getelementptr inbounds i8, ptr %5, i64 24
  %15 = load i32, ptr %14, align 4, !tbaa !11
  %16 = tail call i32 @SwapBytes32(i32 noundef %15) #2
  store i32 %16, ptr %14, align 4, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %5, i64 36
  %18 = load i32, ptr %17, align 4, !tbaa !12
  %19 = tail call i32 @SwapBytes32(i32 noundef %18) #2
  store i32 %19, ptr %17, align 4, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %5, i64 40
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %22 = tail call i32 @SwapBytes32(i32 noundef %21) #2
  store i32 %22, ptr %20, align 4, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %5, i64 44
  %24 = load i32, ptr %23, align 4, !tbaa !14
  %25 = tail call i32 @SwapBytes32(i32 noundef %24) #2
  store i32 %25, ptr %23, align 4, !tbaa !14
  %26 = load i32, ptr %8, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %1, i64 48
  %28 = load i32, ptr %27, align 8, !tbaa !15
  %.not = icmp eq i32 %26, %28
  br i1 %.not, label %29, label %65

29:                                               ; preds = %7
  %30 = load i32, ptr %14, align 4, !tbaa !11
  %31 = getelementptr inbounds i8, ptr %1, i64 80
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  %33 = getelementptr inbounds i8, ptr %32, i64 52
  %34 = load i32, ptr %33, align 4, !tbaa !21
  %35 = icmp eq i32 %30, %34
  br i1 %35, label %36, label %65

36:                                               ; preds = %29
  %37 = getelementptr inbounds i8, ptr %1, i64 20
  %38 = load i32, ptr %17, align 4, !tbaa !12
  %39 = tail call i64 @IScsiCheckSN(ptr noundef nonnull %37, i32 noundef %38)
  %40 = icmp slt i64 %39, 0
  br i1 %40, label %65, label %41

41:                                               ; preds = %36
  %42 = getelementptr inbounds i8, ptr %1, i64 60
  %43 = load i32, ptr %11, align 4, !tbaa !10
  store i32 %43, ptr %42, align 4, !tbaa !30
  %44 = load i32, ptr %20, align 4, !tbaa !13
  %45 = getelementptr inbounds i8, ptr %1, i64 64
  store i32 %44, ptr %45, align 4, !tbaa !31
  %46 = load i32, ptr %23, align 4, !tbaa !14
  %47 = getelementptr inbounds i8, ptr %1, i64 68
  store i32 %46, ptr %47, align 4, !tbaa !32
  %48 = add i32 %46, %44
  %49 = getelementptr inbounds i8, ptr %3, i64 44
  %50 = load i32, ptr %49, align 4, !tbaa !33
  %51 = icmp ugt i32 %48, %50
  br i1 %51, label %65, label %52

52:                                               ; preds = %41
  %53 = load ptr, ptr %31, align 8, !tbaa !20
  %54 = getelementptr inbounds i8, ptr %53, i64 32
  %55 = load ptr, ptr %54, align 8, !tbaa !35
  %56 = getelementptr inbounds i8, ptr %55, i64 2964
  %57 = load i32, ptr %56, align 4, !tbaa !36
  %58 = icmp ugt i32 %46, %57
  br i1 %58, label %65, label %59

59:                                               ; preds = %52
  %60 = getelementptr inbounds i8, ptr %3, i64 16
  %61 = load ptr, ptr %60, align 8, !tbaa !43
  %62 = zext i32 %44 to i64
  %63 = getelementptr inbounds i8, ptr %61, i64 %62
  %64 = tail call i64 @IScsiSendDataOutPduSequence(ptr noundef %63, i64 noundef %2, ptr noundef nonnull %1)
  br label %65

65:                                               ; preds = %41, %52, %36, %7, %29, %4, %59
  %.0 = phi i64 [ %64, %59 ], [ -9223372036854775784, %4 ], [ -9223372036854775784, %29 ], [ -9223372036854775784, %7 ], [ %39, %36 ], [ -9223372036854775784, %52 ], [ -9223372036854775784, %41 ]
  ret i64 %.0
}

attributes #0 = { 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 #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 }

!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, !9, i64 16}
!6 = !{!"_ISCSI_READY_TO_TRANSFER", !7, i64 0, !7, i64 1, !7, i64 4, !7, i64 5, !7, i64 8, !9, i64 16, !9, i64 20, !9, i64 24, !9, i64 28, !9, i64 32, !9, i64 36, !9, i64 40, !9, i64 44}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !9, i64 20}
!11 = !{!6, !9, i64 24}
!12 = !{!6, !9, i64 36}
!13 = !{!6, !9, i64 40}
!14 = !{!6, !9, i64 44}
!15 = !{!16, !9, i64 48}
!16 = !{!"_ISCSI_TCB", !17, i64 0, !7, i64 16, !9, i64 20, !7, i64 24, !7, i64 25, !9, i64 28, !9, i64 32, !18, i64 40, !9, i64 48, !9, i64 52, !9, i64 56, !19, i64 60, !18, i64 80}
!17 = !{!"_LIST_ENTRY", !18, i64 0, !18, i64 8}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"_ISCSI_XFER_CONTEXT", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!20 = !{!16, !18, i64 80}
!21 = !{!22, !9, i64 52}
!22 = !{!"_ISCSI_CONNECTION", !9, i64 0, !17, i64 8, !18, i64 24, !18, i64 32, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 43, !7, i64 44, !7, i64 45, !7, i64 46, !23, i64 48, !9, i64 52, !24, i64 56, !26, i64 112, !9, i64 240, !9, i64 244, !9, i64 248}
!23 = !{!"short", !7, i64 0}
!24 = !{!"", !9, i64 0, !25, i64 8, !17, i64 16, !17, i64 32, !9, i64 48, !9, i64 52}
!25 = !{!"long long", !7, i64 0}
!26 = !{!"_TCP4_IO", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !27, i64 32, !29, i64 48, !29, i64 72, !29, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!27 = !{!"", !28, i64 0}
!28 = !{!"", !18, i64 0, !25, i64 8}
!29 = !{!"", !28, i64 0, !7, i64 16}
!30 = !{!19, !9, i64 0}
!31 = !{!19, !9, i64 4}
!32 = !{!19, !9, i64 8}
!33 = !{!34, !9, i64 44}
!34 = !{!"", !25, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !18, i64 32, !9, i64 40, !9, i64 44, !7, i64 48, !7, i64 49, !7, i64 50, !7, i64 51, !7, i64 52}
!35 = !{!22, !18, i64 32}
!36 = !{!37, !9, i64 2964}
!37 = !{!"_ISCSI_SESSION", !9, i64 0, !38, i64 4, !41, i64 276, !7, i64 2648, !25, i64 2872, !7, i64 2880, !7, i64 2881, !23, i64 2888, !9, i64 2892, !9, i64 2896, !9, i64 2900, !9, i64 2904, !23, i64 2908, !17, i64 2912, !9, i64 2928, !17, i64 2936, !23, i64 2952, !9, i64 2956, !7, i64 2960, !7, i64 2961, !9, i64 2964, !9, i64 2968, !9, i64 2972, !9, i64 2976, !23, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!38 = !{!"_ISCSI_SESSION_CONFIG_DATA", !39, i64 0, !40, i64 259, !40, i64 263, !40, i64 267}
!39 = !{!"", !7, i64 0, !7, i64 1, !40, i64 2, !40, i64 6, !40, i64 10, !7, i64 14, !7, i64 15, !40, i64 239, !23, i64 243, !7, i64 245, !7, i64 253}
!40 = !{!"", !7, i64 0}
!41 = !{!"_ISCSI_CHAP_AUTH_DATA", !42, i64 0, !9, i64 292, !7, i64 296, !9, i64 1320, !7, i64 1324, !9, i64 1340, !7, i64 1344, !9, i64 2368}
!42 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!43 = !{!34, !18, i64 16}


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