; LLVM IR from stan-dev/math :: lib/boost_1.84.0/tools/build/src/engine (native)

; 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.module_t = type { ptr, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, i32 }
%struct.native_rule_t = type { ptr, ptr, i32 }

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__._Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi = external hidden unnamed_addr constant [106 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = call noundef ptr @_Z10object_newPKc(ptr noundef %19)
  br label %22

21:                                               ; preds = %5
  br label %22

22:                                               ; preds = %21, %18
  %23 = phi ptr [ %20, %18 ], [ null, %21 ]
  store ptr %23, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  %25 = call noundef ptr @_Z10bindmoduleP7_object(ptr noundef %24)
  store ptr %25, ptr %12, align 8, !tbaa !5
  %26 = load ptr, ptr %11, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  call void @_Z11object_freeRP7_object(ptr noundef nonnull align 8 dereferenceable(8) %11)
  br label %29

29:                                               ; preds = %28, %22
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.module_t, ptr %30, i32 0, i32 8
  %32 = load ptr, ptr %31, align 8, !tbaa !11
  %33 = icmp ne ptr %32, null
  br i1 %33, label %38, label %34

34:                                               ; preds = %29
  %35 = call noundef ptr @_Z8hashinitiPKc(i32 noundef 24, ptr noundef @.str)
  %36 = load ptr, ptr %12, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.module_t, ptr %36, i32 0, i32 8
  store ptr %35, ptr %37, align 8, !tbaa !11
  br label %38

38:                                               ; preds = %34, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call noundef ptr @_Z10object_newPKc(ptr noundef %39)
  store ptr %40, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.module_t, ptr %41, i32 0, i32 8
  %43 = load ptr, ptr %42, align 8, !tbaa !11
  %44 = load ptr, ptr %13, align 8, !tbaa !5
  %45 = call noundef ptr @_Z11hash_insertP4hashP7_objectPi(ptr noundef %43, ptr noundef %44, ptr noundef %14)
  store ptr %45, ptr %15, align 8, !tbaa !5
  %46 = load ptr, ptr %13, align 8, !tbaa !5
  %47 = load ptr, ptr %15, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.native_rule_t, ptr %47, i32 0, i32 0
  store ptr %46, ptr %48, align 8, !tbaa !13
  %49 = load i32, ptr %14, align 4, !tbaa !9
  %50 = icmp ne i32 %49, 0
  %51 = xor i1 %50, true
  br i1 %51, label %52, label %53

52:                                               ; preds = %38
  br label %55

53:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 30, ptr noundef @__PRETTY_FUNCTION__._Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi) #5
  unreachable

54:                                               ; No predecessors!
  br label %55

55:                                               ; preds = %54, %52
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = call noundef ptr @_Z16function_builtinPFP4LISTP5frameiEiPPKc(ptr noundef %56, i32 noundef 0, ptr noundef %57)
  %59 = load ptr, ptr %15, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.native_rule_t, ptr %59, i32 0, i32 1
  store ptr %58, ptr %60, align 8, !tbaa !15
  %61 = load i32, ptr %10, align 4, !tbaa !9
  %62 = load ptr, ptr %15, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.native_rule_t, ptr %62, i32 0, i32 2
  store i32 %61, ptr %63, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

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

declare noundef ptr @_Z10object_newPKc(ptr noundef) #2

declare noundef ptr @_Z10bindmoduleP7_object(ptr noundef) #2

declare void @_Z11object_freeRP7_object(ptr noundef nonnull align 8 dereferenceable(8)) #2

declare noundef ptr @_Z8hashinitiPKc(i32 noundef, ptr noundef) #2

declare noundef ptr @_Z11hash_insertP4hashP7_objectPi(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare noundef ptr @_Z16function_builtinPFP4LISTP5frameiEiPPKc(ptr noundef, i32 noundef, ptr noundef) #2

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

attributes #0 = { mustprogress 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { noreturn nounwind "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 #4 = { nounwind }
attributes #5 = { noreturn 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 64}
!12 = !{!"_ZTS8module_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !10, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !10, i64 72}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTS13native_rule_t", !6, i64 0, !6, i64 8, !10, i64 16}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !10, i64 16}


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

@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [98 x i8], align 1
@__PRETTY_FUNCTION__._Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi = external hidden unnamed_addr constant [106 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %.thread, label %9

.thread:                                          ; preds = %5
  store ptr null, ptr %6, align 8, !tbaa !5
  %8 = tail call noundef ptr @_Z10bindmoduleP7_object(ptr noundef null)
  br label %13

9:                                                ; preds = %5
  %10 = tail call noundef ptr @_Z10object_newPKc(ptr noundef nonnull %0)
  store ptr %10, ptr %6, align 8, !tbaa !5
  %11 = tail call noundef ptr @_Z10bindmoduleP7_object(ptr noundef %10)
  %.not13 = icmp eq ptr %10, null
  br i1 %.not13, label %13, label %12

12:                                               ; preds = %9
  call void @_Z11object_freeRP7_object(ptr noundef nonnull align 8 dereferenceable(8) %6)
  br label %13

13:                                               ; preds = %.thread, %12, %9
  %14 = phi ptr [ %8, %.thread ], [ %11, %12 ], [ %11, %9 ]
  %15 = getelementptr inbounds i8, ptr %14, i64 64
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %.not14 = icmp eq ptr %16, null
  br i1 %.not14, label %17, label %19

17:                                               ; preds = %13
  %18 = call noundef ptr @_Z8hashinitiPKc(i32 noundef 24, ptr noundef nonnull @.str)
  store ptr %18, ptr %15, align 8, !tbaa !9
  br label %19

19:                                               ; preds = %17, %13
  %20 = call noundef ptr @_Z10object_newPKc(ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #4
  %21 = load ptr, ptr %15, align 8, !tbaa !9
  %22 = call noundef ptr @_Z11hash_insertP4hashP7_objectPi(ptr noundef %21, ptr noundef %20, ptr noundef nonnull %7)
  store ptr %20, ptr %22, align 8, !tbaa !12
  %23 = load i32, ptr %7, align 4, !tbaa !14
  %.not15 = icmp eq i32 %23, 0
  br i1 %.not15, label %25, label %24

24:                                               ; preds = %19
  call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 30, ptr noundef nonnull @__PRETTY_FUNCTION__._Z19declare_native_rulePKcS0_PS0_PFP4LISTP5frameiEi) #5
  unreachable

25:                                               ; preds = %19
  %26 = call noundef ptr @_Z16function_builtinPFP4LISTP5frameiEiPPKc(ptr noundef %3, i32 noundef 0, ptr noundef %2)
  %27 = getelementptr inbounds i8, ptr %22, i64 8
  store ptr %26, ptr %27, align 8, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %22, i64 16
  store i32 %4, ptr %28, align 8, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret void
}

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

declare noundef ptr @_Z10object_newPKc(ptr noundef) local_unnamed_addr #2

declare noundef ptr @_Z10bindmoduleP7_object(ptr noundef) local_unnamed_addr #2

declare void @_Z11object_freeRP7_object(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

declare noundef ptr @_Z8hashinitiPKc(i32 noundef, ptr noundef) local_unnamed_addr #2

declare noundef ptr @_Z11hash_insertP4hashP7_objectPi(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

declare noundef ptr @_Z16function_builtinPFP4LISTP5frameiEiPPKc(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

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

attributes #0 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { noreturn nounwind "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 #4 = { nounwind }
attributes #5 = { noreturn 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++ TBAA"}
!9 = !{!10, !6, i64 64}
!10 = !{!"_ZTS8module_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !11, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !11, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"_ZTS13native_rule_t", !6, i64 0, !6, i64 8, !11, i64 16}
!14 = !{!11, !11, i64 0}
!15 = !{!13, !6, i64 8}
!16 = !{!13, !11, i64 16}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass