; LLVM IR from jgaeddert/liquid-dsp :: src/fft/src (spgramcf)

; 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.spwaterfallcf_s = type { i32, i32, ptr, ptr, i32, i32, float, float, i32, i32, ptr }

@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [52 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) #0

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @spwaterfallcf_create(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) #3 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  store i32 %0, ptr %7, align 4, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !5
  %13 = load i32, ptr %7, align 4, !tbaa !5
  %14 = icmp ult i32 %13, 2
  br i1 %14, label %15, label %17

15:                                               ; preds = %5
  %16 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 82, ptr noundef @.str.41, ptr noundef @.str.2)
  store ptr %16, ptr %6, align 8
  br label %88

17:                                               ; preds = %5
  %18 = load i32, ptr %9, align 4, !tbaa !5
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = icmp ugt i32 %18, %19
  br i1 %20, label %21, label %23

21:                                               ; preds = %17
  %22 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 84, ptr noundef @.str.42, ptr noundef @.str.2)
  store ptr %22, ptr %6, align 8
  br label %88

23:                                               ; preds = %17
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %28

26:                                               ; preds = %23
  %27 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 86, ptr noundef @.str.43, ptr noundef @.str.2)
  store ptr %27, ptr %6, align 8
  br label %88

28:                                               ; preds = %23
  %29 = load i32, ptr %8, align 4, !tbaa !5
  %30 = icmp eq i32 %29, 9
  br i1 %30, label %31, label %37

31:                                               ; preds = %28
  %32 = load i32, ptr %9, align 4, !tbaa !5
  %33 = urem i32 %32, 2
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %37

35:                                               ; preds = %31
  %36 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 88, ptr noundef @.str.44, ptr noundef @.str.2)
  store ptr %36, ptr %6, align 8
  br label %88

37:                                               ; preds = %31, %28
  %38 = load i32, ptr %10, align 4, !tbaa !5
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %42

40:                                               ; preds = %37
  %41 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 90, ptr noundef @.str.45, ptr noundef @.str.2)
  store ptr %41, ptr %6, align 8
  br label %88

42:                                               ; preds = %37
  %43 = load i32, ptr %11, align 4, !tbaa !5
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %47

45:                                               ; preds = %42
  %46 = call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef @.str.40, i32 noundef 92, ptr noundef @.str.46, ptr noundef @.str.2)
  store ptr %46, ptr %6, align 8
  br label %88

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %48 = call noalias ptr @malloc(i64 noundef 56) #5
  store ptr %48, ptr %12, align 8, !tbaa !9
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load ptr, ptr %12, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %50, i32 0, i32 0
  store i32 %49, ptr %51, align 8, !tbaa !11
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %53, i32 0, i32 1
  store i32 %52, ptr %54, align 4, !tbaa !14
  %55 = load ptr, ptr %12, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %55, i32 0, i32 6
  store float 0.000000e+00, ptr %56, align 8, !tbaa !15
  %57 = load ptr, ptr %12, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %57, i32 0, i32 7
  store float -1.000000e+00, ptr %58, align 4, !tbaa !16
  %59 = load ptr, ptr %12, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %59, i32 0, i32 8
  store i32 800, ptr %60, align 8, !tbaa !17
  %61 = load ptr, ptr %12, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %61, i32 0, i32 9
  store i32 800, ptr %62, align 4, !tbaa !18
  %63 = load ptr, ptr %12, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %63, i32 0, i32 10
  store ptr null, ptr %64, align 8, !tbaa !19
  %65 = load ptr, ptr %12, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %65, i32 0, i32 0
  %67 = load i32, ptr %66, align 8, !tbaa !11
  %68 = mul i32 2, %67
  %69 = load ptr, ptr %12, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !14
  %72 = mul i32 %68, %71
  %73 = zext i32 %72 to i64
  %74 = mul i64 %73, 4
  %75 = call noalias ptr @malloc(i64 noundef %74) #5
  %76 = load ptr, ptr %12, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %76, i32 0, i32 3
  store ptr %75, ptr %77, align 8, !tbaa !20
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = load i32, ptr %8, align 4, !tbaa !5
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = load i32, ptr %10, align 4, !tbaa !5
  %82 = call ptr @spgramcf_create(i32 noundef %78, i32 noundef %79, i32 noundef %80, i32 noundef %81)
  %83 = load ptr, ptr %12, align 8, !tbaa !9
  %84 = getelementptr inbounds %struct.spwaterfallcf_s, ptr %83, i32 0, i32 2
  store ptr %82, ptr %84, align 8, !tbaa !21
  %85 = load ptr, ptr %12, align 8, !tbaa !9
  %86 = call i32 @spwaterfallcf_reset(ptr noundef %85)
  %87 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %87, ptr %6, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %88

88:                                               ; preds = %47, %45, %40, %35, %26, %21, %15
  %89 = load ptr, ptr %6, align 8
  ret ptr %89
}

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

attributes #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 = { nounwind allocsize(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 #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 }
attributes #5 = { nounwind allocsize(0) }

!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 = !{!"int", !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, !6, i64 0}
!12 = !{!"spwaterfallcf_s", !6, i64 0, !6, i64 4, !10, i64 8, !10, i64 16, !6, i64 24, !6, i64 28, !13, i64 32, !13, i64 36, !6, i64 40, !6, i64 44, !10, i64 48}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 4}
!15 = !{!12, !13, i64 32}
!16 = !{!12, !13, i64 36}
!17 = !{!12, !6, i64 40}
!18 = !{!12, !6, i64 44}
!19 = !{!12, !10, i64 48}
!20 = !{!12, !10, i64 16}
!21 = !{!12, !10, i64 8}


; 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.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [86 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [62 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [52 x i8], align 1

declare ptr @liquid_error_config_fl(ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @spgramcf_create(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local ptr @spwaterfallcf_create(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = icmp ult i32 %0, 2
  br i1 %6, label %7, label %9

7:                                                ; preds = %5
  %8 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 82, ptr noundef nonnull @.str.41, ptr noundef nonnull @.str.2) #3
  br label %46

9:                                                ; preds = %5
  %10 = icmp ugt i32 %2, %0
  br i1 %10, label %11, label %13

11:                                               ; preds = %9
  %12 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 84, ptr noundef nonnull @.str.42, ptr noundef nonnull @.str.2) #3
  br label %46

13:                                               ; preds = %9
  %14 = icmp eq i32 %2, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %13
  %16 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 86, ptr noundef nonnull @.str.43, ptr noundef nonnull @.str.2) #3
  br label %46

17:                                               ; preds = %13
  %18 = icmp ne i32 %1, 9
  %19 = and i32 %2, 1
  %.not = icmp eq i32 %19, 0
  %or.cond = or i1 %18, %.not
  br i1 %or.cond, label %22, label %20

20:                                               ; preds = %17
  %21 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 88, ptr noundef nonnull @.str.44, ptr noundef nonnull @.str.2) #3
  br label %46

22:                                               ; preds = %17
  %23 = icmp eq i32 %3, 0
  br i1 %23, label %24, label %26

24:                                               ; preds = %22
  %25 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 90, ptr noundef nonnull @.str.45, ptr noundef nonnull @.str.2) #3
  br label %46

26:                                               ; preds = %22
  %27 = icmp eq i32 %4, 0
  br i1 %27, label %28, label %30

28:                                               ; preds = %26
  %29 = tail call ptr (ptr, i32, ptr, ...) @liquid_error_config_fl(ptr noundef nonnull @.str.40, i32 noundef 92, ptr noundef nonnull @.str.46, ptr noundef nonnull @.str.2) #3
  br label %46

30:                                               ; preds = %26
  %31 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #4
  store i32 %0, ptr %31, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 4
  store i32 %4, ptr %32, align 4, !tbaa !12
  %33 = getelementptr inbounds i8, ptr %31, i64 32
  store <2 x float> <float 0.000000e+00, float -1.000000e+00>, ptr %33, align 8, !tbaa !13
  %34 = getelementptr inbounds i8, ptr %31, i64 40
  store i32 800, ptr %34, align 8, !tbaa !14
  %35 = getelementptr inbounds i8, ptr %31, i64 44
  store i32 800, ptr %35, align 4, !tbaa !15
  %36 = getelementptr inbounds i8, ptr %31, i64 48
  store ptr null, ptr %36, align 8, !tbaa !16
  %37 = shl i32 %0, 1
  %38 = mul i32 %37, %4
  %39 = zext i32 %38 to i64
  %40 = shl nuw nsw i64 %39, 2
  %41 = tail call noalias ptr @malloc(i64 noundef %40) #4
  %42 = getelementptr inbounds i8, ptr %31, i64 16
  store ptr %41, ptr %42, align 8, !tbaa !17
  %43 = tail call ptr @spgramcf_create(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3)
  %44 = getelementptr inbounds i8, ptr %31, i64 8
  store ptr %43, ptr %44, align 8, !tbaa !18
  %45 = tail call i32 @spwaterfallcf_reset(ptr noundef nonnull %31)
  br label %46

46:                                               ; preds = %30, %28, %24, %20, %15, %11, %7
  %.0 = phi ptr [ %8, %7 ], [ %12, %11 ], [ %16, %15 ], [ %21, %20 ], [ %25, %24 ], [ %29, %28 ], [ %31, %30 ]
  ret ptr %.0
}

; Function Attrs: nounwind uwtable
declare dso_local i32 @spwaterfallcf_reset(ptr noundef) local_unnamed_addr #2

attributes #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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #3 = { nounwind }
attributes #4 = { nounwind allocsize(0) }

!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, !7, i64 0}
!6 = !{!"spwaterfallcf_s", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 16, !7, i64 24, !7, i64 28, !11, i64 32, !11, i64 36, !7, i64 40, !7, i64 44, !10, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!11, !11, i64 0}
!14 = !{!6, !7, i64 40}
!15 = !{!6, !7, i64 44}
!16 = !{!6, !10, i64 48}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !10, i64 8}


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