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

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

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

25:                                               ; preds = %19, %16
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %61

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

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

34:                                               ; preds = %31
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i8, ptr %7, align 1, !tbaa !9, !range !16, !noundef !17
  %38 = trunc i8 %37 to i1
  %39 = zext i1 %38 to i32
  %40 = call i32 @binn_object_set_bool(ptr noundef %35, ptr noundef %36, i32 noundef %39)
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %34
  br label %45

44:                                               ; preds = %31
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %60

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

46:                                               ; preds = %26
  %47 = load i32, ptr %8, align 4, !tbaa !11
  %48 = icmp eq i32 %47, 7
  br i1 %48, label %49, label %58

49:                                               ; preds = %46
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = load i8, ptr %7, align 1, !tbaa !9, !range !16, !noundef !17
  %52 = trunc i8 %51 to i1
  %53 = zext i1 %52 to i32
  %54 = call i32 @binn_list_add_bool(ptr noundef %50, i32 noundef %53)
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %57, label %56

56:                                               ; preds = %49
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %60

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

58:                                               ; preds = %46
  br label %59

59:                                               ; preds = %58
  store i64 76003, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %60

60:                                               ; preds = %59, %57, %56, %45, %44, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %61

61:                                               ; preds = %60, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %62 = load i64, ptr %4, align 8
  ret i64 %62
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_list_add_bool(ptr noundef, i32 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 = !{!"_Bool", !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}
!16 = !{i8 0, i8 2}
!17 = !{}


; 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_bool(ptr noundef %0, ptr noundef %1, i1 noundef zeroext %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 %20, 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 %20, label %9

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

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

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

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

17:                                               ; preds = %15
  %18 = zext i1 %2 to i32
  %19 = tail call i32 @binn_list_add_bool(ptr noundef nonnull %0, i32 noundef %18)
  %.not16 = icmp eq i32 %19, 0
  %.18 = select i1 %.not16, i64 76002, i64 0
  br label %20

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

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

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