; LLVM IR from tangjz/acm-icpc :: hdu/6120.ll (Z7precalcv)

; 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.complex = type { double, double }

@f = external dso_local global [32677 x i32], align 16
@val = external dso_local global [41 x [797 x i32]], align 16
@per1 = external dso_local global [41 x i32], align 16
@per2 = external dso_local global [797 x i32], align 16
@ord1 = external dso_local global [41 x i32], align 16
@ord2 = external dso_local global [797 x i32], align 16
@c = external dso_local global [41 x [797 x i32]], align 16
@d = external dso_local global [41 x [797 x i32]], align 16
@ff = external dso_local global [41 x [2049 x %struct.complex]], align 16
@gg = external dso_local global [2049 x %struct.complex], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3FFTiP7complexi(i32 noundef, ptr noundef, i32 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local { double, double } @_ZNK7complexmlERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #0 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) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7precalcv() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.complex, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %struct.complex, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %38, %0
  %16 = load i32, ptr %1, align 4, !tbaa !5
  %17 = icmp slt i32 %16, 32677
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  br label %41

19:                                               ; preds = %15
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [32677 x i32], ptr @f, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = load i32, ptr %1, align 4, !tbaa !5
  %25 = srem i32 %24, 41
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [41 x i32], ptr @ord1, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %29
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = srem i32 %31, 797
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [797 x i32], ptr @ord2, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [797 x i32], ptr %30, i64 0, i64 %36
  store i32 %23, ptr %37, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %19
  %39 = load i32, ptr %1, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %1, align 4, !tbaa !5
  br label %15, !llvm.loop !9

41:                                               ; preds = %18
  call void @llvm.memset.p0.i64(ptr align 16 @d, i8 0, i64 130708, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %82, %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = icmp slt i32 %43, 41
  br i1 %44, label %46, label %45

45:                                               ; preds = %42
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %85

46:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %74, %46
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = icmp slt i32 %48, 2048
  br i1 %49, label %51, label %50

50:                                               ; preds = %47
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %77

51:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #5
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  %54 = icmp slt i32 %53, 797
  br i1 %54, label %55, label %64

55:                                               ; preds = %51
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %57
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [797 x i32], ptr %58, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  br label %65

64:                                               ; preds = %51
  br label %65

65:                                               ; preds = %64, %55
  %66 = phi i32 [ %63, %55 ], [ 0, %64 ]
  %67 = sitofp i32 %66 to double
  call void @_ZN7complexC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %5, double noundef %67, double noundef 0.000000e+00)
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %69
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [2049 x %struct.complex], ptr %70, i64 0, i64 %72
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %73, ptr align 8 %5, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #5
  br label %74

74:                                               ; preds = %65
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %4, align 4, !tbaa !5
  br label %47, !llvm.loop !14

77:                                               ; preds = %50
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %79
  %81 = getelementptr inbounds [2049 x %struct.complex], ptr %80, i64 0, i64 0
  call void @_Z3FFTiP7complexi(i32 noundef 2048, ptr noundef %81, i32 noundef 1)
  br label %82

82:                                               ; preds = %77
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %2, align 4, !tbaa !5
  br label %42, !llvm.loop !15

85:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %222, %85
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 41
  br i1 %88, label %90, label %89

89:                                               ; preds = %86
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %225

90:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %218, %90
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = icmp slt i32 %92, 41
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %221

95:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %96 = load i32, ptr %6, align 4, !tbaa !5
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %109

98:                                               ; preds = %95
  %99 = load i32, ptr %7, align 4, !tbaa !5
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %101, label %109

101:                                              ; preds = %98
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = sub nsw i32 %102, 1
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %103, %104
  %106 = sub nsw i32 %105, 1
  %107 = srem i32 %106, 40
  %108 = add nsw i32 %107, 1
  br label %110

109:                                              ; preds = %98, %95
  br label %110

110:                                              ; preds = %109, %101
  %111 = phi i32 [ %108, %101 ], [ 0, %109 ]
  store i32 %111, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %112

112:                                              ; preds = %159, %110
  %113 = load i32, ptr %9, align 4, !tbaa !5
  %114 = icmp slt i32 %113, 797
  br i1 %114, label %116, label %115

115:                                              ; preds = %112
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %162

116:                                              ; preds = %112
  %117 = load i32, ptr %6, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %118
  %120 = getelementptr inbounds [797 x i32], ptr %119, i64 0, i64 0
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %123
  %125 = load i32, ptr %9, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [797 x i32], ptr %124, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = mul nsw i32 %121, %128
  %130 = load i32, ptr %8, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %131
  %133 = getelementptr inbounds [797 x i32], ptr %132, i64 0, i64 0
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = add nsw i32 %134, %129
  store i32 %135, ptr %133, align 4, !tbaa !5
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = icmp ne i32 %136, 0
  br i1 %137, label %138, label %158

138:                                              ; preds = %116
  %139 = load i32, ptr %6, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %140
  %142 = load i32, ptr %9, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [797 x i32], ptr %141, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %147
  %149 = getelementptr inbounds [797 x i32], ptr %148, i64 0, i64 0
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = mul nsw i32 %145, %150
  %152 = load i32, ptr %8, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %153
  %155 = getelementptr inbounds [797 x i32], ptr %154, i64 0, i64 0
  %156 = load i32, ptr %155, align 4, !tbaa !5
  %157 = add nsw i32 %156, %151
  store i32 %157, ptr %155, align 4, !tbaa !5
  br label %158

158:                                              ; preds = %138, %116
  br label %159

159:                                              ; preds = %158
  %160 = load i32, ptr %9, align 4, !tbaa !5
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %9, align 4, !tbaa !5
  br label %112, !llvm.loop !16

162:                                              ; preds = %115
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %163

163:                                              ; preds = %188, %162
  %164 = load i32, ptr %10, align 4, !tbaa !5
  %165 = icmp slt i32 %164, 2048
  br i1 %165, label %167, label %166

166:                                              ; preds = %163
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %191

167:                                              ; preds = %163
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %168 = load i32, ptr %6, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %169
  %171 = load i32, ptr %10, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [2049 x %struct.complex], ptr %170, i64 0, i64 %172
  %174 = load i32, ptr %7, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %175
  %177 = load i32, ptr %10, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [2049 x %struct.complex], ptr %176, i64 0, i64 %178
  %180 = call { double, double } @_ZNK7complexmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %173, ptr noundef nonnull align 8 dereferenceable(16) %179)
  %181 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 0
  %182 = extractvalue { double, double } %180, 0
  store double %182, ptr %181, align 8
  %183 = getelementptr inbounds { double, double }, ptr %11, i32 0, i32 1
  %184 = extractvalue { double, double } %180, 1
  store double %184, ptr %183, align 8
  %185 = load i32, ptr %10, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [2049 x %struct.complex], ptr @gg, i64 0, i64 %186
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %187, ptr align 8 %11, i64 16, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  br label %188

188:                                              ; preds = %167
  %189 = load i32, ptr %10, align 4, !tbaa !5
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %10, align 4, !tbaa !5
  br label %163, !llvm.loop !17

191:                                              ; preds = %166
  call void @_Z3FFTiP7complexi(i32 noundef 2048, ptr noundef @gg, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %192

192:                                              ; preds = %214, %191
  %193 = load i32, ptr %12, align 4, !tbaa !5
  %194 = icmp slt i32 %193, 2048
  br i1 %194, label %196, label %195

195:                                              ; preds = %192
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %217

196:                                              ; preds = %192
  %197 = load i32, ptr %12, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [2049 x %struct.complex], ptr @gg, i64 0, i64 %198
  %200 = getelementptr inbounds %struct.complex, ptr %199, i32 0, i32 0
  %201 = load double, ptr %200, align 16, !tbaa !18
  %202 = fadd double %201, 5.000000e-01
  %203 = fptosi double %202 to i32
  %204 = load i32, ptr %8, align 4, !tbaa !5
  %205 = sext i32 %204 to i64
  %206 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %205
  %207 = load i32, ptr %12, align 4, !tbaa !5
  %208 = srem i32 %207, 796
  %209 = add nsw i32 %208, 1
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [797 x i32], ptr %206, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !5
  %213 = add nsw i32 %212, %203
  store i32 %213, ptr %211, align 4, !tbaa !5
  br label %214

214:                                              ; preds = %196
  %215 = load i32, ptr %12, align 4, !tbaa !5
  %216 = add nsw i32 %215, 1
  store i32 %216, ptr %12, align 4, !tbaa !5
  br label %192, !llvm.loop !20

217:                                              ; preds = %195
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %218

218:                                              ; preds = %217
  %219 = load i32, ptr %7, align 4, !tbaa !5
  %220 = add nsw i32 %219, 1
  store i32 %220, ptr %7, align 4, !tbaa !5
  br label %91, !llvm.loop !21

221:                                              ; preds = %94
  br label %222

222:                                              ; preds = %221
  %223 = load i32, ptr %6, align 4, !tbaa !5
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %6, align 4, !tbaa !5
  br label %86, !llvm.loop !22

225:                                              ; preds = %89
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %262, %225
  %227 = load i32, ptr %13, align 4, !tbaa !5
  %228 = icmp slt i32 %227, 41
  br i1 %228, label %230, label %229

229:                                              ; preds = %226
  store i32 26, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %265

230:                                              ; preds = %226
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %231

231:                                              ; preds = %258, %230
  %232 = load i32, ptr %14, align 4, !tbaa !5
  %233 = icmp slt i32 %232, 797
  br i1 %233, label %235, label %234

234:                                              ; preds = %231
  store i32 29, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %261

235:                                              ; preds = %231
  %236 = load i32, ptr %13, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %237
  %239 = load i32, ptr %14, align 4, !tbaa !5
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [797 x i32], ptr %238, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !5
  %243 = load i32, ptr %13, align 4, !tbaa !5
  %244 = sext i32 %243 to i64
  %245 = getelementptr inbounds [41 x i32], ptr @per1, i64 0, i64 %244
  %246 = load i32, ptr %245, align 4, !tbaa !5
  %247 = sext i32 %246 to i64
  %248 = getelementptr inbounds [41 x [797 x i32]], ptr @val, i64 0, i64 %247
  %249 = load i32, ptr %14, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [797 x i32], ptr @per2, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = getelementptr inbounds [797 x i32], ptr %248, i64 0, i64 %253
  %255 = load i32, ptr %254, align 4, !tbaa !5
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [32677 x i32], ptr @f, i64 0, i64 %256
  store i32 %242, ptr %257, align 4, !tbaa !5
  br label %258

258:                                              ; preds = %235
  %259 = load i32, ptr %14, align 4, !tbaa !5
  %260 = add nsw i32 %259, 1
  store i32 %260, ptr %14, align 4, !tbaa !5
  br label %231, !llvm.loop !23

261:                                              ; preds = %234
  br label %262

262:                                              ; preds = %261
  %263 = load i32, ptr %13, align 4, !tbaa !5
  %264 = add nsw i32 %263, 1
  store i32 %264, ptr %13, align 4, !tbaa !5
  br label %226, !llvm.loop !24

265:                                              ; preds = %229
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7complexC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{i64 0, i64 8, !12, i64 8, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{!19, !13, i64 0}
!19 = !{!"_ZTS7complex", !13, i64 0, !13, i64 8}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10}
!24 = distinct !{!24, !10}


; 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.complex = type { double, double }

@f = external dso_local local_unnamed_addr global [32677 x i32], align 16
@val = external dso_local local_unnamed_addr global [41 x [797 x i32]], align 16
@per1 = external dso_local local_unnamed_addr global [41 x i32], align 16
@per2 = external dso_local local_unnamed_addr global [797 x i32], align 16
@ord1 = external dso_local local_unnamed_addr global [41 x i32], align 16
@ord2 = external dso_local local_unnamed_addr global [797 x i32], align 16
@c = external dso_local local_unnamed_addr global [41 x [797 x i32]], align 16
@d = external dso_local local_unnamed_addr global [41 x [797 x i32]], align 16
@ff = external dso_local global [41 x [2049 x %struct.complex]], align 16
@gg = external dso_local global [2049 x %struct.complex], align 16

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

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

; 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 uwtable
declare dso_local { double, double } @_ZNK7complexmlERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 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) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z7precalcv() local_unnamed_addr #0 {
  %1 = alloca %struct.complex, align 8
  br label %3

