; LLVM IR from golems/ach :: src (dns)

; 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.res_rec = type { i16, i16, i32, i16, [1 x i8] }
%struct.dns_packet = type { i16, i16, i16, i16, i16, i16, [1 x i8] }
%struct.srv_data = type { i16, i16, i16, [1 x i8] }

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @parse_dns_srv(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i16, align 2
  %16 = alloca i16, align 2
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i32, align 4
  %23 = alloca ptr, align 8
  %24 = alloca i64, align 8
  %25 = alloca i32, align 4
  %26 = alloca ptr, align 8
  %27 = alloca %struct.res_rec, align 4
  %28 = alloca ptr, align 8
  %29 = alloca ptr, align 8
  %30 = alloca ptr, align 8
  %31 = alloca i16, align 2
  %32 = alloca i16, align 2
  %33 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i64 %1, ptr %8, align 8, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i64 %3, ptr %10, align 8, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  %34 = load i64, ptr %8, align 8, !tbaa !9
  %35 = icmp ult i64 %34, 14
  br i1 %35, label %36, label %37

36:                                               ; preds = %5
  store i32 1, ptr %6, align 4
  br label %198

37:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %38 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %38, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load i64, ptr %8, align 8, !tbaa !9
  %41 = getelementptr inbounds i8, ptr %39, i64 %40
  store ptr %41, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.start.p0(i64 2, ptr %15) #6
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.dns_packet, ptr %42, i32 0, i32 2
  %44 = load i16, ptr %43, align 2, !tbaa !11
  %45 = call zeroext i16 @__bswap_16(i16 noundef zeroext %44)
  store i16 %45, ptr %15, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %16) #6
  %46 = load ptr, ptr %12, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.dns_packet, ptr %46, i32 0, i32 3
  %48 = load i16, ptr %47, align 2, !tbaa !15
  %49 = call zeroext i16 @__bswap_16(i16 noundef zeroext %48)
  store i16 %49, ptr %16, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.dns_packet, ptr %50, i32 0, i32 6
  %52 = getelementptr inbounds [1 x i8], ptr %51, i64 0, i64 0
  store ptr %52, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %53 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %53, ptr %18, align 8, !tbaa !5
  %54 = load i16, ptr %15, align 2, !tbaa !14
  %55 = zext i16 %54 to i64
  store i64 %55, ptr %14, align 8, !tbaa !9
  br label %56

56:                                               ; preds = %74, %37
  %57 = load i64, ptr %14, align 8, !tbaa !9
  %58 = icmp ugt i64 %57, 0
  br i1 %58, label %59, label %77

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = call i32 @dn_skipname(ptr noundef %60, ptr noundef %61) #6
  store i32 %62, ptr %19, align 4, !tbaa !16
  %63 = icmp slt i32 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %59
  store i32 14, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %71

65:                                               ; preds = %59
  %66 = load ptr, ptr %18, align 8, !tbaa !5
  %67 = load i32, ptr %19, align 4, !tbaa !16
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds i8, ptr %66, i64 %68
  %70 = getelementptr inbounds i8, ptr %69, i64 4
  store ptr %70, ptr %18, align 8, !tbaa !5
  store i32 0, ptr %20, align 4
  br label %71

71:                                               ; preds = %65, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  %72 = load i32, ptr %20, align 4
  switch i32 %72, label %197 [
    i32 0, label %73
  ]

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73
  %75 = load i64, ptr %14, align 8, !tbaa !9
  %76 = add i64 %75, -1
  store i64 %76, ptr %14, align 8, !tbaa !9
  br label %56, !llvm.loop !18

77:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %78 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %78, ptr %21, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #6
  store i32 2147483647, ptr %22, align 4, !tbaa !16
  %79 = load i16, ptr %16, align 2, !tbaa !14
  %80 = zext i16 %79 to i64
  store i64 %80, ptr %14, align 8, !tbaa !9
  br label %81

81:                                               ; preds = %188, %77
  %82 = load i64, ptr %14, align 8, !tbaa !9
  %83 = icmp ugt i64 %82, 0
  br i1 %83, label %84, label %191

84:                                               ; preds = %81
  %85 = load i64, ptr %10, align 8, !tbaa !9
  %86 = sub i64 %85, 1
  %87 = call ptr @llvm.stacksave.p0()
  store ptr %87, ptr %23, align 8
  %88 = alloca i8, i64 %86, align 16
  store i64 %86, ptr %24, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #6
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = load ptr, ptr %13, align 8, !tbaa !5
  %91 = load ptr, ptr %21, align 8, !tbaa !5
  %92 = load i64, ptr %10, align 8, !tbaa !9
  %93 = trunc i64 %92 to i32
  %94 = sub nsw i32 %93, 1
  %95 = call i32 @dn_expand(ptr noundef %89, ptr noundef %90, ptr noundef %91, ptr noundef %88, i32 noundef %94) #6
  store i32 %95, ptr %25, align 4, !tbaa !16
  %96 = load i32, ptr %25, align 4, !tbaa !16
  %97 = icmp slt i32 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %84
  call void @ach_set_errstr(ptr noundef @.str)
  store i32 14, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %184

99:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #6
  %100 = load ptr, ptr %21, align 8, !tbaa !5
  %101 = load i32, ptr %25, align 4, !tbaa !16
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i8, ptr %100, i64 %102
  store ptr %103, ptr %26, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 12, ptr %27) #6
  %104 = load ptr, ptr %26, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.res_rec, ptr %104, i32 0, i32 0
  %106 = load i16, ptr %105, align 4, !tbaa !20
  %107 = call zeroext i16 @__bswap_16(i16 noundef zeroext %106)
  %108 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 0
  store i16 %107, ptr %108, align 4, !tbaa !20
  %109 = load ptr, ptr %26, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.res_rec, ptr %109, i32 0, i32 1
  %111 = load i16, ptr %110, align 2, !tbaa !22
  %112 = call zeroext i16 @__bswap_16(i16 noundef zeroext %111)
  %113 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 1
  store i16 %112, ptr %113, align 2, !tbaa !22
  %114 = load ptr, ptr %26, align 8, !tbaa !5
  %115 = getelementptr inbounds %struct.res_rec, ptr %114, i32 0, i32 2
  %116 = load i32, ptr %115, align 4, !tbaa !23
  %117 = call i32 @__bswap_32(i32 noundef %116)
  %118 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 2
  store i32 %117, ptr %118, align 4, !tbaa !23
  %119 = load ptr, ptr %26, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.res_rec, ptr %119, i32 0, i32 3
  %121 = load i16, ptr %120, align 4, !tbaa !24
  %122 = call zeroext i16 @__bswap_16(i16 noundef zeroext %121)
  %123 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 3
  store i16 %122, ptr %123, align 4, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #6
  %124 = load ptr, ptr %26, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.res_rec, ptr %124, i32 0, i32 4
  %126 = getelementptr inbounds [1 x i8], ptr %125, i64 0, i64 0
  store ptr %126, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  %127 = load ptr, ptr %28, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 3
  %129 = load i16, ptr %128, align 4, !tbaa !24
  %130 = zext i16 %129 to i32
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds i8, ptr %127, i64 %131
  store ptr %132, ptr %29, align 8, !tbaa !5
  %133 = load ptr, ptr %29, align 8, !tbaa !5
  %134 = load ptr, ptr %13, align 8, !tbaa !5
  %135 = icmp ugt ptr %133, %134
  br i1 %135, label %136, label %137

136:                                              ; preds = %99
  store i32 14, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %183

137:                                              ; preds = %99
  %138 = getelementptr inbounds %struct.res_rec, ptr %27, i32 0, i32 0
  %139 = load i16, ptr %138, align 4, !tbaa !20
  %140 = zext i16 %139 to i32
  %141 = icmp eq i32 33, %140
  br i1 %141, label %142, label %182

142:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  %143 = load ptr, ptr %28, align 8, !tbaa !5
  store ptr %143, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %31) #6
  %144 = load ptr, ptr %30, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.srv_data, ptr %144, i32 0, i32 0
  %146 = load i16, ptr %145, align 2, !tbaa !25
  %147 = call zeroext i16 @__bswap_16(i16 noundef zeroext %146)
  store i16 %147, ptr %31, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %32) #6
  %148 = load ptr, ptr %30, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.srv_data, ptr %148, i32 0, i32 2
  %150 = load i16, ptr %149, align 2, !tbaa !27
  %151 = call zeroext i16 @__bswap_16(i16 noundef zeroext %150)
  store i16 %151, ptr %32, align 2, !tbaa !14
  %152 = load i16, ptr %31, align 2, !tbaa !14
  %153 = zext i16 %152 to i32
  %154 = load i32, ptr %22, align 4, !tbaa !16
  %155 = icmp slt i32 %153, %154
  br i1 %155, label %156, label %178

156:                                              ; preds = %142
  %157 = load i16, ptr %32, align 2, !tbaa !14
  %158 = zext i16 %157 to i32
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %158, ptr %159, align 4, !tbaa !16
  %160 = load i16, ptr %31, align 2, !tbaa !14
  %161 = zext i16 %160 to i32
  store i32 %161, ptr %22, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #6
  %162 = load ptr, ptr %7, align 8, !tbaa !5
  %163 = load ptr, ptr %13, align 8, !tbaa !5
  %164 = load ptr, ptr %30, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.srv_data, ptr %164, i32 0, i32 3
  %166 = getelementptr inbounds [1 x i8], ptr %165, i64 0, i64 0
  %167 = load ptr, ptr %9, align 8, !tbaa !5
  %168 = load i64, ptr %10, align 8, !tbaa !9
  %169 = trunc i64 %168 to i32
  %170 = call i32 @dn_expand(ptr noundef %162, ptr noundef %163, ptr noundef %166, ptr noundef %167, i32 noundef %169) #6
  store i32 %170, ptr %33, align 4, !tbaa !16
  %171 = load i32, ptr %33, align 4, !tbaa !16
  %172 = icmp slt i32 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %156
  call void @ach_set_errstr(ptr noundef @.str.1)
  store i32 14, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %175

174:                                              ; preds = %156
  store i32 0, ptr %20, align 4
  br label %175

175:                                              ; preds = %174, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #6
  %176 = load i32, ptr %20, align 4
  switch i32 %176, label %179 [
    i32 0, label %177
  ]

177:                                              ; preds = %175
  br label %178

178:                                              ; preds = %177, %142
  store i32 0, ptr %20, align 4
  br label %179

179:                                              ; preds = %178, %175
  call void @llvm.lifetime.end.p0(i64 2, ptr %32) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %31) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  %180 = load i32, ptr %20, align 4
  switch i32 %180, label %183 [
    i32 0, label %181
  ]

181:                                              ; preds = %179
  br label %182

182:                                              ; preds = %181, %137
  store i32 0, ptr %20, align 4
  br label %183

183:                                              ; preds = %182, %179, %136
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr %27) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #6
  br label %184

184:                                              ; preds = %183, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #6
  %185 = load ptr, ptr %23, align 8
  call void @llvm.stackrestore.p0(ptr %185)
  %186 = load i32, ptr %20, align 4
  switch i32 %186, label %196 [
    i32 0, label %187
  ]

187:                                              ; preds = %184
  br label %188

188:                                              ; preds = %187
  %189 = load i64, ptr %14, align 8, !tbaa !9
  %190 = add i64 %189, -1
  store i64 %190, ptr %14, align 8, !tbaa !9
  br label %81, !llvm.loop !28

191:                                              ; preds = %81
  %192 = load i32, ptr %22, align 4, !tbaa !16
  %193 = icmp eq i32 2147483647, %192
  br i1 %193, label %194, label %195

194:                                              ; preds = %191
  call void @ach_set_errstr(ptr noundef @.str.2)
  store i32 9, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %196

195:                                              ; preds = %191
  store i32 0, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %196

196:                                              ; preds = %195, %194, %184
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %197

197:                                              ; preds = %196, %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 2, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %198

198:                                              ; preds = %197, %36
  %199 = load i32, ptr %6, align 4
  ret i32 %199
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #2

; Function Attrs: nounwind
declare i32 @dn_skipname(ptr noundef, ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

; Function Attrs: nounwind
declare i32 @dn_expand(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #3

declare void @ach_set_errstr(ptr noundef) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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 = { inlinehint 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 "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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { "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 }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !13, i64 4}
!12 = !{!"dns_packet", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !13, i64 8, !13, i64 10, !7, i64 12}
!13 = !{!"short", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!12, !13, i64 6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !7, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!21, !13, i64 0}
!21 = !{!"res_rec", !13, i64 0, !13, i64 2, !17, i64 4, !13, i64 8, !7, i64 10}
!22 = !{!21, !13, i64 2}
!23 = !{!21, !17, i64 4}
!24 = !{!21, !13, i64 8}
!25 = !{!26, !13, i64 0}
!26 = !{!"srv_data", !13, i64 0, !13, i64 2, !13, i64 4, !7, i64 6}
!27 = !{!26, !13, i64 4}
!28 = distinct !{!28, !19}


; 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"

@.str = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [34 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @parse_dns_srv(ptr noundef %0, i64 noundef %1, ptr noundef %2, i64 noundef %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = icmp ult i64 %1, 14
  br i1 %6, label %.loopexit87, label %7

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 %1
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i16, ptr %9, align 2, !tbaa !5
  %11 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %10)
  %12 = getelementptr inbounds i8, ptr %0, i64 6
  %13 = load i16, ptr %12, align 2, !tbaa !10
  %14 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext %13)
  %15 = getelementptr inbounds i8, ptr %0, i64 12
  %.not94 = icmp eq i16 %11, 0
  br i1 %.not94, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %7
  %16 = zext i16 %11 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %19
  %.05896 = phi i64 [ %23, %19 ], [ %16, %.lr.ph.preheader ]
  %.06095 = phi ptr [ %22, %19 ], [ %15, %.lr.ph.preheader ]
  %17 = tail call i32 @dn_skipname(ptr noundef nonnull %.06095, ptr noundef nonnull %8) #5
  %18 = icmp sgt i32 %17, -1
  br i1 %18, label %19, label %.loopexit87

19:                                               ; preds = %.lr.ph
  %20 = zext nneg i32 %17 to i64
  %21 = getelementptr inbounds i8, ptr %.06095, i64 %20
  %22 = getelementptr inbounds i8, ptr %21, i64 4
  %23 = add nsw i64 %.05896, -1
  %.not = icmp eq i64 %23, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

._crit_edge:                                      ; preds = %19, %7
  %.060.lcssa = phi ptr [ %15, %7 ], [ %22, %19 ]
  %.not7897 = icmp eq i16 %14, 0
  br i1 %.not7897, label %._crit_edge102.thread, label %.lr.ph101

.lr.ph101:                                        ; preds = %._crit_edge
  %24 = zext i16 %14 to i64
  %25 = add i64 %3, -1
  %26 = trunc i64 %3 to i32
  %27 = add nsw i32 %26, -1
  br label %28

28:                                               ; preds = %.lr.ph101, %66
  %.15999 = phi i64 [ %24, %.lr.ph101 ], [ %67, %66 ]
  %.06798 = phi i32 [ 2147483647, %.lr.ph101 ], [ %.572.ph, %66 ]
  %29 = call ptr @llvm.stacksave.p0()
  %30 = alloca i8, i64 %25, align 16
  %31 = call i32 @dn_expand(ptr noundef %0, ptr noundef nonnull %8, ptr noundef nonnull %.060.lcssa, ptr noundef nonnull %30, i32 noundef %27) #5
  %32 = icmp slt i32 %31, 0
  br i1 %32, label %.loopexit.sink.split, label %33

33:                                               ; preds = %28
  %34 = zext nneg i32 %31 to i64
  %35 = getelementptr inbounds i8, ptr %.060.lcssa, i64 %34
  %36 = load i16, ptr %35, align 4, !tbaa !13
  %37 = call zeroext i16 @__bswap_16(i16 noundef zeroext %36)
  %38 = getelementptr inbounds i8, ptr %35, i64 2
  %39 = load i16, ptr %38, align 2, !tbaa !16
  %40 = call zeroext i16 @__bswap_16(i16 noundef zeroext %39)
  %41 = getelementptr inbounds i8, ptr %35, i64 4
  %42 = load i32, ptr %41, align 4, !tbaa !17
  %43 = call i32 @__bswap_32(i32 noundef %42)
  %44 = getelementptr inbounds i8, ptr %35, i64 8
  %45 = load i16, ptr %44, align 4, !tbaa !18
  %46 = call zeroext i16 @__bswap_16(i16 noundef zeroext %45)
  %47 = getelementptr inbounds i8, ptr %35, i64 10
  %48 = zext i16 %46 to i64
  %49 = getelementptr inbounds i8, ptr %47, i64 %48
  %50 = icmp ugt ptr %49, %8
  br i1 %50, label %.loopexit, label %51

51:                                               ; preds = %33
  %52 = icmp eq i16 %37, 33
  br i1 %52, label %53, label %66

53:                                               ; preds = %51
  %54 = load i16, ptr %47, align 2, !tbaa !19
  %55 = call zeroext i16 @__bswap_16(i16 noundef zeroext %54)
  %56 = getelementptr inbounds i8, ptr %35, i64 14
  %57 = load i16, ptr %56, align 2, !tbaa !21
  %58 = call zeroext i16 @__bswap_16(i16 noundef zeroext %57)
  %59 = zext i16 %55 to i32
  %60 = icmp sgt i32 %.06798, %59
  br i1 %60, label %61, label %66

61:                                               ; preds = %53
  %62 = zext i16 %58 to i32
  store i32 %62, ptr %4, align 4, !tbaa !22
  %63 = getelementptr inbounds i8, ptr %35, i64 16
  %64 = call i32 @dn_expand(ptr noundef %0, ptr noundef nonnull %8, ptr noundef nonnull %63, ptr noundef %2, i32 noundef %26) #5
  %65 = icmp sgt i32 %64, -1
  br i1 %65, label %66, label %.loopexit.sink.split

.loopexit.sink.split:                             ; preds = %61, %28
  %.str.1.sink = phi ptr [ @.str, %28 ], [ @.str.1, %61 ]
  call void @ach_set_errstr(ptr noundef nonnull %.str.1.sink) #5
  br label %.loopexit

.loopexit:                                        ; preds = %33, %.loopexit.sink.split
  call void @llvm.stackrestore.p0(ptr %29)
  br label %.loopexit87

66:                                               ; preds = %51, %53, %61
  %.572.ph = phi i32 [ %.06798, %53 ], [ %59, %61 ], [ %.06798, %51 ]
  call void @llvm.stackrestore.p0(ptr %29)
  %67 = add nsw i64 %.15999, -1
  %.not78 = icmp eq i64 %67, 0
  br i1 %.not78, label %._crit_edge102, label %28, !llvm.loop !23

._crit_edge102:                                   ; preds = %66
  %68 = icmp eq i32 %.572.ph, 2147483647
  br i1 %68, label %._crit_edge102.thread, label %.loopexit87

._crit_edge102.thread:                            ; preds = %._crit_edge, %._crit_edge102
  call void @ach_set_errstr(ptr noundef nonnull @.str.2) #5
  br label %.loopexit87

.loopexit87:                                      ; preds = %.lr.ph, %.loopexit, %._crit_edge102, %._crit_edge102.thread, %5
  %.11 = phi i32 [ 1, %5 ], [ 14, %.loopexit ], [ 9, %._crit_edge102.thread ], [ 0, %._crit_edge102 ], [ 14, %.lr.ph ]
  ret i32 %.11
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind
declare i32 @dn_skipname(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nounwind
declare i32 @dn_expand(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @ach_set_errstr(ptr noundef) local_unnamed_addr #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @__bswap_32(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

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 = { inlinehint 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { "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 }

!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, !7, i64 4}
!6 = !{!"dns_packet", !7, i64 0, !7, i64 2, !7, i64 4, !7, i64 6, !7, i64 8, !7, i64 10, !8, i64 12}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 6}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !7, i64 0}
!14 = !{!"res_rec", !7, i64 0, !7, i64 2, !15, i64 4, !7, i64 8, !8, i64 10}
!15 = !{!"int", !8, i64 0}
!16 = !{!14, !7, i64 2}
!17 = !{!14, !15, i64 4}
!18 = !{!14, !7, i64 8}
!19 = !{!20, !7, i64 0}
!20 = !{!"srv_data", !7, i64 0, !7, i64 2, !7, i64 4, !8, i64 6}
!21 = !{!20, !7, i64 4}
!22 = !{!15, !15, i64 0}
!23 = distinct !{!23, !12}


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