; 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
define dso_local i64 @jbl_object_get_bool(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
  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
  %10 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 0, ptr %10, align 1, !tbaa !9
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.jbl, ptr %11, i32 0, i32 0
  %13 = getelementptr inbounds %struct.binn_struct, ptr %12, i32 0, i32 8
  %14 = load i32, ptr %13, align 4, !tbaa !11
  %15 = icmp ne i32 %14, 226
  br i1 %15, label %16, label %17

16:                                               ; preds = %3
  store i64 76016, ptr %4, align 8
  br label %30

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.jbl, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call i32 @binn_object_get_bool(ptr noundef %19, ptr noundef %20, ptr noundef %8)
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %24, label %23

23:                                               ; preds = %17
  store i64 76002, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %29

24:                                               ; preds = %17
  %25 = load i32, ptr %8, align 4, !tbaa !15
  %26 = icmp ne i32 %25, 0
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = zext i1 %26 to i8
  store i8 %28, ptr %27, align 1, !tbaa !9
  store i64 0, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %29

29:                                               ; preds = %24, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %30

30:                                               ; preds = %29, %16
  %31 = load i64, ptr %4, align 8
  ret i64 %31
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden i32 @binn_object_get_bool(ptr noundef, 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 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !14, i64 36}
!12 = !{!"jbl", !13, i64 0, !6, i64 88}
!13 = !{!"binn_struct", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !6, i64 16, !14, i64 24, !14, i64 28, !14, i64 32, !14, i64 36, !6, i64 40, !14, i64 48, !14, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !7, i64 80}
!14 = !{!"int", !7, i64 0}
!15 = !{!14, !14, i64 0}


; 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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: nounwind uwtable
define dso_local range(i64 0, 76017) i64 @jbl_object_get_bool(ptr noundef %0, ptr noundef %1, ptr nocapture noundef writeonly %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  store i8 0, ptr %2, align 1, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 36
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %.not = icmp eq i32 %6, 226
  br i1 %.not, label %7, label %14

7:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %8 = call i32 @binn_object_get_bool(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %4)
  %.not5 = icmp eq i32 %8, 0
  br i1 %.not5, label %13, label %9

9:                                                ; preds = %7
  %10 = load i32, ptr %4, align 4, !tbaa !14
  %11 = icmp ne i32 %10, 0
  %12 = zext i1 %11 to i8
  store i8 %12, ptr %2, align 1, !tbaa !5
  br label %13

13:                                               ; preds = %7, %9
  %.0 = phi i64 [ 0, %9 ], [ 76002, %7 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  br label %14

14:                                               ; preds = %3, %13
  %.1 = phi i64 [ %.0, %13 ], [ 76016, %3 ]
  ret i64 %.1
}

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

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


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