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

; 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.EFI_MAC_ADDRESS = type { [32 x i8] }
%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._LIST_ENTRY = type { ptr, ptr }
%struct.ISCSI_NIC_INFO = type { %struct._LIST_ENTRY, i32, %struct.EFI_MAC_ADDRESS, i8, i16, i64, i64, i64 }
%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 }>
%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 = 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] }

@mPrivate = 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

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

declare zeroext i16 @NetLibGetVlanId(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiRemoveNic(ptr noundef %0) #2 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.EFI_MAC_ADDRESS, align 1
  %11 = alloca i64, align 8
  %12 = alloca i16, align 2
  %13 = 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
  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 32, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #3
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = call i64 @NetLibGetMacAddress(ptr noundef %14, ptr noundef %10, ptr noundef %11)
  store i64 %15, ptr %4, align 8, !tbaa !9
  %16 = load i64, ptr %4, align 8, !tbaa !9
  %17 = icmp slt i64 %16, 0
  br i1 %17, label %18, label %20

18:                                               ; preds = %1
  %19 = load i64, ptr %4, align 8, !tbaa !9
  store i64 %19, ptr %2, align 8
  store i32 1, ptr %13, align 4
  br label %208

20:                                               ; preds = %1
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call zeroext i16 @NetLibGetVlanId(ptr noundef %21)
  store i16 %22, ptr %12, align 2, !tbaa !11
  store ptr null, ptr %9, align 8, !tbaa !5
  %23 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %23, i32 0, i32 1
  %25 = getelementptr inbounds %struct._LIST_ENTRY, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  store ptr %26, ptr %6, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %62, %20
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %29, i32 0, i32 1
  %31 = icmp ne ptr %28, %30
  br i1 %31, label %32, label %66

32:                                               ; preds = %27
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = ptrtoint ptr %33 to i64
  %35 = sub i64 %34, 0
  %36 = inttoptr i64 %35 to ptr
  store ptr %36, ptr %5, align 8, !tbaa !5
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.ISCSI_NIC_INFO, ptr %37, i32 0, i32 1
  %39 = load i32, ptr %38, align 8, !tbaa !16
  %40 = zext i32 %39 to i64
  %41 = load i64, ptr %11, align 8, !tbaa !9
  %42 = icmp eq i64 %40, %41
  br i1 %42, label %43, label %61

43:                                               ; preds = %32
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.ISCSI_NIC_INFO, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds %struct.EFI_MAC_ADDRESS, ptr %10, i32 0, i32 0
  %47 = getelementptr inbounds [32 x i8], ptr %46, i64 0, i64 0
  %48 = load i64, ptr %11, align 8, !tbaa !9
  %49 = call i64 @CompareMem(ptr noundef %45, ptr noundef %47, i64 noundef %48)
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %51, label %61

51:                                               ; preds = %43
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.ISCSI_NIC_INFO, ptr %52, i32 0, i32 4
  %54 = load i16, ptr %53, align 2, !tbaa !20
  %55 = zext i16 %54 to i32
  %56 = load i16, ptr %12, align 2, !tbaa !11
  %57 = zext i16 %56 to i32
  %58 = icmp eq i32 %55, %57
  br i1 %58, label %59, label %61

59:                                               ; preds = %51
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %60, ptr %9, align 8, !tbaa !5
  br label %66

61:                                               ; preds = %51, %43, %32
  br label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct._LIST_ENTRY, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !21
  store ptr %65, ptr %6, align 8, !tbaa !5
  br label %27, !llvm.loop !22

66:                                               ; preds = %59, %27
  %67 = load ptr, ptr %9, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %70

69:                                               ; preds = %66
  store i64 -9223372036854775794, ptr %2, align 8
  store i32 1, ptr %13, align 4
  br label %208

70:                                               ; preds = %66
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.ISCSI_NIC_INFO, ptr %71, i32 0, i32 3
  %73 = load i8, ptr %72, align 4, !tbaa !24
  %74 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %74, i32 0, i32 3
  store i8 %73, ptr %75, align 1, !tbaa !25
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.ISCSI_NIC_INFO, ptr %76, i32 0, i32 0
  %78 = call ptr @RemoveEntryList(ptr noundef %77)
  %79 = load ptr, ptr %9, align 8, !tbaa !5
  call void @FreePool(ptr noundef %79)
  %80 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %80, i32 0, i32 2
  %82 = load i8, ptr %81, align 8, !tbaa !26
  %83 = add i8 %82, -1
  store i8 %83, ptr %81, align 8, !tbaa !26
  %84 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %84, i32 0, i32 14
  %86 = getelementptr inbounds %struct._LIST_ENTRY, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !27
  store ptr %87, ptr %6, align 8, !tbaa !5
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct._LIST_ENTRY, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !21
  store ptr %90, ptr %7, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %191, %70
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %93, i32 0, i32 14
  %95 = icmp ne ptr %92, %94
  br i1 %95, label %96, label %196

96:                                               ; preds = %91
  %97 = load ptr, ptr %6, align 8, !tbaa !5
  %98 = ptrtoint ptr %97 to i64
  %99 = sub i64 %98, 0
  %100 = inttoptr i64 %99 to ptr
  store ptr %100, ptr %8, align 8, !tbaa !5
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %101, i32 0, i32 1
  %103 = load i8, ptr %102, align 1, !tbaa !28
  %104 = zext i8 %103 to i32
  %105 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %105, i32 0, i32 3
  %107 = load i8, ptr %106, align 1, !tbaa !25
  %108 = zext i8 %107 to i32
  %109 = icmp eq i32 %104, %108
  br i1 %109, label %110, label %190

110:                                              ; preds = %96
  %111 = load ptr, ptr %8, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %111, i32 0, i32 0
  %113 = call ptr @RemoveEntryList(ptr noundef %112)
  %114 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %114, i32 0, i32 13
  %116 = load i8, ptr %115, align 1, !tbaa !31
  %117 = add i8 %116, -1
  store i8 %117, ptr %115, align 1, !tbaa !31
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %118, i32 0, i32 14
  %120 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %119, i32 0, i32 1
  %121 = load i8, ptr %120, align 1, !tbaa !32
  %122 = zext i8 %121 to i32
  %123 = icmp eq i32 %122, 2
  br i1 %123, label %124, label %158

124:                                              ; preds = %110
  %125 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %125, i32 0, i32 8
  %127 = load i8, ptr %126, align 2, !tbaa !33
  %128 = zext i8 %127 to i32
  %129 = icmp sgt i32 %128, 0
  br i1 %129, label %130, label %158

130:                                              ; preds = %124
  %131 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %131, i32 0, i32 8
  %133 = load i8, ptr %132, align 2, !tbaa !33
  %134 = add i8 %133, -1
  store i8 %134, ptr %132, align 2, !tbaa !33
  %135 = zext i8 %134 to i32
  %136 = icmp eq i32 %135, 0
  br i1 %136, label %137, label %140

137:                                              ; preds = %130
  %138 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %138, i32 0, i32 7
  store i8 0, ptr %139, align 1, !tbaa !34
  br label %140

140:                                              ; preds = %137, %130
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %141, i32 0, i32 15
  %143 = load i8, ptr %142, align 1, !tbaa !35
  %144 = zext i8 %143 to i32
  %145 = icmp eq i32 %144, 2
  br i1 %145, label %146, label %157

146:                                              ; preds = %140
  %147 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %147, i32 0, i32 9
  %149 = load i8, ptr %148, align 1, !tbaa !36
  %150 = zext i8 %149 to i32
  %151 = icmp sgt i32 %150, 0
  br i1 %151, label %152, label %157

152:                                              ; preds = %146
  %153 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %153, i32 0, i32 9
  %155 = load i8, ptr %154, align 1, !tbaa !36
  %156 = add i8 %155, -1
  store i8 %156, ptr %154, align 1, !tbaa !36
  br label %157

157:                                              ; preds = %152, %146, %140
  br label %188

158:                                              ; preds = %124, %110
  %159 = load ptr, ptr %8, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %159, i32 0, i32 14
  %161 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %160, i32 0, i32 1
  %162 = load i8, ptr %161, align 1, !tbaa !32
  %163 = zext i8 %162 to i32
  %164 = icmp eq i32 %163, 1
  br i1 %164, label %165, label %187

165:                                              ; preds = %158
  %166 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %166, i32 0, i32 10
  %168 = load i8, ptr %167, align 8, !tbaa !37
  %169 = zext i8 %168 to i32
  %170 = icmp sgt i32 %169, 0
  br i1 %170, label %171, label %187

171:                                              ; preds = %165
  %172 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %173 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %172, i32 0, i32 10
  %174 = load i8, ptr %173, align 8, !tbaa !37
  %175 = add i8 %174, -1
  store i8 %175, ptr %173, align 8, !tbaa !37
  %176 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %176, i32 0, i32 11
  %178 = load i8, ptr %177, align 1, !tbaa !38
  %179 = zext i8 %178 to i32
  %180 = icmp sgt i32 %179, 0
  br i1 %180, label %181, label %186

181:                                              ; preds = %171
  %182 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %182, i32 0, i32 11
  %184 = load i8, ptr %183, align 1, !tbaa !38
  %185 = add i8 %184, -1
  store i8 %185, ptr %183, align 1, !tbaa !38
  br label %186

186:                                              ; preds = %181, %171
  br label %187

187:                                              ; preds = %186, %165, %158
  br label %188

188:                                              ; preds = %187, %157
  %189 = load ptr, ptr %8, align 8, !tbaa !5
  call void @FreePool(ptr noundef %189)
  br label %190

190:                                              ; preds = %188, %96
  br label %191

191:                                              ; preds = %190
  %192 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %192, ptr %6, align 8, !tbaa !5
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = getelementptr inbounds %struct._LIST_ENTRY, ptr %193, i32 0, i32 0
  %195 = load ptr, ptr %194, align 8, !tbaa !21
  store ptr %195, ptr %7, align 8, !tbaa !5
  br label %91, !llvm.loop !39

196:                                              ; preds = %91
  %197 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %197, i32 0, i32 17
  %199 = load ptr, ptr %198, align 8, !tbaa !40
  %200 = icmp ne ptr %199, null
  br i1 %200, label %201, label %207

201:                                              ; preds = %196
  %202 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %202, i32 0, i32 17
  %204 = load ptr, ptr %203, align 8, !tbaa !40
  call void @FreePool(ptr noundef %204)
  %205 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.ISCSI_PRIVATE_DATA, ptr %205, i32 0, i32 17
  store ptr null, ptr %206, align 8, !tbaa !40
  br label %207

207:                                              ; preds = %201, %196
  store i64 0, ptr %2, align 8
  store i32 1, ptr %13, align 4
  br label %208

208:                                              ; preds = %207, %69, %18
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 32, 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
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %209 = load i64, ptr %2, align 8
  ret i64 %209
}

declare ptr @RemoveEntryList(ptr noundef) #1

declare void @FreePool(ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!14, !6, i64 448}
!14 = !{!"", !7, i64 0, !15, i64 448, !7, i64 464, !7, i64 465, !7, i64 466, !7, i64 467, !7, i64 468, !7, i64 469, !7, i64 470, !7, i64 471, !7, i64 472, !7, i64 473, !7, i64 474, !7, i64 475, !15, i64 480, !7, i64 496, !10, i64 720, !6, i64 728}
!15 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!16 = !{!17, !18, i64 16}
!17 = !{!"", !15, i64 0, !18, i64 16, !19, i64 20, !7, i64 52, !12, i64 54, !10, i64 56, !10, i64 64, !10, i64 72}
!18 = !{!"int", !7, i64 0}
!19 = !{!"", !7, i64 0}
!20 = !{!17, !12, i64 54}
!21 = !{!15, !6, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!17, !7, i64 52}
!25 = !{!14, !7, i64 465}
!26 = !{!14, !7, i64 464}
!27 = !{!14, !6, i64 480}
!28 = !{!29, !7, i64 16}
!29 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !15, i64 0, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !12, i64 22, !12, i64 24, !7, i64 26, !7, i64 122, !7, i64 218, !7, i64 234, !7, i64 250, !30, i64 266, !7, i64 566, !7, i64 567}
!30 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !12, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !19, i64 20, !7, i64 24, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 266, !7, i64 282, !7, i64 283, !12, i64 291, !7, i64 293, !7, i64 294}
!31 = !{!14, !7, i64 475}
!32 = !{!29, !7, i64 268}
!33 = !{!14, !7, i64 470}
!34 = !{!14, !7, i64 469}
!35 = !{!29, !7, i64 566}
!36 = !{!14, !7, i64 471}
!37 = !{!14, !7, i64 472}
!38 = !{!14, !7, i64 473}
!39 = distinct !{!39, !23}
!40 = !{!14, !6, i64 728}


; 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.EFI_MAC_ADDRESS = type { [32 x i8] }

@mPrivate = 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

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

declare zeroext i16 @NetLibGetVlanId(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775808, 1) i64 @IScsiRemoveNic(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca %struct.EFI_MAC_ADDRESS, align 1
  %3 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %4 = call i64 @NetLibGetMacAddress(ptr noundef %0, ptr noundef nonnull %2, ptr noundef nonnull %3) #3
  %5 = icmp slt i64 %4, 0
  br i1 %5, label %.thread, label %6

6:                                                ; preds = %1
  %7 = call zeroext i16 @NetLibGetVlanId(ptr noundef %0) #3
  %8 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 448
  %.02842 = load ptr, ptr %9, align 8, !tbaa !9
  %.not43 = icmp eq ptr %.02842, %9
  br i1 %.not43, label %.thread, label %.lr.ph

.lr.ph:                                           ; preds = %6, %24
  %10 = phi ptr [ %25, %24 ], [ %8, %6 ]
  %.02844 = phi ptr [ %.028, %24 ], [ %.02842, %6 ]
  %11 = getelementptr inbounds i8, ptr %.02844, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !11
  %13 = zext i32 %12 to i64
  %14 = load i64, ptr %3, align 8, !tbaa !17
  %15 = icmp eq i64 %14, %13
  br i1 %15, label %16, label %24

16:                                               ; preds = %.lr.ph
  %17 = getelementptr inbounds i8, ptr %.02844, i64 20
  %18 = call i64 @CompareMem(ptr noundef nonnull %17, ptr noundef nonnull %2, i64 noundef %13) #3
  %19 = icmp eq i64 %18, 0
  br i1 %19, label %20, label %._crit_edge52

._crit_edge52:                                    ; preds = %16
  %.pre = load ptr, ptr @mPrivate, align 8, !tbaa !5
  br label %24

20:                                               ; preds = %16
  %21 = getelementptr inbounds i8, ptr %.02844, i64 54
  %22 = load i16, ptr %21, align 2, !tbaa !18
  %23 = icmp eq i16 %22, %7
  %.pre53 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  br i1 %23, label %27, label %24

24:                                               ; preds = %._crit_edge52, %.lr.ph, %20
  %25 = phi ptr [ %.pre, %._crit_edge52 ], [ %10, %.lr.ph ], [ %.pre53, %20 ]
  %.028 = load ptr, ptr %.02844, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 448
  %.not = icmp eq ptr %.028, %26
  br i1 %.not, label %.thread, label %.lr.ph, !llvm.loop !19

27:                                               ; preds = %20
  %28 = getelementptr inbounds i8, ptr %.02844, i64 52
  %29 = load i8, ptr %28, align 4, !tbaa !21
  %30 = getelementptr inbounds i8, ptr %.pre53, i64 465
  store i8 %29, ptr %30, align 1, !tbaa !22
  %31 = call ptr @RemoveEntryList(ptr noundef nonnull %.02844) #3
  call void @FreePool(ptr noundef nonnull %.02844) #3
  %32 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 464
  %34 = load i8, ptr %33, align 8, !tbaa !24
  %35 = add i8 %34, -1
  store i8 %35, ptr %33, align 8, !tbaa !24
  %36 = getelementptr inbounds i8, ptr %32, i64 480
  %37 = load ptr, ptr %36, align 8, !tbaa !25
  %.not3346 = icmp eq ptr %37, %36
  br i1 %.not3346, label %._crit_edge, label %.lr.ph49

.lr.ph49:                                         ; preds = %27, %75
  %38 = phi ptr [ %76, %75 ], [ %32, %27 ]
  %.147 = phi ptr [ %.02948, %75 ], [ %37, %27 ]
  %.02948 = load ptr, ptr %.147, align 8, !tbaa !9
  %39 = getelementptr inbounds i8, ptr %.147, i64 16
  %40 = load i8, ptr %39, align 1, !tbaa !26
  %41 = getelementptr inbounds i8, ptr %38, i64 465
  %42 = load i8, ptr %41, align 1, !tbaa !22
  %43 = icmp eq i8 %40, %42
  br i1 %43, label %44, label %75

44:                                               ; preds = %.lr.ph49
  %45 = call ptr @RemoveEntryList(ptr noundef nonnull %.147) #3
  %46 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 475
  %48 = load i8, ptr %47, align 1, !tbaa !29
  %49 = add i8 %48, -1
  store i8 %49, ptr %47, align 1, !tbaa !29
  %50 = getelementptr inbounds i8, ptr %.147, i64 268
  %51 = load i8, ptr %50, align 1, !tbaa !30
  switch i8 %51, label %.thread40 [
    i8 2, label %52
    i8 1, label %67
  ]

52:                                               ; preds = %44
  %53 = getelementptr inbounds i8, ptr %46, i64 470
  %54 = load i8, ptr %53, align 2, !tbaa !31
  %.not35 = icmp eq i8 %54, 0
  br i1 %.not35, label %.thread40, label %55

55:                                               ; preds = %52
  %56 = add i8 %54, -1
  store i8 %56, ptr %53, align 2, !tbaa !31
  %57 = icmp eq i8 %56, 0
  br i1 %57, label %58, label %60

58:                                               ; preds = %55
  %59 = getelementptr inbounds i8, ptr %46, i64 469
  store i8 0, ptr %59, align 1, !tbaa !32
  br label %60

60:                                               ; preds = %58, %55
  %61 = getelementptr inbounds i8, ptr %.147, i64 566
  %62 = load i8, ptr %61, align 1, !tbaa !33
  %63 = icmp eq i8 %62, 2
  br i1 %63, label %64, label %.thread40

64:                                               ; preds = %60
  %65 = getelementptr inbounds i8, ptr %46, i64 471
  %66 = load i8, ptr %65, align 1, !tbaa !34
  %.not38 = icmp eq i8 %66, 0
  br i1 %.not38, label %.thread40, label %.thread40.sink.split

67:                                               ; preds = %44
  %68 = getelementptr inbounds i8, ptr %46, i64 472
  %69 = load i8, ptr %68, align 8, !tbaa !35
  %.not36 = icmp eq i8 %69, 0
  br i1 %.not36, label %.thread40, label %70

70:                                               ; preds = %67
  %71 = add i8 %69, -1
  store i8 %71, ptr %68, align 8, !tbaa !35
  %72 = getelementptr inbounds i8, ptr %46, i64 473
  %73 = load i8, ptr %72, align 1, !tbaa !36
  %.not37 = icmp eq i8 %73, 0
  br i1 %.not37, label %.thread40, label %.thread40.sink.split

.thread40.sink.split:                             ; preds = %70, %64
  %.sink58 = phi i8 [ %66, %64 ], [ %73, %70 ]
  %.sink57 = phi ptr [ %65, %64 ], [ %72, %70 ]
  %74 = add i8 %.sink58, -1
  store i8 %74, ptr %.sink57, align 1, !tbaa !37
  br label %.thread40

.thread40:                                        ; preds = %.thread40.sink.split, %44, %52, %67, %70, %60, %64
  call void @FreePool(ptr noundef nonnull %.147) #3
  %.pre54 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  br label %75

75:                                               ; preds = %.lr.ph49, %.thread40
  %76 = phi ptr [ %38, %.lr.ph49 ], [ %.pre54, %.thread40 ]
  %77 = getelementptr inbounds i8, ptr %76, i64 480
  %.not33 = icmp eq ptr %.02948, %77
  br i1 %.not33, label %._crit_edge, label %.lr.ph49, !llvm.loop !38

._crit_edge:                                      ; preds = %75, %27
  %.lcssa = phi ptr [ %32, %27 ], [ %76, %75 ]
  %78 = getelementptr inbounds i8, ptr %.lcssa, i64 728
  %79 = load ptr, ptr %78, align 8, !tbaa !39
  %.not34 = icmp eq ptr %79, null
  br i1 %.not34, label %.thread, label %80

80:                                               ; preds = %._crit_edge
  call void @FreePool(ptr noundef nonnull %79) #3
  %81 = load ptr, ptr @mPrivate, align 8, !tbaa !5
  %82 = getelementptr inbounds i8, ptr %81, i64 728
  store ptr null, ptr %82, align 8, !tbaa !39
  br label %.thread

.thread:                                          ; preds = %24, %6, %._crit_edge, %80, %1
  %.0 = phi i64 [ %4, %1 ], [ 0, %80 ], [ 0, %._crit_edge ], [ -9223372036854775794, %6 ], [ -9223372036854775794, %24 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #3
  ret i64 %.0
}

declare ptr @RemoveEntryList(ptr noundef) local_unnamed_addr #1

declare void @FreePool(ptr 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!11 = !{!12, !13, i64 16}
!12 = !{!"", !10, i64 0, !13, i64 16, !14, i64 20, !7, i64 52, !15, i64 54, !16, i64 56, !16, i64 64, !16, i64 72}
!13 = !{!"int", !7, i64 0}
!14 = !{!"", !7, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = !{!"long long", !7, i64 0}
!17 = !{!16, !16, i64 0}
!18 = !{!12, !15, i64 54}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !7, i64 52}
!22 = !{!23, !7, i64 465}
!23 = !{!"", !7, i64 0, !10, i64 448, !7, i64 464, !7, i64 465, !7, i64 466, !7, i64 467, !7, i64 468, !7, i64 469, !7, i64 470, !7, i64 471, !7, i64 472, !7, i64 473, !7, i64 474, !7, i64 475, !10, i64 480, !7, i64 496, !16, i64 720, !6, i64 728}
!24 = !{!23, !7, i64 464}
!25 = !{!23, !6, i64 480}
!26 = !{!27, !7, i64 16}
!27 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !10, i64 0, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !15, i64 22, !15, i64 24, !7, i64 26, !7, i64 122, !7, i64 218, !7, i64 234, !7, i64 250, !28, i64 266, !7, i64 566, !7, i64 567}
!28 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !15, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !14, i64 20, !7, i64 24, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 266, !7, i64 282, !7, i64 283, !15, i64 291, !7, i64 293, !7, i64 294}
!29 = !{!23, !7, i64 475}
!30 = !{!27, !7, i64 268}
!31 = !{!23, !7, i64 470}
!32 = !{!23, !7, i64 469}
!33 = !{!27, !7, i64 566}
!34 = !{!23, !7, i64 471}
!35 = !{!23, !7, i64 472}
!36 = !{!23, !7, i64 473}
!37 = !{!7, !7, i64 0}
!38 = distinct !{!38, !20}
!39 = !{!23, !6, i64 728}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass