; LLVM IR from CLASS-SZ/class_sz :: class-sz/hyrec (hyrectools)

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

@stderr = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [69 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local double @rec_interp1d(double noundef %0, double noundef %1, ptr noundef %2, i32 noundef %3, double noundef %4) #4 {
  %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 i64, align 8
  %12 = alloca double, align 8
  store double %0, ptr %6, align 8, !tbaa !5
  store double %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !11
  store double %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %13 = load double, ptr %7, align 8, !tbaa !5
  %14 = fcmp ogt double %13, 0.000000e+00
  br i1 %14, label %15, label %31

15:                                               ; preds = %5
  %16 = load double, ptr %10, align 8, !tbaa !5
  %17 = load double, ptr %6, align 8, !tbaa !5
  %18 = fcmp olt double %16, %17
  br i1 %18, label %28, label %19

19:                                               ; preds = %15
  %20 = load double, ptr %10, align 8, !tbaa !5
  %21 = load double, ptr %6, align 8, !tbaa !5
  %22 = load double, ptr %7, align 8, !tbaa !5
  %23 = load i32, ptr %9, align 4, !tbaa !11
  %24 = sub i32 %23, 1
  %25 = uitofp i32 %24 to double
  %26 = call double @llvm.fmuladd.f64(double %22, double %25, double %21)
  %27 = fcmp ogt double %20, %26
  br i1 %27, label %28, label %31

28:                                               ; preds = %19, %15
  %29 = load ptr, ptr @stderr, align 8, !tbaa !9
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef @.str.3) #5
  call void @exit(i32 noundef 1) #6
  unreachable

31:                                               ; preds = %19, %5
  %32 = load double, ptr %7, align 8, !tbaa !5
  %33 = fcmp olt double %32, 0.000000e+00
  br i1 %33, label %34, label %50

34:                                               ; preds = %31
  %35 = load double, ptr %10, align 8, !tbaa !5
  %36 = load double, ptr %6, align 8, !tbaa !5
  %37 = fcmp ogt double %35, %36
  br i1 %37, label %47, label %38

38:                                               ; preds = %34
  %39 = load double, ptr %10, align 8, !tbaa !5
  %40 = load double, ptr %6, align 8, !tbaa !5
  %41 = load double, ptr %7, align 8, !tbaa !5
  %42 = load i32, ptr %9, align 4, !tbaa !11
  %43 = sub i32 %42, 1
  %44 = uitofp i32 %43 to double
  %45 = call double @llvm.fmuladd.f64(double %41, double %44, double %40)
  %46 = fcmp olt double %39, %45
  br i1 %46, label %47, label %50

47:                                               ; preds = %38, %34
  %48 = load ptr, ptr @stderr, align 8, !tbaa !9
  %49 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %48, ptr noundef @.str.3) #5
  call void @exit(i32 noundef 1) #6
  unreachable

50:                                               ; preds = %38, %31
  %51 = load double, ptr %10, align 8, !tbaa !5
  %52 = load double, ptr %6, align 8, !tbaa !5
  %53 = fsub double %51, %52
  %54 = load double, ptr %7, align 8, !tbaa !5
  %55 = fdiv double %53, %54
  %56 = call double @llvm.floor.f64(double %55)
  %57 = fptosi double %56 to i64
  store i64 %57, ptr %11, align 8, !tbaa !13
  %58 = load i64, ptr %11, align 8, !tbaa !13
  %59 = icmp slt i64 %58, 1
  br i1 %59, label %60, label %61

60:                                               ; preds = %50
  store i64 1, ptr %11, align 8, !tbaa !13
  br label %61

61:                                               ; preds = %60, %50
  %62 = load i64, ptr %11, align 8, !tbaa !13
  %63 = load i32, ptr %9, align 4, !tbaa !11
  %64 = sub i32 %63, 3
  %65 = zext i32 %64 to i64
  %66 = icmp sgt i64 %62, %65
  br i1 %66, label %67, label %71

67:                                               ; preds = %61
  %68 = load i32, ptr %9, align 4, !tbaa !11
  %69 = sub i32 %68, 3
  %70 = zext i32 %69 to i64
  store i64 %70, ptr %11, align 8, !tbaa !13
  br label %71

71:                                               ; preds = %67, %61
  %72 = load double, ptr %10, align 8, !tbaa !5
  %73 = load double, ptr %6, align 8, !tbaa !5
  %74 = fsub double %72, %73
  %75 = load double, ptr %7, align 8, !tbaa !5
  %76 = fdiv double %74, %75
  %77 = load i64, ptr %11, align 8, !tbaa !13
  %78 = sitofp i64 %77 to double
  %79 = fsub double %76, %78
  store double %79, ptr %12, align 8, !tbaa !5
  %80 = load i64, ptr %11, align 8, !tbaa !13
  %81 = sub nsw i64 %80, 1
  %82 = load ptr, ptr %8, align 8, !tbaa !9
  %83 = getelementptr inbounds double, ptr %82, i64 %81
  store ptr %83, ptr %8, align 8, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !9
  %85 = getelementptr inbounds double, ptr %84, i64 0
  %86 = load double, ptr %85, align 8, !tbaa !5
  %87 = fneg double %86
  %88 = load double, ptr %12, align 8, !tbaa !5
  %89 = fmul double %87, %88
  %90 = load double, ptr %12, align 8, !tbaa !5
  %91 = fsub double 1.000000e+00, %90
  %92 = fmul double %89, %91
  %93 = load double, ptr %12, align 8, !tbaa !5
  %94 = fsub double 2.000000e+00, %93
  %95 = fmul double %92, %94
  %96 = fdiv double %95, 6.000000e+00
  %97 = load ptr, ptr %8, align 8, !tbaa !9
  %98 = getelementptr inbounds double, ptr %97, i64 1
  %99 = load double, ptr %98, align 8, !tbaa !5
  %100 = load double, ptr %12, align 8, !tbaa !5
  %101 = fadd double 1.000000e+00, %100
  %102 = fmul double %99, %101
  %103 = load double, ptr %12, align 8, !tbaa !5
  %104 = fsub double 1.000000e+00, %103
  %105 = fmul double %102, %104
  %106 = load double, ptr %12, align 8, !tbaa !5
  %107 = fsub double 2.000000e+00, %106
  %108 = fmul double %105, %107
  %109 = fdiv double %108, 2.000000e+00
  %110 = fadd double %96, %109
  %111 = load ptr, ptr %8, align 8, !tbaa !9
  %112 = getelementptr inbounds double, ptr %111, i64 2
  %113 = load double, ptr %112, align 8, !tbaa !5
  %114 = load double, ptr %12, align 8, !tbaa !5
  %115 = fadd double 1.000000e+00, %114
  %116 = fmul double %113, %115
  %117 = load double, ptr %12, align 8, !tbaa !5
  %118 = fmul double %116, %117
  %119 = load double, ptr %12, align 8, !tbaa !5
  %120 = fsub double 2.000000e+00, %119
  %121 = fmul double %118, %120
  %122 = fdiv double %121, 2.000000e+00
  %123 = fadd double %110, %122
  %124 = load ptr, ptr %8, align 8, !tbaa !9
  %125 = getelementptr inbounds double, ptr %124, i64 3
  %126 = load double, ptr %125, align 8, !tbaa !5
  %127 = load double, ptr %12, align 8, !tbaa !5
  %128 = fadd double 1.000000e+00, %127
  %129 = fmul double %126, %128
  %130 = load double, ptr %12, align 8, !tbaa !5
  %131 = fmul double %129, %130
  %132 = load double, ptr %12, align 8, !tbaa !5
  %133 = fsub double %132, 1.000000e+00
  %134 = fmul double %131, %133
  %135 = fdiv double %134, 6.000000e+00
  %136 = fadd double %123, %135
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  ret double %136
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [69 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local double @rec_interp1d(double noundef %0, double noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, double noundef %4) local_unnamed_addr #3 {
  %6 = fcmp ogt double %1, 0.000000e+00
  br i1 %6, label %7, label %17

7:                                                ; preds = %5
  %8 = fcmp olt double %4, %0
  br i1 %8, label %14, label %9

9:                                                ; preds = %7
  %10 = add i32 %3, -1
  %11 = uitofp i32 %10 to double
  %12 = tail call double @llvm.fmuladd.f64(double %1, double %11, double %0)
  %13 = fcmp olt double %12, %4
  br i1 %13, label %14, label %17

14:                                               ; preds = %9, %7
  %15 = load ptr, ptr @stderr, align 8, !tbaa !5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.3) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

17:                                               ; preds = %9, %5
  %18 = fcmp olt double %1, 0.000000e+00
  br i1 %18, label %19, label %29

19:                                               ; preds = %17
  %20 = fcmp ogt double %4, %0
  br i1 %20, label %26, label %21

21:                                               ; preds = %19
  %22 = add i32 %3, -1
  %23 = uitofp i32 %22 to double
  %24 = tail call double @llvm.fmuladd.f64(double %1, double %23, double %0)
  %25 = fcmp ogt double %24, %4
  br i1 %25, label %26, label %29

26:                                               ; preds = %21, %19
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.3) #5
  tail call void @exit(i32 noundef 1) #6
  unreachable

29:                                               ; preds = %21, %17
  %30 = fsub double %4, %0
  %31 = fdiv double %30, %1
  %32 = tail call double @llvm.floor.f64(double %31)
  %33 = fptosi double %32 to i64
  %spec.store.select = tail call i64 @llvm.smax.i64(i64 %33, i64 1)
  %34 = add i32 %3, -3
  %35 = zext i32 %34 to i64
  %spec.select = tail call i64 @llvm.umin.i64(i64 %spec.store.select, i64 %35)
  %36 = uitofp nneg i64 %spec.select to double
  %37 = fsub double %31, %36
  %38 = getelementptr double, ptr %2, i64 %spec.select
  %39 = getelementptr i8, ptr %38, i64 -8
  %40 = load double, ptr %39, align 8, !tbaa !9
  %41 = fneg double %40
  %42 = fmul double %37, %41
  %43 = fsub double 1.000000e+00, %37
  %44 = fmul double %43, %42
  %45 = fsub double 2.000000e+00, %37
  %46 = fmul double %45, %44
  %47 = fdiv double %46, 6.000000e+00
  %48 = load double, ptr %38, align 8, !tbaa !9
  %49 = fadd double %37, 1.000000e+00
  %50 = fmul double %49, %48
  %51 = fmul double %43, %50
  %52 = fmul double %45, %51
  %53 = fmul double %52, 5.000000e-01
  %54 = fadd double %47, %53
  %55 = getelementptr i8, ptr %38, i64 8
  %56 = load double, ptr %55, align 8, !tbaa !9
  %57 = fmul double %49, %56
  %58 = fmul double %37, %57
  %59 = fmul double %45, %58
  %60 = fmul double %59, 5.000000e-01
  %61 = fadd double %54, %60
  %62 = getelementptr i8, ptr %38, i64 16
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = fmul double %49, %63
  %65 = fmul double %37, %64
  %66 = fadd double %37, -1.000000e+00
  %67 = fmul double %66, %65
  %68 = fdiv double %67, 6.000000e+00
  %69 = fadd double %61, %68
  ret double %69
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #4

attributes #0 = { nofree 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { cold 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}


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