; 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_null(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call i32 @jbl_type(ptr noundef %9)
  store i32 %10, ptr %6, align 4, !tbaa !9
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp ne i32 %11, 6
  br i1 %12, label %13, label %16

13:                                               ; preds = %2
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = icmp ne i32 %14, 7
  br i1 %15, label %22, label %16

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

22:                                               ; preds = %16, %13
  store i64 76002, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %52

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.jbl, ptr %24, i32 0, i32 0
  store ptr %25, ptr %8, align 8, !tbaa !5
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %40

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !9
  %30 = icmp eq i32 %29, 6
  br i1 %30, label %31, label %38

31:                                               ; preds = %28
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call i32 @binn_object_set_null(ptr noundef %32, ptr noundef %33)
  %35 = icmp ne i32 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %31
  store i64 76002, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

37:                                               ; preds = %31
  br label %39

38:                                               ; preds = %28
  store i64 76002, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

39:                                               ; preds = %37
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

40:                                               ; preds = %23
  %41 = load i32, ptr %6, align 4, !tbaa !9
  %42 = icmp eq i32 %41, 7
  br i1 %42, label %43, label %49

43:                                               ; preds = %40
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = call i32 @binn_list_add_null(ptr noundef %44)
  %46 = icmp ne i32 %45, 0
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i64 76002, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

48:                                               ; preds = %43
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

49:                                               ; preds = %40
  br label %50

50:                                               ; preds = %49
  store i64 76003, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %51

51:                                               ; preds = %50, %48, %47, %39, %38, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %52

52:                                               ; preds = %51, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %53 = load i64, ptr %3, align 8
  ret i64 %53
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_null(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_null(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = tail call i32 @jbl_type(ptr noundef %0)
  %4 = add i32 %3, -8
  %or.cond = icmp ult i32 %4, -2
  br i1 %or.cond, label %17, label %5

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

8:                                                ; preds = %5
  %.not13 = icmp eq ptr %1, null
  br i1 %.not13, label %13, label %9

9:                                                ; preds = %8
  %10 = icmp eq i32 %3, 6
  br i1 %10, label %11, label %17

11:                                               ; preds = %9
  %12 = tail call i32 @binn_object_set_null(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %.not15 = icmp eq i32 %12, 0
  %. = select i1 %.not15, i64 76002, i64 0
  br label %17

13:                                               ; preds = %8
  %14 = icmp eq i32 %3, 7
  br i1 %14, label %15, label %17

15:                                               ; preds = %13
  %16 = tail call i32 @binn_list_add_null(ptr noundef nonnull %0)
  %.not14 = icmp eq i32 %16, 0
  %.16 = select i1 %.not14, i64 76002, i64 0
  br label %17

17:                                               ; preds = %11, %9, %15, %13, %5, %2
  %.1 = phi i64 [ 76002, %2 ], [ 76002, %5 ], [ %., %11 ], [ 76002, %9 ], [ %.16, %15 ], [ 76003, %13 ]
  ret i64 %.1
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_null(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