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

; 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.GUID = type { i32, i16, i16, [8 x 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] }
%struct._LIST_ENTRY = type { ptr, ptr }
%struct._ISCSI_DRIVER_DATA = type { i32, ptr, ptr, %struct._ISCSI_PRIVATE_PROTOCOL, ptr, ptr, %struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL, %struct.EFI_EXT_SCSI_PASS_THRU_MODE, ptr, ptr, %struct._ISCSI_SESSION }
%struct._ISCSI_PRIVATE_PROTOCOL = type { i32 }
%struct._EFI_EXT_SCSI_PASS_THRU_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_EXT_SCSI_PASS_THRU_MODE = type { i32, i32, i32 }
%struct._ISCSI_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_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
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [154 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @IScsiDetatchConnection(ptr 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

; Function Attrs: nounwind uwtable
declare dso_local void @IScsiConnReset(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @IScsiDestroyConnection(ptr noundef) #0

declare zeroext i8 @DebugAssertEnabled() #2

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

declare zeroext i8 @IsListEmpty(ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiSessionAbort(ptr noundef %0) #0 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %7, i32 0, i32 5
  %9 = load i8, ptr %8, align 8, !tbaa !9
  %10 = zext i8 %9 to i32
  %11 = icmp ne i32 %10, 1
  br i1 %11, label %12, label %13

12:                                               ; preds = %1
  store i64 0, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %103

13:                                               ; preds = %1
  br label %14

14:                                               ; preds = %13
  %15 = call zeroext i8 @DebugAssertEnabled()
  %16 = icmp ne i8 %15, 0
  br i1 %16, label %17, label %24

17:                                               ; preds = %14
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %18, i32 0, i32 13
  %20 = call zeroext i8 @IsListEmpty(ptr noundef %19)
  %21 = icmp ne i8 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2781, ptr noundef @.str.36)
  br label %23

23:                                               ; preds = %22, %17
  br label %24

24:                                               ; preds = %23, %14
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = call zeroext i8 @DebugAssertEnabled()
  %28 = zext i8 %27 to i32
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %40

30:                                               ; preds = %26
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = ptrtoint ptr %31 to i64
  %33 = sub i64 %32, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_DRIVER_DATA, ptr null, i32 0, i32 10) to i64)
  %34 = inttoptr i64 %33 to ptr
  %35 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !20
  %37 = icmp ne i32 %36, 1094996809
  br i1 %37, label %38, label %40

38:                                               ; preds = %30
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2783, ptr noundef @.str.34)
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  br label %45

40:                                               ; preds = %30, %26
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = ptrtoint ptr %41 to i64
  %43 = sub i64 %42, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_DRIVER_DATA, ptr null, i32 0, i32 10) to i64)
  %44 = inttoptr i64 %43 to ptr
  br label %45

45:                                               ; preds = %40, %38
  %46 = phi ptr [ %39, %38 ], [ %44, %40 ]
  store ptr %46, ptr %4, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %81, %45
  %48 = load ptr, ptr %3, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %48, i32 0, i32 13
  %50 = call zeroext i8 @IsListEmpty(ptr noundef %49)
  %51 = icmp ne i8 %50, 0
  %52 = xor i1 %51, true
  br i1 %52, label %53, label %100

53:                                               ; preds = %47
  %54 = call zeroext i8 @DebugAssertEnabled()
  %55 = zext i8 %54 to i32
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %57, label %73

57:                                               ; preds = %53
  %58 = load ptr, ptr %3, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %58, i32 0, i32 13
  %60 = getelementptr inbounds %struct._LIST_ENTRY, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !25
  %62 = ptrtoint ptr %61 to i64
  %63 = sub i64 %62, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %64 = inttoptr i64 %63 to ptr
  %65 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %64, i32 0, i32 0
  %66 = load i32, ptr %65, align 8, !tbaa !26
  %67 = icmp ne i32 %66, 1313035081
  br i1 %67, label %68, label %73

68:                                               ; preds = %57
  call void @DebugAssert(ptr noundef @.str, i64 noundef 2791, ptr noundef @.str.34)
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %69, i32 0, i32 13
  %71 = getelementptr inbounds %struct._LIST_ENTRY, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !25
  br label %81

73:                                               ; preds = %57, %53
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %74, i32 0, i32 13
  %76 = getelementptr inbounds %struct._LIST_ENTRY, ptr %75, i32 0, i32 0
  %77 = load ptr, ptr %76, align 8, !tbaa !25
  %78 = ptrtoint ptr %77 to i64
  %79 = sub i64 %78, ptrtoint (ptr getelementptr inbounds (%struct._ISCSI_CONNECTION, ptr null, i32 0, i32 1) to i64)
  %80 = inttoptr i64 %79 to ptr
  br label %81

81:                                               ; preds = %73, %68
  %82 = phi ptr [ %72, %68 ], [ %80, %73 ]
  store ptr %82, ptr %5, align 8, !tbaa !5
  %83 = load ptr, ptr @gBS, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.EFI_BOOT_SERVICES, ptr %83, i32 0, i32 34
  %85 = load ptr, ptr %84, align 8, !tbaa !33
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %86, i32 0, i32 14
  %88 = getelementptr inbounds %struct._TCP4_IO, ptr %87, i32 0, i32 2
  %89 = load ptr, ptr %88, align 8, !tbaa !36
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !37
  %93 = load ptr, ptr %4, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct._ISCSI_DRIVER_DATA, ptr %93, i32 0, i32 8
  %95 = load ptr, ptr %94, align 8, !tbaa !38
  %96 = call i64 %85(ptr noundef %89, ptr noundef @gEfiTcp4ProtocolGuid, ptr noundef %92, ptr noundef %95)
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  call void @IScsiConnReset(ptr noundef %97)
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  call void @IScsiDetatchConnection(ptr noundef %98)
  %99 = load ptr, ptr %5, align 8, !tbaa !5
  call void @IScsiDestroyConnection(ptr noundef %99)
  br label %47, !llvm.loop !39

100:                                              ; preds = %47
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %101, i32 0, i32 5
  store i8 2, ptr %102, align 8, !tbaa !9
  store i64 0, ptr %2, align 8
  store i32 1, ptr %6, align 4
  br label %103

103:                                              ; preds = %100, %12
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %104 = load i64, ptr %2, align 8
  ret i64 %104
}

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, !7, i64 2880}
!10 = !{!"_ISCSI_SESSION", !11, i64 0, !12, i64 4, !16, i64 276, !7, i64 2648, !18, i64 2872, !7, i64 2880, !7, i64 2881, !15, i64 2888, !11, i64 2892, !11, i64 2896, !11, i64 2900, !11, i64 2904, !15, i64 2908, !19, i64 2912, !11, i64 2928, !19, i64 2936, !15, i64 2952, !11, i64 2956, !7, i64 2960, !7, i64 2961, !11, i64 2964, !11, i64 2968, !11, i64 2972, !11, i64 2976, !15, i64 2980, !7, i64 2982, !7, i64 2983, !7, i64 2984}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ISCSI_SESSION_CONFIG_DATA", !13, i64 0, !14, i64 259, !14, i64 263, !14, i64 267}
!13 = !{!"", !7, i64 0, !7, i64 1, !14, i64 2, !14, i64 6, !14, i64 10, !7, i64 14, !7, i64 15, !14, i64 239, !15, i64 243, !7, i64 245, !7, i64 253}
!14 = !{!"", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!"_ISCSI_CHAP_AUTH_DATA", !17, i64 0, !11, i64 292, !7, i64 296, !11, i64 1320, !7, i64 1324, !11, i64 1340, !7, i64 1344, !11, i64 2368}
!17 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !7, i64 0, !7, i64 1, !7, i64 128, !7, i64 145, !7, i64 272}
!18 = !{!"long long", !7, i64 0}
!19 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!20 = !{!21, !11, i64 0}
!21 = !{!"_ISCSI_DRIVER_DATA", !11, i64 0, !6, i64 8, !6, i64 16, !22, i64 24, !6, i64 32, !6, i64 40, !23, i64 48, !24, i64 112, !6, i64 128, !6, i64 136, !10, i64 144}
!22 = !{!"_ISCSI_PRIVATE_PROTOCOL", !11, i64 0}
!23 = !{!"_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}
!24 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8}
!25 = !{!10, !6, i64 2912}
!26 = !{!27, !11, i64 0}
!27 = !{!"_ISCSI_CONNECTION", !11, i64 0, !19, 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, !15, i64 48, !11, i64 52, !28, i64 56, !29, i64 112, !11, i64 240, !11, i64 244, !11, i64 248}
!28 = !{!"", !11, i64 0, !18, i64 8, !19, i64 16, !19, i64 32, !11, i64 48, !11, i64 52}
!29 = !{!"_TCP4_IO", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !30, i64 32, !32, i64 48, !32, i64 72, !32, i64 96, !7, i64 120, !7, i64 121, !7, i64 122, !7, i64 123}
!30 = !{!"", !31, i64 0}
!31 = !{!"", !6, i64 0, !18, i64 8}
!32 = !{!"", !31, i64 0, !7, i64 16}
!33 = !{!34, !6, i64 288}
!34 = !{!"", !35, 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}
!35 = !{!"", !18, i64 0, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20}
!36 = !{!27, !6, i64 128}
!37 = !{!21, !6, i64 8}
!38 = !{!21, !6, i64 128}
!39 = distinct !{!39, !40}
!40 = !{!"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.GUID = type { i32, i16, i16, [8 x i8] }

@gBS = external local_unnamed_addr global ptr, align 8
@gEfiTcp4ProtocolGuid = external global %struct.GUID, align 4
@.str = external hidden unnamed_addr constant [154 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [31 x i8], align 1

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

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

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

declare zeroext i8 @DebugAssertEnabled() local_unnamed_addr #1

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

declare zeroext i8 @IsListEmpty(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local noundef i64 @IScsiSessionAbort(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 2880
  %3 = load i8, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i8 %3, 1
  br i1 %.not, label %4, label %36

4:                                                ; preds = %1
  %5 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not16 = icmp eq i8 %5, 0
  br i1 %.not16, label %10, label %6

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 2912
  %8 = tail call zeroext i8 @IsListEmpty(ptr noundef nonnull %7) #2
  %.not17 = icmp eq i8 %8, 0
  br i1 %.not17, label %10, label %9

9:                                                ; preds = %6
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2781, ptr noundef nonnull @.str.36) #2
  br label %10

10:                                               ; preds = %6, %9, %4
  %11 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not18 = icmp eq i8 %11, 0
  %.pre26 = ptrtoint ptr %0 to i64
  %.pre27 = add i64 %.pre26, -144
  %.pre29 = inttoptr i64 %.pre27 to ptr
  br i1 %.not18, label %._crit_edge25, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %.pre29, align 8, !tbaa !19
  %.not19 = icmp eq i32 %13, 1094996809
  br i1 %.not19, label %._crit_edge25, label %14

14:                                               ; preds = %12
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2783, ptr noundef nonnull @.str.34) #2
  br label %._crit_edge25

._crit_edge25:                                    ; preds = %10, %12, %14
  %15 = phi ptr [ %0, %14 ], [ %.pre29, %12 ], [ %.pre29, %10 ]
  %16 = getelementptr inbounds i8, ptr %0, i64 2912
  %17 = tail call zeroext i8 @IsListEmpty(ptr noundef nonnull %16) #2
  %.not2023 = icmp eq i8 %17, 0
  br i1 %.not2023, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %._crit_edge25
  %18 = getelementptr inbounds i8, ptr %15, i64 8
  %19 = getelementptr inbounds i8, ptr %15, i64 128
  br label %20

20:                                               ; preds = %.lr.ph, %._crit_edge24
  %21 = tail call zeroext i8 @DebugAssertEnabled() #2
  %.not21 = icmp eq i8 %21, 0
  %.pre = load ptr, ptr %16, align 8, !tbaa !24
  %.pre31 = ptrtoint ptr %.pre to i64
  %.pre33 = add i64 %.pre31, -8
  %.pre35 = inttoptr i64 %.pre33 to ptr
  br i1 %.not21, label %._crit_edge24, label %22

22:                                               ; preds = %20
  %23 = load i32, ptr %.pre35, align 8, !tbaa !25
  %.not22 = icmp eq i32 %23, 1313035081
  br i1 %.not22, label %._crit_edge24, label %24

24:                                               ; preds = %22
  tail call void @DebugAssert(ptr noundef nonnull @.str, i64 noundef 2791, ptr noundef nonnull @.str.34) #2
  %25 = load ptr, ptr %16, align 8, !tbaa !24
  br label %._crit_edge24

._crit_edge24:                                    ; preds = %20, %22, %24
  %26 = phi ptr [ %25, %24 ], [ %.pre35, %22 ], [ %.pre35, %20 ]
  %27 = load ptr, ptr @gBS, align 8, !tbaa !32
  %28 = getelementptr inbounds i8, ptr %27, i64 288
  %29 = load ptr, ptr %28, align 8, !tbaa !33
  %30 = getelementptr inbounds i8, ptr %26, i64 128
  %31 = load ptr, ptr %30, align 8, !tbaa !36
  %32 = load ptr, ptr %18, align 8, !tbaa !37
  %33 = load ptr, ptr %19, align 8, !tbaa !38
  %34 = tail call i64 %29(ptr noundef %31, ptr noundef nonnull @gEfiTcp4ProtocolGuid, ptr noundef %32, ptr noundef %33) #2
  tail call void @IScsiConnReset(ptr noundef %26)
  tail call void @IScsiDetatchConnection(ptr noundef %26)
  tail call void @IScsiDestroyConnection(ptr noundef %26)
  %35 = tail call zeroext i8 @IsListEmpty(ptr noundef nonnull %16) #2
  %.not20 = icmp eq i8 %35, 0
  br i1 %.not20, label %20, label %._crit_edge, !llvm.loop !39

._crit_edge:                                      ; preds = %._crit_edge24, %._crit_edge25
  store i8 2, ptr %2, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %1, %._crit_edge
  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, !8, i64 2880}
!6 = !{!"_ISCSI_SESSION", !7, i64 0, !10, i64 4, !14, i64 276, !8, i64 2648, !16, i64 2872, !8, i64 2880, !8, i64 2881, !13, i64 2888, !7, i64 2892, !7, i64 2896, !7, i64 2900, !7, i64 2904, !13, i64 2908, !17, i64 2912, !7, i64 2928, !17, i64 2936, !13, i64 2952, !7, i64 2956, !8, i64 2960, !8, i64 2961, !7, i64 2964, !7, i64 2968, !7, i64 2972, !7, i64 2976, !13, i64 2980, !8, i64 2982, !8, i64 2983, !8, i64 2984}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_ISCSI_SESSION_CONFIG_DATA", !11, i64 0, !12, i64 259, !12, i64 263, !12, i64 267}
!11 = !{!"", !8, i64 0, !8, i64 1, !12, i64 2, !12, i64 6, !12, i64 10, !8, i64 14, !8, i64 15, !12, i64 239, !13, i64 243, !8, i64 245, !8, i64 253}
!12 = !{!"", !8, i64 0}
!13 = !{!"short", !8, i64 0}
!14 = !{!"_ISCSI_CHAP_AUTH_DATA", !15, i64 0, !7, i64 292, !8, i64 296, !7, i64 1320, !8, i64 1324, !7, i64 1340, !8, i64 1344, !7, i64 2368}
!15 = !{!"_ISCSI_CHAP_AUTH_CONFIG_NVDATA", !8, i64 0, !8, i64 1, !8, i64 128, !8, i64 145, !8, i64 272}
!16 = !{!"long long", !8, i64 0}
!17 = !{!"_LIST_ENTRY", !18, i64 0, !18, i64 8}
!18 = !{!"any pointer", !8, i64 0}
!19 = !{!20, !7, i64 0}
!20 = !{!"_ISCSI_DRIVER_DATA", !7, i64 0, !18, i64 8, !18, i64 16, !21, i64 24, !18, i64 32, !18, i64 40, !22, i64 48, !23, i64 112, !18, i64 128, !18, i64 136, !6, i64 144}
!21 = !{!"_ISCSI_PRIVATE_PROTOCOL", !7, i64 0}
!22 = !{!"_EFI_EXT_SCSI_PASS_THRU_PROTOCOL", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !18, i64 32, !18, i64 40, !18, i64 48, !18, i64 56}
!23 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8}
!24 = !{!6, !18, i64 2912}
!25 = !{!26, !7, i64 0}
!26 = !{!"_ISCSI_CONNECTION", !7, i64 0, !17, i64 8, !18, i64 24, !18, i64 32, !8, i64 40, !8, i64 41, !8, i64 42, !8, i64 43, !8, i64 44, !8, i64 45, !8, i64 46, !13, i64 48, !7, i64 52, !27, i64 56, !28, i64 112, !7, i64 240, !7, i64 244, !7, i64 248}
!27 = !{!"", !7, i64 0, !16, i64 8, !17, i64 16, !17, i64 32, !7, i64 48, !7, i64 52}
!28 = !{!"_TCP4_IO", !18, i64 0, !18, i64 8, !18, i64 16, !18, i64 24, !29, i64 32, !31, i64 48, !31, i64 72, !31, i64 96, !8, i64 120, !8, i64 121, !8, i64 122, !8, i64 123}
!29 = !{!"", !30, i64 0}
!30 = !{!"", !18, i64 0, !16, i64 8}
!31 = !{!"", !30, i64 0, !8, i64 16}
!32 = !{!18, !18, i64 0}
!33 = !{!34, !18, i64 288}
!34 = !{!"", !35, i64 0, !18, i64 24, !18, i64 32, !18, i64 40, !18, i64 48, !18, i64 56, !18, i64 64, !18, i64 72, !18, i64 80, !18, i64 88, !18, i64 96, !18, i64 104, !18, i64 112, !18, i64 120, !18, i64 128, !18, i64 136, !18, i64 144, !18, i64 152, !18, i64 160, !18, i64 168, !18, i64 176, !18, i64 184, !18, i64 192, !18, i64 200, !18, i64 208, !18, i64 216, !18, i64 224, !18, i64 232, !18, i64 240, !18, i64 248, !18, i64 256, !18, i64 264, !18, i64 272, !18, i64 280, !18, i64 288, !18, i64 296, !18, i64 304, !18, i64 312, !18, i64 320, !18, i64 328, !18, i64 336, !18, i64 344, !18, i64 352, !18, i64 360, !18, i64 368}
!35 = !{!"", !16, i64 0, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20}
!36 = !{!26, !18, i64 128}
!37 = !{!20, !18, i64 8}
!38 = !{!20, !18, i64 128}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}


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