; LLVM IR from sp-nitech/SPTK :: third_party/WORLD/fft_world.ll (ZN4sptk5world15fft_plan_dft_1dEiPA2_dS2_ij)

; 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.sptk::world::fft_plan" = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk5world15fft_plan_dft_1dEiPA2_dS2_ij(ptr dead_on_unwind noalias writable sret(%"struct.sptk::world::fft_plan") align 8 %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store i32 %1, ptr %7, align 4, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !5
  store i32 %5, ptr %11, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 8 %0, i8 0, i64 72, i1 false)
  %12 = load i32, ptr %7, align 4, !tbaa !5
  %13 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 0
  store i32 %12, ptr %13, align 8, !tbaa !11
  %14 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 4
  store ptr null, ptr %14, align 8, !tbaa !13
  %15 = load ptr, ptr %8, align 8, !tbaa !9
  %16 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 3
  store ptr %15, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 6
  store ptr null, ptr %17, align 8, !tbaa !15
  %18 = load ptr, ptr %9, align 8, !tbaa !9
  %19 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 5
  store ptr %18, ptr %19, align 8, !tbaa !16
  %20 = load i32, ptr %10, align 4, !tbaa !5
  %21 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 1
  store i32 %20, ptr %21, align 4, !tbaa !17
  %22 = load i32, ptr %11, align 4, !tbaa !5
  %23 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 2
  store i32 %22, ptr %23, align 8, !tbaa !18
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = mul nsw i32 %24, 2
  %26 = sext i32 %25 to i64
  %27 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %26, i64 8)
  %28 = extractvalue { i64, i1 } %27, 1
  %29 = extractvalue { i64, i1 } %27, 0
  %30 = select i1 %28, i64 -1, i64 %29
  %31 = call noalias noundef nonnull ptr @_Znam(i64 noundef %30) #4
  %32 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 7
  store ptr %31, ptr %32, align 8, !tbaa !19
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %34, i64 4)
  %36 = extractvalue { i64, i1 } %35, 1
  %37 = extractvalue { i64, i1 } %35, 0
  %38 = select i1 %36, i64 -1, i64 %37
  %39 = call noalias noundef nonnull ptr @_Znam(i64 noundef %38) #4
  %40 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 8
  store ptr %39, ptr %40, align 8, !tbaa !20
  %41 = load i32, ptr %7, align 4, !tbaa !5
  %42 = mul nsw i32 %41, 5
  %43 = sdiv i32 %42, 4
  %44 = sext i32 %43 to i64
  %45 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %44, i64 8)
  %46 = extractvalue { i64, i1 } %45, 1
  %47 = extractvalue { i64, i1 } %45, 0
  %48 = select i1 %46, i64 -1, i64 %47
  %49 = call noalias noundef nonnull ptr @_Znam(i64 noundef %48) #4
  %50 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 9
  store ptr %49, ptr %50, align 8, !tbaa !21
  %51 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 8
  %52 = load ptr, ptr %51, align 8, !tbaa !20
  %53 = getelementptr inbounds i32, ptr %52, i64 0
  store i32 0, ptr %53, align 4, !tbaa !5
  %54 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !11
  %56 = ashr i32 %55, 1
  %57 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 8
  %58 = load ptr, ptr %57, align 8, !tbaa !20
  %59 = getelementptr inbounds %"struct.sptk::world::fft_plan", ptr %0, i32 0, i32 9
  %60 = load ptr, ptr %59, align 8, !tbaa !21
  call void @_ZN4sptk5world6makewtEiPiPd(i32 noundef %56, ptr noundef %58, ptr noundef %60)
  ret void
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #2

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4sptk5world6makewtEiPiPd(i32 noundef, ptr noundef, ptr noundef) #0

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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nobuiltin 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 #4 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTSN4sptk5world8fft_planE", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!13 = !{!12, !10, i64 24}
!14 = !{!12, !10, i64 16}
!15 = !{!12, !10, i64 40}
!16 = !{!12, !10, i64 32}
!17 = !{!12, !6, i64 4}
!18 = !{!12, !6, i64 8}
!19 = !{!12, !10, i64 48}
!20 = !{!12, !10, i64 56}
!21 = !{!12, !10, i64 64}


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

%"struct.sptk::world::fft_plan" = type { i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN4sptk5world15fft_plan_dft_1dEiPA2_dS2_ij(ptr dead_on_unwind noalias nocapture writable writeonly sret(%"struct.sptk::world::fft_plan") align 8 %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, i32 noundef %4, i32 noundef %5) local_unnamed_addr #0 {
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 0, ptr %7, align 8
  store i32 %1, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr null, ptr %8, align 8, !tbaa !11
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %2, ptr %9, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %0, i64 40
  store ptr null, ptr %10, align 8, !tbaa !13
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  store ptr %3, ptr %11, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 %4, ptr %12, align 4, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  store i32 %5, ptr %13, align 8, !tbaa !16
  %14 = shl nsw i32 %1, 1
  %15 = sext i32 %14 to i64
  %16 = icmp slt i32 %1, 0
  %17 = shl nsw i64 %15, 3
  %18 = select i1 %16, i64 -1, i64 %17
  %19 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %18) #2
  %20 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %19, ptr %20, align 8, !tbaa !17
  %21 = zext nneg i32 %1 to i64
  %22 = shl nuw nsw i64 %21, 2
  %23 = select i1 %16, i64 -1, i64 %22
  %24 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %23) #2
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %24, ptr %25, align 8, !tbaa !18
  %26 = mul nsw i32 %1, 5
  %27 = sdiv i32 %26, 4
  %28 = sext i32 %27 to i64
  %29 = shl nsw i64 %28, 3
  %30 = select i1 %16, i64 -1, i64 %29
  %31 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %30) #2
  %32 = getelementptr inbounds i8, ptr %0, i64 64
  store ptr %31, ptr %32, align 8, !tbaa !19
  store i32 0, ptr %24, align 4, !tbaa !20
  %33 = ashr i32 %1, 1
  tail call void @_ZN4sptk5world6makewtEiPiPd(i32 noundef %33, ptr noundef nonnull %24, ptr noundef nonnull %31)
  ret void
}

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4sptk5world6makewtEiPiPd(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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 = { nobuiltin 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 #2 = { builtin 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 = !{!"_ZTSN4sptk5world8fft_planE", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !10, i64 24}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !10, i64 40}
!14 = !{!6, !10, i64 32}
!15 = !{!6, !7, i64 4}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !10, i64 48}
!18 = !{!6, !10, i64 56}
!19 = !{!6, !10, i64 64}
!20 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass