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

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct._ISCSI_ROOT_PATH_FIELD = type { ptr, i8 }
%union.EFI_IP_ADDRESS = type { [4 x 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 }>
%struct._LIST_ENTRY = type { ptr, ptr }
%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] }

@.str = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiDhcpExtractRootPath(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) #0 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i8, align 1
  %10 = alloca ptr, align 8
  %11 = alloca [5 x %struct._ISCSI_ROOT_PATH_FIELD], align 16
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i8, align 1
  %15 = alloca ptr, align 8
  %16 = alloca %union.EFI_IP_ADDRESS, align 4
  %17 = alloca i8, align 1
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i8 %1, ptr %6, align 1, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 80, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 1, ptr %17) #3
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %19, i32 0, i32 14
  store ptr %20, ptr %15, align 8, !tbaa !5
  %21 = call i64 @AsciiStrLen(ptr noundef @.str)
  %22 = trunc i64 %21 to i8
  store i8 %22, ptr %9, align 1, !tbaa !9
  %23 = load i8, ptr %6, align 1, !tbaa !9
  %24 = zext i8 %23 to i32
  %25 = load i8, ptr %9, align 1, !tbaa !9
  %26 = zext i8 %25 to i32
  %27 = icmp sle i32 %24, %26
  br i1 %27, label %34, label %28

28:                                               ; preds = %3
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load i8, ptr %9, align 1, !tbaa !9
  %31 = zext i8 %30 to i64
  %32 = call i64 @CompareMem(ptr noundef %29, ptr noundef @.str, i64 noundef %31)
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %35

34:                                               ; preds = %28, %3
  store i64 -9223372036854775794, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %291

35:                                               ; preds = %28
  %36 = load i8, ptr %9, align 1, !tbaa !9
  %37 = zext i8 %36 to i32
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = sext i32 %37 to i64
  %40 = getelementptr inbounds i8, ptr %38, i64 %39
  store ptr %40, ptr %5, align 8, !tbaa !5
  %41 = load i8, ptr %6, align 1, !tbaa !9
  %42 = zext i8 %41 to i32
  %43 = load i8, ptr %9, align 1, !tbaa !9
  %44 = zext i8 %43 to i32
  %45 = sub nsw i32 %42, %44
  %46 = trunc i32 %45 to i8
  store i8 %46, ptr %6, align 1, !tbaa !9
  %47 = load i8, ptr %6, align 1, !tbaa !9
  %48 = zext i8 %47 to i32
  %49 = add nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = call ptr @AllocatePool(i64 noundef %50)
  store ptr %51, ptr %10, align 8, !tbaa !5
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = icmp eq ptr %52, null
  br i1 %53, label %54, label %55

54:                                               ; preds = %35
  store i64 -9223372036854775799, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %291

55:                                               ; preds = %35
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = load i8, ptr %6, align 1, !tbaa !9
  %59 = zext i8 %58 to i64
  %60 = call ptr @CopyMem(ptr noundef %56, ptr noundef %57, i64 noundef %59)
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = load i8, ptr %6, align 1, !tbaa !9
  %63 = zext i8 %62 to i64
  %64 = getelementptr inbounds i8, ptr %61, i64 %63
  store i8 0, ptr %64, align 1, !tbaa !9
  store i8 0, ptr %14, align 1, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !10
  %65 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 0
  %66 = call ptr @ZeroMem(ptr noundef %65, i64 noundef 80)
  store i32 0, ptr %13, align 4, !tbaa !10
  br label %67

67:                                               ; preds = %154, %55
  %68 = load i32, ptr %13, align 4, !tbaa !10
  %69 = icmp ult i32 %68, 5
  br i1 %69, label %70, label %76

70:                                               ; preds = %67
  %71 = load i8, ptr %14, align 1, !tbaa !9
  %72 = zext i8 %71 to i32
  %73 = load i8, ptr %6, align 1, !tbaa !9
  %74 = zext i8 %73 to i32
  %75 = icmp slt i32 %72, %74
  br label %76

76:                                               ; preds = %70, %67
  %77 = phi i1 [ false, %67 ], [ %75, %70 ]
  br i1 %77, label %78, label %157

78:                                               ; preds = %76
  %79 = load ptr, ptr %10, align 8, !tbaa !5
  %80 = load i8, ptr %14, align 1, !tbaa !9
  %81 = zext i8 %80 to i64
  %82 = getelementptr inbounds i8, ptr %79, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !9
  %84 = sext i8 %83 to i32
  %85 = icmp ne i32 %84, 58
  br i1 %85, label %86, label %95

86:                                               ; preds = %78
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = load i8, ptr %14, align 1, !tbaa !9
  %89 = zext i8 %88 to i64
  %90 = getelementptr inbounds i8, ptr %87, i64 %89
  %91 = load i32, ptr %13, align 4, !tbaa !10
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 %92
  %94 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %93, i32 0, i32 0
  store ptr %90, ptr %94, align 16, !tbaa !12
  br label %95

95:                                               ; preds = %86, %78
  br label %96

96:                                               ; preds = %112, %95
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = load i8, ptr %14, align 1, !tbaa !9
  %99 = zext i8 %98 to i64
  %100 = getelementptr inbounds i8, ptr %97, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !9
  %102 = sext i8 %101 to i32
  %103 = icmp ne i32 %102, 58
  br i1 %103, label %104, label %110

104:                                              ; preds = %96
  %105 = load i8, ptr %14, align 1, !tbaa !9
  %106 = zext i8 %105 to i32
  %107 = load i8, ptr %6, align 1, !tbaa !9
  %108 = zext i8 %107 to i32
  %109 = icmp slt i32 %106, %108
  br label %110

110:                                              ; preds = %104, %96
  %111 = phi i1 [ false, %96 ], [ %109, %104 ]
  br i1 %111, label %112, label %115

112:                                              ; preds = %110
  %113 = load i8, ptr %14, align 1, !tbaa !9
  %114 = add i8 %113, 1
  store i8 %114, ptr %14, align 1, !tbaa !9
  br label %96, !llvm.loop !14

115:                                              ; preds = %110
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = load i8, ptr %14, align 1, !tbaa !9
  %118 = zext i8 %117 to i64
  %119 = getelementptr inbounds i8, ptr %116, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !9
  %121 = sext i8 %120 to i32
  %122 = icmp eq i32 %121, 58
  br i1 %122, label %123, label %153

123:                                              ; preds = %115
  %124 = load i32, ptr %13, align 4, !tbaa !10
  %125 = icmp ne i32 %124, 4
  br i1 %125, label %126, label %133

126:                                              ; preds = %123
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = load i8, ptr %14, align 1, !tbaa !9
  %129 = zext i8 %128 to i64
  %130 = getelementptr inbounds i8, ptr %127, i64 %129
  store i8 0, ptr %130, align 1, !tbaa !9
  %131 = load i8, ptr %14, align 1, !tbaa !9
  %132 = add i8 %131, 1
  store i8 %132, ptr %14, align 1, !tbaa !9
  br label %133

133:                                              ; preds = %126, %123
  %134 = load i32, ptr %13, align 4, !tbaa !10
  %135 = zext i32 %134 to i64
  %136 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 %135
  %137 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %136, i32 0, i32 0
  %138 = load ptr, ptr %137, align 16, !tbaa !12
  %139 = icmp ne ptr %138, null
  br i1 %139, label %140, label %152

140:                                              ; preds = %133
  %141 = load i32, ptr %13, align 4, !tbaa !10
  %142 = zext i32 %141 to i64
  %143 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 %142
  %144 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %143, i32 0, i32 0
  %145 = load ptr, ptr %144, align 16, !tbaa !12
  %146 = call i64 @AsciiStrLen(ptr noundef %145)
  %147 = trunc i64 %146 to i8
  %148 = load i32, ptr %13, align 4, !tbaa !10
  %149 = zext i32 %148 to i64
  %150 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 %149
  %151 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %150, i32 0, i32 1
  store i8 %147, ptr %151, align 8, !tbaa !16
  br label %152

152:                                              ; preds = %140, %133
  br label %153

153:                                              ; preds = %152, %115
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %13, align 4, !tbaa !10
  %156 = add i32 %155, 1
  store i32 %156, ptr %13, align 4, !tbaa !10
  br label %67, !llvm.loop !17

157:                                              ; preds = %76
  %158 = load i32, ptr %13, align 4, !tbaa !10
  %159 = icmp ne i32 %158, 5
  br i1 %159, label %160, label %161

160:                                              ; preds = %157
  store i64 -9223372036854775806, ptr %8, align 8, !tbaa !18
  br label %288

161:                                              ; preds = %157
  %162 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 0
  %163 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %162, i32 0, i32 0
  %164 = load ptr, ptr %163, align 16, !tbaa !12
  %165 = icmp eq ptr %164, null
  br i1 %165, label %177, label %166

166:                                              ; preds = %161
  %167 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 4
  %168 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %167, i32 0, i32 0
  %169 = load ptr, ptr %168, align 16, !tbaa !12
  %170 = icmp eq ptr %169, null
  br i1 %170, label %177, label %171

171:                                              ; preds = %166
  %172 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 1
  %173 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %172, i32 0, i32 1
  %174 = load i8, ptr %173, align 8, !tbaa !16
  %175 = zext i8 %174 to i32
  %176 = icmp sgt i32 %175, 1
  br i1 %176, label %177, label %178

177:                                              ; preds = %171, %166, %161
  store i64 -9223372036854775806, ptr %8, align 8, !tbaa !18
  br label %288

178:                                              ; preds = %171
  %179 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 0
  store ptr %179, ptr %12, align 8, !tbaa !5
  %180 = load ptr, ptr %15, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %180, i32 0, i32 2
  %182 = load i8, ptr %181, align 1, !tbaa !20
  %183 = zext i8 %182 to i32
  %184 = icmp slt i32 %183, 2
  br i1 %184, label %185, label %189

185:                                              ; preds = %178
  %186 = load ptr, ptr %15, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %186, i32 0, i32 2
  %188 = load i8, ptr %187, align 1, !tbaa !20
  store i8 %188, ptr %17, align 1, !tbaa !9
  br label %193

189:                                              ; preds = %178
  %190 = load ptr, ptr %7, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct._ISCSI_ATTEMPT_CONFIG_NVDATA, ptr %190, i32 0, i32 6
  %192 = load i8, ptr %191, align 1, !tbaa !24
  store i8 %192, ptr %17, align 1, !tbaa !9
  br label %193

193:                                              ; preds = %189, %185
  %194 = load ptr, ptr %12, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %194, i32 0, i32 0
  %196 = load ptr, ptr %195, align 8, !tbaa !12
  %197 = load i8, ptr %17, align 1, !tbaa !9
  %198 = call i64 @IScsiAsciiStrToIp(ptr noundef %196, i8 noundef zeroext %197, ptr noundef %16)
  store i64 %198, ptr %8, align 8, !tbaa !18
  %199 = load ptr, ptr %15, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %199, i32 0, i32 9
  %201 = call ptr @CopyMem(ptr noundef %200, ptr noundef %16, i64 noundef 16)
  %202 = load i64, ptr %8, align 8, !tbaa !18
  %203 = icmp slt i64 %202, 0
  br i1 %203, label %204, label %205

204:                                              ; preds = %193
  br label %288

205:                                              ; preds = %193
  %206 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 1
  store ptr %206, ptr %12, align 8, !tbaa !5
  %207 = load ptr, ptr %12, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !12
  %210 = icmp ne ptr %209, null
  br i1 %210, label %211, label %220

211:                                              ; preds = %205
  %212 = load ptr, ptr %12, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %212, i32 0, i32 0
  %214 = load ptr, ptr %213, align 8, !tbaa !12
  %215 = load i8, ptr %214, align 1, !tbaa !9
  %216 = sext i8 %215 to i32
  %217 = sub nsw i32 %216, 48
  %218 = icmp ne i32 %217, 6
  br i1 %218, label %219, label %220

219:                                              ; preds = %211
  store i64 -9223372036854775806, ptr %8, align 8, !tbaa !18
  br label %288

220:                                              ; preds = %211, %205
  %221 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 2
  store ptr %221, ptr %12, align 8, !tbaa !5
  %222 = load ptr, ptr %12, align 8, !tbaa !5
  %223 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %222, i32 0, i32 0
  %224 = load ptr, ptr %223, align 8, !tbaa !12
  %225 = icmp ne ptr %224, null
  br i1 %225, label %226, label %234

226:                                              ; preds = %220
  %227 = load ptr, ptr %12, align 8, !tbaa !5
  %228 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %227, i32 0, i32 0
  %229 = load ptr, ptr %228, align 8, !tbaa !12
  %230 = call i64 @AsciiStrDecimalToUintn(ptr noundef %229)
  %231 = trunc i64 %230 to i16
  %232 = load ptr, ptr %15, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %232, i32 0, i32 0
  store i16 %231, ptr %233, align 1, !tbaa !27
  br label %237

234:                                              ; preds = %220
  %235 = load ptr, ptr %15, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %235, i32 0, i32 0
  store i16 3260, ptr %236, align 1, !tbaa !27
  br label %237

237:                                              ; preds = %234, %226
  %238 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 3
  store ptr %238, ptr %12, align 8, !tbaa !5
  %239 = load ptr, ptr %12, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %239, i32 0, i32 0
  %241 = load ptr, ptr %240, align 8, !tbaa !12
  %242 = icmp ne ptr %241, null
  br i1 %242, label %243, label %255

243:                                              ; preds = %237
  %244 = load ptr, ptr %12, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %244, i32 0, i32 0
  %246 = load ptr, ptr %245, align 8, !tbaa !12
  %247 = load ptr, ptr %15, align 8, !tbaa !5
  %248 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %247, i32 0, i32 11
  %249 = getelementptr inbounds [8 x i8], ptr %248, i64 0, i64 0
  %250 = call i64 @IScsiAsciiStrToLun(ptr noundef %246, ptr noundef %249)
  store i64 %250, ptr %8, align 8, !tbaa !18
  %251 = load i64, ptr %8, align 8, !tbaa !18
  %252 = icmp slt i64 %251, 0
  br i1 %252, label %253, label %254

253:                                              ; preds = %243
  br label %288

254:                                              ; preds = %243
  br label %260

255:                                              ; preds = %237
  %256 = load ptr, ptr %15, align 8, !tbaa !5
  %257 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %256, i32 0, i32 11
  %258 = getelementptr inbounds [8 x i8], ptr %257, i64 0, i64 0
  %259 = call ptr @ZeroMem(ptr noundef %258, i64 noundef 8)
  br label %260

260:                                              ; preds = %255, %254
  %261 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %11, i64 0, i64 4
  store ptr %261, ptr %12, align 8, !tbaa !5
  %262 = load ptr, ptr %12, align 8, !tbaa !5
  %263 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %262, i32 0, i32 0
  %264 = load ptr, ptr %263, align 8, !tbaa !12
  %265 = call i64 @AsciiStrLen(ptr noundef %264)
  %266 = icmp ugt i64 %265, 223
  br i1 %266, label %267, label %268

267:                                              ; preds = %260
  store i64 -9223372036854775806, ptr %8, align 8, !tbaa !18
  br label %288

268:                                              ; preds = %260
  %269 = load ptr, ptr %12, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %269, i32 0, i32 0
  %271 = load ptr, ptr %270, align 8, !tbaa !12
  %272 = load ptr, ptr %12, align 8, !tbaa !5
  %273 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %272, i32 0, i32 0
  %274 = load ptr, ptr %273, align 8, !tbaa !12
  %275 = call i64 @AsciiStrLen(ptr noundef %274)
  %276 = call i64 @IScsiNormalizeName(ptr noundef %271, i64 noundef %275)
  store i64 %276, ptr %8, align 8, !tbaa !18
  %277 = load i64, ptr %8, align 8, !tbaa !18
  %278 = icmp slt i64 %277, 0
  br i1 %278, label %279, label %280

279:                                              ; preds = %268
  br label %288

280:                                              ; preds = %268
  %281 = load ptr, ptr %15, align 8, !tbaa !5
  %282 = getelementptr inbounds %struct._ISCSI_SESSION_CONFIG_NVDATA, ptr %281, i32 0, i32 8
  %283 = getelementptr inbounds [224 x i8], ptr %282, i64 0, i64 0
  %284 = load ptr, ptr %12, align 8, !tbaa !5
  %285 = getelementptr inbounds %struct._ISCSI_ROOT_PATH_FIELD, ptr %284, i32 0, i32 0
  %286 = load ptr, ptr %285, align 8, !tbaa !12
  %287 = call ptr @AsciiStrCpy(ptr noundef %283, ptr noundef %286)
  br label %288

288:                                              ; preds = %280, %279, %267, %253, %219, %204, %177, %160
  %289 = load ptr, ptr %10, align 8, !tbaa !5
  call void @FreePool(ptr noundef %289)
  %290 = load i64, ptr %8, align 8, !tbaa !18
  store i64 %290, ptr %4, align 8
  store i32 1, ptr %18, align 4
  br label %291

291:                                              ; preds = %288, %54, %34
  call void @llvm.lifetime.end.p0(i64 1, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 80, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %292 = load i64, ptr %4, align 8
  ret i64 %292
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i64 @AsciiStrLen(ptr noundef) #2

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

declare ptr @AllocatePool(i64 noundef) #2

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

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

declare i64 @IScsiAsciiStrToIp(ptr noundef, i8 noundef zeroext, ptr noundef) #2

declare i64 @AsciiStrDecimalToUintn(ptr noundef) #2

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

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

declare ptr @AsciiStrCpy(ptr noundef, ptr noundef) #2

declare void @FreePool(ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ISCSI_ROOT_PATH_FIELD", !6, i64 0, !7, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!13, !7, i64 8}
!17 = distinct !{!17, !15}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = !{!21, !7, i64 3}
!21 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !22, i64 0, !7, i64 2, !7, i64 3, !7, i64 4, !23, i64 20, !7, i64 24, !7, i64 40, !7, i64 41, !7, i64 42, !7, i64 266, !7, i64 282, !7, i64 283, !22, i64 291, !7, i64 293, !7, i64 294}
!22 = !{!"short", !7, i64 0}
!23 = !{!"", !7, i64 0}
!24 = !{!25, !7, i64 21}
!25 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !26, i64 0, !7, i64 16, !7, i64 17, !7, i64 18, !7, i64 19, !7, i64 20, !7, i64 21, !22, i64 22, !22, i64 24, !7, i64 26, !7, i64 122, !7, i64 218, !7, i64 234, !7, i64 250, !21, i64 266, !7, i64 566, !7, i64 567}
!26 = !{!"_LIST_ENTRY", !6, i64 0, !6, i64 8}
!27 = !{!21, !22, i64 0}


; 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._ISCSI_ROOT_PATH_FIELD = type { ptr, i8 }
%union.EFI_IP_ADDRESS = type { [4 x i32] }

@.str = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @IScsiDhcpExtractRootPath(ptr noundef %0, i8 noundef zeroext %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [5 x %struct._ISCSI_ROOT_PATH_FIELD], align 16
  %5 = alloca %union.EFI_IP_ADDRESS, align 4
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #3
  %6 = getelementptr inbounds i8, ptr %2, i64 266
  %7 = tail call i64 @AsciiStrLen(ptr noundef nonnull @.str) #3
  %8 = zext i8 %1 to i32
  %9 = trunc i64 %7 to i32
  %10 = and i32 %9, 255
  %.not = icmp ult i32 %10, %8
  br i1 %.not, label %11, label %110

11:                                               ; preds = %3
  %12 = and i64 %7, 255
  %13 = tail call i64 @CompareMem(ptr noundef %0, ptr noundef nonnull @.str, i64 noundef %12) #3
  %.not90 = icmp eq i64 %13, 0
  br i1 %.not90, label %14, label %110

14:                                               ; preds = %11
  %15 = trunc i64 %7 to i8
  %16 = sub i8 %1, %15
  %17 = zext i8 %16 to i64
  %18 = add nuw nsw i64 %17, 1
  %19 = tail call ptr @AllocatePool(i64 noundef %18) #3
  %20 = icmp eq ptr %19, null
  br i1 %20, label %110, label %21

21:                                               ; preds = %14
  %22 = getelementptr inbounds i8, ptr %0, i64 %12
  %23 = tail call ptr @CopyMem(ptr noundef nonnull %19, ptr noundef %22, i64 noundef %17) #3
  %24 = getelementptr inbounds i8, ptr %19, i64 %17
  store i8 0, ptr %24, align 1, !tbaa !5
  %25 = call ptr @ZeroMem(ptr noundef nonnull %4, i64 noundef 80) #3
  %.not103 = icmp eq i8 %15, %1
  br i1 %.not103, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %21, %51
  %indvars.iv107 = phi i64 [ %indvars.iv.next108, %51 ], [ 0, %21 ]
  %.075102 = phi i8 [ %.3, %51 ], [ 0, %21 ]
  %26 = zext i8 %.075102 to i64
  %27 = getelementptr inbounds i8, ptr %19, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !5
  %.not96 = icmp eq i8 %28, 58
  br i1 %.not96, label %.preheader, label %29

29:                                               ; preds = %.lr.ph
  %30 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %4, i64 0, i64 %indvars.iv107
  store ptr %27, ptr %30, align 16, !tbaa !8
  br label %.preheader

.preheader:                                       ; preds = %29, %.lr.ph
  br label %31

31:                                               ; preds = %.preheader, %31
  %indvars.iv = phi i64 [ %indvars.iv.next, %31 ], [ %26, %.preheader ]
  %32 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = icmp ne i8 %33, 58
  %35 = icmp ult i64 %indvars.iv, %17
  %36 = and i1 %35, %34
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %36, label %31, label %37, !llvm.loop !11

37:                                               ; preds = %31
  %38 = getelementptr inbounds i8, ptr %19, i64 %indvars.iv
  %39 = trunc nuw i64 %indvars.iv to i8
  %40 = icmp eq i8 %33, 58
  br i1 %40, label %41, label %51

41:                                               ; preds = %37
  %.not97 = icmp eq i64 %indvars.iv107, 4
  br i1 %.not97, label %44, label %42

42:                                               ; preds = %41
  store i8 0, ptr %38, align 1, !tbaa !5
  %43 = add i8 %39, 1
  br label %44

44:                                               ; preds = %42, %41
  %.2 = phi i8 [ %43, %42 ], [ %39, %41 ]
  %45 = getelementptr inbounds [5 x %struct._ISCSI_ROOT_PATH_FIELD], ptr %4, i64 0, i64 %indvars.iv107
  %46 = load ptr, ptr %45, align 16, !tbaa !8
  %.not98 = icmp eq ptr %46, null
  br i1 %.not98, label %51, label %47

47:                                               ; preds = %44
  %48 = call i64 @AsciiStrLen(ptr noundef nonnull %46) #3
  %49 = trunc i64 %48 to i8
  %50 = getelementptr inbounds i8, ptr %45, i64 8
  store i8 %49, ptr %50, align 8, !tbaa !13
  br label %51

51:                                               ; preds = %37, %47, %44
  %.3 = phi i8 [ %.2, %47 ], [ %.2, %44 ], [ %39, %37 ]
  %indvars.iv.next108 = add nuw nsw i64 %indvars.iv107, 1
  %52 = icmp ult i64 %indvars.iv107, 4
  %53 = icmp ult i8 %.3, %16
  %54 = and i1 %52, %53
  br i1 %54, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %51
  %55 = icmp eq i64 %indvars.iv.next108, 5
  br i1 %55, label %56, label %._crit_edge.thread

56:                                               ; preds = %._crit_edge
  %57 = load ptr, ptr %4, align 16, !tbaa !8
  %58 = icmp eq ptr %57, null
  %59 = getelementptr inbounds i8, ptr %4, i64 64
  %60 = load ptr, ptr %59, align 16
  %61 = icmp eq ptr %60, null
  %or.cond = select i1 %58, i1 true, i1 %61
  %62 = getelementptr inbounds i8, ptr %4, i64 16
  %63 = getelementptr inbounds i8, ptr %4, i64 24
  %64 = load i8, ptr %63, align 8
  %65 = icmp ugt i8 %64, 1
  %or.cond8 = select i1 %or.cond, i1 true, i1 %65
  br i1 %or.cond8, label %._crit_edge.thread, label %66

66:                                               ; preds = %56
  %67 = getelementptr inbounds i8, ptr %2, i64 269
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = icmp ult i8 %68, 2
  br i1 %69, label %73, label %70

70:                                               ; preds = %66
  %71 = getelementptr inbounds i8, ptr %2, i64 21
  %72 = load i8, ptr %71, align 1, !tbaa !19
  br label %73

73:                                               ; preds = %66, %70
  %.0 = phi i8 [ %72, %70 ], [ %68, %66 ]
  %74 = call i64 @IScsiAsciiStrToIp(ptr noundef nonnull %57, i8 noundef zeroext %.0, ptr noundef nonnull %5) #3
  %75 = getelementptr inbounds i8, ptr %2, i64 532
  %76 = call ptr @CopyMem(ptr noundef nonnull %75, ptr noundef nonnull %5, i64 noundef 16) #3
  %77 = icmp slt i64 %74, 0
  br i1 %77, label %._crit_edge.thread, label %78

78:                                               ; preds = %73
  %79 = load ptr, ptr %62, align 16, !tbaa !8
  %.not92 = icmp eq ptr %79, null
  br i1 %.not92, label %82, label %80

80:                                               ; preds = %78
  %81 = load i8, ptr %79, align 1, !tbaa !5
  %.not93 = icmp eq i8 %81, 54
  br i1 %.not93, label %82, label %._crit_edge.thread

82:                                               ; preds = %80, %78
  %83 = getelementptr inbounds i8, ptr %4, i64 32
  %84 = load ptr, ptr %83, align 16, !tbaa !8
  %.not94 = icmp eq ptr %84, null
  br i1 %.not94, label %88, label %85

85:                                               ; preds = %82
  %86 = call i64 @AsciiStrDecimalToUintn(ptr noundef nonnull %84) #3
  %87 = trunc i64 %86 to i16
  br label %88

88:                                               ; preds = %82, %85
  %storemerge = phi i16 [ %87, %85 ], [ 3260, %82 ]
  store i16 %storemerge, ptr %6, align 1, !tbaa !22
  %89 = getelementptr inbounds i8, ptr %4, i64 48
  %90 = load ptr, ptr %89, align 16, !tbaa !8
  %.not95 = icmp eq ptr %90, null
  %91 = getelementptr inbounds i8, ptr %2, i64 549
  br i1 %.not95, label %95, label %92

92:                                               ; preds = %88
  %93 = call i64 @IScsiAsciiStrToLun(ptr noundef nonnull %90, ptr noundef nonnull %91) #3
  %94 = icmp slt i64 %93, 0
  br i1 %94, label %._crit_edge.thread, label %97

95:                                               ; preds = %88
  %96 = call ptr @ZeroMem(ptr noundef nonnull %91, i64 noundef 8) #3
  br label %97

97:                                               ; preds = %92, %95
  %98 = load ptr, ptr %59, align 16, !tbaa !8
  %99 = call i64 @AsciiStrLen(ptr noundef %98) #3
  %100 = icmp ugt i64 %99, 223
  br i1 %100, label %._crit_edge.thread, label %101

101:                                              ; preds = %97
  %102 = load ptr, ptr %59, align 16, !tbaa !8
  %103 = call i64 @AsciiStrLen(ptr noundef %102) #3
  %104 = call i64 @IScsiNormalizeName(ptr noundef %102, i64 noundef %103) #3
  %105 = icmp slt i64 %104, 0
  br i1 %105, label %._crit_edge.thread, label %106

106:                                              ; preds = %101
  %107 = getelementptr inbounds i8, ptr %2, i64 308
  %108 = load ptr, ptr %59, align 16, !tbaa !8
  %109 = call ptr @AsciiStrCpy(ptr noundef nonnull %107, ptr noundef %108) #3
  br label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %21, %97, %80, %56, %._crit_edge, %101, %92, %73, %106
  %.077 = phi i64 [ %74, %73 ], [ %93, %92 ], [ %104, %101 ], [ %104, %106 ], [ -9223372036854775806, %._crit_edge ], [ -9223372036854775806, %56 ], [ -9223372036854775806, %80 ], [ -9223372036854775806, %97 ], [ -9223372036854775806, %21 ]
  call void @FreePool(ptr noundef nonnull %19) #3
  br label %110

110:                                              ; preds = %14, %3, %11, %._crit_edge.thread
  %.074 = phi i64 [ %.077, %._crit_edge.thread ], [ -9223372036854775794, %11 ], [ -9223372036854775794, %3 ], [ -9223372036854775799, %14 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %4) #3
  ret i64 %.074
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare i64 @AsciiStrLen(ptr noundef) local_unnamed_addr #2

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

declare ptr @AllocatePool(i64 noundef) local_unnamed_addr #2

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

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

declare i64 @IScsiAsciiStrToIp(ptr noundef, i8 noundef zeroext, ptr noundef) local_unnamed_addr #2

declare i64 @AsciiStrDecimalToUintn(ptr noundef) local_unnamed_addr #2

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

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

declare ptr @AsciiStrCpy(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @FreePool(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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 = { mustprogress 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !10, i64 0}
!9 = !{!"_ISCSI_ROOT_PATH_FIELD", !10, i64 0, !6, i64 8}
!10 = !{!"any pointer", !6, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!9, !6, i64 8}
!14 = distinct !{!14, !12}
!15 = !{!16, !6, i64 3}
!16 = !{!"_ISCSI_SESSION_CONFIG_NVDATA", !17, i64 0, !6, i64 2, !6, i64 3, !6, i64 4, !18, i64 20, !6, i64 24, !6, i64 40, !6, i64 41, !6, i64 42, !6, i64 266, !6, i64 282, !6, i64 283, !17, i64 291, !6, i64 293, !6, i64 294}
!17 = !{!"short", !6, i64 0}
!18 = !{!"", !6, i64 0}
!19 = !{!20, !6, i64 21}
!20 = !{!"_ISCSI_ATTEMPT_CONFIG_NVDATA", !21, i64 0, !6, i64 16, !6, i64 17, !6, i64 18, !6, i64 19, !6, i64 20, !6, i64 21, !17, i64 22, !17, i64 24, !6, i64 26, !6, i64 122, !6, i64 218, !6, i64 234, !6, i64 250, !16, i64 266, !6, i64 566, !6, i64 567}
!21 = !{!"_LIST_ENTRY", !10, i64 0, !10, i64 8}
!22 = !{!16, !17, i64 0}


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