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

; 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_IP6_MODE_DATA = type { i8, i32, %struct.EFI_IP6_CONFIG_DATA, i8, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr }
%struct.EFI_IP6_CONFIG_DATA = type { i8, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32, i32 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%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.0 }
%union.anon.0 = 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, 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 = 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_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._EFI_TCP6_PROTOCOL = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.EFI_IP6_ADDRESS_INFO = type { %struct.EFI_IPv6_ADDRESS, i8 }
%struct.EFI_IP6_ROUTE_TABLE = type { %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8 }

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiGetIp6NicInfo(ptr noundef %0) #2 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.EFI_IP6_MODE_DATA, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i8, align 1
  %11 = alloca i64, align 8
  %12 = 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 160, 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 1, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %13, i32 0, i32 3
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct._ISCSI_SESSION, ptr %15, i32 0, i32 2
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %17, i32 0, i32 14
  store ptr %18, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %19, i32 0, i32 9
  store ptr %20, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ISCSI_CONNECTION, ptr %21, i32 0, i32 16
  %23 = getelementptr inbounds %struct.TCP_IO, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  store ptr %24, ptr %5, align 8, !tbaa !5
  %25 = call ptr @ZeroMem(ptr noundef %6, i64 noundef 160)
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct._EFI_TCP6_PROTOCOL, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !20
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call i64 %28(ptr noundef %29, ptr noundef null, ptr noundef null, ptr noundef %6, ptr noundef null, ptr noundef null)
  store i64 %30, ptr %7, align 8, !tbaa !22
  %31 = load i64, ptr %7, align 8, !tbaa !22
  %32 = icmp slt i64 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %1
  %34 = load i64, ptr %7, align 8, !tbaa !22
  store i64 %34, ptr %2, align 8
  store i32 1, ptr %12, align 4
  br label %186

35:                                               ; preds = %1
  %36 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 3
  %37 = load i8, ptr %36, align 4, !tbaa !23
  %38 = icmp ne i8 %37, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %35
  store i64 -9223372036854775787, ptr %7, align 8, !tbaa !22
  br label %142

40:                                               ; preds = %35
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %41, i32 0, i32 3
  %43 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 2
  %44 = getelementptr inbounds %struct.EFI_IP6_CONFIG_DATA, ptr %43, i32 0, i32 5
  %45 = call ptr @CopyMem(ptr noundef %42, ptr noundef %44, i64 noundef 16)
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %46, i32 0, i32 10
  store i8 0, ptr %47, align 1, !tbaa !27
  store i64 0, ptr %9, align 8, !tbaa !22
  br label %48

48:                                               ; preds = %74, %40
  %49 = load i64, ptr %9, align 8, !tbaa !22
  %50 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 4
  %51 = load i32, ptr %50, align 8, !tbaa !29
  %52 = zext i32 %51 to i64
  %53 = icmp ult i64 %49, %52
  br i1 %53, label %54, label %77

54:                                               ; preds = %48
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %55, i32 0, i32 3
  %57 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 5
  %58 = load ptr, ptr %57, align 8, !tbaa !30
  %59 = load i64, ptr %9, align 8, !tbaa !22
  %60 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %58, i64 %59
  %61 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %60, i32 0, i32 0
  %62 = call i64 @CompareMem(ptr noundef %56, ptr noundef %61, i64 noundef 16)
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %73

64:                                               ; preds = %54
  %65 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 5
  %66 = load ptr, ptr %65, align 8, !tbaa !30
  %67 = load i64, ptr %9, align 8, !tbaa !22
  %68 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %66, i64 %67
  %69 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %68, i32 0, i32 1
  %70 = load i8, ptr %69, align 1, !tbaa !31
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %71, i32 0, i32 10
  store i8 %70, ptr %72, align 1, !tbaa !27
  br label %77

73:                                               ; preds = %54
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %9, align 8, !tbaa !22
  %76 = add i64 %75, 1
  store i64 %76, ptr %9, align 8, !tbaa !22
  br label %48, !llvm.loop !33

77:                                               ; preds = %64, %48
  store i8 0, ptr %10, align 1, !tbaa !19
  %78 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 8
  %79 = load i32, ptr %78, align 8, !tbaa !35
  %80 = zext i32 %79 to i64
  store i64 %80, ptr %11, align 8, !tbaa !22
  store i64 0, ptr %9, align 8, !tbaa !22
  br label %81

81:                                               ; preds = %123, %77
  %82 = load i64, ptr %9, align 8, !tbaa !22
  %83 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 8
  %84 = load i32, ptr %83, align 8, !tbaa !35
  %85 = zext i32 %84 to i64
  %86 = icmp ult i64 %82, %85
  br i1 %86, label %87, label %126

87:                                               ; preds = %81
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %90 = load ptr, ptr %89, align 8, !tbaa !36
  %91 = load i64, ptr %9, align 8, !tbaa !22
  %92 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %90, i64 %91
  %93 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %92, i32 0, i32 1
  %94 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %95 = load ptr, ptr %94, align 8, !tbaa !36
  %96 = load i64, ptr %9, align 8, !tbaa !22
  %97 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %95, i64 %96
  %98 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %97, i32 0, i32 2
  %99 = load i8, ptr %98, align 1, !tbaa !37
  %100 = call zeroext i8 @NetIp6IsNetEqual(ptr noundef %88, ptr noundef %93, i8 noundef zeroext %99)
  %101 = icmp ne i8 %100, 0
  br i1 %101, label %102, label %122

102:                                              ; preds = %87
  %103 = load i8, ptr %10, align 1, !tbaa !19
  %104 = zext i8 %103 to i32
  %105 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %106 = load ptr, ptr %105, align 8, !tbaa !36
  %107 = load i64, ptr %9, align 8, !tbaa !22
  %108 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %106, i64 %107
  %109 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %108, i32 0, i32 2
  %110 = load i8, ptr %109, align 1, !tbaa !37
  %111 = zext i8 %110 to i32
  %112 = icmp slt i32 %104, %111
  br i1 %112, label %113, label %121

113:                                              ; preds = %102
  %114 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %115 = load ptr, ptr %114, align 8, !tbaa !36
  %116 = load i64, ptr %9, align 8, !tbaa !22
  %117 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %115, i64 %116
  %118 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %117, i32 0, i32 2
  %119 = load i8, ptr %118, align 1, !tbaa !37
  store i8 %119, ptr %10, align 1, !tbaa !19
  %120 = load i64, ptr %9, align 8, !tbaa !22
  store i64 %120, ptr %11, align 8, !tbaa !22
  br label %121

121:                                              ; preds = %113, %102
  br label %122

122:                                              ; preds = %121, %87
  br label %123

123:                                              ; preds = %122
  %124 = load i64, ptr %9, align 8, !tbaa !22
  %125 = add i64 %124, 1
  store i64 %125, ptr %9, align 8, !tbaa !22
  br label %81, !llvm.loop !39

126:                                              ; preds = %81
  %127 = load i64, ptr %11, align 8, !tbaa !22
  %128 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 8
  %129 = load i32, ptr %128, align 8, !tbaa !35
  %130 = zext i32 %129 to i64
  %131 = icmp ne i64 %127, %130
  br i1 %131, label %132, label %141

132:                                              ; preds = %126
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %133, i32 0, i32 5
  %135 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %136 = load ptr, ptr %135, align 8, !tbaa !36
  %137 = load i64, ptr %11, align 8, !tbaa !22
  %138 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %136, i64 %137
  %139 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %138, i32 0, i32 0
  %140 = call ptr @CopyMem(ptr noundef %134, ptr noundef %139, i64 noundef 16)
  br label %141

141:                                              ; preds = %132, %126
  br label %142

142:                                              ; preds = %141, %39
  %143 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 5
  %144 = load ptr, ptr %143, align 8, !tbaa !30
  %145 = icmp ne ptr %144, null
  br i1 %145, label %146, label %149

