; LLVM IR from GPUOpen-LibrariesAndSDKs/TAN :: tan/tanlibrary/src/clFFT-master/src/library/generator.transpose/ZN25clfft_t_65a05fcf (cyclesEPmmm)

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

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25clfft_transpose_generator10get_cyclesEPmmm(ptr noundef %0, i64 noundef %1, i64 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %12 = load i64, ptr %5, align 8, !tbaa !9
  %13 = load i64, ptr %6, align 8, !tbaa !9
  %14 = mul i64 %12, %13
  %15 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %14, i64 4)
  %16 = extractvalue { i64, i1 } %15, 1
  %17 = extractvalue { i64, i1 } %15, 0
  %18 = select i1 %16, i64 -1, i64 %17
  %19 = call noalias noundef nonnull ptr @_Znam(i64 noundef %18) #6
  store ptr %19, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds i32, ptr %20, i64 0
  store i32 1, ptr %21, align 4, !tbaa !11
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = load i64, ptr %5, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = mul i64 %23, %24
  %26 = sub i64 %25, 1
  %27 = getelementptr inbounds i32, ptr %22, i64 %26
  store i32 1, ptr %27, align 4, !tbaa !11
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %28

28:                                               ; preds = %41, %3
  %29 = load i32, ptr %8, align 4, !tbaa !11
  %30 = sext i32 %29 to i64
  %31 = load i64, ptr %5, align 8, !tbaa !9
  %32 = load i64, ptr %6, align 8, !tbaa !9
  %33 = mul i64 %31, %32
  %34 = sub i64 %33, 1
  %35 = icmp ult i64 %30, %34
  br i1 %35, label %36, label %44

36:                                               ; preds = %28
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load i32, ptr %8, align 4, !tbaa !11
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %37, i64 %39
  store i32 0, ptr %40, align 4, !tbaa !11
  br label %41

41:                                               ; preds = %36
  %42 = load i32, ptr %8, align 4, !tbaa !11
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %8, align 4, !tbaa !11
  br label %28, !llvm.loop !13

44:                                               ; preds = %28
  store i32 1, ptr %8, align 4, !tbaa !11
  br label %45

45:                                               ; preds = %96, %44
  %46 = load i32, ptr %8, align 4, !tbaa !11
  %47 = sext i32 %46 to i64
  %48 = load i64, ptr %5, align 8, !tbaa !9
  %49 = load i64, ptr %6, align 8, !tbaa !9
  %50 = mul i64 %48, %49
  %51 = sub i64 %50, 1
  %52 = icmp ult i64 %47, %51
  br i1 %52, label %53, label %99

53:                                               ; preds = %45
  %54 = load i32, ptr %8, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  store i64 %55, ptr %11, align 8, !tbaa !9
  br label %56

56:                                               ; preds = %94, %53
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load i64, ptr %11, align 8, !tbaa !9
  %59 = getelementptr inbounds i32, ptr %57, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !11
  %61 = icmp ne i32 %60, 0
  %62 = xor i1 %61, true
  br i1 %62, label %63, label %95

63:                                               ; preds = %56
  %64 = load ptr, ptr %7, align 8, !tbaa !5
  %65 = load i64, ptr %11, align 8, !tbaa !9
  %66 = getelementptr inbounds i32, ptr %64, i64 %65
  store i32 1, ptr %66, align 4, !tbaa !11
  %67 = load i64, ptr %11, align 8, !tbaa !9
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = load i32, ptr %9, align 4, !tbaa !11
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %9, align 4, !tbaa !11
  %71 = sext i32 %69 to i64
  %72 = getelementptr inbounds i64, ptr %68, i64 %71
  store i64 %67, ptr %72, align 8, !tbaa !9
  %73 = load i64, ptr %5, align 8, !tbaa !9
  %74 = load i64, ptr %11, align 8, !tbaa !9
  %75 = mul i64 %73, %74
  %76 = load i64, ptr %5, align 8, !tbaa !9
  %77 = load i64, ptr %6, align 8, !tbaa !9
  %78 = mul i64 %76, %77
  %79 = sub i64 %78, 1
  %80 = urem i64 %75, %79
  store i64 %80, ptr %11, align 8, !tbaa !9
  %81 = load i64, ptr %11, align 8, !tbaa !9
  %82 = load i32, ptr %8, align 4, !tbaa !11
  %83 = sext i32 %82 to i64
  %84 = icmp eq i64 %81, %83
  br i1 %84, label %85, label %94

85:                                               ; preds = %63
  %86 = load i64, ptr %11, align 8, !tbaa !9
  %87 = load ptr, ptr %4, align 8, !tbaa !5
  %88 = load i32, ptr %9, align 4, !tbaa !11
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %9, align 4, !tbaa !11
  %90 = sext i32 %88 to i64
  %91 = getelementptr inbounds i64, ptr %87, i64 %90
  store i64 %86, ptr %91, align 8, !tbaa !9
  %92 = load i32, ptr %10, align 4, !tbaa !11
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %10, align 4, !tbaa !11
  br label %94

94:                                               ; preds = %85, %63
  br label %56, !llvm.loop !15

