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

; 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_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._LIST_ENTRY = type { ptr, ptr }
%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 }
%union.anon = type { ptr }
%union.TCP_IO_CLOSE_TOKEN = type { %struct.EFI_TCP4_CLOSE_TOKEN }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%union.TCP_IO_LISTEN_TOKEN = type { %struct.EFI_TCP4_LISTEN_TOKEN }
%struct.EFI_TCP4_LISTEN_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, ptr }
%struct._ISCSI_SESSION = type { i32, ptr, ptr, i8, %union.anon.1, 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.1 = 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.ISCSI_PRIVATE_DATA = type { [223 x i16], %struct._LIST_ENTRY, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, %struct._LIST_ENTRY, [224 x i8], i64, ptr }
%struct._ISCSI_ATTEMPT_CONFIG_NVDATA = type <{ %struct._LIST_ENTRY, i8, i8, i8, i8, i8, i8, i16, i16, [96 x i8], [96 x i8], %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %union.EFI_IP_ADDRESS, %struct._ISCSI_SESSION_CONFIG_NVDATA, i8, %union.anon.2 }>
%union.EFI_IP_ADDRESS = type { [4 x i32] }
%struct._ISCSI_SESSION_CONFIG_NVDATA = type <{ i16, i8, i8, %union.EFI_IP_ADDRESS, %struct.EFI_IPv4_ADDRESS, %union.EFI_IP_ADDRESS, i8, i8, [224 x i8], %union.EFI_IP_ADDRESS, i8, [8 x i8], i16, i8, [6 x i8] }>
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%union.anon.2 = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%struct._ISCSI_BASIC_HEADER = type { i8, i8, i16, i8, [3 x i8], [8 x i8], i32, [7 x i32] }

@.str = external hidden unnamed_addr constant [133 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@mPrivate = external global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 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

declare void @FreePool(ptr noundef) #1

; 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 ptr @AllocateZeroPool(i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiCHAPToSendReq(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca [256 x i8], align 16
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 256, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  br label %17

17:                                               ; preds = %2
  %18 = call zeroext i8 @DebugAssertEnabled()
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %28

20:                                               ; preds = %17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %21, i32 0, i32 5
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = zext i8 %23 to i32
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %20
  call void @DebugAssert(ptr noundef @.str, i64 noundef 372, ptr noundef @.str.1)
  br label %27

27:                                               ; preds = %26, %20
  br label %28

28:                                               ; preds = %27, %17
  br label %29

29:                                               ; preds = %28
  br label %30

30:                                               ; preds = %29
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !17
  store ptr %33, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %34, i32 0, i32 4
  store ptr %35, ptr %9, align 8, !tbaa !5
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call ptr @NetbufGetByte(ptr noundef %36, i32 noundef 0, ptr noundef null)
  store ptr %37, ptr %8, align 8, !tbaa !5
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %30
  store i64 -9223372036854775784, ptr %3, align 8
  store i32 1, ptr %16, align 4
  br label %162

41:                                               ; preds = %30
  store i64 0, ptr %6, align 8, !tbaa !18
  store i32 35, ptr %13, align 4, !tbaa !19
  %42 = load i32, ptr %13, align 4, !tbaa !19
  %43 = zext i32 %42 to i64
  %44 = call ptr @AllocateZeroPool(i64 noundef %43)
  store ptr %44, ptr %12, align 8, !tbaa !5
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %48

47:                                               ; preds = %41
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %16, align 4
  br label %162

48:                                               ; preds = %41
  store i32 35, ptr %15, align 4, !tbaa !19
  %49 = load i32, ptr %15, align 4, !tbaa !19
  %50 = zext i32 %49 to i64
  %51 = call ptr @AllocateZeroPool(i64 noundef %50)
  store ptr %51, ptr %14, align 8, !tbaa !5
  %52 = load ptr, ptr %14, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %56

54:                                               ; preds = %48
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %55)
  store i64 -9223372036854775799, ptr %3, align 8
  store i32 1, ptr %16, align 4
  br label %162

56:                                               ; preds = %48
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %57, i32 0, i32 7
  %59 = load i8, ptr %58, align 1, !tbaa !20
  %60 = zext i8 %59 to i32
  switch i32 %60, label %157 [
    i32 0, label %61
    i32 1, label %94
    i32 3, label %102
  ]

61:                                               ; preds = %56
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %63, i32 0, i32 15
  %65 = getelementptr inbounds [224 x i8], ptr %64, i64 0, i64 0
  %66 = call i64 @IScsiAddKeyValuePair(ptr noundef %62, ptr noundef @.str.13, ptr noundef %65)
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  %68 = call i64 @IScsiAddKeyValuePair(ptr noundef %67, ptr noundef @.str.14, ptr noundef @.str.15)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %70, i32 0, i32 2
  %72 = load ptr, ptr %71, align 8, !tbaa !21
  %73 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %72, i32 0, i32 14
  %74 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %73, i32 0, i32 8
  %75 = getelementptr inbounds [224 x i8], ptr %74, i64 0, i64 0
  %76 = call i64 @IScsiAddKeyValuePair(ptr noundef %69, ptr noundef @.str.16, ptr noundef %75)
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %77, i32 0, i32 3
  %79 = load i8, ptr %78, align 8, !tbaa !23
  %80 = zext i8 %79 to i32
  %81 = icmp eq i32 %80, 0
  br i1 %81, label %82, label %89

82:                                               ; preds = %61
  store ptr @.str.5, ptr %10, align 8, !tbaa !5
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %83, i32 0, i32 1
  %85 = load i8, ptr %84, align 1, !tbaa !24
  %86 = zext i8 %85 to i32
  %87 = or i32 %86, 128
  %88 = trunc i32 %87 to i8
  store i8 %88, ptr %84, align 1, !tbaa !24
  br label %90

89:                                               ; preds = %61
  store ptr @.str.6, ptr %10, align 8, !tbaa !5
  br label %90

90:                                               ; preds = %89, %82
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = call i64 @IScsiAddKeyValuePair(ptr noundef %91, ptr noundef @.str.4, ptr noundef %92)
  br label %158

94:                                               ; preds = %56
  %95 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %96 = call i64 (ptr, i64, ptr, ...) @AsciiSPrint(ptr noundef %95, i64 noundef 256, ptr noundef @.str.17, i32 noundef 5)
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %99 = call i64 @IScsiAddKeyValuePair(ptr noundef %97, ptr noundef @.str.7, ptr noundef %98)
  %100 = load ptr, ptr %4, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %100, i32 0, i32 7
  store i8 2, ptr %101, align 1, !tbaa !20
  br label %158

102:                                              ; preds = %56
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %104, i32 0, i32 0
  %106 = load ptr, ptr %105, align 8, !tbaa !26
  %107 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, ptr %106, i32 0, i32 1
  %108 = call i64 @IScsiAddKeyValuePair(ptr noundef %103, ptr noundef @.str.11, ptr noundef %107)
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %109, i32 0, i32 4
  %111 = getelementptr inbounds [16 x i8], ptr %110, i64 0, i64 0
  %112 = load ptr, ptr %12, align 8, !tbaa !5
  %113 = call i64 @IScsiBinToHex(ptr noundef %111, i32 noundef 16, ptr noundef %112, ptr noundef %13)
  %114 = load ptr, ptr %5, align 8, !tbaa !5
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = call i64 @IScsiAddKeyValuePair(ptr noundef %114, ptr noundef @.str.12, ptr noundef %115)
  %117 = load ptr, ptr %9, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %117, i32 0, i32 0
  %119 = load ptr, ptr %118, align 8, !tbaa !26
  %120 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, ptr %119, i32 0, i32 0
  %121 = load i8, ptr %120, align 1, !tbaa !28
  %122 = zext i8 %121 to i32
  %123 = icmp eq i32 %122, 1
  br i1 %123, label %124, label %150

124:                                              ; preds = %102
  %125 = load ptr, ptr %9, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %125, i32 0, i32 5
  call void @IScsiGenRandom(ptr noundef %126, i64 noundef 1)
  %127 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %128, i32 0, i32 5
  %130 = load i32, ptr %129, align 8, !tbaa !30
  %131 = call i64 (ptr, i64, ptr, ...) @AsciiSPrint(ptr noundef %127, i64 noundef 256, ptr noundef @.str.17, i32 noundef %130)
  %132 = load ptr, ptr %5, align 8, !tbaa !5
  %133 = getelementptr inbounds [256 x i8], ptr %11, i64 0, i64 0
  %134 = call i64 @IScsiAddKeyValuePair(ptr noundef %132, ptr noundef @.str.8, ptr noundef %133)
  %135 = load ptr, ptr %9, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %135, i32 0, i32 6
  %137 = getelementptr inbounds [1024 x i8], ptr %136, i64 0, i64 0
  call void @IScsiGenRandom(ptr noundef %137, i64 noundef 16)
  %138 = load ptr, ptr %9, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %138, i32 0, i32 7
  store i32 16, ptr %139, align 4, !tbaa !31
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct._ISCSI_CHAP_AUTH_DATA, ptr %140, i32 0, i32 6
  %142 = getelementptr inbounds [1024 x i8], ptr %141, i64 0, i64 0
  %143 = load ptr, ptr %14, align 8, !tbaa !5
  %144 = call i64 @IScsiBinToHex(ptr noundef %142, i32 noundef 16, ptr noundef %143, ptr noundef %15)
  %145 = load ptr, ptr %5, align 8, !tbaa !5
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = call i64 @IScsiAddKeyValuePair(ptr noundef %145, ptr noundef @.str.9, ptr noundef %146)
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %148, i32 0, i32 7
  store i8 4, ptr %149, align 1, !tbaa !20
  br label %150

150:                                              ; preds = %124, %102
  %151 = load ptr, ptr %8, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct._ISCSI_BASIC_HEADER, ptr %151, i32 0, i32 1
  %153 = load i8, ptr %152, align 1, !tbaa !24
  %154 = zext i8 %153 to i32
  %155 = or i32 %154, 128
  %156 = trunc i32 %155 to i8
  store i8 %156, ptr %152, align 1, !tbaa !24
  br label %158

157:                                              ; preds = %56
  store i64 -9223372036854775784, ptr %6, align 8, !tbaa !18
  br label %158

158:                                              ; preds = %157, %150, %94, %90
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  call void @FreePool(ptr noundef %159)
  %160 = load ptr, ptr %14, align 8, !tbaa !5
  call void @FreePool(ptr noundef %160)
  %161 = load i64, ptr %6, align 8, !tbaa !18
  store i64 %161, ptr %3, align 8
  store i32 1, ptr %16, align 4
  br label %162

162:                                              ; preds = %158, %54, %47, %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 256, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %163 = load i64, ptr %3, align 8
  ret i64 %163
}

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

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

declare i64 @AsciiSPrint(ptr noundef, i64 noundef, ptr noundef, ...) #1

declare i64 @IScsiBinToHex(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

declare void @IScsiGenRandom(ptr noundef, i64 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, !7, i64 41}
!10 = !{!"_ISCSI_CONNECTION", !11, i64 0, !12, 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, !13, i64 48, !11, i64 52, !14, i64 56, !7, i64 112, !16, i64 120, !11, i64 288, !11, i64 292, !11, i64 296}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!"", !11, i64 0, !15, i64 8, !12, i64 16, !12, i64 32, !11, i64 48, !11, i64 52}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"", !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}
!17 = !{!10, !6, i64 32}
!18 = !{!15, !15, i64 0}
!19 = !{!11, !11, i64 0}
!20 = !{!10, !7, i64 43}
!21 = !{!22, !6, i64 16}
!22 = !{!"_ISCSI_SESSION", !11, i64 0, !6, i64 8, !6, i64 16, !7, i64 24, !7, i64 32, !7, i64 2120, !7, i64 2121, !13, i64 2128, !11, i64 2132, !11, i64 2136, !11, i64 2140, !11, i64 2144, !13, i64 2148, !12, i64 2152, !11, i64 2168, !12, i64 2176, !13, i64 2192, !11, i64 2196, !7, i64 2200, !7, i64 2201, !11, i64 2204, !11, i64 2208, !11, i64 2212, !11, i64 2216, !13, i64 2220, !7, i64 2222, !7, i64 2223, !7, i64 2224}
!23 = !{!22, !7, i64 24}
!24 = !{!25, !7, i64 1}
!25 = !{!"_ISCSI_BASIC_HEADER", !7, i64 0, !7, i64 1, !13, i64 2, !7, i64 4, !7, i64 5, !7, i64 8, !11, i64 16, !7, i64 20}
!26 = !{!27, !6, i64 0}
!27 = !{!"_ISCSI_CHAP_AUTH_DATA", !6, i64 0, !11, i64 8, !7, i64 12, !11, i64 1036, !7, i64 1040, !11, i64 1056, !7, i64 1060, !11, i64 2084}
!28 = !{!29, !7, i64 0}
!29 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!30 = !{!27, !11, i64 1056}
!31 = !{!27, !11, i64 2084}


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

@.str = external hidden unnamed_addr constant [133 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [14 x i8], align 1
@mPrivate = external local_unnamed_addr global ptr, align 8
@.str.14 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 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

declare void @FreePool(ptr noundef) local_unnamed_addr #1

; 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 ptr @AllocateZeroPool(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775799, 1) i64 @IScsiCHAPToSendReq(ptr nocapture noundef %0, ptr noundef %1) local_unnamed_addr #2 {
  %3 = alloca [256 x i8], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #3
  %6 = tail call zeroext i8 @DebugAssertEnabled() #3
  %.not = icmp eq i8 %6, 0
  br i1 %.not, label %12, label %7

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 41
  %9 = load i8, ptr %8, align 1, !tbaa !5
  %10 = icmp eq i8 %9, 0
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 372, ptr noundef nonnull @.str.1) #3
  br label %12

12:                                               ; preds = %7, %11, %2
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %14, i64 32
  %16 = tail call ptr @NetbufGetByte(ptr noundef %1, i32 noundef 0, ptr noundef null) #3
  %17 = icmp eq ptr %16, null
  br i1 %17, label %73, label %18

18:                                               ; preds = %12
  store i32 35, ptr %4, align 4, !tbaa !17
  %19 = tail call ptr @AllocateZeroPool(i64 noundef 35) #3
  %20 = icmp eq ptr %19, null
  br i1 %20, label %73, label %21

21:                                               ; preds = %18
  store i32 35, ptr %5, align 4, !tbaa !17
  %22 = tail call ptr @AllocateZeroPool(i64 noundef 35) #3
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  tail call void @FreePool(ptr noundef nonnull %19) #3
  br label %73

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %0, i64 43
  %27 = load i8, ptr %26, align 1, !tbaa !18
  switch i8 %27, label %72 [
    i8 0, label %28
    i8 1, label %46
    i8 3, label %49
  ]

28:                                               ; preds = %25
  %29 = load ptr, ptr @mPrivate, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %29, i64 496
  %31 = tail call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.13, ptr noundef nonnull %30) #3
  %32 = tail call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.15) #3
  %33 = getelementptr inbounds i8, ptr %14, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !20
  %35 = getelementptr inbounds i8, ptr %34, i64 308
  %36 = tail call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.16, ptr noundef nonnull %35) #3
  %37 = getelementptr inbounds i8, ptr %14, i64 24
  %38 = load i8, ptr %37, align 8, !tbaa !22
  %39 = icmp eq i8 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %28
  %41 = getelementptr inbounds i8, ptr %16, i64 1
  %42 = load i8, ptr %41, align 1, !tbaa !23
  %43 = or i8 %42, -128
  store i8 %43, ptr %41, align 1, !tbaa !23
  br label %44

44:                                               ; preds = %28, %40
  %.041 = phi ptr [ @.str.5, %40 ], [ @.str.6, %28 ]
  %45 = tail call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.4, ptr noundef nonnull %.041) #3
  br label %72

46:                                               ; preds = %25
  %47 = call i64 (ptr, i64, ptr, ...) @AsciiSPrint(ptr noundef nonnull %3, i64 noundef 256, ptr noundef nonnull @.str.17, i32 noundef 5) #3
  %48 = call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.7, ptr noundef nonnull %3) #3
  store i8 2, ptr %26, align 1, !tbaa !18
  br label %72

49:                                               ; preds = %25
  %50 = load ptr, ptr %15, align 8, !tbaa !25
  %51 = getelementptr inbounds i8, ptr %50, i64 1
  %52 = tail call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.11, ptr noundef nonnull %51) #3
  %53 = getelementptr inbounds i8, ptr %14, i64 1072
  %54 = call i64 @IScsiBinToHex(ptr noundef nonnull %53, i32 noundef 16, ptr noundef nonnull %19, ptr noundef nonnull %4) #3
  %55 = call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.12, ptr noundef nonnull %19) #3
  %56 = load ptr, ptr %15, align 8, !tbaa !25
  %57 = load i8, ptr %56, align 1, !tbaa !27
  %58 = icmp eq i8 %57, 1
  br i1 %58, label %59, label %68

59:                                               ; preds = %49
  %60 = getelementptr inbounds i8, ptr %14, i64 1088
  call void @IScsiGenRandom(ptr noundef nonnull %60, i64 noundef 1) #3
  %61 = load i32, ptr %60, align 8, !tbaa !29
  %62 = call i64 (ptr, i64, ptr, ...) @AsciiSPrint(ptr noundef nonnull %3, i64 noundef 256, ptr noundef nonnull @.str.17, i32 noundef %61) #3
  %63 = call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.8, ptr noundef nonnull %3) #3
  %64 = getelementptr inbounds i8, ptr %14, i64 1092
  call void @IScsiGenRandom(ptr noundef nonnull %64, i64 noundef 16) #3
  %65 = getelementptr inbounds i8, ptr %14, i64 2116
  store i32 16, ptr %65, align 4, !tbaa !30
  %66 = call i64 @IScsiBinToHex(ptr noundef nonnull %64, i32 noundef 16, ptr noundef nonnull %22, ptr noundef nonnull %5) #3
  %67 = call i64 @IScsiAddKeyValuePair(ptr noundef %1, ptr noundef nonnull @.str.9, ptr noundef nonnull %22) #3
  store i8 4, ptr %26, align 1, !tbaa !18
  br label %68

68:                                               ; preds = %59, %49
  %69 = getelementptr inbounds i8, ptr %16, i64 1
  %70 = load i8, ptr %69, align 1, !tbaa !23
  %71 = or i8 %70, -128
  store i8 %71, ptr %69, align 1, !tbaa !23
  br label %72

72:                                               ; preds = %25, %68, %46, %44
  %.040 = phi i64 [ 0, %68 ], [ 0, %46 ], [ 0, %44 ], [ -9223372036854775784, %25 ]
  call void @FreePool(ptr noundef nonnull %19) #3
  call void @FreePool(ptr noundef nonnull %22) #3
  br label %73

73:                                               ; preds = %18, %12, %72, %24
  %.0 = phi i64 [ -9223372036854775799, %24 ], [ %.040, %72 ], [ -9223372036854775784, %12 ], [ -9223372036854775799, %18 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #3
  ret i64 %.0
}

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

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

declare i64 @AsciiSPrint(ptr noundef, i64 noundef, ptr noundef, ...) local_unnamed_addr #1

declare i64 @IScsiBinToHex(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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 = { 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, !8, i64 41}
!6 = !{!"_ISCSI_CONNECTION", !7, i64 0, !10, i64 8, !11, i64 24, !11, 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, !12, i64 48, !7, i64 52, !13, i64 56, !8, i64 112, !15, i64 120, !7, i64 288, !7, i64 292, !7, i64 296}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_LIST_ENTRY", !11, i64 0, !11, i64 8}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!"", !7, i64 0, !14, i64 8, !10, i64 16, !10, i64 32, !7, i64 48, !7, i64 52}
!14 = !{!"long long", !8, i64 0}
!15 = !{!"", !8, i64 0, !11, i64 8, !11, i64 16, !11, 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}
!16 = !{!6, !11, i64 32}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !8, i64 43}
!19 = !{!11, !11, i64 0}
!20 = !{!21, !11, i64 16}
!21 = !{!"_ISCSI_SESSION", !7, i64 0, !11, i64 8, !11, i64 16, !8, i64 24, !8, i64 32, !8, i64 2120, !8, i64 2121, !12, i64 2128, !7, i64 2132, !7, i64 2136, !7, i64 2140, !7, i64 2144, !12, i64 2148, !10, i64 2152, !7, i64 2168, !10, i64 2176, !12, i64 2192, !7, i64 2196, !8, i64 2200, !8, i64 2201, !7, i64 2204, !7, i64 2208, !7, i64 2212, !7, i64 2216, !12, i64 2220, !8, i64 2222, !8, i64 2223, !8, i64 2224}
!22 = !{!21, !8, i64 24}
!23 = !{!24, !8, i64 1}
!24 = !{!"_ISCSI_BASIC_HEADER", !8, i64 0, !8, i64 1, !12, i64 2, !8, i64 4, !8, i64 5, !8, i64 8, !7, i64 16, !8, i64 20}
!25 = !{!26, !11, i64 0}
!26 = !{!"_ISCSI_CHAP_AUTH_DATA", !11, i64 0, !7, i64 8, !8, i64 12, !7, i64 1036, !8, i64 1040, !7, i64 1056, !8, i64 1060, !7, i64 2084}
!27 = !{!28, !8, i64 0}
!28 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !8, i64 0, !8, i64 1, !8, i64 128, !8, i64 145, !8, i64 272}
!29 = !{!26, !7, i64 1056}
!30 = !{!26, !7, i64 2084}


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