; LLVM IR from berquist/rchem :: libpyquante2 (cints)

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

@.str.1 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__.gcf = external hidden unnamed_addr constant [45 x i8], align 1

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: nounwind
declare double @exp(double noundef) #2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

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

; Function Attrs: nounwind uwtable
define dso_local void @gcf(ptr noundef %0, double noundef %1, double noundef %2, ptr noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store double %1, ptr %6, align 8, !tbaa !9
  store double %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #5
  %16 = load double, ptr %6, align 8, !tbaa !9
  %17 = call double @lgamma(double noundef %16) #5
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  store double %17, ptr %18, align 8, !tbaa !9
  %19 = load double, ptr %7, align 8, !tbaa !9
  %20 = fadd double %19, 1.000000e+00
  %21 = load double, ptr %6, align 8, !tbaa !9
  %22 = fsub double %20, %21
  store double %22, ptr %11, align 8, !tbaa !9
  store double 0x46293E5939A08CE9, ptr %12, align 8, !tbaa !9
  %23 = load double, ptr %11, align 8, !tbaa !9
  %24 = fdiv double 1.000000e+00, %23
  store double %24, ptr %13, align 8, !tbaa !9
  %25 = load double, ptr %13, align 8, !tbaa !9
  store double %25, ptr %15, align 8, !tbaa !9
  store i32 1, ptr %9, align 4, !tbaa !11
  br label %26

26:                                               ; preds = %73, %4
  %27 = load i32, ptr %9, align 4, !tbaa !11
  %28 = icmp sle i32 %27, 100
  br i1 %28, label %29, label %76

29:                                               ; preds = %26
  %30 = load i32, ptr %9, align 4, !tbaa !11
  %31 = sub nsw i32 0, %30
  %32 = sitofp i32 %31 to double
  %33 = load i32, ptr %9, align 4, !tbaa !11
  %34 = sitofp i32 %33 to double
  %35 = load double, ptr %6, align 8, !tbaa !9
  %36 = fsub double %34, %35
  %37 = fmul double %32, %36
  store double %37, ptr %10, align 8, !tbaa !9
  %38 = load double, ptr %11, align 8, !tbaa !9
  %39 = fadd double %38, 2.000000e+00
  store double %39, ptr %11, align 8, !tbaa !9
  %40 = load double, ptr %10, align 8, !tbaa !9
  %41 = load double, ptr %13, align 8, !tbaa !9
  %42 = load double, ptr %11, align 8, !tbaa !9
  %43 = call double @llvm.fmuladd.f64(double %40, double %41, double %42)
  store double %43, ptr %13, align 8, !tbaa !9
  %44 = load double, ptr %13, align 8, !tbaa !9
  %45 = call double @llvm.fabs.f64(double %44)
  %46 = fcmp olt double %45, 1.000000e-30
  br i1 %46, label %47, label %48

47:                                               ; preds = %29
  store double 1.000000e-30, ptr %13, align 8, !tbaa !9
  br label %48

48:                                               ; preds = %47, %29
  %49 = load double, ptr %11, align 8, !tbaa !9
  %50 = load double, ptr %10, align 8, !tbaa !9
  %51 = load double, ptr %12, align 8, !tbaa !9
  %52 = fdiv double %50, %51
  %53 = fadd double %49, %52
  store double %53, ptr %12, align 8, !tbaa !9
  %54 = load double, ptr %12, align 8, !tbaa !9
  %55 = call double @llvm.fabs.f64(double %54)
  %56 = fcmp olt double %55, 1.000000e-30
  br i1 %56, label %57, label %58

57:                                               ; preds = %48
  store double 1.000000e-30, ptr %12, align 8, !tbaa !9
  br label %58

58:                                               ; preds = %57, %48
  %59 = load double, ptr %13, align 8, !tbaa !9
  %60 = fdiv double 1.000000e+00, %59
  store double %60, ptr %13, align 8, !tbaa !9
  %61 = load double, ptr %13, align 8, !tbaa !9
  %62 = load double, ptr %12, align 8, !tbaa !9
  %63 = fmul double %61, %62
  store double %63, ptr %14, align 8, !tbaa !9
  %64 = load double, ptr %14, align 8, !tbaa !9
  %65 = load double, ptr %15, align 8, !tbaa !9
  %66 = fmul double %65, %64
  store double %66, ptr %15, align 8, !tbaa !9
  %67 = load double, ptr %14, align 8, !tbaa !9
  %68 = fsub double %67, 1.000000e+00
  %69 = call double @llvm.fabs.f64(double %68)
  %70 = fcmp olt double %69, 3.000000e-07
  br i1 %70, label %71, label %72

71:                                               ; preds = %58
  br label %76

72:                                               ; preds = %58
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %9, align 4, !tbaa !11
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !11
  br label %26, !llvm.loop !13

76:                                               ; preds = %71, %26
  %77 = load i32, ptr %9, align 4, !tbaa !11
  %78 = icmp sle i32 %77, 100
  br i1 %78, label %79, label %80

79:                                               ; preds = %76
  br label %81

80:                                               ; preds = %76
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 371, ptr noundef @__PRETTY_FUNCTION__.gcf) #6
  unreachable

81:                                               ; preds = %79
  %82 = load double, ptr %7, align 8, !tbaa !9
  %83 = fneg double %82
  %84 = load double, ptr %6, align 8, !tbaa !9
  %85 = load double, ptr %7, align 8, !tbaa !9
  %86 = call double @log(double noundef %85) #5
  %87 = call double @llvm.fmuladd.f64(double %84, double %86, double %83)
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  %89 = load double, ptr %88, align 8, !tbaa !9
  %90 = fsub double %87, %89
  %91 = call double @exp(double noundef %90) #5
  %92 = load double, ptr %15, align 8, !tbaa !9
  %93 = fmul double %91, %92
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  store double %93, ptr %94, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  ret void
}

; Function Attrs: nounwind
declare double @lgamma(double noundef) #2

; Function Attrs: nounwind
declare double @log(double noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #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 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 #5 = { nounwind }
attributes #6 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; 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.1 = external hidden unnamed_addr constant [69 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [9 x i8], align 1
@__PRETTY_FUNCTION__.gcf = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #0

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @exp(double noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @gcf(ptr nocapture noundef writeonly %0, double noundef %1, double noundef %2, ptr nocapture noundef %3) local_unnamed_addr #3 {
  %5 = tail call double @lgamma(double noundef %1) #6
  store double %5, ptr %3, align 8, !tbaa !5
  %6 = fadd double %2, 1.000000e+00
  %7 = fsub double %6, %1
  %8 = fdiv double 1.000000e+00, %7
  br label %11

9:                                                ; preds = %11
  %10 = add nuw nsw i32 %.03243, 1
  %exitcond.not = icmp eq i32 %10, 101
  br i1 %exitcond.not, label %35, label %11, !llvm.loop !9

11:                                               ; preds = %4, %9
  %.044 = phi double [ %8, %4 ], [ %31, %9 ]
  %.03243 = phi i32 [ 1, %4 ], [ %10, %9 ]
  %.03342 = phi double [ %8, %4 ], [ %28, %9 ]
  %.03541 = phi double [ 0x46293E5939A08CE9, %4 ], [ %29, %9 ]
  %.03740 = phi double [ %7, %4 ], [ %17, %9 ]
  %12 = sub nsw i32 0, %.03243
  %13 = sitofp i32 %12 to double
  %14 = uitofp nneg i32 %.03243 to double
  %15 = fsub double %14, %1
  %16 = fmul double %15, %13
  %17 = fadd double %.03740, 2.000000e+00
  %18 = tail call double @llvm.fmuladd.f64(double %16, double %.03342, double %17)
  %19 = fdiv double 1.000000e+00, %18
  %20 = fdiv double %16, %.03541
  %21 = fadd double %17, %20
  %22 = insertelement <2 x double> poison, double %18, i64 0
  %23 = insertelement <2 x double> %22, double %21, i64 1
  %24 = tail call <2 x double> @llvm.fabs.v2f64(<2 x double> %23)
  %25 = fcmp olt <2 x double> %24, <double 1.000000e-30, double 1.000000e-30>
  %26 = insertelement <2 x double> %23, double %19, i64 0
  %27 = select <2 x i1> %25, <2 x double> <double 0x46293E5939A08CE9, double 1.000000e-30>, <2 x double> %26
  %28 = extractelement <2 x double> %27, i64 0
  %29 = extractelement <2 x double> %27, i64 1
  %30 = fmul double %28, %29
  %31 = fmul double %.044, %30
  %32 = fadd double %30, -1.000000e+00
  %33 = tail call double @llvm.fabs.f64(double %32)
  %34 = fcmp olt double %33, 3.000000e-07
  br i1 %34, label %36, label %9

35:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 371, ptr noundef nonnull @__PRETTY_FUNCTION__.gcf) #7
  unreachable

36:                                               ; preds = %11
  %37 = fneg double %2
  %38 = tail call double @log(double noundef %2) #6
  %39 = tail call double @llvm.fmuladd.f64(double %1, double %38, double %37)
  %40 = load double, ptr %3, align 8, !tbaa !5
  %41 = fsub double %39, %40
  %42 = tail call double @exp(double noundef %41) #6
  %43 = fmul double %31, %42
  store double %43, ptr %0, align 8, !tbaa !5
  ret void
}

; Function Attrs: nounwind
declare double @lgamma(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @log(double noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fabs.v2f64(<2 x double>) #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree nounwind willreturn memory(write) "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 = { 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 #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass