; LLVM IR from ADJA/algos :: NumberTheory/FFT.ll (Z3fftPSt7complexIdEib)

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

%"class.std::complex" = type { { double, double } }

@_ZL2pi = external hidden global double, align 8
@rev = external dso_local global [1010000 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3fftPSt7complexIdEib(ptr noundef %0, i32 noundef %1, i1 noundef zeroext %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca double, align 8
  %12 = alloca %"class.std::complex", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"class.std::complex", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"class.std::complex", align 8
  %17 = alloca %"class.std::complex", align 8
  %18 = alloca %"class.std::complex", align 8
  %19 = alloca %"class.std::complex", align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %21 = zext i1 %2 to i8
  store i8 %21, ptr %6, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %22

22:                                               ; preds = %27, %3
  %23 = load i32, ptr %7, align 4, !tbaa !9
  %24 = shl i32 1, %23
  %25 = load i32, ptr %5, align 4, !tbaa !9
  %26 = icmp slt i32 %24, %25
  br i1 %26, label %27, label %30

27:                                               ; preds = %22
  %28 = load i32, ptr %7, align 4, !tbaa !9
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %7, align 4, !tbaa !9
  br label %22, !llvm.loop !13

30:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %71, %30
  %32 = load i32, ptr %8, align 4, !tbaa !9
  %33 = load i32, ptr %5, align 4, !tbaa !9
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %74

36:                                               ; preds = %31
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = ashr i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = ashr i32 %41, 1
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = and i32 %43, 1
  %45 = load i32, ptr %7, align 4, !tbaa !9
  %46 = sub nsw i32 %45, 1
  %47 = shl i32 %44, %46
  %48 = or i32 %42, %47
  %49 = load i32, ptr %8, align 4, !tbaa !9
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %50
  store i32 %48, ptr %51, align 4, !tbaa !9
  %52 = load i32, ptr %8, align 4, !tbaa !9
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = icmp sgt i32 %55, %56
  br i1 %57, label %58, label %70

58:                                               ; preds = %36
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = load i32, ptr %8, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds %"class.std::complex", ptr %59, i64 %61
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = load i32, ptr %8, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !9
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds %"class.std::complex", ptr %63, i64 %68
  call void @_ZSt4swapISt7complexIdEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 8 dereferenceable(16) %62, ptr noundef nonnull align 8 dereferenceable(16) %69) #7
  br label %70

70:                                               ; preds = %58, %36
  br label %71

71:                                               ; preds = %70
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %8, align 4, !tbaa !9
  br label %31, !llvm.loop !15

74:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 2, ptr %9, align 4, !tbaa !9
  br label %75

75:                                               ; preds = %167, %74
  %76 = load i32, ptr %9, align 4, !tbaa !9
  %77 = load i32, ptr %5, align 4, !tbaa !9
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 7, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %170

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %81 = load double, ptr @_ZL2pi, align 8, !tbaa !16
  %82 = fmul double 2.000000e+00, %81
  %83 = load i32, ptr %9, align 4, !tbaa !9
  %84 = sitofp i32 %83 to double
  %85 = fdiv double %82, %84
  store double %85, ptr %11, align 8, !tbaa !16
  %86 = load i8, ptr %6, align 1, !tbaa !11, !range !18, !noundef !19
  %87 = trunc i8 %86 to i1
  br i1 %87, label %88, label %91

88:                                               ; preds = %80
  %89 = load double, ptr %11, align 8, !tbaa !16
  %90 = fmul double %89, -1.000000e+00
  store double %90, ptr %11, align 8, !tbaa !16
  br label %91

91:                                               ; preds = %88, %80
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %92 = load double, ptr %11, align 8, !tbaa !16
  %93 = call double @cos(double noundef %92) #7
  %94 = load double, ptr %11, align 8, !tbaa !16
  %95 = call double @sin(double noundef %94) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %12, double noundef %93, double noundef %95)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %96

96:                                               ; preds = %162, %91
  %97 = load i32, ptr %13, align 4, !tbaa !9
  %98 = load i32, ptr %5, align 4, !tbaa !9
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  store i32 10, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %166

101:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %14, double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %102

102:                                              ; preds = %158, %101
  %103 = load i32, ptr %15, align 4, !tbaa !9
  %104 = load i32, ptr %9, align 4, !tbaa !9
  %105 = ashr i32 %104, 1
  %106 = icmp slt i32 %103, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %102
  store i32 13, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %161

108:                                              ; preds = %102
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #7
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = load i32, ptr %13, align 4, !tbaa !9
  %111 = load i32, ptr %15, align 4, !tbaa !9
  %112 = add nsw i32 %110, %111
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds %"class.std::complex", ptr %109, i64 %113
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %114, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #7
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = load i32, ptr %13, align 4, !tbaa !9
  %117 = load i32, ptr %15, align 4, !tbaa !9
  %118 = add nsw i32 %116, %117
  %119 = load i32, ptr %9, align 4, !tbaa !9
  %120 = ashr i32 %119, 1
  %121 = add nsw i32 %118, %120
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds %"class.std::complex", ptr %115, i64 %122
  %124 = call { double, double } @_ZStmlIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %123)
  %125 = getelementptr inbounds %"class.std::complex", ptr %17, i32 0, i32 0
  %126 = getelementptr inbounds { double, double }, ptr %125, i32 0, i32 0
  %127 = extractvalue { double, double } %124, 0
  store double %127, ptr %126, align 8
  %128 = getelementptr inbounds { double, double }, ptr %125, i32 0, i32 1
  %129 = extractvalue { double, double } %124, 1
  store double %129, ptr %128, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #7
  %130 = call { double, double } @_ZStplIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %17)
  %131 = getelementptr inbounds %"class.std::complex", ptr %18, i32 0, i32 0
  %132 = getelementptr inbounds { double, double }, ptr %131, i32 0, i32 0
  %133 = extractvalue { double, double } %130, 0
  store double %133, ptr %132, align 8
  %134 = getelementptr inbounds { double, double }, ptr %131, i32 0, i32 1
  %135 = extractvalue { double, double } %130, 1
  store double %135, ptr %134, align 8
  %136 = load ptr, ptr %4, align 8, !tbaa !5
  %137 = load i32, ptr %13, align 4, !tbaa !9
  %138 = load i32, ptr %15, align 4, !tbaa !9
  %139 = add nsw i32 %137, %138
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds %"class.std::complex", ptr %136, i64 %140
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %141, ptr align 8 %18, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %19) #7
  %142 = call { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull align 8 dereferenceable(16) %17)
  %143 = getelementptr inbounds %"class.std::complex", ptr %19, i32 0, i32 0
  %144 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 0
  %145 = extractvalue { double, double } %142, 0
  store double %145, ptr %144, align 8
  %146 = getelementptr inbounds { double, double }, ptr %143, i32 0, i32 1
  %147 = extractvalue { double, double } %142, 1
  store double %147, ptr %146, align 8
  %148 = load ptr, ptr %4, align 8, !tbaa !5
  %149 = load i32, ptr %13, align 4, !tbaa !9
  %150 = load i32, ptr %15, align 4, !tbaa !9
  %151 = add nsw i32 %149, %150
  %152 = load i32, ptr %9, align 4, !tbaa !9
  %153 = ashr i32 %152, 1
  %154 = add nsw i32 %151, %153
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds %"class.std::complex", ptr %148, i64 %155
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %156, ptr align 8 %19, i64 16, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.end.p0(i64 16, ptr %19) #7
  %157 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #7
  br label %158

158:                                              ; preds = %108
  %159 = load i32, ptr %15, align 4, !tbaa !9
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %15, align 4, !tbaa !9
  br label %102, !llvm.loop !22

161:                                              ; preds = %107
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #7
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %9, align 4, !tbaa !9
  %164 = load i32, ptr %13, align 4, !tbaa !9
  %165 = add nsw i32 %164, %163
  store i32 %165, ptr %13, align 4, !tbaa !9
  br label %96, !llvm.loop !23

166:                                              ; preds = %100
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  br label %167

167:                                              ; preds = %166
  %168 = load i32, ptr %9, align 4, !tbaa !9
  %169 = shl i32 %168, 1
  store i32 %169, ptr %9, align 4, !tbaa !9
  br label %75, !llvm.loop !24

170:                                              ; preds = %79
  %171 = load i8, ptr %6, align 1, !tbaa !11, !range !18, !noundef !19
  %172 = trunc i8 %171 to i1
  br i1 %172, label %173, label %191

173:                                              ; preds = %170
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #7
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %174

174:                                              ; preds = %187, %173
  %175 = load i32, ptr %20, align 4, !tbaa !9
  %176 = load i32, ptr %5, align 4, !tbaa !9
  %177 = icmp slt i32 %175, %176
  br i1 %177, label %179, label %178

178:                                              ; preds = %174
  store i32 16, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #7
  br label %190

179:                                              ; preds = %174
  %180 = load i32, ptr %5, align 4, !tbaa !9
  %181 = sitofp i32 %180 to double
  %182 = load ptr, ptr %4, align 8, !tbaa !5
  %183 = load i32, ptr %20, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds %"class.std::complex", ptr %182, i64 %184
  %186 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEdVEd(ptr noundef nonnull align 8 dereferenceable(16) %185, double noundef %181)
  br label %187

187:                                              ; preds = %179
  %188 = load i32, ptr %20, align 4, !tbaa !9
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %20, align 4, !tbaa !9
  br label %174, !llvm.loop !25

190:                                              ; preds = %178
  br label %191

191:                                              ; preds = %190, %170
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapISt7complexIdEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2

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

; Function Attrs: nounwind
declare double @cos(double noundef) #3

; Function Attrs: nounwind
declare double @sin(double noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #4 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmlIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStplIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEdVEd(ptr noundef nonnull align 8 dereferenceable(16), double noundef) #4 align 2

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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress 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 "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 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint 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 #7 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"double", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{i64 0, i64 16, !21}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !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"

%"class.std::complex" = type { { double, double } }

@_ZL2pi = external hidden local_unnamed_addr global double, align 8
@rev = external dso_local local_unnamed_addr global [1010000 x i32], align 16

; Function Attrs: mustprogress uwtable
define dso_local void @_Z3fftPSt7complexIdEib(ptr noundef %0, i32 noundef %1, i1 noundef zeroext %2) local_unnamed_addr #0 {
  %4 = alloca %"class.std::complex", align 8
  %5 = alloca %"class.std::complex", align 8
  %6 = alloca %"class.std::complex", align 8
  %7 = alloca %"class.std::complex", align 8
  br label %8

8:                                                ; preds = %8, %3
  %.053 = phi i32 [ 0, %3 ], [ %11, %8 ]
  %9 = shl nuw i32 1, %.053
  %10 = icmp slt i32 %9, %1
  %11 = add nuw nsw i32 %.053, 1
  br i1 %10, label %8, label %.preheader63, !llvm.loop !5

.preheader63:                                     ; preds = %8
  %12 = icmp sgt i32 %1, 0
  br i1 %12, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %.preheader63
  %13 = add nsw i32 %.053, -1
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %44

.preheader62:                                     ; preds = %60
  %.not71 = icmp eq i32 %1, 1
  br i1 %.not71, label %._crit_edge, label %.lr.ph74

.lr.ph74:                                         ; preds = %.preheader62
  %14 = getelementptr inbounds i8, ptr %7, i64 8
  %15 = zext nneg i32 %1 to i64
  br label %.lr.ph69.us

.lr.ph69.us:                                      ; preds = %._crit_edge70.us, %.lr.ph74
  %.05572.us = phi i32 [ 2, %.lr.ph74 ], [ %29, %._crit_edge70.us ]
  %16 = load double, ptr @_ZL2pi, align 8, !tbaa !7
  %17 = fmul double %16, 2.000000e+00
  %18 = sitofp i32 %.05572.us to double
  %19 = fdiv double %17, %18
  %20 = fneg double %19
  %.058.us = select i1 %2, double %20, double %19
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  %21 = call double @cos(double noundef %.058.us) #7
  %22 = call double @sin(double noundef %.058.us) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %4, double noundef %21, double noundef %22)
  %23 = ashr exact i32 %.05572.us, 1
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %.lr.ph66.us.us.preheader, label %.lr.ph69.split.us77

.lr.ph66.us.us.preheader:                         ; preds = %.lr.ph69.us
  %25 = zext nneg i32 %23 to i64
  %26 = zext nneg i32 %.05572.us to i64
  %wide.trip.count87 = zext nneg i32 %23 to i64
  %invariant.gep = getelementptr %"class.std::complex", ptr %0, i64 %25
  br label %.lr.ph66.us.us

.lr.ph69.split.us77:                              ; preds = %.lr.ph69.us, %.lr.ph69.split.us77
  %.05767.us75 = phi i32 [ %27, %.lr.ph69.split.us77 ], [ 0, %.lr.ph69.us ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef 1.000000e+00, double noundef 0.000000e+00)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %27 = add nsw i32 %.05767.us75, %.05572.us
  %28 = icmp slt i32 %27, %1
  br i1 %28, label %.lr.ph69.split.us77, label %._crit_edge70.us, !llvm.loop !11

._crit_edge70.us:                                 ; preds = %.lr.ph69.split.us77, %._crit_edge.us.us
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  %29 = shl i32 %.05572.us, 1
  %.not.us = icmp sgt i32 %29, %1
  br i1 %.not.us, label %._crit_edge, label %.lr.ph69.us, !llvm.loop !12

.lr.ph66.us.us:                                   ; preds = %.lr.ph66.us.us.preheader, %._crit_edge.us.us
  %indvars.iv89 = phi i64 [ 0, %.lr.ph66.us.us.preheader ], [ %indvars.iv.next90, %._crit_edge.us.us ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef 1.000000e+00, double noundef 0.000000e+00)
  br label %30

30:                                               ; preds = %30, %.lr.ph66.us.us
  %indvars.iv84 = phi i64 [ %indvars.iv.next85, %30 ], [ 0, %.lr.ph66.us.us ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  %31 = add nuw nsw i64 %indvars.iv84, %indvars.iv89
  %32 = getelementptr inbounds %"class.std::complex", ptr %0, i64 %31
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %32, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %gep = getelementptr %"class.std::complex", ptr %invariant.gep, i64 %31
  %33 = call { double, double } @_ZStmlIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %gep)
  %34 = extractvalue { double, double } %33, 0
  store double %34, ptr %7, align 8
  %35 = extractvalue { double, double } %33, 1
  store double %35, ptr %14, align 8
  %36 = call { double, double } @_ZStplIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %37 = extractvalue { double, double } %36, 0
  %38 = extractvalue { double, double } %36, 1
  store double %37, ptr %32, align 8
  %.sroa.44.0..sroa_idx.us.us = getelementptr inbounds i8, ptr %32, i64 8
  store double %38, ptr %.sroa.44.0..sroa_idx.us.us, align 8, !tbaa !14
  %39 = call { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(16) %7)
  %40 = extractvalue { double, double } %39, 0
  %41 = extractvalue { double, double } %39, 1
  store double %40, ptr %gep, align 8
  %.sroa.4.0..sroa_idx.us.us = getelementptr inbounds i8, ptr %gep, i64 8
  store double %41, ptr %.sroa.4.0..sroa_idx.us.us, align 8, !tbaa !14
  %42 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  %indvars.iv.next85 = add nuw nsw i64 %indvars.iv84, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next85, %wide.trip.count87
  br i1 %exitcond88.not, label %._crit_edge.us.us, label %30, !llvm.loop !15

._crit_edge.us.us:                                ; preds = %30
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #7
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, %26
  %43 = icmp ult i64 %indvars.iv.next90, %15
  br i1 %43, label %.lr.ph66.us.us, label %._crit_edge70.us, !llvm.loop !11

44:                                               ; preds = %.lr.ph, %60
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %60 ]
  %45 = trunc nuw nsw i64 %indvars.iv to i32
  %46 = lshr i64 %indvars.iv, 1
  %47 = and i64 %46, 2147483647
  %48 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = ashr i32 %49, 1
  %51 = and i32 %45, 1
  %52 = shl nuw i32 %51, %13
  %53 = or i32 %50, %52
  %54 = getelementptr inbounds [1010000 x i32], ptr @rev, i64 0, i64 %indvars.iv
  store i32 %53, ptr %54, align 4, !tbaa !16
  %55 = sext i32 %53 to i64
  %56 = icmp slt i64 %indvars.iv, %55
  br i1 %56, label %57, label %60

57:                                               ; preds = %44
  %58 = getelementptr inbounds %"class.std::complex", ptr %0, i64 %indvars.iv
  %59 = getelementptr inbounds %"class.std::complex", ptr %0, i64 %55
  tail call void @_ZSt4swapISt7complexIdEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 8 dereferenceable(16) %59) #7
  br label %60

60:                                               ; preds = %44, %57
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader62, label %44, !llvm.loop !18

._crit_edge:                                      ; preds = %._crit_edge70.us, %.preheader62
  %or.cond = and i1 %12, %2
  br i1 %or.cond, label %.lr.ph81, label %.loopexit

.lr.ph81:                                         ; preds = %._crit_edge
  %61 = uitofp nneg i32 %1 to double
  %wide.trip.count95 = zext nneg i32 %1 to i64
  br label %62

62:                                               ; preds = %.lr.ph81, %62
  %indvars.iv92 = phi i64 [ 0, %.lr.ph81 ], [ %indvars.iv.next93, %62 ]
  %63 = getelementptr inbounds %"class.std::complex", ptr %0, i64 %indvars.iv92
  %64 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEdVEd(ptr noundef nonnull align 8 dereferenceable(16) %63, double noundef %61)
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond96.not = icmp eq i64 %indvars.iv.next93, %wide.trip.count95
  br i1 %exitcond96.not, label %.loopexit, label %62, !llvm.loop !19

.loopexit:                                        ; preds = %62, %.preheader63, %._crit_edge
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZSt4swapISt7complexIdEENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS5_ESt18is_move_assignableIS5_EEE5valueEvE4typeERS5_SE_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #4 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmlIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStplIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { double, double } @_ZStmiIdESt7complexIT_ERKS2_S4_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEmLIdEERS0_RKS_IT_E(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt7complexIdEdVEd(ptr noundef nonnull align 8 dereferenceable(16), double noundef) local_unnamed_addr #4 align 2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress 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 = { 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 #4 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { inlinehint 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 #7 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"double", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}
!12 = distinct !{!12, !6}
!13 = !{i64 0, i64 16, !14}
!14 = !{!9, !9, i64 0}
!15 = distinct !{!15, !6}
!16 = !{!17, !17, i64 0}
!17 = !{!"int", !9, i64 0}
!18 = distinct !{!18, !6}
!19 = distinct !{!19, !6}


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