; LLVM IR from seppo0010/rlite :: src (hyperloglog)

; 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.hllhdr = type { [4 x i8], i8, [3 x i8], [8 x i8], [0 x i8] }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @isHLLObject(ptr noundef, i64 noundef) #1

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_str_pfdebug_decode(ptr noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [100 x i8], align 16
  %18 = alloca i64, align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca ptr, align 8
  %23 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i64 %1, ptr %7, align 8, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = load i64, ptr %7, align 8, !tbaa !9
  %26 = call i32 @isHLLObject(ptr noundef %24, i64 noundef %25)
  %27 = icmp ne i32 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %4
  store i32 -1, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %227

29:                                               ; preds = %4
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %30, ptr %10, align 8, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.hllhdr, ptr %31, i32 0, i32 1
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = zext i8 %33 to i32
  %35 = icmp ne i32 %34, 1
  br i1 %35, label %36, label %37

36:                                               ; preds = %29
  store i32 -2, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %227

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %38 = load ptr, ptr %6, 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 %12, align 8, !tbaa !5
  %40 = load i64, ptr %7, 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
  store i64 0, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %42 = load i64, ptr %7, align 8, !tbaa !9
  %43 = mul nsw i64 %42, 10
  store i64 %43, ptr %15, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %44 = load i64, ptr %15, align 8, !tbaa !9
  %45 = mul i64 1, %44
  %46 = call noalias ptr @malloc(i64 noundef %45) #7
  store ptr %46, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 100, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  store ptr %48, ptr %12, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %214, %37
  %50 = load ptr, ptr %12, align 8, !tbaa !5
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = icmp ult ptr %50, %51
  br i1 %52, label %53, label %215

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %54 = load ptr, ptr %12, align 8, !tbaa !5
  %55 = load i8, ptr %54, align 1, !tbaa !11
  %56 = zext i8 %55 to i32
  %57 = and i32 %56, 192
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %103

59:                                               ; preds = %53
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = zext i8 %61 to i32
  %63 = and i32 %62, 63
  %64 = add nsw i32 %63, 1
  store i32 %64, ptr %19, align 4, !tbaa !12
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds i8, ptr %65, i32 1
  store ptr %66, ptr %12, align 8, !tbaa !5
  %67 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %68 = load i32, ptr %19, align 4, !tbaa !12
  %69 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %67, i64 noundef 100, ptr noundef @.str, i32 noundef %68) #6
  %70 = sext i32 %69 to i64
  store i64 %70, ptr %18, align 8, !tbaa !9
  br label %71

71:                                               ; preds = %93, %59
  %72 = load i64, ptr %14, align 8, !tbaa !9
  %73 = load i64, ptr %18, align 8, !tbaa !9
  %74 = add nsw i64 %72, %73
  %75 = load i64, ptr %15, align 8, !tbaa !9
  %76 = icmp sgt i64 %74, %75
  br i1 %76, label %77, label %94

77:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %78 = load ptr, ptr %16, align 8, !tbaa !5
  %79 = load i64, ptr %15, align 8, !tbaa !9
  %80 = mul i64 1, %79
  %81 = mul i64 %80, 2
  %82 = call ptr @realloc(ptr noundef %78, i64 noundef %81) #8
  store ptr %82, ptr %21, align 8, !tbaa !5
  %83 = load ptr, ptr %21, align 8, !tbaa !5
  %84 = icmp ne ptr %83, null
  br i1 %84, label %87, label %85

85:                                               ; preds = %77
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %86) #6
  store i32 -4, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %91

87:                                               ; preds = %77
  %88 = load ptr, ptr %21, align 8, !tbaa !5
  store ptr %88, ptr %16, align 8, !tbaa !5
  %89 = load i64, ptr %15, align 8, !tbaa !9
  %90 = mul nsw i64 %89, 2
  store i64 %90, ptr %15, align 8, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %91

91:                                               ; preds = %87, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  %92 = load i32, ptr %11, align 4
  switch i32 %92, label %212 [
    i32 0, label %93
  ]

93:                                               ; preds = %91
  br label %71, !llvm.loop !14

94:                                               ; preds = %71
  %95 = load ptr, ptr %16, align 8, !tbaa !5
  %96 = load i64, ptr %14, align 8, !tbaa !9
  %97 = getelementptr inbounds i8, ptr %95, i64 %96
  %98 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %99 = load i64, ptr %18, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %97, ptr align 16 %98, i64 %99, i1 false)
  %100 = load i64, ptr %18, align 8, !tbaa !9
  %101 = load i64, ptr %14, align 8, !tbaa !9
  %102 = add nsw i64 %101, %100
  store i64 %102, ptr %14, align 8, !tbaa !9
  br label %211

103:                                              ; preds = %53
  %104 = load ptr, ptr %12, align 8, !tbaa !5
  %105 = load i8, ptr %104, align 1, !tbaa !11
  %106 = zext i8 %105 to i32
  %107 = and i32 %106, 192
  %108 = icmp eq i32 %107, 64
  br i1 %108, label %109, label %159

109:                                              ; preds = %103
  %110 = load ptr, ptr %12, align 8, !tbaa !5
  %111 = load i8, ptr %110, align 1, !tbaa !11
  %112 = zext i8 %111 to i32
  %113 = and i32 %112, 63
  %114 = shl i32 %113, 8
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = getelementptr inbounds i8, ptr %115, i64 1
  %117 = load i8, ptr %116, align 1, !tbaa !11
  %118 = zext i8 %117 to i32
  %119 = or i32 %114, %118
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %19, align 4, !tbaa !12
  %121 = load ptr, ptr %12, align 8, !tbaa !5
  %122 = getelementptr inbounds i8, ptr %121, i64 2
  store ptr %122, ptr %12, align 8, !tbaa !5
  %123 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %124 = load i32, ptr %19, align 4, !tbaa !12
  %125 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %123, i64 noundef 100, ptr noundef @.str.1, i32 noundef %124) #6
  %126 = sext i32 %125 to i64
  store i64 %126, ptr %18, align 8, !tbaa !9
  br label %127

127:                                              ; preds = %149, %109
  %128 = load i64, ptr %14, align 8, !tbaa !9
  %129 = load i64, ptr %18, align 8, !tbaa !9
  %130 = add nsw i64 %128, %129
  %131 = load i64, ptr %15, align 8, !tbaa !9
  %132 = icmp sgt i64 %130, %131
  br i1 %132, label %133, label %150

133:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %134 = load ptr, ptr %16, align 8, !tbaa !5
  %135 = load i64, ptr %15, align 8, !tbaa !9
  %136 = mul i64 1, %135
  %137 = mul i64 %136, 2
  %138 = call ptr @realloc(ptr noundef %134, i64 noundef %137) #8
  store ptr %138, ptr %22, align 8, !tbaa !5
  %139 = load ptr, ptr %22, align 8, !tbaa !5
  %140 = icmp ne ptr %139, null
  br i1 %140, label %143, label %141

141:                                              ; preds = %133
  %142 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %142) #6
  store i32 -4, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %147

143:                                              ; preds = %133
  %144 = load ptr, ptr %22, align 8, !tbaa !5
  store ptr %144, ptr %16, align 8, !tbaa !5
  %145 = load i64, ptr %15, align 8, !tbaa !9
  %146 = mul nsw i64 %145, 2
  store i64 %146, ptr %15, align 8, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %147

147:                                              ; preds = %143, %141
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  %148 = load i32, ptr %11, align 4
  switch i32 %148, label %212 [
    i32 0, label %149
  ]

149:                                              ; preds = %147
  br label %127, !llvm.loop !16

150:                                              ; preds = %127
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = load i64, ptr %14, align 8, !tbaa !9
  %153 = getelementptr inbounds i8, ptr %151, i64 %152
  %154 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %155 = load i64, ptr %18, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %153, ptr align 16 %154, i64 %155, i1 false)
  %156 = load i64, ptr %18, align 8, !tbaa !9
  %157 = load i64, ptr %14, align 8, !tbaa !9
  %158 = add nsw i64 %157, %156
  store i64 %158, ptr %14, align 8, !tbaa !9
  br label %210

159:                                              ; preds = %103
  %160 = load ptr, ptr %12, align 8, !tbaa !5
  %161 = load i8, ptr %160, align 1, !tbaa !11
  %162 = zext i8 %161 to i32
  %163 = and i32 %162, 3
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %19, align 4, !tbaa !12
  %165 = load ptr, ptr %12, align 8, !tbaa !5
  %166 = load i8, ptr %165, align 1, !tbaa !11
  %167 = zext i8 %166 to i32
  %168 = ashr i32 %167, 2
  %169 = and i32 %168, 31
  %170 = add nsw i32 %169, 1
  store i32 %170, ptr %20, align 4, !tbaa !12
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = getelementptr inbounds i8, ptr %171, i32 1
  store ptr %172, ptr %12, align 8, !tbaa !5
  %173 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %174 = load i32, ptr %20, align 4, !tbaa !12
  %175 = load i32, ptr %19, align 4, !tbaa !12
  %176 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %173, i64 noundef 100, ptr noundef @.str.2, i32 noundef %174, i32 noundef %175) #6
  %177 = sext i32 %176 to i64
  store i64 %177, ptr %18, align 8, !tbaa !9
  br label %178

178:                                              ; preds = %200, %159
  %179 = load i64, ptr %14, align 8, !tbaa !9
  %180 = load i64, ptr %18, align 8, !tbaa !9
  %181 = add nsw i64 %179, %180
  %182 = load i64, ptr %15, align 8, !tbaa !9
  %183 = icmp sgt i64 %181, %182
  br i1 %183, label %184, label %201

184:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #6
  %185 = load ptr, ptr %16, align 8, !tbaa !5
  %186 = load i64, ptr %15, align 8, !tbaa !9
  %187 = mul i64 1, %186
  %188 = mul i64 %187, 2
  %189 = call ptr @realloc(ptr noundef %185, i64 noundef %188) #8
  store ptr %189, ptr %23, align 8, !tbaa !5
  %190 = load ptr, ptr %23, align 8, !tbaa !5
  %191 = icmp ne ptr %190, null
  br i1 %191, label %194, label %192

192:                                              ; preds = %184
  %193 = load ptr, ptr %16, align 8, !tbaa !5
  call void @free(ptr noundef %193) #6
  store i32 -4, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %198

194:                                              ; preds = %184
  %195 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %195, ptr %16, align 8, !tbaa !5
  %196 = load i64, ptr %15, align 8, !tbaa !9
  %197 = mul nsw i64 %196, 2
  store i64 %197, ptr %15, align 8, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %198

198:                                              ; preds = %194, %192
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #6
  %199 = load i32, ptr %11, align 4
  switch i32 %199, label %212 [
    i32 0, label %200
  ]

200:                                              ; preds = %198
  br label %178, !llvm.loop !17

201:                                              ; preds = %178
  %202 = load ptr, ptr %16, align 8, !tbaa !5
  %203 = load i64, ptr %14, align 8, !tbaa !9
  %204 = getelementptr inbounds i8, ptr %202, i64 %203
  %205 = getelementptr inbounds [100 x i8], ptr %17, i64 0, i64 0
  %206 = load i64, ptr %18, align 8, !tbaa !9
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %204, ptr align 16 %205, i64 %206, i1 false)
  %207 = load i64, ptr %18, align 8, !tbaa !9
  %208 = load i64, ptr %14, align 8, !tbaa !9
  %209 = add nsw i64 %208, %207
  store i64 %209, ptr %14, align 8, !tbaa !9
  br label %210

210:                                              ; preds = %201, %150
  br label %211

211:                                              ; preds = %210, %94
  store i32 0, ptr %11, align 4
  br label %212

212:                                              ; preds = %211, %198, %147, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  %213 = load i32, ptr %11, align 4
  switch i32 %213, label %226 [
    i32 0, label %214
  ]

214:                                              ; preds = %212
  br label %49, !llvm.loop !18

215:                                              ; preds = %49
  %216 = load i64, ptr %14, align 8, !tbaa !9
  %217 = add nsw i64 %216, -1
  store i64 %217, ptr %14, align 8, !tbaa !9
  %218 = load ptr, ptr %16, align 8, !tbaa !5
  %219 = load i64, ptr %14, align 8, !tbaa !9
  %220 = mul i64 1, %219
  %221 = call ptr @realloc(ptr noundef %218, i64 noundef %220) #8
  store ptr %221, ptr %16, align 8, !tbaa !5
  %222 = load ptr, ptr %16, align 8, !tbaa !5
  %223 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %222, ptr %223, align 8, !tbaa !5
  %224 = load i64, ptr %14, align 8, !tbaa !9
  %225 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %224, ptr %225, align 8, !tbaa !9
  store i32 0, ptr %5, align 4
  store i32 1, ptr %11, align 4
  br label %226

226:                                              ; preds = %215, %212
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 100, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, 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 %227

227:                                              ; preds = %226, %36, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %228 = load i32, ptr %5, align 4
  ret i32 %228
}

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nounwind allocsize(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 #4 = { nounwind allocsize(1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind allocsize(1) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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 [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @isHLLObject(ptr noundef, i64 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @rl_str_pfdebug_decode(ptr noundef %0, i64 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #1 {
  %5 = alloca [100 x i8], align 16
  %6 = tail call i32 @isHLLObject(ptr noundef %0, i64 noundef %1)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %65

7:                                                ; preds = %4
  %8 = getelementptr inbounds i8, ptr %0, i64 4
  %9 = load i8, ptr %8, align 1, !tbaa !5
  %.not117 = icmp eq i8 %9, 1
  br i1 %.not117, label %10, label %65

10:                                               ; preds = %7
  %11 = getelementptr inbounds i8, ptr %0, i64 %1
  %12 = mul nsw i64 %1, 10
  %13 = tail call noalias ptr @malloc(i64 noundef %12) #7
  call void @llvm.lifetime.start.p0(i64 100, ptr nonnull %5) #8
  %14 = icmp sgt i64 %1, 16
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %10
  %15 = getelementptr inbounds i8, ptr %0, i64 16
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.loopexit
  %.086155 = phi ptr [ %.288, %.loopexit ], [ %15, %.lr.ph.preheader ]
  %.089154 = phi i64 [ %.291, %.loopexit ], [ 0, %.lr.ph.preheader ]
  %.092153 = phi ptr [ %.193.lcssa.sink, %.loopexit ], [ %13, %.lr.ph.preheader ]
  %.0101152 = phi i64 [ %.8109, %.loopexit ], [ %12, %.lr.ph.preheader ]
  %16 = load i8, ptr %.086155, align 1, !tbaa !5
  %17 = zext i8 %16 to i32
  %trunc = and i8 %16, -64
  switch i8 %trunc, label %46 [
    i8 0, label %18
    i8 64, label %29
  ]

18:                                               ; preds = %.lr.ph
  %19 = add nuw nsw i32 %17, 1
  %20 = getelementptr inbounds i8, ptr %.086155, i64 1
  %21 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 100, ptr noundef nonnull @.str, i32 noundef %19) #8
  %22 = sext i32 %21 to i64
  %23 = add nsw i64 %.089154, %22
  br label %24

24:                                               ; preds = %26, %18
  %.1102 = phi i64 [ %.0101152, %18 ], [ %27, %26 ]
  %.193 = phi ptr [ %.092153, %18 ], [ %28, %26 ]
  %25 = icmp sgt i64 %23, %.1102
  br i1 %25, label %26, label %.loopexit

26:                                               ; preds = %24
  %27 = shl i64 %.1102, 1
  %28 = tail call ptr @realloc(ptr noundef %.193, i64 noundef %27) #9
  %.not120.not = icmp eq ptr %28, null
  br i1 %.not120.not, label %.thread, label %24, !llvm.loop !8

.thread:                                          ; preds = %26
  tail call void @free(ptr noundef %.193) #8
  br label %.thread129

29:                                               ; preds = %.lr.ph
  %30 = shl nuw nsw i32 %17, 8
  %31 = and i32 %30, 16128
  %32 = getelementptr inbounds i8, ptr %.086155, i64 1
  %33 = load i8, ptr %32, align 1, !tbaa !5
  %34 = zext i8 %33 to i32
  %35 = or disjoint i32 %31, 1
  %36 = add nuw nsw i32 %35, %34
  %37 = getelementptr inbounds i8, ptr %.086155, i64 2
  %38 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 100, ptr noundef nonnull @.str.1, i32 noundef %36) #8
  %39 = sext i32 %38 to i64
  %40 = add nsw i64 %.089154, %39
  br label %41

41:                                               ; preds = %43, %29
  %.3104 = phi i64 [ %.0101152, %29 ], [ %44, %43 ]
  %.395 = phi ptr [ %.092153, %29 ], [ %45, %43 ]
  %42 = icmp sgt i64 %40, %.3104
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %41
  %44 = shl i64 %.3104, 1
  %45 = tail call ptr @realloc(ptr noundef %.395, i64 noundef %44) #9
  %.not119.not = icmp eq ptr %45, null
  br i1 %.not119.not, label %.thread123, label %41, !llvm.loop !10

.thread123:                                       ; preds = %43
  tail call void @free(ptr noundef %.395) #8
  br label %.thread129

46:                                               ; preds = %.lr.ph
  %47 = and i32 %17, 3
  %48 = add nuw nsw i32 %47, 1
  %49 = lshr i32 %17, 2
  %50 = and i32 %49, 31
  %51 = add nuw nsw i32 %50, 1
  %52 = getelementptr inbounds i8, ptr %.086155, i64 1
  %53 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %5, i64 noundef 100, ptr noundef nonnull @.str.2, i32 noundef %51, i32 noundef %48) #8
  %54 = sext i32 %53 to i64
  %55 = add nsw i64 %.089154, %54
  br label %56

56:                                               ; preds = %58, %46
  %.5106 = phi i64 [ %.0101152, %46 ], [ %59, %58 ]
  %.597 = phi ptr [ %.092153, %46 ], [ %60, %58 ]
  %57 = icmp sgt i64 %55, %.5106
  br i1 %57, label %58, label %.loopexit

58:                                               ; preds = %56
  %59 = shl i64 %.5106, 1
  %60 = tail call ptr @realloc(ptr noundef %.597, i64 noundef %59) #9
  %.not118.not = icmp eq ptr %60, null
  br i1 %.not118.not, label %.thread126, label %56, !llvm.loop !11

.thread126:                                       ; preds = %58
  tail call void @free(ptr noundef %.597) #8
  br label %.thread129

.loopexit:                                        ; preds = %41, %24, %56
  %.193.lcssa.sink = phi ptr [ %.597, %56 ], [ %.193, %24 ], [ %.395, %41 ]
  %.sink169 = phi i64 [ %54, %56 ], [ %22, %24 ], [ %39, %41 ]
  %.8109 = phi i64 [ %.5106, %56 ], [ %.1102, %24 ], [ %.3104, %41 ]
  %.291 = phi i64 [ %55, %56 ], [ %23, %24 ], [ %40, %41 ]
  %.288 = phi ptr [ %52, %56 ], [ %20, %24 ], [ %37, %41 ]
  %61 = getelementptr inbounds i8, ptr %.193.lcssa.sink, i64 %.089154
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %61, ptr nonnull align 16 %5, i64 %.sink169, i1 false)
  %62 = icmp ult ptr %.288, %11
  br i1 %62, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !12

._crit_edge.loopexit:                             ; preds = %.loopexit
  %63 = add nsw i64 %.291, -1
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %10
  %.092.lcssa = phi ptr [ %13, %10 ], [ %.193.lcssa.sink, %._crit_edge.loopexit ]
  %.089.lcssa = phi i64 [ -1, %10 ], [ %63, %._crit_edge.loopexit ]
  %64 = tail call ptr @realloc(ptr noundef %.092.lcssa, i64 noundef %.089.lcssa) #9
  store ptr %64, ptr %2, align 8, !tbaa !13
  store i64 %.089.lcssa, ptr %3, align 8, !tbaa !15
  br label %.thread129

.thread129:                                       ; preds = %.thread126, %.thread123, %.thread, %._crit_edge
  %.9 = phi i32 [ 0, %._crit_edge ], [ -4, %.thread ], [ -4, %.thread123 ], [ -4, %.thread126 ]
  call void @llvm.lifetime.end.p0(i64 100, ptr nonnull %5) #8
  br label %65

65:                                               ; preds = %7, %4, %.thread129
  %.10 = phi i32 [ %.9, %.thread129 ], [ -1, %4 ], [ -2, %7 ]
  ret i32 %.10
}

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

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind }
attributes #9 = { nounwind allocsize(1) }

!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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9}
!12 = distinct !{!12, !9}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !6, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !6, i64 0}


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