146:                                              ; preds = %142
  %147 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 5
  %148 = load ptr, ptr %147, align 8, !tbaa !30
  call void @FreePool(ptr noundef %148)
  br label %149

149:                                              ; preds = %146, %142
  %150 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 7
  %151 = load ptr, ptr %150, align 8, !tbaa !40
  %152 = icmp ne ptr %151, null
  br i1 %152, label %153, label %156

153:                                              ; preds = %149
  %154 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 7
  %155 = load ptr, ptr %154, align 8, !tbaa !40
  call void @FreePool(ptr noundef %155)
  br label %156

156:                                              ; preds = %153, %149
  %157 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %158 = load ptr, ptr %157, align 8, !tbaa !36
  %159 = icmp ne ptr %158, null
  br i1 %159, label %160, label %163

160:                                              ; preds = %156
  %161 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 9
  %162 = load ptr, ptr %161, align 8, !tbaa !36
  call void @FreePool(ptr noundef %162)
  br label %163

163:                                              ; preds = %160, %156
  %164 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 11
  %165 = load ptr, ptr %164, align 8, !tbaa !41
  %166 = icmp ne ptr %165, null
  br i1 %166, label %167, label %170

167:                                              ; preds = %163
  %168 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 11
  %169 = load ptr, ptr %168, align 8, !tbaa !41
  call void @FreePool(ptr noundef %169)
  br label %170

170:                                              ; preds = %167, %163
  %171 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 13
  %172 = load ptr, ptr %171, align 8, !tbaa !42
  %173 = icmp ne ptr %172, null
  br i1 %173, label %174, label %177

174:                                              ; preds = %170
  %175 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 13
  %176 = load ptr, ptr %175, align 8, !tbaa !42
  call void @FreePool(ptr noundef %176)
  br label %177

177:                                              ; preds = %174, %170
  %178 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 15
  %179 = load ptr, ptr %178, align 8, !tbaa !43
  %180 = icmp ne ptr %179, null
  br i1 %180, label %181, label %184

181:                                              ; preds = %177
  %182 = getelementptr inbounds %struct.EFI_IP6_MODE_DATA, ptr %6, i32 0, i32 15
  %183 = load ptr, ptr %182, align 8, !tbaa !43
  call void @FreePool(ptr noundef %183)
  br label %184

184:                                              ; preds = %181, %177
  %185 = load i64, ptr %7, align 8, !tbaa !22
  store i64 %185, ptr %2, align 8
  store i32 1, ptr %12, align 4
  br label %186

186:                                              ; preds = %184, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 1, 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 160, 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
  %187 = load i64, ptr %2, align 8
  ret i64 %187
}

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

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

declare zeroext i8 @NetIp6IsNetEqual(ptr noundef, ptr noundef, i8 noundef zeroext) #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, !6, i64 32}
!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 = !{!18, !6, i64 16}
!18 = !{!"_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}
!19 = !{!7, !7, i64 0}
!20 = !{!21, !6, i64 0}
!21 = !{!"_EFI_TCP6_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, !6, i64 64}
!22 = !{!15, !15, i64 0}
!23 = !{!24, !7, i64 60}
!24 = !{!"", !7, i64 0, !11, i64 4, !25, i64 8, !7, i64 60, !11, i64 64, !6, i64 72, !11, i64 80, !6, i64 88, !11, i64 96, !6, i64 104, !11, i64 112, !6, i64 120, !11, i64 128, !6, i64 136, !11, i64 144, !6, i64 152}
!25 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !26, i64 4, !26, i64 20, !7, i64 36, !7, i64 37, !11, i64 40, !11, i64 44, !11, i64 48}
!26 = !{!"", !7, i64 0}
!27 = !{!28, !7, i64 282}
!28 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !13, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !26, i64 20, !7, i64 24, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 266, !7, i64 282, !7, i64 283, !13, i64 291, !7, i64 293, !7, i64 294}
!29 = !{!24, !11, i64 64}
!30 = !{!24, !6, i64 72}
!31 = !{!32, !7, i64 16}
!32 = !{!"", !26, i64 0, !7, i64 16}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!24, !11, i64 96}
!36 = !{!24, !6, i64 104}
!37 = !{!38, !7, i64 32}
!38 = !{!"", !26, i64 0, !26, i64 16, !7, i64 32}
!39 = distinct !{!39, !34}
!40 = !{!24, !6, i64 88}
!41 = !{!24, !6, i64 120}
!42 = !{!24, !6, i64 136}
!43 = !{!24, !6, i64 152}


; 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_IP6_MODE_DATA = type { i8, i32, %struct.EFI_IP6_CONFIG_DATA, i8, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr, i32, ptr }
%struct.EFI_IP6_CONFIG_DATA = type { i8, i8, i8, i8, %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8, i8, i32, i32, i32 }
%struct.EFI_IPv6_ADDRESS = type { [16 x i8] }
%struct.EFI_IP6_ADDRESS_INFO = type { %struct.EFI_IPv6_ADDRESS, i8 }
%struct.EFI_IP6_ROUTE_TABLE = type { %struct.EFI_IPv6_ADDRESS, %struct.EFI_IPv6_ADDRESS, i8 }

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiGetIp6NicInfo(ptr nocapture noundef readonly %0) local_unnamed_addr #2 {
  %2 = alloca %struct.EFI_IP6_MODE_DATA, align 8
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %2) #4
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 16
  %6 = load ptr, ptr %5, align 8, !tbaa !16
  %7 = getelementptr inbounds i8, ptr %6, i64 532
  %8 = getelementptr inbounds i8, ptr %0, i64 152
  %9 = load ptr, ptr %8, align 8, !tbaa !18
  %10 = call ptr @ZeroMem(ptr noundef nonnull %2, i64 noundef 160) #4
  %11 = load ptr, ptr %9, align 8, !tbaa !19
  %12 = call i64 %11(ptr noundef nonnull %9, ptr noundef null, ptr noundef null, ptr noundef nonnull %2, ptr noundef null, ptr noundef null) #4
  %13 = icmp slt i64 %12, 0
  br i1 %13, label %89, label %14

14:                                               ; preds = %1
  %15 = getelementptr inbounds i8, ptr %2, i64 60
  %16 = load i8, ptr %15, align 4, !tbaa !21
  %.not = icmp eq i8 %16, 0
  br i1 %.not, label %._crit_edge.thread, label %17

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %6, i64 270
  %19 = getelementptr inbounds i8, ptr %2, i64 28
  %20 = call ptr @CopyMem(ptr noundef nonnull %18, ptr noundef nonnull %19, i64 noundef 16) #4
  %21 = getelementptr inbounds i8, ptr %6, i64 548
  store i8 0, ptr %21, align 1, !tbaa !25
  %22 = getelementptr inbounds i8, ptr %2, i64 64
  %23 = load i32, ptr %22, align 8, !tbaa !27
  %.not60 = icmp eq i32 %23, 0
  br i1 %.not60, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %17
  %24 = getelementptr inbounds i8, ptr %2, i64 72
  br label %25

25:                                               ; preds = %.lr.ph, %34
  %.03054 = phi i64 [ 0, %.lr.ph ], [ %35, %34 ]
  %26 = load ptr, ptr %24, align 8, !tbaa !28
  %27 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %26, i64 %.03054
  %28 = call i64 @CompareMem(ptr noundef nonnull %18, ptr noundef %27, i64 noundef 16) #4
  %29 = icmp eq i64 %28, 0
  br i1 %29, label %30, label %34

30:                                               ; preds = %25
  %31 = load ptr, ptr %24, align 8, !tbaa !28
  %32 = getelementptr inbounds %struct.EFI_IP6_ADDRESS_INFO, ptr %31, i64 %.03054, i32 1
  %33 = load i8, ptr %32, align 1, !tbaa !29
  store i8 %33, ptr %21, align 1, !tbaa !25
  br label %.loopexit

34:                                               ; preds = %25
  %35 = add nuw nsw i64 %.03054, 1
  %36 = load i32, ptr %22, align 8, !tbaa !27
  %37 = zext i32 %36 to i64
  %38 = icmp ult i64 %35, %37
  br i1 %38, label %25, label %.loopexit, !llvm.loop !31

.loopexit:                                        ; preds = %34, %17, %30
  %39 = getelementptr inbounds i8, ptr %2, i64 96
  %40 = load i32, ptr %39, align 8, !tbaa !33
  %.not61 = icmp eq i32 %40, 0
  br i1 %.not61, label %._crit_edge.thread, label %.lr.ph58

.lr.ph58:                                         ; preds = %.loopexit
  %41 = zext i32 %40 to i64
  %42 = getelementptr inbounds i8, ptr %2, i64 104
  br label %43

43:                                               ; preds = %.lr.ph58, %55
  %.057 = phi i64 [ %41, %.lr.ph58 ], [ %.1, %55 ]
  %.02856 = phi i8 [ 0, %.lr.ph58 ], [ %.129, %55 ]
  %.13155 = phi i64 [ 0, %.lr.ph58 ], [ %56, %55 ]
  %44 = load ptr, ptr %42, align 8, !tbaa !34
  %45 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %44, i64 %.13155
  %46 = getelementptr inbounds i8, ptr %45, i64 16
  %47 = getelementptr inbounds i8, ptr %45, i64 32
  %48 = load i8, ptr %47, align 1, !tbaa !35
  %49 = call zeroext i8 @NetIp6IsNetEqual(ptr noundef nonnull %7, ptr noundef nonnull %46, i8 noundef zeroext %48) #4
  %.not50 = icmp eq i8 %49, 0
  br i1 %.not50, label %55, label %50

50:                                               ; preds = %43
  %51 = load ptr, ptr %42, align 8, !tbaa !34
  %52 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %51, i64 %.13155, i32 2
  %53 = load i8, ptr %52, align 1, !tbaa !35
  %54 = icmp ult i8 %.02856, %53
  %spec.select = call i8 @llvm.umax.i8(i8 %.02856, i8 %53)
  %spec.select51 = select i1 %54, i64 %.13155, i64 %.057
  br label %55

55:                                               ; preds = %50, %43
  %.129 = phi i8 [ %.02856, %43 ], [ %spec.select, %50 ]
  %.1 = phi i64 [ %.057, %43 ], [ %spec.select51, %50 ]
  %56 = add nuw nsw i64 %.13155, 1
  %57 = load i32, ptr %39, align 8, !tbaa !33
  %58 = zext i32 %57 to i64
  %59 = icmp ult i64 %56, %58
  br i1 %59, label %43, label %._crit_edge, !llvm.loop !37

._crit_edge:                                      ; preds = %55
  %.not43 = icmp eq i64 %.1, %58
  br i1 %.not43, label %._crit_edge.thread, label %60

60:                                               ; preds = %._crit_edge
  %61 = getelementptr inbounds i8, ptr %6, i64 290
  %62 = getelementptr inbounds i8, ptr %2, i64 104
  %63 = load ptr, ptr %62, align 8, !tbaa !34
  %64 = getelementptr inbounds %struct.EFI_IP6_ROUTE_TABLE, ptr %63, i64 %.1
  %65 = call ptr @CopyMem(ptr noundef nonnull %61, ptr noundef %64, i64 noundef 16) #4
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.loopexit, %14, %._crit_edge, %60
  %.033 = phi i64 [ %12, %60 ], [ %12, %._crit_edge ], [ -9223372036854775787, %14 ], [ %12, %.loopexit ]
  %66 = getelementptr inbounds i8, ptr %2, i64 72
  %67 = load ptr, ptr %66, align 8, !tbaa !28
  %.not44 = icmp eq ptr %67, null
  br i1 %.not44, label %69, label %68

68:                                               ; preds = %._crit_edge.thread
  call void @FreePool(ptr noundef nonnull %67) #4
  br label %69

69:                                               ; preds = %68, %._crit_edge.thread
  %70 = getelementptr inbounds i8, ptr %2, i64 88
  %71 = load ptr, ptr %70, align 8, !tbaa !38
  %.not45 = icmp eq ptr %71, null
  br i1 %.not45, label %73, label %72

72:                                               ; preds = %69
  call void @FreePool(ptr noundef nonnull %71) #4
  br label %73

73:                                               ; preds = %72, %69
  %74 = getelementptr inbounds i8, ptr %2, i64 104
  %75 = load ptr, ptr %74, align 8, !tbaa !34
  %.not46 = icmp eq ptr %75, null
  br i1 %.not46, label %77, label %76

76:                                               ; preds = %73
  call void @FreePool(ptr noundef nonnull %75) #4
  br label %77

77:                                               ; preds = %76, %73
  %78 = getelementptr inbounds i8, ptr %2, i64 120
  %79 = load ptr, ptr %78, align 8, !tbaa !39
  %.not47 = icmp eq ptr %79, null
  br i1 %.not47, label %81, label %80

80:                                               ; preds = %77
  call void @FreePool(ptr noundef nonnull %79) #4
  br label %81

81:                                               ; preds = %80, %77
  %82 = getelementptr inbounds i8, ptr %2, i64 136
  %83 = load ptr, ptr %82, align 8, !tbaa !40
  %.not48 = icmp eq ptr %83, null
  br i1 %.not48, label %85, label %84

84:                                               ; preds = %81
  call void @FreePool(ptr noundef nonnull %83) #4
  br label %85

85:                                               ; preds = %84, %81
  %86 = getelementptr inbounds i8, ptr %2, i64 152
  %87 = load ptr, ptr %86, align 8, !tbaa !41
  %.not49 = icmp eq ptr %87, null
  br i1 %.not49, label %89, label %88

88:                                               ; preds = %85
  call void @FreePool(ptr noundef nonnull %87) #4
  br label %89

89:                                               ; preds = %85, %88, %1
  %.032 = phi i64 [ %12, %1 ], [ %.033, %88 ], [ %.033, %85 ]
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #4
  ret i64 %.032
}

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

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

declare zeroext i8 @NetIp6IsNetEqual(ptr noundef, ptr noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i8 @llvm.umax.i8(i8, i8) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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, !11, i64 32}
!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 = !{!17, !11, i64 16}
!17 = !{!"_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}
!18 = !{!8, !8, i64 0}
!19 = !{!20, !11, i64 0}
!20 = !{!"_EFI_TCP6_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, !11, i64 64}
!21 = !{!22, !8, i64 60}
!22 = !{!"", !8, i64 0, !7, i64 4, !23, i64 8, !8, i64 60, !7, i64 64, !11, i64 72, !7, i64 80, !11, i64 88, !7, i64 96, !11, i64 104, !7, i64 112, !11, i64 120, !7, i64 128, !11, i64 136, !7, i64 144, !11, i64 152}
!23 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !24, i64 4, !24, i64 20, !8, i64 36, !8, i64 37, !7, i64 40, !7, i64 44, !7, i64 48}
!24 = !{!"", !8, i64 0}
!25 = !{!26, !8, i64 282}
!26 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !12, i64 0, !8, i64 2, !8, i64 3, !8, i64 4, !24, i64 20, !8, i64 24, !8, i64 40, !8, i64 41, !8, i64 42, !8, i64 266, !8, i64 282, !8, i64 283, !12, i64 291, !8, i64 293, !8, i64 294}
!27 = !{!22, !7, i64 64}
!28 = !{!22, !11, i64 72}
!29 = !{!30, !8, i64 16}
!30 = !{!"", !24, i64 0, !8, i64 16}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!22, !7, i64 96}
!34 = !{!22, !11, i64 104}
!35 = !{!36, !8, i64 32}
!36 = !{!"", !24, i64 0, !24, i64 16, !8, i64 32}
!37 = distinct !{!37, !32}
!38 = !{!22, !11, i64 88}
!39 = !{!22, !11, i64 120}
!40 = !{!22, !11, i64 136}
!41 = !{!22, !11, i64 152}


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