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

; 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_node = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, %union.anon.0 }
%union.anon.0 = type { ptr }

; Function Attrs: nounwind uwtable
define dso_local i64 @_jbl_increment_node_data(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.jbl_node, ptr %6, i32 0, i32 8
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = icmp ne i32 %8, 3
  br i1 %9, label %10, label %16

10:                                               ; preds = %2
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.jbl_node, ptr %11, i32 0, i32 8
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 4
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  store i64 76014, ptr %3, align 8
  br label %73

16:                                               ; preds = %10, %2
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.jbl_node, ptr %17, i32 0, i32 8
  %19 = load i32, ptr %18, align 4, !tbaa !9
  %20 = icmp eq i32 %19, 3
  br i1 %20, label %21, label %44

21:                                               ; preds = %16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.jbl_node, ptr %22, i32 0, i32 8
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = icmp eq i32 %24, 3
  br i1 %25, label %26, label %34

26:                                               ; preds = %21
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.jbl_node, ptr %27, i32 0, i32 9
  %29 = load i64, ptr %28, align 8, !tbaa !12
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.jbl_node, ptr %30, i32 0, i32 9
  %32 = load i64, ptr %31, align 8, !tbaa !12
  %33 = add nsw i64 %32, %29
  store i64 %33, ptr %31, align 8, !tbaa !12
  br label %43

34:                                               ; preds = %21
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.jbl_node, ptr %35, i32 0, i32 9
  %37 = load double, ptr %36, align 8, !tbaa !12
  %38 = fptosi double %37 to i64
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.jbl_node, ptr %39, i32 0, i32 9
  %41 = load i64, ptr %40, align 8, !tbaa !12
  %42 = add nsw i64 %41, %38
  store i64 %42, ptr %40, align 8, !tbaa !12
  br label %43

43:                                               ; preds = %34, %26
  store i64 0, ptr %3, align 8
  br label %73

44:                                               ; preds = %16
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.jbl_node, ptr %45, i32 0, i32 8
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = icmp eq i32 %47, 4
  br i1 %48, label %49, label %72

49:                                               ; preds = %44
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.jbl_node, ptr %50, i32 0, i32 8
  %52 = load i32, ptr %51, align 4, !tbaa !9
  %53 = icmp eq i32 %52, 4
  br i1 %53, label %54, label %62

54:                                               ; preds = %49
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.jbl_node, ptr %55, i32 0, i32 9
  %57 = load double, ptr %56, align 8, !tbaa !12
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.jbl_node, ptr %58, i32 0, i32 9
  %60 = load double, ptr %59, align 8, !tbaa !12
  %61 = fadd double %60, %57
  store double %61, ptr %59, align 8, !tbaa !12
  br label %71

62:                                               ; preds = %49
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.jbl_node, ptr %63, i32 0, i32 9
  %65 = load i64, ptr %64, align 8, !tbaa !12
  %66 = sitofp i64 %65 to double
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.jbl_node, ptr %67, i32 0, i32 9
  %69 = load double, ptr %68, align 8, !tbaa !12
  %70 = fadd double %69, %66
  store double %70, ptr %68, align 8, !tbaa !12
  br label %71

71:                                               ; preds = %62, %54
  store i64 0, ptr %3, align 8
  br label %73

72:                                               ; preds = %44
  store i64 76013, ptr %3, align 8
  br label %73

73:                                               ; preds = %72, %71, %43, %15
  %74 = load i64, ptr %3, align 8
  ret i64 %74
}

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

!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, !11, i64 52}
!10 = !{!"jbl_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !11, i64 36, !6, i64 40, !11, i64 48, !11, i64 52, !7, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!7, !7, 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 nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) uwtable
define dso_local range(i64 0, 76015) i64 @_jbl_increment_node_data(ptr nocapture noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %1, i64 52
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.off = add i32 %4, -3
  %switch = icmp ult i32 %.off, 2
  br i1 %switch, label %5, label %36

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 52
  %7 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %7, label %36 [
    i32 3, label %8
    i32 4, label %22
  ]

8:                                                ; preds = %5
  %9 = icmp eq i32 %4, 3
  %10 = getelementptr inbounds i8, ptr %1, i64 56
  br i1 %9, label %11, label %16

11:                                               ; preds = %8
  %12 = load i64, ptr %10, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  %14 = load i64, ptr %13, align 8, !tbaa !11
  %15 = add nsw i64 %14, %12
  store i64 %15, ptr %13, align 8, !tbaa !11
  br label %36

16:                                               ; preds = %8
  %17 = load double, ptr %10, align 8, !tbaa !11
  %18 = fptosi double %17 to i64
  %19 = getelementptr inbounds i8, ptr %0, i64 56
  %20 = load i64, ptr %19, align 8, !tbaa !11
  %21 = add nsw i64 %20, %18
  store i64 %21, ptr %19, align 8, !tbaa !11
  br label %36

22:                                               ; preds = %5
  %23 = icmp eq i32 %4, 4
  %24 = getelementptr inbounds i8, ptr %1, i64 56
  br i1 %23, label %25, label %30

25:                                               ; preds = %22
  %26 = load double, ptr %24, align 8, !tbaa !11
  %27 = getelementptr inbounds i8, ptr %0, i64 56
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = fadd double %26, %28
  store double %29, ptr %27, align 8, !tbaa !11
  br label %36

30:                                               ; preds = %22
  %31 = load i64, ptr %24, align 8, !tbaa !11
  %32 = sitofp i64 %31 to double
  %33 = getelementptr inbounds i8, ptr %0, i64 56
  %34 = load double, ptr %33, align 8, !tbaa !11
  %35 = fadd double %34, %32
  store double %35, ptr %33, align 8, !tbaa !11
  br label %36

36:                                               ; preds = %2, %5, %25, %30, %11, %16
  %.0 = phi i64 [ 76014, %2 ], [ 0, %16 ], [ 0, %11 ], [ 0, %30 ], [ 0, %25 ], [ 76013, %5 ]
  ret i64 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite) 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, !10, i64 52}
!6 = !{!"jbl_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !10, i64 48, !10, i64 52, !8, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!8, !8, i64 0}


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