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

; 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._TCP4_IO_CONFIG_DATA = type { %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }
%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._LIST_ENTRY = type { ptr, ptr }
%struct.NET_BUF_QUEUE = type { i32, i64, %struct._LIST_ENTRY, %struct._LIST_ENTRY, i32, i32 }
%struct._TCP4_IO = type { ptr, ptr, ptr, ptr, %struct.EFI_TCP4_CONNECTION_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_IO_TOKEN, %struct.EFI_TCP4_CLOSE_TOKEN, i8, i8, i8, i8 }
%struct.EFI_TCP4_CONNECTION_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN }
%struct.EFI_TCP4_COMPLETION_TOKEN = type { ptr, i64 }
%struct.EFI_TCP4_IO_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, %union.anon }
%union.anon = type { ptr }
%struct.EFI_TCP4_CLOSE_TOKEN = type { %struct.EFI_TCP4_COMPLETION_TOKEN, i8 }
%struct._ISCSI_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._ISCSI_CHAP_AUTH_DATA = type { %struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA, i32, [1024 x i8], i32, [16 x i8], i32, [1024 x i8], i32 }
%struct._ISCSI_CHAP_AUTH_CONFIG_NVDATA = type { i8, [127 x i8], [17 x i8], [127 x i8], [17 x i8] }
%struct.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 }
%struct._ISCSI_DRIVER_DATA = type { i32, ptr, ptr, %struct._ISCSI_PRIVATE_PROTOCOL, ptr, ptr, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, ptr, ptr, %struct._ISCSI_SESSION }
%struct._ISCSI_PRIVATE_PROTOCOL = type { i32 }
%struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_EXT_SCSI_PASS_THRU_MODE = type { i32, i32, i32 }

@gBS = external global ptr, align 8

; 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

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiCreateConnection(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct._TCP4_IO_CONFIG_DATA, align 2
  %8 = alloca i64, align 8
  %9 = 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 18, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %10 = call ptr @AllocatePool(i64 noundef 256)
  store ptr %10, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  store ptr null, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %108

14:                                               ; preds = %2
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %15, i32 0, i32 0
  store i32 1313035081, ptr %16, align 8, !tbaa !9
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %17, i32 0, i32 4
  store i8 0, ptr %18, align 8, !tbaa !20
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %19, i32 0, i32 5
  store i8 0, ptr %20, align 1, !tbaa !21
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %21, i32 0, i32 6
  store i8 1, ptr %22, align 2, !tbaa !22
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %23, i32 0, i32 7
  store i8 0, ptr %24, align 1, !tbaa !23
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %25, i32 0, i32 12
  store i32 0, ptr %26, align 4, !tbaa !24
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %27, i32 0, i32 8
  store i8 0, ptr %28, align 4, !tbaa !25
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %29, i32 0, i32 9
  store i8 0, ptr %30, align 1, !tbaa !26
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %31, i32 0, i32 12
  %33 = load i16, ptr %32, align 4, !tbaa !27
  %34 = add i16 %33, 1
  store i16 %34, ptr %32, align 4, !tbaa !27
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %35, i32 0, i32 11
  store i16 %33, ptr %36, align 8, !tbaa !34
  %37 = load ptr, ptr @gBS, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %37, i32 0, i32 8
  %39 = load ptr, ptr %38, align 8, !tbaa !35
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %40, i32 0, i32 2
  %42 = call i64 %39(i32 noundef -2147483648, i64 noundef 8, ptr noundef null, ptr noundef null, ptr noundef %41)
  store i64 %42, ptr %8, align 8, !tbaa !38
  %43 = load i64, ptr %8, align 8, !tbaa !38
  %44 = icmp slt i64 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %14
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  call void @FreePool(ptr noundef %46)
  store ptr null, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %108

47:                                               ; preds = %14
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %48, i32 0, i32 13
  call void @NetbufQueInit(ptr noundef %49)
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %50, i32 0, i32 15
  store i32 8192, ptr %51, align 8, !tbaa !39
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %52, i32 0, i32 16
  store i32 0, ptr %53, align 4, !tbaa !40
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %54, i32 0, i32 17
  store i32 0, ptr %55, align 8, !tbaa !41
  %56 = getelementptr inbounds %struct._TCP4_IO_CONFIG_DATA, ptr %7, i32 0, i32 0
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %59, i32 0, i32 2
  %61 = call ptr @CopyMem(ptr noundef %56, ptr noundef %60, i64 noundef 4)
  %62 = getelementptr inbounds %struct._TCP4_IO_CONFIG_DATA, ptr %7, i32 0, i32 1
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %63, i32 0, i32 1
  %65 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %65, i32 0, i32 3
  %67 = call ptr @CopyMem(ptr noundef %62, ptr noundef %66, i64 noundef 4)
  %68 = getelementptr inbounds %struct._TCP4_IO_CONFIG_DATA, ptr %7, i32 0, i32 2
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %69, i32 0, i32 1
  %71 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %70, i32 0, i32 0
  %72 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %71, i32 0, i32 4
  %73 = call ptr @CopyMem(ptr noundef %68, ptr noundef %72, i64 noundef 4)
  %74 = getelementptr inbounds %struct._TCP4_IO_CONFIG_DATA, ptr %7, i32 0, i32 3
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %75, i32 0, i32 1
  %77 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %76, i32 0, i32 0
  %78 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %77, i32 0, i32 7
  %79 = call ptr @CopyMem(ptr noundef %74, ptr noundef %78, i64 noundef 4)
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %80, i32 0, i32 1
  %82 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_DATA, ptr %81, i32 0, i32 0
  %83 = getelementptr inbounds %struct.ISCSI_SESSION_CONFIG_NVDATA, ptr %82, i32 0, i32 8
  %84 = load i16, ptr %83, align 1, !tbaa !42
  %85 = getelementptr inbounds %struct._TCP4_IO_CONFIG_DATA, ptr %7, i32 0, i32 4
  store i16 %84, ptr %85, align 2, !tbaa !43
  %86 = load ptr, ptr %4, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !45
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !50
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %92, i32 0, i32 14
  %94 = call i64 @Tcp4IoCreateSocket(ptr noundef %88, ptr noundef %91, ptr noundef %7, ptr noundef %93)
  store i64 %94, ptr %8, align 8, !tbaa !38
  %95 = load i64, ptr %8, align 8, !tbaa !38
  %96 = icmp slt i64 %95, 0
  br i1 %96, label %97, label %106

97:                                               ; preds = %47
  %98 = load ptr, ptr @gBS, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %98, i32 0, i32 12
  %100 = load ptr, ptr %99, align 8, !tbaa !51
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %101, i32 0, i32 2
  %103 = load ptr, ptr %102, align 8, !tbaa !52
  %104 = call i64 %100(ptr noundef %103)
  %105 = load ptr, ptr %6, align 8, !tbaa !5
  call void @FreePool(ptr noundef %105)
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %106

106:                                              ; preds = %97, %47
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %107, ptr %3, align 8
  store i32 1, ptr %9, align 4
  br label %108

108:                                              ; preds = %106, %45, %13
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 18, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %109 = load ptr, ptr %3, align 8
  ret ptr %109
}

declare ptr @AllocatePool(i64 noundef) #2

declare void @FreePool(ptr noundef) #2

declare void @NetbufQueInit(ptr noundef) #2

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) #2

declare i64 @Tcp4IoCreateSocket(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { "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, !11, i64 0}
!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, !13, i64 48, !11, i64 52, !14, i64 56, !16, i64 112, !11, i64 240, !11, i64 244, !11, i64 248}
!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 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !17, i64 32, !19, i64 48, !19, i64 72, !19, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!17 = !{!"", !18, i64 0}
!18 = !{!"", !6, i64 0, !15, i64 8}
!19 = !{!"", !18, i64 0, !7, i64 16}
!20 = !{!10, !7, i64 40}
!21 = !{!10, !7, i64 41}
!22 = !{!10, !7, i64 42}
!23 = !{!10, !7, i64 43}
!24 = !{!10, !11, i64 52}
!25 = !{!10, !7, i64 44}
!26 = !{!10, !7, i64 45}
!27 = !{!28, !13, i64 2908}
!28 = !{!"_ISCSI_SESSION", !11, i64 0, !29, i64 4, !32, i64 276, !7, i64 2648, !15, i64 2872, !7, i64 2880, !7, i64 2881, !13, i64 2888, !11, i64 2892, !11, i64 2896, !11, i64 2900, !11, i64 2904, !13, i64 2908, !12, i64 2912, !11, i64 2928, !12, i64 2936, !13, i64 2952, !11, i64 2956, !7, i64 2960, !7, i64 2961, !11, i64 2964, !11, i64 2968, !11, i64 2972, !11, i64 2976, !13, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!29 = !{!"_ISCSI_SESSION_CONFIG_DATA", !30, i64 0, !31, i64 259, !31, i64 263, !31, i64 267}
!30 = !{!"", !7, i64 0, !7, i64 1, !31, i64 2, !31, i64 6, !31, i64 10, !7, i64 14, !7, i64 15, !31, i64 239, !13, i64 243, !7, i64 245, !7, i64 253}
!31 = !{!"", !7, i64 0}
!32 = !{!"_ISCSI_CHAP_AUTH_DATA", !33, i64 0, !11, i64 292, !7, i64 296, !11, i64 1320, !7, i64 1324, !11, i64 1340, !7, i64 1344, !11, i64 2368}
!33 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!34 = !{!10, !13, i64 48}
!35 = !{!36, !6, i64 80}
!36 = !{!"", !37, 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}
!37 = !{!"", !15, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!38 = !{!15, !15, i64 0}
!39 = !{!10, !11, i64 240}
!40 = !{!10, !11, i64 244}
!41 = !{!10, !11, i64 248}
!42 = !{!28, !13, i64 247}
!43 = !{!44, !13, i64 16}
!44 = !{!"_TCP4_IO_CONFIG_DATA", !31, i64 0, !31, i64 4, !31, i64 8, !31, i64 12, !13, i64 16}
!45 = !{!46, !6, i64 8}
!46 = !{!"_ISCSI_DRIVER_DATA", !11, i64 0, !6, i64 8, !6, i64 16, !47, i64 24, !6, i64 32, !6, i64 40, !48, i64 48, !49, i64 112, !6, i64 128, !6, i64 136, !28, i64 144}
!47 = !{!"_ISCSI_PRIVATE_PROTOCOL", !11, i64 0}
!48 = !{!"_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}
!49 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!50 = !{!46, !6, i64 16}
!51 = !{!36, !6, i64 112}
!52 = !{!10, !6, i64 24}


; 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._TCP4_IO_CONFIG_DATA = type { %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, %struct.EFI_IPv4_ADDRESS, i16 }
%struct.EFI_IPv4_ADDRESS = type { [4 x i8] }

@gBS = external local_unnamed_addr global ptr, align 8

; 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

; Function Attrs: nounwind uwtable
define dso_local ptr @IScsiCreateConnection(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = alloca %struct._TCP4_IO_CONFIG_DATA, align 2
  call void @llvm.lifetime.start.p0(i64 18, ptr nonnull %3) #3
  %4 = tail call ptr @AllocatePool(i64 noundef 256) #3
  %5 = icmp eq ptr %4, null
  br i1 %5, label %54, label %6

6:                                                ; preds = %2
  store i32 1313035081, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %4, i64 40
  store <4 x i8> <i8 0, i8 0, i8 1, i8 0>, ptr %7, align 8, !tbaa !19
  %8 = getelementptr inbounds i8, ptr %4, i64 52
  store i32 0, ptr %8, align 4, !tbaa !20
  %9 = getelementptr inbounds i8, ptr %4, i64 44
  store i8 0, ptr %9, align 4, !tbaa !21
  %10 = getelementptr inbounds i8, ptr %4, i64 45
  store i8 0, ptr %10, align 1, !tbaa !22
  %11 = getelementptr inbounds i8, ptr %1, i64 2908
  %12 = load i16, ptr %11, align 4, !tbaa !23
  %13 = add i16 %12, 1
  store i16 %13, ptr %11, align 4, !tbaa !23
  %14 = getelementptr inbounds i8, ptr %4, i64 48
  store i16 %12, ptr %14, align 8, !tbaa !30
  %15 = load ptr, ptr @gBS, align 8, !tbaa !31
  %16 = getelementptr inbounds i8, ptr %15, i64 80
  %17 = load ptr, ptr %16, align 8, !tbaa !32
  %18 = getelementptr inbounds i8, ptr %4, i64 24
  %19 = tail call i64 %17(i32 noundef -2147483648, i64 noundef 8, ptr noundef null, ptr noundef null, ptr noundef nonnull %18) #3
  %20 = icmp slt i64 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %6
  tail call void @FreePool(ptr noundef nonnull %4) #3
  br label %54

22:                                               ; preds = %6
  %23 = getelementptr inbounds i8, ptr %4, i64 56
  tail call void @NetbufQueInit(ptr noundef nonnull %23) #3
  %24 = getelementptr inbounds i8, ptr %4, i64 240
  store i32 8192, ptr %24, align 8, !tbaa !35
  %25 = getelementptr inbounds i8, ptr %4, i64 244
  store i32 0, ptr %25, align 4, !tbaa !36
  %26 = getelementptr inbounds i8, ptr %4, i64 248
  store i32 0, ptr %26, align 8, !tbaa !37
  %27 = getelementptr inbounds i8, ptr %1, i64 6
  %28 = call ptr @CopyMem(ptr noundef nonnull %3, ptr noundef nonnull %27, i64 noundef 4) #3
  %29 = getelementptr inbounds i8, ptr %3, i64 4
  %30 = getelementptr inbounds i8, ptr %1, i64 10
  %31 = call ptr @CopyMem(ptr noundef nonnull %29, ptr noundef nonnull %30, i64 noundef 4) #3
  %32 = getelementptr inbounds i8, ptr %3, i64 8
  %33 = getelementptr inbounds i8, ptr %1, i64 14
  %34 = call ptr @CopyMem(ptr noundef nonnull %32, ptr noundef nonnull %33, i64 noundef 4) #3
  %35 = getelementptr inbounds i8, ptr %3, i64 12
  %36 = getelementptr inbounds i8, ptr %1, i64 243
  %37 = call ptr @CopyMem(ptr noundef nonnull %35, ptr noundef nonnull %36, i64 noundef 4) #3
  %38 = getelementptr inbounds i8, ptr %1, i64 247
  %39 = load i16, ptr %38, align 1, !tbaa !38
  %40 = getelementptr inbounds i8, ptr %3, i64 16
  store i16 %39, ptr %40, align 2, !tbaa !39
  %41 = getelementptr inbounds i8, ptr %0, i64 8
  %42 = load ptr, ptr %41, align 8, !tbaa !41
  %43 = getelementptr inbounds i8, ptr %0, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !46
  %45 = getelementptr inbounds i8, ptr %4, i64 112
  %46 = call i64 @Tcp4IoCreateSocket(ptr noundef %42, ptr noundef %44, ptr noundef nonnull %3, ptr noundef nonnull %45) #3
  %47 = icmp slt i64 %46, 0
  br i1 %47, label %48, label %54

48:                                               ; preds = %22
  %49 = load ptr, ptr @gBS, align 8, !tbaa !31
  %50 = getelementptr inbounds i8, ptr %49, i64 112
  %51 = load ptr, ptr %50, align 8, !tbaa !47
  %52 = load ptr, ptr %18, align 8, !tbaa !48
  %53 = call i64 %51(ptr noundef %52) #3
  call void @FreePool(ptr noundef nonnull %4) #3
  br label %54

54:                                               ; preds = %22, %48, %2, %21
  %.030 = phi ptr [ null, %21 ], [ null, %2 ], [ null, %48 ], [ %4, %22 ]
  call void @llvm.lifetime.end.p0(i64 18, ptr nonnull %3) #3
  ret ptr %.030
}

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

declare void @NetbufQueInit(ptr noundef) local_unnamed_addr #2

declare ptr @CopyMem(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i64 @Tcp4IoCreateSocket(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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


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