; 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_f64(ptr noundef %0, ptr noundef %1, double noundef %2) #1 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, 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 double %2, ptr %7, align 8, !tbaa !9
  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 !11
  %13 = load i32, ptr %8, align 4, !tbaa !11
  %14 = icmp ne i32 %13, 6
  br i1 %14, label %15, label %18

15:                                               ; preds = %3
  %16 = load i32, ptr %8, align 4, !tbaa !11
  %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 !13
  %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 %56

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 %43

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

33:                                               ; preds = %30
  %34 = load ptr, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = load double, ptr %7, align 8, !tbaa !9
  %37 = call i32 @binn_object_set_double(ptr noundef %34, ptr noundef %35, double noundef %36)
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %40, label %39

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

40:                                               ; preds = %33
  br label %42

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

42:                                               ; preds = %40
  store i64 0, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %55

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

46:                                               ; preds = %43
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = load double, ptr %7, align 8, !tbaa !9
  %49 = call i32 @binn_list_add_double(ptr noundef %47, double noundef %48)
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %55

52:                                               ; preds = %46
  store i64 0, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %55

53:                                               ; preds = %43
  br label %54

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

55:                                               ; preds = %54, %52, %51, %42, %41, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %56

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

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_double(ptr noundef, double 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"jbl", !15, i64 0, !6, i64 88}
!15 = !{!"binn_struct", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !6, i64 16, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !6, i64 40, !12, i64 48, !12, 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_f64(ptr noundef %0, ptr noundef %1, double 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_double(ptr noundef nonnull %0, ptr noundef nonnull %1, double 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_double(ptr noundef nonnull %0, double 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_double(ptr noundef, ptr noundef, double noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_double(ptr noundef, double 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