95:                                               ; preds = %56
  br label %96

96:                                               ; preds = %95
  %97 = load i32, ptr %8, align 4, !tbaa !11
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %8, align 4, !tbaa !11
  br label %45, !llvm.loop !16

99:                                               ; preds = %45
  %100 = load i32, ptr %10, align 4, !tbaa !11
  %101 = sext i32 %100 to i64
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = getelementptr inbounds i64, ptr %102, i64 0
  store i64 %101, ptr %103, align 8, !tbaa !9
  %104 = load ptr, ptr %7, align 8, !tbaa !5
  %105 = icmp eq ptr %104, null
  br i1 %105, label %107, label %106

106:                                              ; preds = %99
  call void @_ZdaPv(ptr noundef %104) #7
  br label %107

107:                                              ; preds = %106, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  ret void
}

; 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: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { nobuiltin 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 = { nounwind }
attributes #6 = { builtin allocsize(0) }
attributes #7 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN25clfft_transpose_generator10get_cyclesEPmmm(ptr nocapture noundef writeonly %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = mul i64 %2, %1
  %5 = icmp ugt i64 %4, 4611686018427387903
  %6 = shl i64 %4, 2
  %7 = select i1 %5, i64 -1, i64 %6
  %8 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %7) #4
  store i32 1, ptr %8, align 4, !tbaa !5
  %9 = add i64 %4, -1
  %10 = getelementptr inbounds i32, ptr %8, i64 %9
  store i32 1, ptr %10, align 4, !tbaa !5
  %11 = icmp ugt i64 %9, 1
  br i1 %11, label %.preheader.preheader, label %._crit_edge57

.preheader.preheader:                             ; preds = %3
  %scevgep = getelementptr i8, ptr %8, i64 4
  %12 = add i64 %6, -8
  tail call void @llvm.memset.p0.i64(ptr align 4 %scevgep, i8 0, i64 %12, i1 false), !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge
  %indvars.iv = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next, %._crit_edge ]
  %.03656 = phi i32 [ 0, %.preheader.preheader ], [ %.1.lcssa, %._crit_edge ]
  %.03755 = phi i32 [ 1, %.preheader.preheader ], [ %.138.lcssa, %._crit_edge ]
  %13 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %.not48 = icmp eq i32 %14, 0
  br i1 %.not48, label %.lr.ph52, label %._crit_edge

.lr.ph52:                                         ; preds = %.preheader, %27
  %15 = phi ptr [ %28, %27 ], [ %13, %.preheader ]
  %.051 = phi i64 [ %20, %27 ], [ %indvars.iv, %.preheader ]
  %.150 = phi i32 [ %.2, %27 ], [ %.03656, %.preheader ]
  %.13849 = phi i32 [ %.239, %27 ], [ %.03755, %.preheader ]
  store i32 1, ptr %15, align 4, !tbaa !5
  %16 = add nsw i32 %.13849, 1
  %17 = sext i32 %.13849 to i64
  %18 = getelementptr inbounds i64, ptr %0, i64 %17
  store i64 %.051, ptr %18, align 8, !tbaa !9
  %19 = mul i64 %.051, %1
  %20 = urem i64 %19, %9
  %21 = icmp eq i64 %20, %indvars.iv
  br i1 %21, label %22, label %27

22:                                               ; preds = %.lr.ph52
  %23 = add nsw i32 %.13849, 2
  %24 = sext i32 %16 to i64
  %25 = getelementptr inbounds i64, ptr %0, i64 %24
  store i64 %indvars.iv, ptr %25, align 8, !tbaa !9
  %26 = add nsw i32 %.150, 1
  br label %27

27:                                               ; preds = %22, %.lr.ph52
  %.239 = phi i32 [ %23, %22 ], [ %16, %.lr.ph52 ]
  %.2 = phi i32 [ %26, %22 ], [ %.150, %.lr.ph52 ]
  %28 = getelementptr inbounds i32, ptr %8, i64 %20
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %.not = icmp eq i32 %29, 0
  br i1 %.not, label %.lr.ph52, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %27, %.preheader
  %.138.lcssa = phi i32 [ %.03755, %.preheader ], [ %.239, %27 ]
  %.1.lcssa = phi i32 [ %.03656, %.preheader ], [ %.2, %27 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %9
  br i1 %exitcond.not, label %._crit_edge57.loopexit, label %.preheader, !llvm.loop !13

._crit_edge57.loopexit:                           ; preds = %._crit_edge
  %30 = sext i32 %.1.lcssa to i64
  br label %._crit_edge57

._crit_edge57:                                    ; preds = %3, %._crit_edge57.loopexit
  %.036.lcssa = phi i64 [ %30, %._crit_edge57.loopexit ], [ 0, %3 ]
  store i64 %.036.lcssa, ptr %0, align 8, !tbaa !9
  tail call void @_ZdaPv(ptr noundef nonnull %8) #5
  ret void
}

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

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

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

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 = { nobuiltin 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 nounwind willreturn memory(argmem: write) }
attributes #4 = { builtin allocsize(0) }
attributes #5 = { builtin 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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