; LLVM IR from dynexcoin/Dynex :: external/miniupnpc (testportlistingparse)

; 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.PortMappingParserData = type { ptr, i32 }
%struct.PortMapping = type { ptr, i64, i16, i16, [64 x i8], [64 x i8], [64 x i8], [4 x i8], i8 }
%struct.port_mapping = type { i32, i16, i16, ptr, ptr, ptr, ptr, i8 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.PortMappingParserData, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.memset.p0.i64(ptr align 8 %11, i8 0, i64 16, i1 false)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = load i32, ptr %6, align 4, !tbaa !9
  call void @ParsePortListing(ptr noundef %13, i32 noundef %14, ptr noundef %11)
  store i32 0, ptr %9, align 4, !tbaa !9
  %15 = getelementptr inbounds %struct.PortMappingParserData, ptr %11, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  store ptr %16, ptr %12, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %263, %4
  %18 = load ptr, ptr %12, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %24

20:                                               ; preds = %17
  %21 = load i32, ptr %9, align 4, !tbaa !9
  %22 = load i32, ptr %8, align 4, !tbaa !9
  %23 = icmp slt i32 %21, %22
  br label %24

24:                                               ; preds = %20, %17
  %25 = phi i1 [ false, %17 ], [ %23, %20 ]
  br i1 %25, label %26, label %269

26:                                               ; preds = %24
  %27 = load i32, ptr %9, align 4, !tbaa !9
  %28 = load ptr, ptr %12, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.PortMapping, ptr %28, i32 0, i32 7
  %30 = getelementptr inbounds [4 x i8], ptr %29, i64 0, i64 0
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.PortMapping, ptr %31, i32 0, i32 2
  %33 = load i16, ptr %32, align 8, !tbaa !13
  %34 = zext i16 %33 to i32
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.PortMapping, ptr %35, i32 0, i32 5
  %37 = getelementptr inbounds [64 x i8], ptr %36, i64 0, i64 0
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.PortMapping, ptr %38, i32 0, i32 3
  %40 = load i16, ptr %39, align 2, !tbaa !17
  %41 = zext i16 %40 to i32
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.PortMapping, ptr %42, i32 0, i32 6
  %44 = getelementptr inbounds [64 x i8], ptr %43, i64 0, i64 0
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.PortMapping, ptr %45, i32 0, i32 4
  %47 = getelementptr inbounds [64 x i8], ptr %46, i64 0, i64 0
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.PortMapping, ptr %48, i32 0, i32 1
  %50 = load i64, ptr %49, align 8, !tbaa !18
  %51 = trunc i64 %50 to i32
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %27, ptr noundef %30, i32 noundef %34, ptr noundef %37, i32 noundef %41, ptr noundef %44, ptr noundef %47, i32 noundef %51)
  %53 = load ptr, ptr %12, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.PortMapping, ptr %53, i32 0, i32 7
  %55 = getelementptr inbounds [4 x i8], ptr %54, i64 0, i64 0
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load i32, ptr %9, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds %struct.port_mapping, ptr %56, i64 %58
  %60 = getelementptr inbounds %struct.port_mapping, ptr %59, i32 0, i32 5
  %61 = load ptr, ptr %60, align 8, !tbaa !19
  %62 = call i32 @strcmp(ptr noundef %55, ptr noundef %61) #6
  %63 = icmp ne i32 0, %62
  br i1 %63, label %64, label %77

64:                                               ; preds = %26
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.PortMapping, ptr %65, i32 0, i32 7
  %67 = getelementptr inbounds [4 x i8], ptr %66, i64 0, i64 0
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = load i32, ptr %9, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds %struct.port_mapping, ptr %68, i64 %70
  %72 = getelementptr inbounds %struct.port_mapping, ptr %71, i32 0, i32 5
  %73 = load ptr, ptr %72, align 8, !tbaa !19
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %67, ptr noundef %73)
  %75 = load i32, ptr %10, align 4, !tbaa !9
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %10, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %64, %26
  %78 = load ptr, ptr %12, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.PortMapping, ptr %78, i32 0, i32 2
  %80 = load i16, ptr %79, align 8, !tbaa !13
  %81 = zext i16 %80 to i32
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds %struct.port_mapping, ptr %82, i64 %84
  %86 = getelementptr inbounds %struct.port_mapping, ptr %85, i32 0, i32 1
  %87 = load i16, ptr %86, align 4, !tbaa !21
  %88 = zext i16 %87 to i32
  %89 = icmp ne i32 %81, %88
  br i1 %89, label %90, label %105

90:                                               ; preds = %77
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.PortMapping, ptr %91, i32 0, i32 2
  %93 = load i16, ptr %92, align 8, !tbaa !13
  %94 = zext i16 %93 to i32
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds %struct.port_mapping, ptr %95, i64 %97
  %99 = getelementptr inbounds %struct.port_mapping, ptr %98, i32 0, i32 1
  %100 = load i16, ptr %99, align 4, !tbaa !21
  %101 = zext i16 %100 to i32
  %102 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %94, i32 noundef %101)
  %103 = load i32, ptr %10, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %10, align 4, !tbaa !9
  br label %105

105:                                              ; preds = %90, %77
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.PortMapping, ptr %106, i32 0, i32 5
  %108 = getelementptr inbounds [64 x i8], ptr %107, i64 0, i64 0
  %109 = load ptr, ptr %7, align 8, !tbaa !5
  %110 = load i32, ptr %9, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds %struct.port_mapping, ptr %109, i64 %111
  %113 = getelementptr inbounds %struct.port_mapping, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !22
  %115 = call i32 @strcmp(ptr noundef %108, ptr noundef %114) #6
  %116 = icmp ne i32 0, %115
  br i1 %116, label %117, label %130

117:                                              ; preds = %105
  %118 = load ptr, ptr %12, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.PortMapping, ptr %118, i32 0, i32 5
  %120 = getelementptr inbounds [64 x i8], ptr %119, i64 0, i64 0
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = load i32, ptr %9, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds %struct.port_mapping, ptr %121, i64 %123
  %125 = getelementptr inbounds %struct.port_mapping, ptr %124, i32 0, i32 4
  %126 = load ptr, ptr %125, align 8, !tbaa !22
  %127 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, ptr noundef %120, ptr noundef %126)
  %128 = load i32, ptr %10, align 4, !tbaa !9
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %10, align 4, !tbaa !9
  br label %130

130:                                              ; preds = %117, %105
  %131 = load ptr, ptr %12, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.PortMapping, ptr %131, i32 0, i32 3
  %133 = load i16, ptr %132, align 2, !tbaa !17
  %134 = zext i16 %133 to i32
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = load i32, ptr %9, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds %struct.port_mapping, ptr %135, i64 %137
  %139 = getelementptr inbounds %struct.port_mapping, ptr %138, i32 0, i32 2
  %140 = load i16, ptr %139, align 2, !tbaa !23
  %141 = zext i16 %140 to i32
  %142 = icmp ne i32 %134, %141
  br i1 %142, label %143, label %158

143:                                              ; preds = %130
  %144 = load ptr, ptr %12, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.PortMapping, ptr %144, i32 0, i32 3
  %146 = load i16, ptr %145, align 2, !tbaa !17
  %147 = zext i16 %146 to i32
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = load i32, ptr %9, align 4, !tbaa !9
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds %struct.port_mapping, ptr %148, i64 %150
  %152 = getelementptr inbounds %struct.port_mapping, ptr %151, i32 0, i32 2
  %153 = load i16, ptr %152, align 2, !tbaa !23
  %154 = zext i16 %153 to i32
  %155 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %147, i32 noundef %154)
  %156 = load i32, ptr %10, align 4, !tbaa !9
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %10, align 4, !tbaa !9
  br label %158

158:                                              ; preds = %143, %130
  %159 = load ptr, ptr %12, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.PortMapping, ptr %159, i32 0, i32 6
  %161 = getelementptr inbounds [64 x i8], ptr %160, i64 0, i64 0
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = load i32, ptr %9, align 4, !tbaa !9
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds %struct.port_mapping, ptr %162, i64 %164
  %166 = getelementptr inbounds %struct.port_mapping, ptr %165, i32 0, i32 6
  %167 = load ptr, ptr %166, align 8, !tbaa !24
  %168 = call i32 @strcmp(ptr noundef %161, ptr noundef %167) #6
  %169 = icmp ne i32 0, %168
  br i1 %169, label %170, label %183

170:                                              ; preds = %158
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.PortMapping, ptr %171, i32 0, i32 6
  %173 = getelementptr inbounds [64 x i8], ptr %172, i64 0, i64 0
  %174 = load ptr, ptr %7, align 8, !tbaa !5
  %175 = load i32, ptr %9, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds %struct.port_mapping, ptr %174, i64 %176
  %178 = getelementptr inbounds %struct.port_mapping, ptr %177, i32 0, i32 6
  %179 = load ptr, ptr %178, align 8, !tbaa !24
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, ptr noundef %173, ptr noundef %179)
  %181 = load i32, ptr %10, align 4, !tbaa !9
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %10, align 4, !tbaa !9
  br label %183

183:                                              ; preds = %170, %158
  %184 = load ptr, ptr %12, align 8, !tbaa !5
  %185 = getelementptr inbounds %struct.PortMapping, ptr %184, i32 0, i32 4
  %186 = getelementptr inbounds [64 x i8], ptr %185, i64 0, i64 0
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = load i32, ptr %9, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds %struct.port_mapping, ptr %187, i64 %189
  %191 = getelementptr inbounds %struct.port_mapping, ptr %190, i32 0, i32 3
  %192 = load ptr, ptr %191, align 8, !tbaa !25
  %193 = call i32 @strcmp(ptr noundef %186, ptr noundef %192) #6
  %194 = icmp ne i32 0, %193
  br i1 %194, label %195, label %208

195:                                              ; preds = %183
  %196 = load ptr, ptr %12, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.PortMapping, ptr %196, i32 0, i32 4
  %198 = getelementptr inbounds [64 x i8], ptr %197, i64 0, i64 0
  %199 = load ptr, ptr %7, align 8, !tbaa !5
  %200 = load i32, ptr %9, align 4, !tbaa !9
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds %struct.port_mapping, ptr %199, i64 %201
  %203 = getelementptr inbounds %struct.port_mapping, ptr %202, i32 0, i32 3
  %204 = load ptr, ptr %203, align 8, !tbaa !25
  %205 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, ptr noundef %198, ptr noundef %204)
  %206 = load i32, ptr %10, align 4, !tbaa !9
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %10, align 4, !tbaa !9
  br label %208

208:                                              ; preds = %195, %183
  %209 = load ptr, ptr %12, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.PortMapping, ptr %209, i32 0, i32 1
  %211 = load i64, ptr %210, align 8, !tbaa !18
  %212 = trunc i64 %211 to i32
  %213 = load ptr, ptr %7, align 8, !tbaa !5
  %214 = load i32, ptr %9, align 4, !tbaa !9
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds %struct.port_mapping, ptr %213, i64 %215
  %217 = getelementptr inbounds %struct.port_mapping, ptr %216, i32 0, i32 0
  %218 = load i32, ptr %217, align 8, !tbaa !26
  %219 = icmp ne i32 %212, %218
  br i1 %219, label %220, label %234

220:                                              ; preds = %208
  %221 = load ptr, ptr %12, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.PortMapping, ptr %221, i32 0, i32 1
  %223 = load i64, ptr %222, align 8, !tbaa !18
  %224 = trunc i64 %223 to i32
  %225 = load ptr, ptr %7, align 8, !tbaa !5
  %226 = load i32, ptr %9, align 4, !tbaa !9
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds %struct.port_mapping, ptr %225, i64 %227
  %229 = getelementptr inbounds %struct.port_mapping, ptr %228, i32 0, i32 0
  %230 = load i32, ptr %229, align 8, !tbaa !26
  %231 = call i32 (ptr, ...) @printf(ptr noundef @.str.7, i32 noundef %224, i32 noundef %230)
  %232 = load i32, ptr %10, align 4, !tbaa !9
  %233 = add nsw i32 %232, 1
  store i32 %233, ptr %10, align 4, !tbaa !9
  br label %234

234:                                              ; preds = %220, %208
  %235 = load ptr, ptr %12, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.PortMapping, ptr %235, i32 0, i32 8
  %237 = load i8, ptr %236, align 8, !tbaa !27
  %238 = zext i8 %237 to i32
  %239 = load ptr, ptr %7, align 8, !tbaa !5
  %240 = load i32, ptr %9, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds %struct.port_mapping, ptr %239, i64 %241
  %243 = getelementptr inbounds %struct.port_mapping, ptr %242, i32 0, i32 7
  %244 = load i8, ptr %243, align 8, !tbaa !28
  %245 = zext i8 %244 to i32
  %246 = icmp ne i32 %238, %245
  br i1 %246, label %247, label %262

247:                                              ; preds = %234
  %248 = load ptr, ptr %12, align 8, !tbaa !5
  %249 = getelementptr inbounds %struct.PortMapping, ptr %248, i32 0, i32 8
  %250 = load i8, ptr %249, align 8, !tbaa !27
  %251 = zext i8 %250 to i32
  %252 = load ptr, ptr %7, align 8, !tbaa !5
  %253 = load i32, ptr %9, align 4, !tbaa !9
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds %struct.port_mapping, ptr %252, i64 %254
  %256 = getelementptr inbounds %struct.port_mapping, ptr %255, i32 0, i32 7
  %257 = load i8, ptr %256, align 8, !tbaa !28
  %258 = zext i8 %257 to i32
  %259 = call i32 (ptr, ...) @printf(ptr noundef @.str.8, i32 noundef %251, i32 noundef %258)
  %260 = load i32, ptr %10, align 4, !tbaa !9
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %10, align 4, !tbaa !9
  br label %262

262:                                              ; preds = %247, %234
  br label %263

263:                                              ; preds = %262
  %264 = load i32, ptr %9, align 4, !tbaa !9
  %265 = add nsw i32 %264, 1
  store i32 %265, ptr %9, align 4, !tbaa !9
  %266 = load ptr, ptr %12, align 8, !tbaa !5
  %267 = getelementptr inbounds %struct.PortMapping, ptr %266, i32 0, i32 0
  %268 = load ptr, ptr %267, align 8, !tbaa !29
  store ptr %268, ptr %12, align 8, !tbaa !5
  br label %17, !llvm.loop !30

269:                                              ; preds = %24
  %270 = load i32, ptr %9, align 4, !tbaa !9
  %271 = load i32, ptr %8, align 4, !tbaa !9
  %272 = icmp ne i32 %270, %271
  br i1 %272, label %276, label %273

273:                                              ; preds = %269
  %274 = load ptr, ptr %12, align 8, !tbaa !5
  %275 = icmp ne ptr %274, null
  br i1 %275, label %276, label %283

276:                                              ; preds = %273, %269
  %277 = load i32, ptr %9, align 4, !tbaa !9
  %278 = load i32, ptr %8, align 4, !tbaa !9
  %279 = load ptr, ptr %12, align 8, !tbaa !5
  %280 = call i32 (ptr, ...) @printf(ptr noundef @.str.9, i32 noundef %277, i32 noundef %278, ptr noundef %279)
  %281 = load i32, ptr %10, align 4, !tbaa !9
  %282 = add nsw i32 %281, 1
  store i32 %282, ptr %10, align 4, !tbaa !9
  br label %283

283:                                              ; preds = %276, %273
  call void @FreePortListing(ptr noundef %11)
  %284 = load i32, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret i32 %284
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @ParsePortListing(ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #3

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

declare void @FreePortListing(ptr noundef) #3

; 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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 #4 = { nounwind willreturn memory(read) "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 #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"PortMappingParserData", !6, i64 0, !10, i64 8}
!13 = !{!14, !16, i64 16}
!14 = !{!"PortMapping", !6, i64 0, !15, i64 8, !16, i64 16, !16, i64 18, !7, i64 20, !7, i64 84, !7, i64 148, !7, i64 212, !7, i64 216}
!15 = !{!"long long", !7, i64 0}
!16 = !{!"short", !7, i64 0}
!17 = !{!14, !16, i64 18}
!18 = !{!14, !15, i64 8}
!19 = !{!20, !6, i64 24}
!20 = !{!"port_mapping", !10, i64 0, !16, i64 4, !16, i64 6, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40}
!21 = !{!20, !16, i64 4}
!22 = !{!20, !6, i64 16}
!23 = !{!20, !16, i64 6}
!24 = !{!20, !6, i64 32}
!25 = !{!20, !6, i64 8}
!26 = !{!20, !10, i64 0}
!27 = !{!14, !7, i64 216}
!28 = !{!20, !7, i64 40}
!29 = !{!14, !6, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.PortMappingParserData = type { ptr, i32 }
%struct.port_mapping = type { i32, i16, i16, ptr, ptr, ptr, ptr, i8 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [38 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @test(ptr noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.PortMappingParserData, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %5, i8 0, i64 16, i1 false)
  call void @ParsePortListing(ptr noundef %0, i32 noundef %1, ptr noundef nonnull %5) #6
  %.096 = load ptr, ptr %5, align 8, !tbaa !5
  %6 = icmp ne ptr %.096, null
  %7 = icmp sgt i32 %3, 0
  %8 = and i1 %6, %7
  br i1 %8, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %4
  %9 = zext nneg i32 %3 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %88
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %88 ]
  %.099 = phi ptr [ %.096, %.lr.ph.preheader ], [ %.0, %88 ]
  %.07998 = phi i32 [ 0, %.lr.ph.preheader ], [ %.8, %88 ]
  %10 = getelementptr inbounds i8, ptr %.099, i64 212
  %11 = getelementptr inbounds i8, ptr %.099, i64 16
  %12 = load i16, ptr %11, align 8, !tbaa !9
  %13 = zext i16 %12 to i32
  %14 = getelementptr inbounds i8, ptr %.099, i64 84
  %15 = getelementptr inbounds i8, ptr %.099, i64 18
  %16 = load i16, ptr %15, align 2, !tbaa !13
  %17 = zext i16 %16 to i32
  %18 = getelementptr inbounds i8, ptr %.099, i64 148
  %19 = getelementptr inbounds i8, ptr %.099, i64 20
  %20 = getelementptr inbounds i8, ptr %.099, i64 8
  %21 = load i64, ptr %20, align 8, !tbaa !14
  %22 = trunc i64 %21 to i32
  %23 = trunc nuw nsw i64 %indvars.iv to i32
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23, ptr noundef nonnull %10, i32 noundef %13, ptr noundef nonnull %14, i32 noundef %17, ptr noundef nonnull %18, ptr noundef nonnull %19, i32 noundef %22)
  %25 = getelementptr inbounds %struct.port_mapping, ptr %2, i64 %indvars.iv
  %26 = getelementptr inbounds i8, ptr %25, i64 24
  %27 = load ptr, ptr %26, align 8, !tbaa !15
  %28 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %10, ptr noundef nonnull dereferenceable(1) %27) #7
  %.not = icmp eq i32 %28, 0
  br i1 %.not, label %32, label %29

29:                                               ; preds = %.lr.ph
  %30 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, ptr noundef nonnull %10, ptr noundef %27)
  %31 = add nsw i32 %.07998, 1
  br label %32

32:                                               ; preds = %29, %.lr.ph
  %.1 = phi i32 [ %31, %29 ], [ %.07998, %.lr.ph ]
  %33 = load i16, ptr %11, align 8, !tbaa !9
  %34 = getelementptr inbounds i8, ptr %25, i64 4
  %35 = load i16, ptr %34, align 4, !tbaa !18
  %.not89 = icmp eq i16 %33, %35
  br i1 %.not89, label %41, label %36

36:                                               ; preds = %32
  %37 = zext i16 %35 to i32
  %38 = zext i16 %33 to i32
  %39 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %38, i32 noundef %37)
  %40 = add nsw i32 %.1, 1
  br label %41

41:                                               ; preds = %36, %32
  %.2 = phi i32 [ %40, %36 ], [ %.1, %32 ]
  %42 = getelementptr inbounds i8, ptr %25, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) %43) #7
  %.not90 = icmp eq i32 %44, 0
  br i1 %.not90, label %48, label %45

45:                                               ; preds = %41
  %46 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, ptr noundef nonnull %14, ptr noundef %43)
  %47 = add nsw i32 %.2, 1
  br label %48

48:                                               ; preds = %45, %41
  %.3 = phi i32 [ %47, %45 ], [ %.2, %41 ]
  %49 = load i16, ptr %15, align 2, !tbaa !13
  %50 = getelementptr inbounds i8, ptr %25, i64 6
  %51 = load i16, ptr %50, align 2, !tbaa !20
  %.not91 = icmp eq i16 %49, %51
  br i1 %.not91, label %57, label %52

52:                                               ; preds = %48
  %53 = zext i16 %51 to i32
  %54 = zext i16 %49 to i32
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %54, i32 noundef %53)
  %56 = add nsw i32 %.3, 1
  br label %57

57:                                               ; preds = %52, %48
  %.4 = phi i32 [ %56, %52 ], [ %.3, %48 ]
  %58 = getelementptr inbounds i8, ptr %25, i64 32
  %59 = load ptr, ptr %58, align 8, !tbaa !21
  %60 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %18, ptr noundef nonnull dereferenceable(1) %59) #7
  %.not92 = icmp eq i32 %60, 0
  br i1 %.not92, label %64, label %61

61:                                               ; preds = %57
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, ptr noundef nonnull %18, ptr noundef %59)
  %63 = add nsw i32 %.4, 1
  br label %64

64:                                               ; preds = %61, %57
  %.5 = phi i32 [ %63, %61 ], [ %.4, %57 ]
  %65 = getelementptr inbounds i8, ptr %25, i64 8
  %66 = load ptr, ptr %65, align 8, !tbaa !22
  %67 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %19, ptr noundef nonnull dereferenceable(1) %66) #7
  %.not93 = icmp eq i32 %67, 0
  br i1 %.not93, label %71, label %68

68:                                               ; preds = %64
  %69 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, ptr noundef nonnull %19, ptr noundef %66)
  %70 = add nsw i32 %.5, 1
  br label %71

71:                                               ; preds = %68, %64
  %.6 = phi i32 [ %70, %68 ], [ %.5, %64 ]
  %72 = load i64, ptr %20, align 8, !tbaa !14
  %73 = trunc i64 %72 to i32
  %74 = load i32, ptr %25, align 8, !tbaa !23
  %.not94 = icmp eq i32 %74, %73
  br i1 %.not94, label %78, label %75

75:                                               ; preds = %71
  %76 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7, i32 noundef %73, i32 noundef %74)
  %77 = add nsw i32 %.6, 1
  br label %78

78:                                               ; preds = %75, %71
  %.7 = phi i32 [ %77, %75 ], [ %.6, %71 ]
  %79 = getelementptr inbounds i8, ptr %.099, i64 216
  %80 = load i8, ptr %79, align 8, !tbaa !24
  %81 = getelementptr inbounds i8, ptr %25, i64 40
  %82 = load i8, ptr %81, align 8, !tbaa !25
  %.not95 = icmp eq i8 %80, %82
  br i1 %.not95, label %88, label %83

83:                                               ; preds = %78
  %84 = zext i8 %82 to i32
  %85 = zext i8 %80 to i32
  %86 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8, i32 noundef %85, i32 noundef %84)
  %87 = add nsw i32 %.7, 1
  br label %88

88:                                               ; preds = %78, %83
  %.8 = phi i32 [ %87, %83 ], [ %.7, %78 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %.0 = load ptr, ptr %.099, align 8, !tbaa !5
  %89 = icmp ne ptr %.0, null
  %90 = icmp ult i64 %indvars.iv.next, %9
  %91 = select i1 %89, i1 %90, i1 false
  br i1 %91, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !26

._crit_edge.loopexit:                             ; preds = %88
  %92 = trunc nuw nsw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %4
  %.080.lcssa = phi i32 [ 0, %4 ], [ %92, %._crit_edge.loopexit ]
  %.079.lcssa = phi i32 [ 0, %4 ], [ %.8, %._crit_edge.loopexit ]
  %.0.lcssa = phi ptr [ %.096, %4 ], [ %.0, %._crit_edge.loopexit ]
  %.lcssa = phi i1 [ %6, %4 ], [ %89, %._crit_edge.loopexit ]
  %93 = icmp ne i32 %.080.lcssa, %3
  %or.cond = or i1 %93, %.lcssa
  br i1 %or.cond, label %94, label %97

94:                                               ; preds = %._crit_edge
  %95 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9, i32 noundef %.080.lcssa, i32 noundef %3, ptr noundef %.0.lcssa)
  %96 = add nsw i32 %.079.lcssa, 1
  br label %97

97:                                               ; preds = %._crit_edge, %94
  %.9 = phi i32 [ %96, %94 ], [ %.079.lcssa, %._crit_edge ]
  call void @FreePortListing(ptr noundef nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  ret i32 %.9
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

declare void @ParsePortListing(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

declare void @FreePortListing(ptr noundef) local_unnamed_addr #3

; 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { "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 #4 = { nofree nounwind "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 #5 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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, !12, i64 16}
!10 = !{!"PortMapping", !6, i64 0, !11, i64 8, !12, i64 16, !12, i64 18, !7, i64 20, !7, i64 84, !7, i64 148, !7, i64 212, !7, i64 216}
!11 = !{!"long long", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !12, i64 18}
!14 = !{!10, !11, i64 8}
!15 = !{!16, !6, i64 24}
!16 = !{!"port_mapping", !17, i64 0, !12, i64 4, !12, i64 6, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40}
!17 = !{!"int", !7, i64 0}
!18 = !{!16, !12, i64 4}
!19 = !{!16, !6, i64 16}
!20 = !{!16, !12, i64 6}
!21 = !{!16, !6, i64 32}
!22 = !{!16, !6, i64 8}
!23 = !{!16, !17, i64 0}
!24 = !{!10, !7, i64 216}
!25 = !{!16, !7, i64 40}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass