; LLVM IR from clibs/clib :: deps/parson (parson)

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

@parson_free = external hidden global ptr, align 8

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @json_object_get_object(ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare dso_local void @json_value_free(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @json_value_init_object() #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @json_object_set_value(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @json_object_dotset_value(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  store ptr null, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store ptr null, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store ptr null, ptr %11, align 8, !tbaa !5
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %21, label %15

15:                                               ; preds = %3
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp eq ptr %16, null
  br i1 %17, label %21, label %18

18:                                               ; preds = %15
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %18, %15, %3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %74

22:                                               ; preds = %18
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = call ptr @strchr(ptr noundef %23, i32 noundef 46) #4
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %32

27:                                               ; preds = %22
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call i32 @json_object_set_value(ptr noundef %28, ptr noundef %29, ptr noundef %30)
  store i32 %31, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %74

32:                                               ; preds = %22
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = ptrtoint ptr %34 to i64
  %37 = ptrtoint ptr %35 to i64
  %38 = sub i64 %36, %37
  %39 = call ptr @parson_strndup(ptr noundef %33, i64 noundef %38)
  store ptr %39, ptr %9, align 8, !tbaa !5
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = call ptr @json_object_get_object(ptr noundef %40, ptr noundef %41)
  store ptr %42, ptr %10, align 8, !tbaa !5
  %43 = load ptr, ptr %10, align 8, !tbaa !5
  %44 = icmp eq ptr %43, null
  br i1 %44, label %45, label %66

45:                                               ; preds = %32
  %46 = call ptr @json_value_init_object()
  store ptr %46, ptr %11, align 8, !tbaa !5
  %47 = load ptr, ptr %11, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %45
  %50 = load ptr, ptr @parson_free, align 8, !tbaa !5
  %51 = load ptr, ptr %9, align 8, !tbaa !5
  call void %50(ptr noundef %51)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %74

52:                                               ; preds = %45
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %11, align 8, !tbaa !5
  %56 = call i32 @json_object_add(ptr noundef %53, ptr noundef %54, ptr noundef %55)
  %57 = icmp eq i32 %56, -1
  br i1 %57, label %58, label %62

58:                                               ; preds = %52
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  call void @json_value_free(ptr noundef %59)
  %60 = load ptr, ptr @parson_free, align 8, !tbaa !5
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  call void %60(ptr noundef %61)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %74

62:                                               ; preds = %52
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %9, align 8, !tbaa !5
  %65 = call ptr @json_object_get_object(ptr noundef %63, ptr noundef %64)
  store ptr %65, ptr %10, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %62, %32
  %67 = load ptr, ptr @parson_free, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  call void %67(ptr noundef %68)
  %69 = load ptr, ptr %10, align 8, !tbaa !5
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds i8, ptr %70, i64 1
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = call i32 @json_object_dotset_value(ptr noundef %69, ptr noundef %71, ptr noundef %72)
  store i32 %73, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %74

74:                                               ; preds = %66, %58, %49, %27, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %75 = load i32, ptr %4, align 4
  ret i32 %75
}

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 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 #3 = { nounwind }
attributes #4 = { 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"}


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

@parson_free = external hidden local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local ptr @json_object_get_object(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @json_value_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local ptr @json_value_init_object() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @parson_strndup(ptr noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @json_object_add(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @json_object_set_value(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @json_object_dotset_value(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = icmp eq ptr %2, null
  %5 = icmp eq ptr %1, null
  %or.cond47 = or i1 %4, %5
  br i1 %or.cond47, label %.loopexit, label %.lr.ph.split.split

.lr.ph.split.split:                               ; preds = %3
  %6 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %1, i32 noundef 46) #2
  %7 = icmp eq ptr %6, null
  br i1 %7, label %.split, label %.lr.ph60

.split:                                           ; preds = %tailrecurse, %.lr.ph.split.split
  %.tr.lcssa41 = phi ptr [ %0, %.lr.ph.split.split ], [ %.0, %tailrecurse ]
  %.tr36.lcssa38 = phi ptr [ %1, %.lr.ph.split.split ], [ %27, %tailrecurse ]
  %8 = tail call i32 @json_object_set_value(ptr noundef %.tr.lcssa41, ptr noundef nonnull %.tr36.lcssa38, ptr noundef nonnull %2)
  br label %.loopexit

.lr.ph60:                                         ; preds = %.lr.ph.split.split, %tailrecurse
  %9 = phi ptr [ %28, %tailrecurse ], [ %6, %.lr.ph.split.split ]
  %.tr4859 = phi ptr [ %.0, %tailrecurse ], [ %0, %.lr.ph.split.split ]
  %.tr364958 = phi ptr [ %27, %tailrecurse ], [ %1, %.lr.ph.split.split ]
  %10 = ptrtoint ptr %9 to i64
  %11 = ptrtoint ptr %.tr364958 to i64
  %12 = sub i64 %10, %11
  %13 = tail call ptr @parson_strndup(ptr noundef nonnull %.tr364958, i64 noundef %12)
  %14 = tail call ptr @json_object_get_object(ptr noundef %.tr4859, ptr noundef %13)
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %tailrecurse

16:                                               ; preds = %.lr.ph60
  %17 = tail call ptr @json_value_init_object()
  %18 = icmp eq ptr %17, null
  br i1 %18, label %.split52, label %20

.split52:                                         ; preds = %16
  %19 = load ptr, ptr @parson_free, align 8, !tbaa !5
  tail call void %19(ptr noundef %13) #3
  br label %.loopexit

20:                                               ; preds = %16
  %21 = tail call i32 @json_object_add(ptr noundef %.tr4859, ptr noundef %13, ptr noundef nonnull %17)
  %22 = icmp eq i32 %21, -1
  br i1 %22, label %.split55, label %24

.split55:                                         ; preds = %20
  tail call void @json_value_free(ptr noundef nonnull %17)
  %23 = load ptr, ptr @parson_free, align 8, !tbaa !5
  tail call void %23(ptr noundef %13) #3
  br label %.loopexit

24:                                               ; preds = %20
  %25 = tail call ptr @json_object_get_object(ptr noundef %.tr4859, ptr noundef %13)
  br label %tailrecurse

tailrecurse:                                      ; preds = %24, %.lr.ph60
  %.0 = phi ptr [ %25, %24 ], [ %14, %.lr.ph60 ]
  %26 = load ptr, ptr @parson_free, align 8, !tbaa !5
  tail call void %26(ptr noundef %13) #3
  %27 = getelementptr inbounds i8, ptr %9, i64 1
  %28 = tail call ptr @strchr(ptr noundef nonnull dereferenceable(1) %27, i32 noundef 46) #2
  %29 = icmp eq ptr %28, null
  br i1 %29, label %.split, label %.lr.ph60

.loopexit:                                        ; preds = %3, %.split55, %.split52, %.split
  %.030 = phi i32 [ %8, %.split ], [ -1, %.split52 ], [ -1, %.split55 ], [ -1, %3 ]
  ret i32 %.030
}

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 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 #2 = { nounwind willreturn memory(read) }
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"}


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