2:                                                ; preds = %3
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(130708) @d, i8 0, i64 130708, i1 false)
  br label %.preheader73

3:                                                ; preds = %0, %3
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %3 ]
  %4 = getelementptr inbounds [32677 x i32], ptr @f, i64 0, i64 %indvars.iv
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %.lhs.trunc = trunc i64 %indvars.iv to i16
  %6 = urem i16 %.lhs.trunc, 41
  %7 = zext nneg i16 %6 to i64
  %8 = getelementptr inbounds [41 x i32], ptr @ord1, i64 0, i64 %7
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = urem i16 %.lhs.trunc, 797
  %12 = zext nneg i16 %11 to i64
  %13 = getelementptr inbounds [797 x i32], ptr @ord2, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %10, i64 %15
  store i32 %5, ptr %16, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 32677
  br i1 %exitcond.not, label %2, label %3, !llvm.loop !9

.preheader73:                                     ; preds = %2, %17
  %indvars.iv89 = phi i64 [ 0, %2 ], [ %indvars.iv.next90, %17 ]
  br label %19

17:                                               ; preds = %24
  %18 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %indvars.iv89
  call void @_Z3FFTiP7complexi(i32 noundef 2048, ptr noundef nonnull %18, i32 noundef 1)
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next90, 41
  br i1 %exitcond92.not, label %.preheader71, label %.preheader73, !llvm.loop !11

19:                                               ; preds = %.preheader73, %24
  %indvars.iv85 = phi i64 [ 0, %.preheader73 ], [ %indvars.iv.next86, %24 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %20 = icmp ult i64 %indvars.iv85, 796
  br i1 %20, label %21, label %24

21:                                               ; preds = %19
  %22 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv89, i64 %indvars.iv.next86
  %23 = load i32, ptr %22, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %19, %21
  %25 = phi i32 [ %23, %21 ], [ 0, %19 ]
  %26 = sitofp i32 %25 to double
  call void @_ZN7complexC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %1, double noundef %26, double noundef 0.000000e+00)
  %27 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %indvars.iv89, i64 %indvars.iv85
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %27, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 16, i1 false), !tbaa.struct !12
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  %exitcond88.not = icmp eq i64 %indvars.iv.next86, 2048
  br i1 %exitcond88.not, label %17, label %19, !llvm.loop !15

.preheader71:                                     ; preds = %17, %35
  %indvars.iv110 = phi i64 [ %indvars.iv.next111, %35 ], [ 0, %17 ]
  %28 = icmp ne i64 %indvars.iv110, 0
  %29 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110
  %30 = add nuw i64 %indvars.iv110, 4294967294
  %31 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110, i64 793
  %32 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110, i64 794
  %33 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110, i64 795
  %34 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110, i64 796
  br label %36

35:                                               ; preds = %102
  %indvars.iv.next111 = add nuw nsw i64 %indvars.iv110, 1
  %exitcond113.not = icmp eq i64 %indvars.iv.next111, 41
  br i1 %exitcond113.not, label %.preheader, label %.preheader71, !llvm.loop !16

36:                                               ; preds = %.preheader71, %102
  %indvars.iv106 = phi i64 [ 0, %.preheader71 ], [ %indvars.iv.next107, %102 ]
  %37 = icmp ne i64 %indvars.iv106, 0
  %or.cond = and i1 %28, %37
  br i1 %or.cond, label %38, label %.peel.next

38:                                               ; preds = %36
  %39 = add i64 %30, %indvars.iv106
  %40 = trunc i64 %39 to i32
  %41 = srem i32 %40, 40
  %42 = add nsw i32 %41, 1
  br label %.peel.next

.peel.next:                                       ; preds = %36, %38
  %43 = phi i32 [ %42, %38 ], [ 0, %36 ]
  %44 = load i32, ptr %29, align 4, !tbaa !5
  %45 = sext i32 %43 to i64
  %46 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %45
  %47 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %.promoted = load i32, ptr %46, align 4, !tbaa !5
  %49 = mul nsw i32 %48, %44
  %50 = add nsw i32 %.promoted, %49
  %51 = insertelement <4 x i32> <i32 poison, i32 0, i32 0, i32 0>, i32 %50, i64 0
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %44, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert126 = insertelement <4 x i32> poison, i32 %48, i64 0
  %broadcast.splat127 = shufflevector <4 x i32> %broadcast.splatinsert126, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %.peel.next
  %index = phi i64 [ 0, %.peel.next ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %51, %.peel.next ], [ %62, %vector.body ]
  %vec.phi122 = phi <4 x i32> [ zeroinitializer, %.peel.next ], [ %63, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %52 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106, i64 %offset.idx
  %53 = getelementptr inbounds i8, ptr %52, i64 16
  %wide.load = load <4 x i32>, ptr %52, align 4, !tbaa !5
  %wide.load123 = load <4 x i32>, ptr %53, align 4, !tbaa !5
  %54 = mul nsw <4 x i32> %wide.load, %broadcast.splat
  %55 = mul nsw <4 x i32> %wide.load123, %broadcast.splat
  %56 = add <4 x i32> %vec.phi, %54
  %57 = add <4 x i32> %vec.phi122, %55
  %58 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv110, i64 %offset.idx
  %59 = getelementptr inbounds i8, ptr %58, i64 16
  %wide.load124 = load <4 x i32>, ptr %58, align 4, !tbaa !5
  %wide.load125 = load <4 x i32>, ptr %59, align 4, !tbaa !5
  %60 = mul nsw <4 x i32> %broadcast.splat127, %wide.load124
  %61 = mul nsw <4 x i32> %broadcast.splat127, %wide.load125
  %62 = add <4 x i32> %60, %56
  %63 = add <4 x i32> %61, %57
  %index.next = add nuw i64 %index, 8
  %64 = icmp eq i64 %index.next, 792
  br i1 %64, label %.preheader70, label %vector.body, !llvm.loop !17

.preheader70:                                     ; preds = %vector.body
  %bin.rdx = add <4 x i32> %63, %62
  %65 = call i32 @llvm.vector.reduce.add.v4i32(<4 x i32> %bin.rdx)
  %66 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106, i64 793
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = mul nsw i32 %67, %44
  %69 = add nsw i32 %65, %68
  %70 = load i32, ptr %31, align 4, !tbaa !5
  %71 = mul nsw i32 %48, %70
  %72 = add nsw i32 %71, %69
  %73 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106, i64 794
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = mul nsw i32 %74, %44
  %76 = add nsw i32 %72, %75
  %77 = load i32, ptr %32, align 4, !tbaa !5
  %78 = mul nsw i32 %48, %77
  %79 = add nsw i32 %78, %76
  %80 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106, i64 795
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = mul nsw i32 %81, %44
  %83 = add nsw i32 %79, %82
  %84 = load i32, ptr %33, align 4, !tbaa !5
  %85 = mul nsw i32 %48, %84
  %86 = add nsw i32 %85, %83
  %87 = getelementptr inbounds [41 x [797 x i32]], ptr @c, i64 0, i64 %indvars.iv106, i64 796
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = mul nsw i32 %88, %44
  %90 = add nsw i32 %86, %89
  %91 = load i32, ptr %34, align 4, !tbaa !5
  %92 = mul nsw i32 %48, %91
  %93 = add nsw i32 %92, %90
  store i32 %93, ptr %46, align 4, !tbaa !5
  br label %95

94:                                               ; preds = %95
  call void @_Z3FFTiP7complexi(i32 noundef 2048, ptr noundef nonnull @gg, i32 noundef -1)
  br label %103

95:                                               ; preds = %.preheader70, %95
  %indvars.iv98 = phi i64 [ 0, %.preheader70 ], [ %indvars.iv.next99, %95 ]
  %96 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %indvars.iv110, i64 %indvars.iv98
  %97 = getelementptr inbounds [41 x [2049 x %struct.complex]], ptr @ff, i64 0, i64 %indvars.iv106, i64 %indvars.iv98
  %98 = call { double, double } @_ZNK7complexmlERKS_(ptr noundef nonnull align 8 dereferenceable(16) %96, ptr noundef nonnull align 8 dereferenceable(16) %97)
  %99 = extractvalue { double, double } %98, 0
  %100 = extractvalue { double, double } %98, 1
  %101 = getelementptr inbounds [2049 x %struct.complex], ptr @gg, i64 0, i64 %indvars.iv98
  store double %99, ptr %101, align 16, !tbaa !13
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %101, i64 8
  store double %100, ptr %.sroa.4.0..sroa_idx, align 8, !tbaa !13
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %exitcond101.not = icmp eq i64 %indvars.iv.next99, 2048
  br i1 %exitcond101.not, label %94, label %95, !llvm.loop !21

102:                                              ; preds = %103
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %exitcond109.not = icmp eq i64 %indvars.iv.next107, 41
  br i1 %exitcond109.not, label %35, label %36, !llvm.loop !22

103:                                              ; preds = %94, %103
  %indvars.iv102 = phi i64 [ 0, %94 ], [ %indvars.iv.next103, %103 ]
  %104 = getelementptr inbounds [2049 x %struct.complex], ptr @gg, i64 0, i64 %indvars.iv102
  %105 = load double, ptr %104, align 16, !tbaa !23
  %106 = fadd double %105, 5.000000e-01
  %107 = fptosi double %106 to i32
  %.lhs.trunc67 = trunc i64 %indvars.iv102 to i16
  %108 = urem i16 %.lhs.trunc67, 796
  %narrow = add nuw nsw i16 %108, 1
  %109 = zext nneg i16 %narrow to i64
  %110 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %45, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = add nsw i32 %111, %107
  store i32 %112, ptr %110, align 4, !tbaa !5
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %exitcond105.not = icmp eq i64 %indvars.iv.next103, 2048
  br i1 %exitcond105.not, label %102, label %103, !llvm.loop !25

.preheader:                                       ; preds = %35, %117
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %117 ], [ 0, %35 ]
  %113 = getelementptr inbounds [41 x i32], ptr @per1, i64 0, i64 %indvars.iv118
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  br label %118

116:                                              ; preds = %117
  ret void

117:                                              ; preds = %118
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond121.not = icmp eq i64 %indvars.iv.next119, 41
  br i1 %exitcond121.not, label %116, label %.preheader, !llvm.loop !26

118:                                              ; preds = %128, %.preheader
  %indvars.iv114 = phi i64 [ 0, %.preheader ], [ %indvars.iv.next115.1, %128 ]
  %119 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %indvars.iv118, i64 %indvars.iv114
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = getelementptr inbounds [797 x i32], ptr @per2, i64 0, i64 %indvars.iv114
  %122 = load i32, ptr %121, align 8, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [41 x [797 x i32]], ptr @val, i64 0, i64 %115, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [32677 x i32], ptr @f, i64 0, i64 %126
  store i32 %120, ptr %127, align 4, !tbaa !5
  %exitcond117.not = icmp eq i64 %indvars.iv114, 796
  br i1 %exitcond117.not, label %117, label %128, !llvm.loop !27

128:                                              ; preds = %118
  %indvars.iv.next115 = or disjoint i64 %indvars.iv114, 1
  %129 = getelementptr inbounds [41 x [797 x i32]], ptr @d, i64 0, i64 %indvars.iv118, i64 %indvars.iv.next115
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = getelementptr inbounds [797 x i32], ptr @per2, i64 0, i64 %indvars.iv.next115
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [41 x [797 x i32]], ptr @val, i64 0, i64 %115, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [32677 x i32], ptr @f, i64 0, i64 %136
  store i32 %130, ptr %137, align 4, !tbaa !5
  %indvars.iv.next115.1 = add nuw nsw i64 %indvars.iv114, 2
  br label %118
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.add.v4i32(<4 x i32>) #5

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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{i64 0, i64 8, !13, i64 8, i64 8, !13}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18, !19, !20}
!18 = !{!"llvm.loop.peeled.count", i32 1}
!19 = !{!"llvm.loop.isvectorized", i32 1}
!20 = !{!"llvm.loop.unroll.runtime.disable"}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}
!23 = !{!24, !14, i64 0}
!24 = !{!"_ZTS7complex", !14, i64 0, !14, i64 8}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass