; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-12-02/upsolved (I - Goddess - lzy)

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

@_ZL2pi = external hidden global double, align 8
@n = external dso_local global i32, align 4
@o = external dso_local global [509 x i32], align 16
@L = external dso_local global double, align 8
@R = external dso_local global double, align 8
@U = external dso_local global double, align 8
@V = external dso_local global double, align 8
@dis = external dso_local global [509 x double], align 16
@the = external dso_local global [509 x double], align 16
@det = external dso_local global double, align 8
@x = external dso_local global [509 x double], align 16
@y = external dso_local global [509 x double], align 16
@rad = external dso_local global [509 x double], align 16
@l = external dso_local global [509 x double], align 16
@r = external dso_local global [509 x double], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4dcmpd(double noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z3sqrd(double noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z4calcd(double noundef) #1

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #5 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca double, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca double, align 8
  store i32 0, ptr %1, align 4
  br label %11

11:                                               ; preds = %286, %0
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %13 = icmp eq i32 %12, 1
  br i1 %13, label %14, label %289

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

15:                                               ; preds = %90, %14
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr @n, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #9
  br label %93

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %23
  store i32 %21, ptr %24, align 4, !tbaa !5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds double, ptr @x, i64 %26
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds double, ptr @y, i64 %29
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds double, ptr @rad, i64 %32
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %27, ptr noundef %30, ptr noundef %33)
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %36
  %38 = load double, ptr %37, align 8, !tbaa !9
  %39 = call noundef double @_Z3sqrd(double noundef %38)
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %41
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = call noundef double @_Z3sqrd(double noundef %43)
  %45 = fadd double %39, %44
  %46 = call double @sqrt(double noundef %45) #9
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %48
  store double %46, ptr %49, align 8, !tbaa !9
  %50 = load i32, ptr %2, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !9
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %55
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = call double @atan2(double noundef %53, double noundef %57) #9
  %59 = load i32, ptr %2, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %60
  store double %58, ptr %61, align 8, !tbaa !9
  %62 = load i32, ptr %2, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %63
  %65 = load double, ptr %64, align 8, !tbaa !9
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %67
  %69 = load double, ptr %68, align 8, !tbaa !9
  %70 = fdiv double %65, %69
  %71 = call double @asin(double noundef %70) #9
  store double %71, ptr @det, align 8, !tbaa !9
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %73
  %75 = load double, ptr %74, align 8, !tbaa !9
  %76 = load double, ptr @det, align 8, !tbaa !9
  %77 = fsub double %75, %76
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %79
  store double %77, ptr %80, align 8, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = load double, ptr @det, align 8, !tbaa !9
  %86 = fadd double %84, %85
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %88
  store double %86, ptr %89, align 8, !tbaa !9
  br label %90

90:                                               ; preds = %20
  %91 = load i32, ptr %2, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !11

93:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #9
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %94

94:                                               ; preds = %177, %93
  %95 = load i32, ptr %3, align 4, !tbaa !5
  %96 = load i32, ptr @n, align 4, !tbaa !5
  %97 = icmp slt i32 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #9
  br label %180

99:                                               ; preds = %94
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = load i32, ptr @n, align 4, !tbaa !5
  %102 = add nsw i32 %100, %101
  %103 = load i32, ptr %3, align 4, !tbaa !5
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = add nsw i32 %103, %104
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %106
  store i32 %102, ptr %107, align 4, !tbaa !5
  %108 = load i32, ptr %3, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %109
  %111 = load double, ptr %110, align 8, !tbaa !9
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = load i32, ptr @n, align 4, !tbaa !5
  %114 = add nsw i32 %112, %113
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %115
  store double %111, ptr %116, align 8, !tbaa !9
  %117 = load i32, ptr %3, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %118
  %120 = load double, ptr %119, align 8, !tbaa !9
  %121 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %122 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %121, double %120)
  %123 = load i32, ptr %3, align 4, !tbaa !5
  %124 = load i32, ptr @n, align 4, !tbaa !5
  %125 = add nsw i32 %123, %124
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %126
  store double %122, ptr %127, align 8, !tbaa !9
  %128 = load i32, ptr %3, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %129
  %131 = load double, ptr %130, align 8, !tbaa !9
  %132 = load i32, ptr %3, align 4, !tbaa !5
  %133 = load i32, ptr @n, align 4, !tbaa !5
  %134 = add nsw i32 %132, %133
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %135
  store double %131, ptr %136, align 8, !tbaa !9
  %137 = load i32, ptr %3, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %138
  %140 = load double, ptr %139, align 8, !tbaa !9
  %141 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %142 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %141, double %140)
  %143 = load i32, ptr %3, align 4, !tbaa !5
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %145 = add nsw i32 %143, %144
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %146
  store double %142, ptr %147, align 8, !tbaa !9
  %148 = load i32, ptr %3, align 4, !tbaa !5
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %149
  %151 = load double, ptr %150, align 8, !tbaa !9
  %152 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %153 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %152, double %151)
  %154 = load i32, ptr %3, align 4, !tbaa !5
  %155 = load i32, ptr @n, align 4, !tbaa !5
  %156 = add nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %157
  store double %153, ptr %158, align 8, !tbaa !9
  %159 = load i32, ptr %3, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %160
  %162 = load double, ptr %161, align 8, !tbaa !9
  %163 = load i32, ptr %3, align 4, !tbaa !5
  %164 = load i32, ptr @n, align 4, !tbaa !5
  %165 = add nsw i32 %163, %164
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %166
  store double %162, ptr %167, align 8, !tbaa !9
  %168 = load i32, ptr %3, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %169
  %171 = load double, ptr %170, align 8, !tbaa !9
  %172 = load i32, ptr %3, align 4, !tbaa !5
  %173 = load i32, ptr @n, align 4, !tbaa !5
  %174 = add nsw i32 %172, %173
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %175
  store double %171, ptr %176, align 8, !tbaa !9
  br label %177

177:                                              ; preds = %99
  %178 = load i32, ptr %3, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %3, align 4, !tbaa !5
  br label %94, !llvm.loop !13

180:                                              ; preds = %98
  %181 = load i32, ptr @n, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds i32, ptr @o, i64 %182
  %184 = load i32, ptr @n, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds i32, ptr %183, i64 %185
  call void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef @o, ptr noundef %186, ptr noundef @_Z3cmpii)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #9
  store double 0.000000e+00, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #9
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #9
  br label %187

187:                                              ; preds = %283, %180
  %188 = load i32, ptr %5, align 4, !tbaa !5
  %189 = load i32, ptr @n, align 4, !tbaa !5
  %190 = icmp slt i32 %188, %189
  br i1 %190, label %192, label %191

191:                                              ; preds = %187
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #9
  br label %286

192:                                              ; preds = %187
  %193 = load i32, ptr %5, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %194
  %196 = load i32, ptr %195, align 4, !tbaa !5
  store i32 %196, ptr %7, align 4, !tbaa !5
  %197 = load i32, ptr %7, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %198
  %200 = load double, ptr %199, align 8, !tbaa !9
  store double %200, ptr @L, align 8, !tbaa !9
  %201 = load i32, ptr %7, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %202
  %204 = load double, ptr %203, align 8, !tbaa !9
  store double %204, ptr @R, align 8, !tbaa !9
  %205 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %205, ptr %6, align 4, !tbaa !5
  br label %206

206:                                              ; preds = %279, %192
  %207 = load i32, ptr %6, align 4, !tbaa !5
  %208 = load i32, ptr %5, align 4, !tbaa !5
  %209 = load i32, ptr @n, align 4, !tbaa !5
  %210 = add nsw i32 %208, %209
  %211 = icmp slt i32 %207, %210
  br i1 %211, label %212, label %282

212:                                              ; preds = %206
  %213 = load i32, ptr %6, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  store i32 %216, ptr %8, align 4, !tbaa !5
  %217 = load i32, ptr %8, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %218
  %220 = load double, ptr %219, align 8, !tbaa !9
  %221 = load i32, ptr %7, align 4, !tbaa !5
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %222
  %224 = load double, ptr %223, align 8, !tbaa !9
  %225 = fsub double %220, %224
  %226 = call noundef i32 @_Z4dcmpd(double noundef %225)
  %227 = icmp sle i32 %226, 0
  br i1 %227, label %228, label %277

228:                                              ; preds = %212
  %229 = load i32, ptr %7, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %230
  %232 = load i32, ptr %8, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %233
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %231, ptr noundef nonnull align 8 dereferenceable(8) %234)
  %236 = load double, ptr %235, align 8, !tbaa !9
  store double %236, ptr @L, align 8, !tbaa !9
  %237 = load i32, ptr %7, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %238
  %240 = load i32, ptr %8, align 4, !tbaa !5
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %241
  %243 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %239, ptr noundef nonnull align 8 dereferenceable(8) %242)
  %244 = load double, ptr %243, align 8, !tbaa !9
  store double %244, ptr @R, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #9
  store i32 60, ptr %9, align 4, !tbaa !5
  br label %245

245:                                              ; preds = %271, %228
  %246 = load i32, ptr %9, align 4, !tbaa !5
  %247 = add nsw i32 %246, -1
  store i32 %247, ptr %9, align 4, !tbaa !5
  %248 = icmp ne i32 %246, 0
  br i1 %248, label %249, label %272

249:                                              ; preds = %245
  %250 = load double, ptr @L, align 8, !tbaa !9
  %251 = load double, ptr @R, align 8, !tbaa !9
  %252 = load double, ptr @L, align 8, !tbaa !9
  %253 = fsub double %251, %252
  %254 = fdiv double %253, 3.000000e+00
  %255 = fadd double %250, %254
  store double %255, ptr @U, align 8, !tbaa !9
  %256 = load double, ptr @R, align 8, !tbaa !9
  %257 = load double, ptr @R, align 8, !tbaa !9
  %258 = load double, ptr @L, align 8, !tbaa !9
  %259 = fsub double %257, %258
  %260 = fdiv double %259, 3.000000e+00
  %261 = fsub double %256, %260
  store double %261, ptr @V, align 8, !tbaa !9
  %262 = load double, ptr @U, align 8, !tbaa !9
  %263 = call noundef double @_Z4calcd(double noundef %262)
  %264 = load double, ptr @V, align 8, !tbaa !9
  %265 = call noundef double @_Z4calcd(double noundef %264)
  %266 = fcmp olt double %263, %265
  br i1 %266, label %267, label %269

267:                                              ; preds = %249
  %268 = load double, ptr @U, align 8, !tbaa !9
  store double %268, ptr @L, align 8, !tbaa !9
  br label %271

269:                                              ; preds = %249
  %270 = load double, ptr @V, align 8, !tbaa !9
  store double %270, ptr @R, align 8, !tbaa !9
  br label %271

271:                                              ; preds = %269, %267
  br label %245, !llvm.loop !14

272:                                              ; preds = %245
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #9
  %273 = load double, ptr @L, align 8, !tbaa !9
  %274 = call noundef double @_Z4calcd(double noundef %273)
  store double %274, ptr %10, align 8, !tbaa !9
  %275 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %276 = load double, ptr %275, align 8, !tbaa !9
  store double %276, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #9
  br label %278

277:                                              ; preds = %212
  br label %282

278:                                              ; preds = %272
  br label %279

279:                                              ; preds = %278
  %280 = load i32, ptr %6, align 4, !tbaa !5
  %281 = add nsw i32 %280, 1
  store i32 %281, ptr %6, align 4, !tbaa !5
  br label %206, !llvm.loop !15

282:                                              ; preds = %277, %206
  br label %283

283:                                              ; preds = %282
  %284 = load i32, ptr %5, align 4, !tbaa !5
  %285 = add nsw i32 %284, 1
  store i32 %285, ptr %5, align 4, !tbaa !5
  br label %187, !llvm.loop !16

286:                                              ; preds = %191
  %287 = load double, ptr %4, align 8, !tbaa !9
  %288 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %287)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #9
  br label %11, !llvm.loop !17

289:                                              ; preds = %11
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef, ptr noundef, ptr noundef) #7

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

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

declare i32 @printf(ptr noundef, ...) #6

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { "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 = { 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 #8 = { 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 #9 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


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

@_ZL2pi = external hidden local_unnamed_addr global double, align 8
@n = external dso_local global i32, align 4
@o = external dso_local global [509 x i32], align 16
@L = external dso_local local_unnamed_addr global double, align 8
@R = external dso_local local_unnamed_addr global double, align 8
@U = external dso_local local_unnamed_addr global double, align 8
@V = external dso_local local_unnamed_addr global double, align 8
@dis = external dso_local local_unnamed_addr global [509 x double], align 16
@the = external dso_local local_unnamed_addr global [509 x double], align 16
@det = external dso_local local_unnamed_addr global double, align 8
@x = external dso_local global [509 x double], align 16
@y = external dso_local global [509 x double], align 16
@rad = external dso_local global [509 x double], align 16
@l = external dso_local global [509 x double], align 16
@r = external dso_local global [509 x double], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z4dcmpd(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z3sqrd(double noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpii(i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_Z4calcd(double noundef) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #4

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #5 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %4 = icmp eq i32 %3, 1
  br i1 %4, label %.preheader59, label %._crit_edge72

.preheader59:                                     ; preds = %0, %._crit_edge71
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %7 = icmp sgt i32 %61, 0
  br i1 %7, label %.lr.ph62, label %._crit_edge

.lr.ph62:                                         ; preds = %.preheader
  %8 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %9 = zext nneg i32 %61 to i64
  %min.iters.check = icmp eq i32 %61, 1
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

scalar.ph.preheader:                              ; preds = %middle.block, %.lr.ph62
  %indvars.iv75.ph = phi i64 [ 0, %.lr.ph62 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.ph:                                        ; preds = %.lr.ph62
  %n.vec = and i64 %9, 2147483646
  %broadcast.splatinsert = insertelement <2 x double> poison, double %8, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %10 = or disjoint i64 %index, 1
  %11 = add nuw nsw i64 %index, %9
  %12 = add nuw nsw i64 %10, %9
  %13 = insertelement <2 x i64> poison, i64 %11, i64 0
  %14 = insertelement <2 x i64> %13, i64 %12, i64 1
  %15 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %11
  %16 = trunc <2 x i64> %14 to <2 x i32>
  store <2 x i32> %16, ptr %15, align 4, !tbaa !5
  %17 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %index
  %wide.load = load <2 x double>, ptr %17, align 16, !tbaa !9
  %18 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %11
  store <2 x double> %wide.load, ptr %18, align 8, !tbaa !9
  %19 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %index
  %wide.load90 = load <2 x double>, ptr %19, align 16, !tbaa !9
  %20 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %wide.load90)
  %21 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %11
  store <2 x double> %20, ptr %21, align 8, !tbaa !9
  %22 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %index
  %wide.load91 = load <2 x double>, ptr %22, align 16, !tbaa !9
  %23 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %11
  store <2 x double> %wide.load91, ptr %23, align 8, !tbaa !9
  %24 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %index
  %wide.load92 = load <2 x double>, ptr %24, align 16, !tbaa !9
  %25 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %wide.load92)
  %26 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %11
  store <2 x double> %25, ptr %26, align 8, !tbaa !9
  %27 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %index
  %wide.load93 = load <2 x double>, ptr %27, align 16, !tbaa !9
  %28 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %broadcast.splat, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %wide.load93)
  %29 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %11
  store <2 x double> %28, ptr %29, align 8, !tbaa !9
  %30 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %index
  %wide.load94 = load <2 x double>, ptr %30, align 16, !tbaa !9
  %31 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %11
  store <2 x double> %wide.load94, ptr %31, align 8, !tbaa !9
  %32 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %index
  %wide.load95 = load <2 x double>, ptr %32, align 16, !tbaa !9
  %33 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %11
  store <2 x double> %wide.load95, ptr %33, align 8, !tbaa !9
  %index.next = add nuw i64 %index, 2
  %34 = icmp eq i64 %index.next, %n.vec
  br i1 %34, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %9
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

.lr.ph:                                           ; preds = %.preheader59, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader59 ]
  %35 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %indvars.iv
  %36 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %36, ptr %35, align 4, !tbaa !5
  %37 = getelementptr inbounds double, ptr @x, i64 %indvars.iv
  %38 = getelementptr inbounds double, ptr @y, i64 %indvars.iv
  %39 = getelementptr inbounds double, ptr @rad, i64 %indvars.iv
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %37, ptr noundef nonnull %38, ptr noundef nonnull %39)
  %41 = load double, ptr %37, align 8, !tbaa !9
  %42 = call noundef double @_Z3sqrd(double noundef %41)
  %43 = load double, ptr %38, align 8, !tbaa !9
  %44 = call noundef double @_Z3sqrd(double noundef %43)
  %45 = fadd double %42, %44
  %46 = call double @sqrt(double noundef %45) #10
  %47 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %indvars.iv
  store double %46, ptr %47, align 8, !tbaa !9
  %48 = load double, ptr %38, align 8, !tbaa !9
  %49 = load double, ptr %37, align 8, !tbaa !9
  %50 = call double @atan2(double noundef %48, double noundef %49) #10
  %51 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %indvars.iv
  store double %50, ptr %51, align 8, !tbaa !9
  %52 = load double, ptr %39, align 8, !tbaa !9
  %53 = load double, ptr %47, align 8, !tbaa !9
  %54 = fdiv double %52, %53
  %55 = call double @asin(double noundef %54) #10
  store double %55, ptr @det, align 8, !tbaa !9
  %56 = load double, ptr %51, align 8, !tbaa !9
  %57 = fsub double %56, %55
  %58 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %indvars.iv
  store double %57, ptr %58, align 8, !tbaa !9
  %59 = fadd double %55, %56
  %60 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %indvars.iv
  store double %59, ptr %60, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = icmp slt i64 %indvars.iv.next, %62
  br i1 %63, label %.lr.ph, label %.preheader, !llvm.loop !15

._crit_edge:                                      ; preds = %scalar.ph, %middle.block, %.preheader59, %.preheader
  %.lcssa87 = phi i32 [ %61, %.preheader ], [ %5, %.preheader59 ], [ %61, %middle.block ], [ %61, %scalar.ph ]
  %64 = sext i32 %.lcssa87 to i64
  %65 = getelementptr inbounds i32, ptr @o, i64 %64
  %66 = getelementptr inbounds i32, ptr %65, i64 %64
  call void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef nonnull @o, ptr noundef nonnull %66, ptr noundef nonnull @_Z3cmpii)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #10
  store double 0.000000e+00, ptr %1, align 8, !tbaa !9
  %67 = load i32, ptr @n, align 4, !tbaa !5
  %68 = icmp sgt i32 %67, 0
  br i1 %68, label %.lr.ph70, label %._crit_edge71

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv75 = phi i64 [ %indvars.iv.next76, %scalar.ph ], [ %indvars.iv75.ph, %scalar.ph.preheader ]
  %69 = add nuw nsw i64 %indvars.iv75, %9
  %70 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %69
  %71 = trunc nuw i64 %69 to i32
  store i32 %71, ptr %70, align 4, !tbaa !5
  %72 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %indvars.iv75
  %73 = load double, ptr %72, align 8, !tbaa !9
  %74 = getelementptr inbounds [509 x double], ptr @dis, i64 0, i64 %69
  store double %73, ptr %74, align 8, !tbaa !9
  %75 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %indvars.iv75
  %76 = load double, ptr %75, align 8, !tbaa !9
  %77 = call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %76)
  %78 = getelementptr inbounds [509 x double], ptr @the, i64 0, i64 %69
  store double %77, ptr %78, align 8, !tbaa !9
  %79 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %indvars.iv75
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = getelementptr inbounds [509 x double], ptr @rad, i64 0, i64 %69
  store double %80, ptr %81, align 8, !tbaa !9
  %82 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %indvars.iv75
  %83 = load double, ptr %82, align 8, !tbaa !9
  %84 = call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %83)
  %85 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %69
  store double %84, ptr %85, align 8, !tbaa !9
  %86 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %indvars.iv75
  %87 = load double, ptr %86, align 8, !tbaa !9
  %88 = call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double %87)
  %89 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %69
  store double %88, ptr %89, align 8, !tbaa !9
  %90 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %indvars.iv75
  %91 = load double, ptr %90, align 8, !tbaa !9
  %92 = getelementptr inbounds [509 x double], ptr @x, i64 0, i64 %69
  store double %91, ptr %92, align 8, !tbaa !9
  %93 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %indvars.iv75
  %94 = load double, ptr %93, align 8, !tbaa !9
  %95 = getelementptr inbounds [509 x double], ptr @y, i64 0, i64 %69
  store double %94, ptr %95, align 8, !tbaa !9
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next76, %9
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !16

._crit_edge71.loopexit:                           ; preds = %._crit_edge66
  %.pre84 = load double, ptr %1, align 8, !tbaa !9
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge71.loopexit, %._crit_edge
  %96 = phi double [ %.pre84, %._crit_edge71.loopexit ], [ 0.000000e+00, %._crit_edge ]
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %96)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #10
  %98 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %99 = icmp eq i32 %98, 1
  br i1 %99, label %.preheader59, label %._crit_edge72, !llvm.loop !17

.lr.ph70:                                         ; preds = %._crit_edge, %._crit_edge66
  %100 = phi i32 [ %148, %._crit_edge66 ], [ %67, %._crit_edge ]
  %indvars.iv78 = phi i64 [ %indvars.iv.next79, %._crit_edge66 ], [ 0, %._crit_edge ]
  %101 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %indvars.iv78
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %103
  %105 = load double, ptr %104, align 8, !tbaa !9
  store double %105, ptr @L, align 8, !tbaa !9
  %106 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %103
  %107 = load double, ptr %106, align 8, !tbaa !9
  store double %107, ptr @R, align 8, !tbaa !9
  %108 = icmp sgt i32 %100, 0
  br i1 %108, label %.lr.ph65.preheader, label %._crit_edge66

.lr.ph65.preheader:                               ; preds = %.lr.ph70
  %109 = trunc nuw nsw i64 %indvars.iv78 to i32
  br label %.lr.ph65

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %139
  %indvars.iv80 = phi i64 [ %indvars.iv78, %.lr.ph65.preheader ], [ %indvars.iv.next81, %139 ]
  %110 = getelementptr inbounds [509 x i32], ptr @o, i64 0, i64 %indvars.iv80
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [509 x double], ptr @l, i64 0, i64 %112
  %114 = load double, ptr %113, align 8, !tbaa !9
  %115 = load double, ptr %106, align 8, !tbaa !9
  %116 = fsub double %114, %115
  %117 = call noundef i32 @_Z4dcmpd(double noundef %116)
  %118 = icmp slt i32 %117, 1
  br i1 %118, label %119, label %.lr.ph65.._crit_edge66.loopexit_crit_edge

.lr.ph65.._crit_edge66.loopexit_crit_edge:        ; preds = %.lr.ph65
  %.pre.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge66

119:                                              ; preds = %.lr.ph65
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %104, ptr noundef nonnull align 8 dereferenceable(8) %113)
  %121 = load double, ptr %120, align 8, !tbaa !9
  store double %121, ptr @L, align 8, !tbaa !9
  %122 = getelementptr inbounds [509 x double], ptr @r, i64 0, i64 %112
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %106, ptr noundef nonnull align 8 dereferenceable(8) %122)
  %124 = load double, ptr %123, align 8, !tbaa !9
  store double %124, ptr @R, align 8, !tbaa !9
  br label %125

125:                                              ; preds = %119, %125
  %126 = phi i32 [ 59, %119 ], [ %138, %125 ]
  %127 = load double, ptr @L, align 8, !tbaa !9
  %128 = load double, ptr @R, align 8, !tbaa !9
  %129 = fsub double %128, %127
  %130 = fdiv double %129, 3.000000e+00
  %131 = fadd double %127, %130
  store double %131, ptr @U, align 8, !tbaa !9
  %132 = fsub double %128, %130
  store double %132, ptr @V, align 8, !tbaa !9
  %133 = call noundef double @_Z4calcd(double noundef %131)
  %134 = load double, ptr @V, align 8, !tbaa !9
  %135 = call noundef double @_Z4calcd(double noundef %134)
  %136 = fcmp olt double %133, %135
  %L.R = select i1 %136, ptr @L, ptr @R
  %U.val = load double, ptr @U, align 8
  %V.val = load double, ptr @V, align 8
  %137 = select i1 %136, double %U.val, double %V.val
  store double %137, ptr %L.R, align 8, !tbaa !9
  %138 = add nsw i32 %126, -1
  %.not = icmp eq i32 %126, 0
  br i1 %.not, label %139, label %125, !llvm.loop !18

139:                                              ; preds = %125
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #10
  %140 = load double, ptr @L, align 8, !tbaa !9
  %141 = call noundef double @_Z4calcd(double noundef %140)
  store double %141, ptr %2, align 8, !tbaa !9
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %1, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %143 = load double, ptr %142, align 8, !tbaa !9
  store double %143, ptr %1, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #10
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %144 = load i32, ptr @n, align 4, !tbaa !5
  %145 = add nsw i32 %144, %109
  %146 = trunc nuw i64 %indvars.iv.next81 to i32
  %147 = icmp sgt i32 %145, %146
  br i1 %147, label %.lr.ph65, label %._crit_edge66, !llvm.loop !19

._crit_edge66:                                    ; preds = %139, %.lr.ph65.._crit_edge66.loopexit_crit_edge, %.lr.ph70
  %148 = phi i32 [ %100, %.lr.ph70 ], [ %.pre.pre, %.lr.ph65.._crit_edge66.loopexit_crit_edge ], [ %144, %139 ]
  %indvars.iv.next79 = add nuw nsw i64 %indvars.iv78, 1
  %149 = sext i32 %148 to i64
  %150 = icmp slt i64 %indvars.iv.next79, %149
  br i1 %150, label %.lr.ph70, label %._crit_edge71.loopexit, !llvm.loop !20

._crit_edge72:                                    ; preds = %._crit_edge71, %0
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiPFbiiEEvT_S3_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #7

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #9

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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 #6 = { 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 #7 = { 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 #8 = { 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 #9 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #10 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !14, !13}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}


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