; LLVM IR from Softmotions/iowow :: src/json (iwjson)

; 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.jbl = type { %struct.binn_struct, ptr }
%struct.binn_struct = type { i32, i32, i32, i32, ptr, i32, i32, i32, i32, ptr, i32, i32, ptr, ptr, ptr, %union.anon }
%union.anon = type { i64 }

; 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 i32 @jbl_type(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i64 @jbl_set_nested(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  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 4, ptr %8) #3
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call i32 @jbl_type(ptr noundef %11)
  store i32 %12, ptr %8, align 4, !tbaa !9
  %13 = load i32, ptr %8, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 6
  br i1 %14, label %15, label %18

15:                                               ; preds = %3
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 7
  br i1 %17, label %24, label %18

18:                                               ; preds = %15, %3
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.jbl, ptr %19, i32 0, i32 0
  %21 = getelementptr inbounds %struct.binn_struct, ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 8, !tbaa !11
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %25, label %24

24:                                               ; preds = %18, %15
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %58

25:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.jbl, ptr %26, i32 0, i32 0
  store ptr %27, ptr %10, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %44

30:                                               ; preds = %25
  %31 = load i32, ptr %8, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 6
  br i1 %32, label %33, label %42

33:                                               ; preds = %30
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.jbl, ptr %36, i32 0, i32 0
  %38 = call i32 @binn_object_set_value(ptr noundef %34, ptr noundef %35, ptr noundef %37)
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %41, label %40

40:                                               ; preds = %33
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

41:                                               ; preds = %33
  br label %43

42:                                               ; preds = %30
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

43:                                               ; preds = %41
  store i64 0, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

44:                                               ; preds = %25
  %45 = load i32, ptr %8, align 4, !tbaa !9
  %46 = icmp eq i32 %45, 7
  br i1 %46, label %47, label %55

47:                                               ; preds = %44
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.jbl, ptr %49, i32 0, i32 0
  %51 = call i32 @binn_list_add_value(ptr noundef %48, ptr noundef %50)
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %54, label %53

53:                                               ; preds = %47
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

54:                                               ; preds = %47
  store i64 0, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

55:                                               ; preds = %44
  br label %56

56:                                               ; preds = %55
  store i64 76003, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %57

57:                                               ; preds = %56, %54, %53, %43, %42, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %58

58:                                               ; preds = %57, %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %59 = load i64, ptr %4, align 8
  ret i64 %59
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_object_set_value(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_value(ptr noundef, ptr noundef) #2

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 = { alwaysinline 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 }

!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, !10, i64 8}
!12 = !{!"jbl", !13, i64 0, !6, i64 88}
!13 = !{!"binn_struct", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !6, i64 40, !10, i64 48, !10, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80}


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

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 76004) i64 @jbl_set_nested(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call i32 @jbl_type(ptr noundef %0)
  %5 = add i32 %4, -8
  %or.cond = icmp ult i32 %5, -2
  br i1 %or.cond, label %18, label %6

6:                                                ; preds = %3
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %18, label %9

9:                                                ; preds = %6
  %.not15 = icmp eq ptr %1, null
  br i1 %.not15, label %14, label %10

10:                                               ; preds = %9
  %11 = icmp eq i32 %4, 6
  br i1 %11, label %12, label %18

12:                                               ; preds = %10
  %13 = tail call i32 @binn_object_set_value(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2)
  %.not17 = icmp eq i32 %13, 0
  %. = select i1 %.not17, i64 76002, i64 0
  br label %18

14:                                               ; preds = %9
  %15 = icmp eq i32 %4, 7
  br i1 %15, label %16, label %18

16:                                               ; preds = %14
  %17 = tail call i32 @binn_list_add_value(ptr noundef nonnull %0, ptr noundef %2)
  %.not16 = icmp eq i32 %17, 0
  %.18 = select i1 %.not16, i64 76002, i64 0
  br label %18

18:                                               ; preds = %12, %10, %16, %14, %6, %3
  %.1 = phi i64 [ 76002, %3 ], [ 76002, %6 ], [ %., %12 ], [ 76002, %10 ], [ %.18, %16 ], [ 76003, %14 ]
  ret i64 %.1
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_value(ptr noundef, ptr noundef) local_unnamed_addr #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 = { alwaysinline 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" }

!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, !8, i64 8}
!6 = !{!"jbl", !7, i64 0, !11, i64 88}
!7 = !{!"binn_struct", !8, i64 0, !8, i64 4, !8, i64 8, !8, i64 12, !11, i64 16, !8, i64 24, !8, i64 28, !8, i64 32, !8, i64 36, !11, i64 40, !8, i64 48, !8, i64 52, !11, i64 56, !11, i64 64, !11, i64 72, !9, i64 80}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass