; LLVM IR from CLASS-SZ/class_sz :: class-sz/source (nonlinear)

; 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.nonlinear = type { i32, i32, i32, double, double, double, i16, i32, i32, i32, ptr, i16, i16, i32, i32, i32, i32, i32, i16, i32, ptr, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr, ptr, ptr, i16, [2048 x i8] }

@.str.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [98 x i8], align 1
@__func__.nonlinear_pk_tilt_at_k_and_z = external hidden unnamed_addr constant [29 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [98 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

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) #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 @log(double noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @nonlinear_pk_at_k_and_z(ptr noundef, ptr noundef, ptr noundef, i32 noundef, double noundef, double noundef, i32 noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local i32 @nonlinear_pk_tilt_at_k_and_z(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, double noundef %4, double noundef %5, i32 noundef %6, ptr noundef %7) #3 {
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca double, align 8
  %19 = alloca double, align 8
  %20 = alloca double, align 8
  %21 = alloca [2048 x i8], align 16
  %22 = alloca i32, align 4
  %23 = alloca [2048 x i8], align 16
  store ptr %0, ptr %10, align 8, !tbaa !5
  store ptr %1, ptr %11, align 8, !tbaa !5
  store ptr %2, ptr %12, align 8, !tbaa !5
  store i32 %3, ptr %13, align 4, !tbaa !9
  store double %4, ptr %14, align 8, !tbaa !11
  store double %5, ptr %15, align 8, !tbaa !11
  store i32 %6, ptr %16, align 4, !tbaa !9
  store ptr %7, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %24 = load ptr, ptr %12, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.nonlinear, ptr %24, i32 0, i32 21
  %26 = load ptr, ptr %25, align 8, !tbaa !13
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.nonlinear, ptr %27, i32 0, i32 19
  %29 = load i32, ptr %28, align 4, !tbaa !16
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds double, ptr %26, i64 %31
  %33 = load double, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.nonlinear, ptr %34, i32 0, i32 21
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nonlinear, ptr %37, i32 0, i32 19
  %39 = load i32, ptr %38, align 4, !tbaa !16
  %40 = sub nsw i32 %39, 2
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds double, ptr %36, i64 %41
  %43 = load double, ptr %42, align 8, !tbaa !11
  %44 = fsub double %33, %43
  store double %44, ptr %18, align 8, !tbaa !11
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = load ptr, ptr %11, align 8, !tbaa !5
  %47 = load ptr, ptr %12, align 8, !tbaa !5
  %48 = load i32, ptr %13, align 4, !tbaa !9
  %49 = load double, ptr %14, align 8, !tbaa !11
  %50 = load double, ptr %18, align 8, !tbaa !11
  %51 = fadd double 1.000000e+00, %50
  %52 = fdiv double %49, %51
  %53 = load double, ptr %15, align 8, !tbaa !11
  %54 = load i32, ptr %16, align 4, !tbaa !9
  %55 = call i32 @nonlinear_pk_at_k_and_z(ptr noundef %45, ptr noundef %46, ptr noundef %47, i32 noundef %48, double noundef %52, double noundef %53, i32 noundef %54, ptr noundef %19, ptr noundef null)
  %56 = icmp eq i32 %55, 1
  br i1 %56, label %57, label %66

57:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 2048, ptr %21) #4
  %58 = getelementptr inbounds [2048 x i8], ptr %21, i64 0, i64 0
  %59 = load ptr, ptr %12, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.nonlinear, ptr %59, i32 0, i32 45
  %61 = getelementptr inbounds [2048 x i8], ptr %60, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %58, ptr noundef @.str.4, ptr noundef @.str.41, ptr noundef %61)
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.nonlinear, ptr %62, i32 0, i32 45
  %64 = getelementptr inbounds [2048 x i8], ptr %63, i64 0, i64 0
  %65 = getelementptr inbounds [2048 x i8], ptr %21, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %64, ptr noundef @.str.3, ptr noundef @__func__.nonlinear_pk_tilt_at_k_and_z, i32 noundef 995, ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %21) #4
  store i32 1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %100

66:                                               ; preds = %8
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = load double, ptr %14, align 8, !tbaa !11
  %72 = load double, ptr %18, align 8, !tbaa !11
  %73 = fadd double 1.000000e+00, %72
  %74 = fmul double %71, %73
  %75 = load double, ptr %15, align 8, !tbaa !11
  %76 = load i32, ptr %16, align 4, !tbaa !9
  %77 = call i32 @nonlinear_pk_at_k_and_z(ptr noundef %67, ptr noundef %68, ptr noundef %69, i32 noundef %70, double noundef %74, double noundef %75, i32 noundef %76, ptr noundef %20, ptr noundef null)
  %78 = icmp eq i32 %77, 1
  br i1 %78, label %79, label %88

79:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 2048, ptr %23) #4
  %80 = getelementptr inbounds [2048 x i8], ptr %23, i64 0, i64 0
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.nonlinear, ptr %81, i32 0, i32 45
  %83 = getelementptr inbounds [2048 x i8], ptr %82, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %80, ptr noundef @.str.4, ptr noundef @.str.42, ptr noundef %83)
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.nonlinear, ptr %84, i32 0, i32 45
  %86 = getelementptr inbounds [2048 x i8], ptr %85, i64 0, i64 0
  %87 = getelementptr inbounds [2048 x i8], ptr %23, i64 0, i64 0
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef %86, ptr noundef @.str.3, ptr noundef @__func__.nonlinear_pk_tilt_at_k_and_z, i32 noundef 1007, ptr noundef %87)
  call void @llvm.lifetime.end.p0(i64 2048, ptr %23) #4
  store i32 1, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %100

88:                                               ; preds = %66
  %89 = load double, ptr %20, align 8, !tbaa !11
  %90 = call double @log(double noundef %89) #4
  %91 = load double, ptr %19, align 8, !tbaa !11
  %92 = call double @log(double noundef %91) #4
  %93 = fsub double %90, %92
  %94 = load double, ptr %18, align 8, !tbaa !11
  %95 = fadd double 1.000000e+00, %94
  %96 = call double @log(double noundef %95) #4
  %97 = fmul double 2.000000e+00, %96
  %98 = fdiv double %93, %97
  %99 = load ptr, ptr %17, align 8, !tbaa !5
  store double %98, ptr %99, align 8, !tbaa !11
  store i32 0, ptr %9, align 4
  store i32 1, ptr %22, align 4
  br label %100

100:                                              ; preds = %88, %79, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  %101 = load i32, ptr %9, align 4
  ret i32 %101
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !6, i64 104}
!14 = !{!"nonlinear", !10, i64 0, !10, i64 4, !10, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !15, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !6, i64 56, !15, i64 64, !15, i64 66, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !15, i64 88, !10, i64 92, !6, i64 96, !6, i64 104, !6, i64 112, !10, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !10, i64 184, !10, i64 188, !6, i64 192, !6, i64 200, !6, i64 208, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !6, i64 240, !6, i64 248, !6, i64 256, !15, i64 264, !7, i64 266}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !10, i64 92}


; 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.3 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [98 x i8], align 1
@__func__.nonlinear_pk_tilt_at_k_and_z = external hidden unnamed_addr constant [29 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [98 x i8], align 1

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

declare void @class_protect_sprintf(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @nonlinear_pk_at_k_and_z(ptr noundef, ptr noundef, ptr noundef, i32 noundef, double noundef, double noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nonlinear_pk_tilt_at_k_and_z(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, double noundef %4, double noundef %5, i32 noundef %6, ptr nocapture noundef writeonly %7) local_unnamed_addr #3 {
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca [2048 x i8], align 16
  %12 = alloca [2048 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  %13 = getelementptr inbounds i8, ptr %2, i64 104
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %2, i64 92
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = sext i32 %16 to i64
  %18 = getelementptr double, ptr %14, i64 %17
  %19 = getelementptr i8, ptr %18, i64 -8
  %20 = load double, ptr %19, align 8, !tbaa !14
  %21 = getelementptr i8, ptr %18, i64 -16
  %22 = load double, ptr %21, align 8, !tbaa !14
  %23 = fsub double %20, %22
  %24 = fadd double %23, 1.000000e+00
  %25 = fdiv double %4, %24
  %26 = call i32 @nonlinear_pk_at_k_and_z(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, double noundef %25, double noundef %5, i32 noundef %6, ptr noundef nonnull %9, ptr noundef null)
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %30

28:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %11) #4
  %29 = getelementptr inbounds i8, ptr %2, i64 266
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %11, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.41, ptr noundef nonnull %29) #4
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %29, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.nonlinear_pk_tilt_at_k_and_z, i32 noundef 995, ptr noundef nonnull %11) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %11) #4
  br label %45

30:                                               ; preds = %8
  %31 = fmul double %24, %4
  %32 = call i32 @nonlinear_pk_at_k_and_z(ptr noundef %0, ptr noundef %1, ptr noundef nonnull %2, i32 noundef %3, double noundef %31, double noundef %5, i32 noundef %6, ptr noundef nonnull %10, ptr noundef null)
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %34, label %36

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %12) #4
  %35 = getelementptr inbounds i8, ptr %2, i64 266
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %12, ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.42, ptr noundef nonnull %35) #4
  call void (ptr, ptr, ...) @class_protect_sprintf(ptr noundef nonnull %35, ptr noundef nonnull @.str.3, ptr noundef nonnull @__func__.nonlinear_pk_tilt_at_k_and_z, i32 noundef 1007, ptr noundef nonnull %12) #4
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %12) #4
  br label %45

36:                                               ; preds = %30
  %37 = load double, ptr %10, align 8, !tbaa !14
  %38 = call double @log(double noundef %37) #4
  %39 = load double, ptr %9, align 8, !tbaa !14
  %40 = call double @log(double noundef %39) #4
  %41 = fsub double %38, %40
  %42 = call double @log(double noundef %24) #4
  %43 = fmul double %42, 2.000000e+00
  %44 = fdiv double %41, %43
  store double %44, ptr %7, align 8, !tbaa !14
  br label %45

45:                                               ; preds = %36, %34, %28
  %.0 = phi i32 [ 1, %28 ], [ 1, %34 ], [ 0, %36 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 #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 }

!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, !12, i64 104}
!6 = !{!"nonlinear", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !12, i64 56, !11, i64 64, !11, i64 66, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !11, i64 88, !7, i64 92, !12, i64 96, !12, i64 104, !12, i64 112, !7, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !12, i64 176, !7, i64 184, !7, i64 188, !12, i64 192, !12, i64 200, !12, i64 208, !7, i64 216, !7, i64 220, !7, i64 224, !7, i64 228, !7, i64 232, !12, i64 240, !12, i64 248, !12, i64 256, !11, i64 264, !8, i64 266}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 92}
!14 = !{!10, !10, i64 0}


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