; LLVM IR from tangjz/acm-icpc :: lydsy (4115)

; 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 { x86_fp80, x86_fp80 }

@FFTx = external dso_local global [1048576 x %struct.complex], align 16
@tot = external dso_local global i32, align 4
@prime = external dso_local global [500001 x i32], align 16
@d = external dso_local global [500001 x i32], align 16
@c = external dso_local global [500001 x i32], align 16
@s = external dso_local global [500001 x i32], align 16
@f = external dso_local global [500001 x i64], align 16
@vis = external dso_local global [500001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3FFTP7complexii(ptr noundef, i32 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 nounwind uwtable
declare dso_local void @_ZN7complexC2Eee(ptr noundef nonnull align 16 dereferenceable(32), x86_fp80 noundef, x86_fp80 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZmlRK7complexS1_(ptr dead_on_unwind noalias writable sret(%struct.complex) align 16, ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) #0

; 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) #3

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %struct.complex, align 16
  %7 = alloca i32, align 4
  %8 = alloca %struct.complex, align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([500001 x i32], ptr @s, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([500001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 2, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %162, %0
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = icmp slt i32 %15, 500001
  br i1 %16, label %18, label %17

17:                                               ; preds = %14
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %165

18:                                               ; preds = %14
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [500001 x i8], ptr @vis, i64 0, i64 %20
  %22 = load i8, ptr %21, align 1, !tbaa !9, !range !11, !noundef !12
  %23 = trunc i8 %22 to i1
  br i1 %23, label %39, label %24

24:                                               ; preds = %18
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = load i32, ptr @tot, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @tot, align 4, !tbaa !5
  %28 = sext i32 %26 to i64
  %29 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %28
  store i32 %25, ptr %29, align 4, !tbaa !5
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %31
  store i32 1, ptr %32, align 4, !tbaa !5
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %34
  store i32 1, ptr %35, align 4, !tbaa !5
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %37
  store i32 2, ptr %38, align 4, !tbaa !5
  br label %39

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

40:                                               ; preds = %157, %39
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr @tot, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %54

44:                                               ; preds = %40
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = mul nsw i64 %46, %51
  %53 = icmp slt i64 %52, 500001
  br label %54

54:                                               ; preds = %44, %40
  %55 = phi i1 [ false, %40 ], [ %53, %44 ]
  br i1 %55, label %57, label %56

56:                                               ; preds = %54
  store i32 5, ptr %3, align 4
  br label %160

57:                                               ; preds = %54
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = mul nsw i32 %58, %62
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [500001 x i8], ptr @vis, i64 0, i64 %64
  store i8 1, ptr %65, align 1, !tbaa !9
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = load i32, ptr %4, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = srem i32 %66, %70
  %72 = icmp eq i32 %71, 0
  br i1 %72, label %73, label %125

73:                                               ; preds = %57
  %74 = load i32, ptr %2, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = load i32, ptr %4, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = mul nsw i32 %78, %82
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %84
  store i32 %77, ptr %85, align 4, !tbaa !5
  %86 = load i32, ptr %2, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = load i32, ptr %4, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = mul nsw i32 %91, %95
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %97
  store i32 %90, ptr %98, align 4, !tbaa !5
  %99 = load i32, ptr %2, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = load i32, ptr %2, align 4, !tbaa !5
  %107 = load i32, ptr %4, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = mul nsw i32 %106, %110
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  %116 = mul nsw i32 %105, %115
  %117 = load i32, ptr %2, align 4, !tbaa !5
  %118 = load i32, ptr %4, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = mul nsw i32 %117, %121
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %123
  store i32 %116, ptr %124, align 4, !tbaa !5
  store i32 5, ptr %3, align 4
  br label %160

125:                                              ; preds = %57
  %126 = load i32, ptr %2, align 4, !tbaa !5
  %127 = load i32, ptr %2, align 4, !tbaa !5
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = mul nsw i32 %127, %131
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %133
  store i32 %126, ptr %134, align 4, !tbaa !5
  %135 = load i32, ptr %2, align 4, !tbaa !5
  %136 = load i32, ptr %4, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = mul nsw i32 %135, %139
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %141
  store i32 1, ptr %142, align 4, !tbaa !5
  %143 = load i32, ptr %2, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = mul nsw i32 %146, 2
  %148 = load i32, ptr %2, align 4, !tbaa !5
  %149 = load i32, ptr %4, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = mul nsw i32 %148, %152
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %154
  store i32 %147, ptr %155, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %125
  br label %157

157:                                              ; preds = %156
  %158 = load i32, ptr %4, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !13

160:                                              ; preds = %73, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %161

161:                                              ; preds = %160
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %2, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !15

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

166:                                              ; preds = %185, %165
  %167 = load i32, ptr %5, align 4, !tbaa !5
  %168 = icmp slt i32 %167, 1048576
  br i1 %168, label %170, label %169

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

170:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  %171 = load i32, ptr %5, align 4, !tbaa !5
  %172 = icmp slt i32 %171, 500001
  br i1 %172, label %173, label %178

173:                                              ; preds = %170
  %174 = load i32, ptr %5, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !5
  br label %179

178:                                              ; preds = %170
  br label %179

179:                                              ; preds = %178, %173
  %180 = phi i32 [ %177, %173 ], [ 0, %178 ]
  %181 = sitofp i32 %180 to x86_fp80
  call void @_ZN7complexC2Eee(ptr noundef nonnull align 16 dereferenceable(32) %6, x86_fp80 noundef %181, x86_fp80 noundef 0xK00000000000000000000)
  %182 = load i32, ptr %5, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %183
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %184, ptr align 16 %6, i64 32, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  br label %185

185:                                              ; preds = %179
  %186 = load i32, ptr %5, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %5, align 4, !tbaa !5
  br label %166, !llvm.loop !19

188:                                              ; preds = %169
  call void @_Z3FFTP7complexii(ptr noundef @FFTx, i32 noundef 1048576, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %189

189:                                              ; preds = %203, %188
  %190 = load i32, ptr %7, align 4, !tbaa !5
  %191 = icmp slt i32 %190, 1048576
  br i1 %191, label %193, label %192

192:                                              ; preds = %189
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %206

193:                                              ; preds = %189
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %195
  %197 = load i32, ptr %7, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %198
  call void @_ZmlRK7complexS1_(ptr dead_on_unwind writable sret(%struct.complex) align 16 %8, ptr noundef nonnull align 16 dereferenceable(32) %196, ptr noundef nonnull align 16 dereferenceable(32) %199)
  %200 = load i32, ptr %7, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %201
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %202, ptr align 16 %8, i64 32, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %203

203:                                              ; preds = %193
  %204 = load i32, ptr %7, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %7, align 4, !tbaa !5
  br label %189, !llvm.loop !20

206:                                              ; preds = %192
  call void @_Z3FFTP7complexii(ptr noundef @FFTx, i32 noundef 1048576, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %222, %206
  %208 = load i32, ptr %9, align 4, !tbaa !5
  %209 = icmp slt i32 %208, 500001
  br i1 %209, label %211, label %210

210:                                              ; preds = %207
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %225

211:                                              ; preds = %207
  %212 = load i32, ptr %9, align 4, !tbaa !5
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %213
  %215 = getelementptr inbounds %struct.complex, ptr %214, i32 0, i32 0
  %216 = load x86_fp80, ptr %215, align 16, !tbaa !21
  %217 = fadd x86_fp80 %216, 0xK3FFE8000000000000000
  %218 = fptosi x86_fp80 %217 to i64
  %219 = load i32, ptr %9, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %220
  store i64 %218, ptr %221, align 8, !tbaa !23
  br label %222

222:                                              ; preds = %211
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = add nsw i32 %223, 1
  store i32 %224, ptr %9, align 4, !tbaa !5
  br label %207, !llvm.loop !25

225:                                              ; preds = %210
  call void @_Z5buildii(i32 noundef 1, i32 noundef 500000)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %226 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %10)
  br label %227

227:                                              ; preds = %231, %225
  %228 = load i32, ptr %10, align 4, !tbaa !5
  %229 = add nsw i32 %228, -1
  store i32 %229, ptr %10, align 4, !tbaa !5
  %230 = icmp ne i32 %228, 0
  br i1 %230, label %231, label %242

231:                                              ; preds = %227
  %232 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %11, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %233 = load i32, ptr %11, align 4, !tbaa !5
  %234 = load i32, ptr %12, align 4, !tbaa !5
  %235 = call noundef i32 @_Z5queryiiii(i32 noundef 1, i32 noundef 500000, i32 noundef %233, i32 noundef %234)
  store i32 %235, ptr %13, align 4, !tbaa !5
  %236 = load i32, ptr %13, align 4, !tbaa !5
  %237 = load i32, ptr %13, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %238
  %240 = load i64, ptr %239, align 8, !tbaa !23
  %241 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %236, i64 noundef %240)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %227, !llvm.loop !26

242:                                              ; preds = %227
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  %243 = load i32, ptr %1, align 4
  ret i32 %243
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #5

declare i32 @printf(ptr noundef, ...) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress norecurse 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 = { "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 #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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 16, !17, i64 16, i64 16, !17}
!17 = !{!18, !18, i64 0}
!18 = !{!"long double", !7, i64 0}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = !{!22, !18, i64 0}
!22 = !{!"_ZTS7complex", !18, i64 0, !18, i64 16}
!23 = !{!24, !24, i64 0}
!24 = !{!"long long", !7, i64 0}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !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"

%struct.complex = type { x86_fp80, x86_fp80 }

@FFTx = external dso_local global [1048576 x %struct.complex], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@prime = external dso_local local_unnamed_addr global [500001 x i32], align 16
@d = external dso_local local_unnamed_addr global [500001 x i32], align 16
@c = external dso_local local_unnamed_addr global [500001 x i32], align 16
@s = external dso_local local_unnamed_addr global [500001 x i32], align 16
@f = external dso_local local_unnamed_addr global [500001 x i64], align 16
@vis = external dso_local local_unnamed_addr global [500001 x i8], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3FFTP7complexii(ptr noundef, i32 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 nounwind uwtable
declare dso_local void @_ZN7complexC2Eee(ptr noundef nonnull align 16 dereferenceable(32), x86_fp80 noundef, x86_fp80 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZmlRK7complexS1_(ptr dead_on_unwind noalias writable sret(%struct.complex) align 16, ptr noundef nonnull align 16 dereferenceable(32), ptr noundef nonnull align 16 dereferenceable(32)) local_unnamed_addr #0

; 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) #3

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %struct.complex, align 16
  %2 = alloca %struct.complex, align 16
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @s, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  %tot.promoted = load i32, ptr @tot, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %0, %.critedge
  %indvars.iv65 = phi i64 [ 2, %0 ], [ %indvars.iv.next66, %.critedge ]
  %7 = phi i32 [ %tot.promoted, %0 ], [ %20, %.critedge ]
  %8 = getelementptr inbounds [500001 x i8], ptr @vis, i64 0, i64 %indvars.iv65
  %9 = load i8, ptr %8, align 1, !tbaa !9, !range !11, !noundef !12
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %19, label %11

11:                                               ; preds = %6
  %12 = add nsw i32 %7, 1
  store i32 %12, ptr @tot, align 4, !tbaa !5
  %13 = sext i32 %7 to i64
  %14 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %13
  %15 = trunc nuw nsw i64 %indvars.iv65 to i32
  store i32 %15, ptr %14, align 4, !tbaa !5
  %16 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %indvars.iv65
  store i32 1, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %indvars.iv65
  store i32 1, ptr %17, align 4, !tbaa !5
  %18 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %indvars.iv65
  store i32 2, ptr %18, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %11, %6
  %20 = phi i32 [ %12, %11 ], [ %7, %6 ]
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %19
  %22 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %indvars.iv65
  %wide.trip.count = zext nneg i32 %20 to i64
  %23 = trunc nuw nsw i64 %indvars.iv65 to i32
  br label %24

24:                                               ; preds = %.lr.ph, %50
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %50 ]
  %25 = getelementptr inbounds [500001 x i32], ptr @prime, i64 0, i64 %indvars.iv
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = mul nsw i64 %indvars.iv65, %27
  %29 = icmp slt i64 %28, 500001
  br i1 %29, label %30, label %.critedge

30:                                               ; preds = %24
  %31 = mul nsw i32 %26, %23
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [500001 x i8], ptr @vis, i64 0, i64 %32
  store i8 1, ptr %33, align 1, !tbaa !9
  %34 = srem i32 %23, %26
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %50

36:                                               ; preds = %30
  %37 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %indvars.iv65
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %32
  store i32 %38, ptr %39, align 4, !tbaa !5
  %40 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %indvars.iv65
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  %43 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %32
  store i32 %42, ptr %43, align 4, !tbaa !5
  %44 = sext i32 %38 to i64
  %45 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i32 %41, 2
  %48 = mul nsw i32 %46, %47
  %49 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %32
  store i32 %48, ptr %49, align 4, !tbaa !5
  br label %.critedge

50:                                               ; preds = %30
  %51 = getelementptr inbounds [500001 x i32], ptr @d, i64 0, i64 %32
  store i32 %23, ptr %51, align 4, !tbaa !5
  %52 = getelementptr inbounds [500001 x i32], ptr @c, i64 0, i64 %32
  store i32 1, ptr %52, align 4, !tbaa !5
  %53 = load i32, ptr %22, align 4, !tbaa !5
  %54 = shl nsw i32 %53, 1
  %55 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %32
  store i32 %54, ptr %55, align 4, !tbaa !5
  %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 %.critedge, label %24, !llvm.loop !13

.critedge:                                        ; preds = %50, %24, %19, %36
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %exitcond68.not = icmp eq i64 %indvars.iv.next66, 500001
  br i1 %exitcond68.not, label %.preheader, label %6, !llvm.loop !15

56:                                               ; preds = %61
  call void @_Z3FFTP7complexii(ptr noundef nonnull @FFTx, i32 noundef 1048576, i32 noundef 1)
  br label %66

.preheader:                                       ; preds = %.critedge, %61
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %61 ], [ 0, %.critedge ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #6
  %57 = icmp ult i64 %indvars.iv69, 500001
  br i1 %57, label %58, label %61

58:                                               ; preds = %.preheader
  %59 = getelementptr inbounds [500001 x i32], ptr @s, i64 0, i64 %indvars.iv69
  %60 = load i32, ptr %59, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %.preheader, %58
  %62 = phi i32 [ %60, %58 ], [ 0, %.preheader ]
  %63 = sitofp i32 %62 to x86_fp80
  call void @_ZN7complexC2Eee(ptr noundef nonnull align 16 dereferenceable(32) %1, x86_fp80 noundef %63, x86_fp80 noundef 0xK00000000000000000000)
  %64 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %indvars.iv69
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %64, ptr noundef nonnull align 16 dereferenceable(32) %1, i64 32, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #6
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next70, 1048576
  br i1 %exitcond72.not, label %56, label %.preheader, !llvm.loop !19

65:                                               ; preds = %66
  call void @_Z3FFTP7complexii(ptr noundef nonnull @FFTx, i32 noundef 1048576, i32 noundef -1)
  br label %72

66:                                               ; preds = %56, %66
  %indvars.iv73 = phi i64 [ 0, %56 ], [ %indvars.iv.next74, %66 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #6
  %67 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %indvars.iv73
  call void @_ZmlRK7complexS1_(ptr dead_on_unwind nonnull writable sret(%struct.complex) align 16 %2, ptr noundef nonnull align 16 dereferenceable(32) %67, ptr noundef nonnull align 16 dereferenceable(32) %67)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %67, ptr noundef nonnull align 16 dereferenceable(32) %2, i64 32, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #6
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond76.not = icmp eq i64 %indvars.iv.next74, 1048576
  br i1 %exitcond76.not, label %65, label %66, !llvm.loop !20

68:                                               ; preds = %72
  call void @_Z5buildii(i32 noundef 1, i32 noundef 500000)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #6
  %69 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %70 = load i32, ptr %3, align 4, !tbaa !5
  %71 = add nsw i32 %70, -1
  store i32 %71, ptr %3, align 4, !tbaa !5
  %.not62 = icmp eq i32 %70, 0
  br i1 %.not62, label %._crit_edge, label %.lr.ph63

72:                                               ; preds = %72, %65
  %indvars.iv77 = phi i64 [ 1, %65 ], [ %indvars.iv.next78.1, %72 ]
  %73 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %indvars.iv77
  %74 = load x86_fp80, ptr %73, align 16, !tbaa !21
  %75 = fadd x86_fp80 %74, 0xK3FFE8000000000000000
  %76 = fptosi x86_fp80 %75 to i64
  %77 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %indvars.iv77
  store i64 %76, ptr %77, align 8, !tbaa !23
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %78 = getelementptr inbounds [1048576 x %struct.complex], ptr @FFTx, i64 0, i64 %indvars.iv.next78
  %79 = load x86_fp80, ptr %78, align 16, !tbaa !21
  %80 = fadd x86_fp80 %79, 0xK3FFE8000000000000000
  %81 = fptosi x86_fp80 %80 to i64
  %82 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %indvars.iv.next78
  store i64 %81, ptr %82, align 8, !tbaa !23
  %indvars.iv.next78.1 = add nuw nsw i64 %indvars.iv77, 2
  %exitcond80.not.1 = icmp eq i64 %indvars.iv.next78.1, 500001
  br i1 %exitcond80.not.1, label %68, label %72, !llvm.loop !25

.lr.ph63:                                         ; preds = %68, %.lr.ph63
  %83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = call noundef i32 @_Z5queryiiii(i32 noundef 1, i32 noundef 500000, i32 noundef %84, i32 noundef %85)
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [500001 x i64], ptr @f, i64 0, i64 %87
  %89 = load i64, ptr %88, align 8, !tbaa !23
  %90 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %86, i64 noundef %89)
  %91 = load i32, ptr %3, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %3, align 4, !tbaa !5
  %.not = icmp eq i32 %91, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph63, !llvm.loop !26

._crit_edge:                                      ; preds = %.lr.ph63, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress norecurse 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 = { nofree 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 #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 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = !{i64 0, i64 16, !17, i64 16, i64 16, !17}
!17 = !{!18, !18, i64 0}
!18 = !{!"long double", !7, i64 0}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = !{!22, !18, i64 0}
!22 = !{!"_ZTS7complex", !18, i64 0, !18, i64 16}
!23 = !{!24, !24, i64 0}
!24 = !{!"long long", !7, i64 0}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !14}


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