; LLVM IR from tangjz/acm-icpc :: lydsy/3964.ll (Z5solveii)

; 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
@a = external dso_local global [501 x i32], align 16

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z9getAnglesiid(i32 noundef, i32 noundef, double 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: nounwind
declare double @asin(double noundef) #2

; 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
define dso_local noundef double @_Z5solveii(i32 noundef %0, i32 noundef %1) #3 {
  %3 = alloca double, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca double, align 8
  %15 = alloca i32, align 4
  %16 = alloca double, align 8
  %17 = alloca double, align 8
  %18 = alloca i32, align 4
  %19 = alloca double, align 8
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sub nsw i32 %20, %21
  %23 = icmp slt i32 %22, 3
  br i1 %23, label %24, label %49

24:                                               ; preds = %2
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sub nsw i32 %25, %26
  %28 = icmp eq i32 %27, 2
  br i1 %28, label %29, label %48

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = icmp sgt i32 %33, %38
  br i1 %39, label %40, label %48

40:                                               ; preds = %29
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %46
  call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %47) #7
  br label %48

48:                                               ; preds = %40, %29, %24
  store double 0.000000e+00, ptr %3, align 8
  br label %276

49:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %50 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %50, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %51 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %51, ptr %8, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %76, %49
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %52
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = load i32, ptr %6, align 4, !tbaa !5
  %63 = add nsw i32 %62, %61
  store i32 %63, ptr %6, align 4, !tbaa !5
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr %8, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = icmp slt i32 %67, %71
  br i1 %72, label %73, label %75

73:                                               ; preds = %57
  %74 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %74, ptr %7, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %73, %57
  br label %76

76:                                               ; preds = %75
  %77 = load i32, ptr %8, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %8, align 4, !tbaa !5
  br label %52, !llvm.loop !9

79:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = call noundef double @_Z5solveii(i32 noundef %80, i32 noundef %81)
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  %85 = load i32, ptr %5, align 4, !tbaa !5
  %86 = call noundef double @_Z5solveii(i32 noundef %84, i32 noundef %85)
  %87 = fadd double %82, %86
  store double %87, ptr %9, align 8, !tbaa !11
  %88 = load i32, ptr %4, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds i32, ptr @a, i64 %89
  %91 = load i32, ptr %7, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds i32, ptr @a, i64 %92
  %94 = getelementptr inbounds i32, ptr %93, i64 1
  %95 = load i32, ptr %5, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds i32, ptr @a, i64 %96
  call void @_ZSt13inplace_mergeIPiEvT_S1_S1_(ptr noundef %90, ptr noundef %94, ptr noundef %97)
  %98 = load i32, ptr %5, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = mul nsw i32 %102, 2
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = icmp slt i32 %103, %104
  br i1 %105, label %106, label %274

106:                                              ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sub nsw i32 %107, 1
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = sitofp i32 %111 to double
  %113 = fdiv double %112, 2.000000e+00
  store double %113, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #7
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = load i32, ptr %5, align 4, !tbaa !5
  %116 = load double, ptr %10, align 8, !tbaa !11
  %117 = call noundef double @_Z9getAnglesiid(i32 noundef %114, i32 noundef %115, double noundef %116)
  %118 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %119 = fcmp olt double %117, %118
  %120 = zext i1 %119 to i8
  store i8 %120, ptr %12, align 1, !tbaa !13
  %121 = load i8, ptr %12, align 1, !tbaa !13, !range !15, !noundef !16
  %122 = trunc i8 %121 to i1
  br i1 %122, label %123, label %164

123:                                              ; preds = %106
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = sitofp i32 %124 to double
  %126 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %127 = fmul double %125, %126
  store double %127, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %160, %123
  %129 = load i32, ptr %13, align 4, !tbaa !5
  %130 = icmp slt i32 %129, 50
  br i1 %130, label %132, label %131

131:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %163

132:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %133 = load double, ptr %10, align 8, !tbaa !11
  %134 = load double, ptr %11, align 8, !tbaa !11
  %135 = load double, ptr %10, align 8, !tbaa !11
  %136 = fsub double %134, %135
  %137 = fdiv double %136, 2.000000e+00
  %138 = fadd double %133, %137
  store double %138, ptr %14, align 8, !tbaa !11
  %139 = load i32, ptr %4, align 4, !tbaa !5
  %140 = load i32, ptr %5, align 4, !tbaa !5
  %141 = sub nsw i32 %140, 1
  %142 = load double, ptr %14, align 8, !tbaa !11
  %143 = call noundef double @_Z9getAnglesiid(i32 noundef %139, i32 noundef %141, double noundef %142)
  %144 = load i32, ptr %5, align 4, !tbaa !5
  %145 = sub nsw i32 %144, 1
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = sitofp i32 %148 to double
  %150 = fdiv double %149, 2.000000e+00
  %151 = load double, ptr %14, align 8, !tbaa !11
  %152 = fdiv double %150, %151
  %153 = call double @asin(double noundef %152) #7
  %154 = fcmp olt double %143, %153
  br i1 %154, label %155, label %157

155:                                              ; preds = %132
  %156 = load double, ptr %14, align 8, !tbaa !11
  store double %156, ptr %10, align 8, !tbaa !11
  br label %159

157:                                              ; preds = %132
  %158 = load double, ptr %14, align 8, !tbaa !11
  store double %158, ptr %11, align 8, !tbaa !11
  br label %159

159:                                              ; preds = %157, %155
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %160

160:                                              ; preds = %159
  %161 = load i32, ptr %13, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %13, align 4, !tbaa !5
  br label %128, !llvm.loop !17

163:                                              ; preds = %131
  br label %194

164:                                              ; preds = %106
  %165 = load i32, ptr %6, align 4, !tbaa !5
  %166 = sitofp i32 %165 to double
  %167 = fdiv double %166, 2.000000e+00
  store double %167, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %168

168:                                              ; preds = %190, %164
  %169 = load i32, ptr %15, align 4, !tbaa !5
  %170 = icmp slt i32 %169, 50
  br i1 %170, label %172, label %171

171:                                              ; preds = %168
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %193

172:                                              ; preds = %168
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %173 = load double, ptr %10, align 8, !tbaa !11
  %174 = load double, ptr %11, align 8, !tbaa !11
  %175 = load double, ptr %10, align 8, !tbaa !11
  %176 = fsub double %174, %175
  %177 = fdiv double %176, 2.000000e+00
  %178 = fadd double %173, %177
  store double %178, ptr %16, align 8, !tbaa !11
  %179 = load i32, ptr %4, align 4, !tbaa !5
  %180 = load i32, ptr %5, align 4, !tbaa !5
  %181 = load double, ptr %16, align 8, !tbaa !11
  %182 = call noundef double @_Z9getAnglesiid(i32 noundef %179, i32 noundef %180, double noundef %181)
  %183 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %184 = fcmp olt double %182, %183
  br i1 %184, label %185, label %187

185:                                              ; preds = %172
  %186 = load double, ptr %16, align 8, !tbaa !11
  store double %186, ptr %11, align 8, !tbaa !11
  br label %189

187:                                              ; preds = %172
  %188 = load double, ptr %16, align 8, !tbaa !11
  store double %188, ptr %10, align 8, !tbaa !11
  br label %189

189:                                              ; preds = %187, %185
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %15, align 4, !tbaa !5
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %15, align 4, !tbaa !5
  br label %168, !llvm.loop !18

193:                                              ; preds = %171
  br label %194

194:                                              ; preds = %193, %163
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  store double 0.000000e+00, ptr %17, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %195 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %195, ptr %18, align 4, !tbaa !5
  br label %196

196:                                              ; preds = %232, %194
  %197 = load i32, ptr %18, align 4, !tbaa !5
  %198 = load i32, ptr %5, align 4, !tbaa !5
  %199 = load i8, ptr %12, align 1, !tbaa !13, !range !15, !noundef !16
  %200 = trunc i8 %199 to i1
  %201 = zext i1 %200 to i32
  %202 = sub nsw i32 %198, %201
  %203 = icmp slt i32 %197, %202
  br i1 %203, label %205, label %204

204:                                              ; preds = %196
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %235

205:                                              ; preds = %196
  %206 = load i32, ptr %18, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %207
  %209 = load i32, ptr %208, align 4, !tbaa !5
  %210 = sitofp i32 %209 to x86_fp80
  %211 = load double, ptr %10, align 8, !tbaa !11
  %212 = load double, ptr %10, align 8, !tbaa !11
  %213 = load i32, ptr %18, align 4, !tbaa !5
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !5
  %217 = load i32, ptr %18, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %218
  %220 = load i32, ptr %219, align 4, !tbaa !5
  %221 = mul nsw i32 %216, %220
  %222 = sitofp i32 %221 to double
  %223 = fdiv double %222, 4.000000e+00
  %224 = fneg double %223
  %225 = call double @llvm.fmuladd.f64(double %211, double %212, double %224)
  %226 = fpext double %225 to x86_fp80
  %227 = call x86_fp80 @sqrtl(x86_fp80 noundef %226) #7
  %228 = load double, ptr %17, align 8, !tbaa !11
  %229 = fpext double %228 to x86_fp80
  %230 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %210, x86_fp80 %227, x86_fp80 %229)
  %231 = fptrunc x86_fp80 %230 to double
  store double %231, ptr %17, align 8, !tbaa !11
  br label %232

232:                                              ; preds = %205
  %233 = load i32, ptr %18, align 4, !tbaa !5
  %234 = add nsw i32 %233, 1
  store i32 %234, ptr %18, align 4, !tbaa !5
  br label %196, !llvm.loop !19

235:                                              ; preds = %204
  %236 = load i8, ptr %12, align 1, !tbaa !13, !range !15, !noundef !16
  %237 = trunc i8 %236 to i1
  br i1 %237, label %238, label %269

238:                                              ; preds = %235
  %239 = load i32, ptr %5, align 4, !tbaa !5
  %240 = sub nsw i32 %239, 1
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %241
  %243 = load i32, ptr %242, align 4, !tbaa !5
  %244 = sitofp i32 %243 to x86_fp80
  %245 = load double, ptr %10, align 8, !tbaa !11
  %246 = load double, ptr %10, align 8, !tbaa !11
  %247 = load i32, ptr %5, align 4, !tbaa !5
  %248 = sub nsw i32 %247, 1
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  %252 = load i32, ptr %5, align 4, !tbaa !5
  %253 = sub nsw i32 %252, 1
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %254
  %256 = load i32, ptr %255, align 4, !tbaa !5
  %257 = mul nsw i32 %251, %256
  %258 = sitofp i32 %257 to double
  %259 = fdiv double %258, 4.000000e+00
  %260 = fneg double %259
  %261 = call double @llvm.fmuladd.f64(double %245, double %246, double %260)
  %262 = fpext double %261 to x86_fp80
  %263 = call x86_fp80 @sqrtl(x86_fp80 noundef %262) #7
  %264 = load double, ptr %17, align 8, !tbaa !11
  %265 = fpext double %264 to x86_fp80
  %266 = fneg x86_fp80 %244
  %267 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %266, x86_fp80 %263, x86_fp80 %265)
  %268 = fptrunc x86_fp80 %267 to double
  store double %268, ptr %17, align 8, !tbaa !11
  br label %269

269:                                              ; preds = %238, %235
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  %270 = load double, ptr %17, align 8, !tbaa !11
  %271 = fdiv double %270, 2.000000e+00
  store double %271, ptr %19, align 8, !tbaa !11
  %272 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %19)
  %273 = load double, ptr %272, align 8, !tbaa !11
  store double %273, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %274

274:                                              ; preds = %269, %79
  %275 = load double, ptr %9, align 8, !tbaa !11
  store double %275, ptr %3, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %276

276:                                              ; preds = %274, %48
  %277 = load double, ptr %3, align 8
  ret double %277
}

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

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

; Function Attrs: nounwind
declare x86_fp80 @sqrtl(x86_fp80 noundef) #2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #6

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !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"

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef double @_Z9getAnglesiid(i32 noundef, i32 noundef, double 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 nofree nounwind willreturn memory(write)
declare double @asin(double noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef double @_Z5solveii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #3 {
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = sub nsw i32 %1, %0
  %6 = icmp slt i32 %5, 3
  br i1 %6, label %12, label %.preheader

.preheader:                                       ; preds = %2
  %7 = icmp slt i32 %0, %1
  %8 = sext i32 %0 to i64
  %wide.trip.count = sext i32 %1 to i64
  br i1 %7, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader
  %9 = sub nsw i64 %wide.trip.count, %8
  %xtraiter = and i64 %9, 1
  %10 = add nsw i64 %wide.trip.count, -1
  %11 = icmp eq i64 %10, %8
  br i1 %11, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %9, -2
  br label %.lr.ph

12:                                               ; preds = %2
  %13 = icmp eq i32 %5, 2
  br i1 %13, label %14, label %126

14:                                               ; preds = %12
  %15 = sext i32 %0 to i64
  %16 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %15
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = add nsw i32 %0, 1
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %19
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = icmp sgt i32 %17, %21
  br i1 %22, label %23, label %126

23:                                               ; preds = %14
  tail call void @_ZSt4swapIiENSt9enable_ifIXsr6__and_ISt6__not_ISt15__is_tuple_likeIT_EESt21is_move_constructibleIS3_ESt18is_move_assignableIS3_EEE5valueEvE4typeERS3_SC_(ptr noundef nonnull align 4 dereferenceable(4) %16, ptr noundef nonnull align 4 dereferenceable(4) %20) #7
  br label %126

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph, %.lr.ph.preheader
  %.lcssa128.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %56, %.lr.ph ]
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ %8, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %.07895.unr = phi i32 [ 0, %.lr.ph.preheader ], [ %56, %.lr.ph ]
  %.08094.unr = phi i32 [ %0, %.lr.ph.preheader ], [ %spec.select.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge.loopexit, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %._crit_edge.loopexit.unr-lcssa
  %24 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %indvars.iv.unr
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = add nsw i32 %25, %.07895.unr
  %27 = sext i32 %.08094.unr to i64
  %28 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = icmp slt i32 %29, %25
  %31 = trunc nsw i64 %indvars.iv.unr to i32
  %spec.select.epil = select i1 %30, i32 %31, i32 %.08094.unr
  br label %._crit_edge.loopexit

._crit_edge.loopexit:                             ; preds = %._crit_edge.loopexit.unr-lcssa, %.lr.ph.epil
  %.lcssa128 = phi i32 [ %.lcssa128.ph, %._crit_edge.loopexit.unr-lcssa ], [ %26, %.lr.ph.epil ]
  %spec.select.lcssa = phi i32 [ %spec.select.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %spec.select.epil, %.lr.ph.epil ]
  %.pre119 = sext i32 %spec.select.lcssa to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.preheader, %._crit_edge.loopexit
  %.pre-phi120 = phi i64 [ %.pre119, %._crit_edge.loopexit ], [ %8, %.preheader ]
  %.080.lcssa = phi i32 [ %spec.select.lcssa, %._crit_edge.loopexit ], [ %0, %.preheader ]
  %.078.lcssa = phi i32 [ %.lcssa128, %._crit_edge.loopexit ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %32 = tail call noundef double @_Z5solveii(i32 noundef %0, i32 noundef %.080.lcssa)
  %33 = add nsw i32 %.080.lcssa, 1
  %34 = tail call noundef double @_Z5solveii(i32 noundef %33, i32 noundef %1)
  %35 = fadd double %32, %34
  store double %35, ptr %3, align 8, !tbaa !9
  %36 = getelementptr inbounds i32, ptr @a, i64 %8
  %37 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi120
  %38 = getelementptr inbounds i8, ptr %37, i64 4
  %39 = getelementptr inbounds i32, ptr @a, i64 %wide.trip.count
  tail call void @_ZSt13inplace_mergeIPiEvT_S1_S1_(ptr noundef nonnull %36, ptr noundef nonnull %38, ptr noundef nonnull %39)
  %40 = add nsw i32 %1, -1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = shl nsw i32 %43, 1
  %45 = icmp slt i32 %44, %.078.lcssa
  br i1 %45, label %62, label %124

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %indvars.iv = phi i64 [ %8, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %.07895 = phi i32 [ 0, %.lr.ph.preheader.new ], [ %56, %.lr.ph ]
  %.08094 = phi i32 [ %0, %.lr.ph.preheader.new ], [ %spec.select.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %46 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %indvars.iv
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = add nsw i32 %47, %.07895
  %49 = sext i32 %.08094 to i64
  %50 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = icmp slt i32 %51, %47
  %53 = trunc nsw i64 %indvars.iv to i32
  %spec.select = select i1 %52, i32 %53, i32 %.08094
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %54 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %indvars.iv.next
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = add nsw i32 %55, %48
  %57 = sext i32 %spec.select to i64
  %58 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = icmp slt i32 %59, %55
  %61 = trunc nsw i64 %indvars.iv.next to i32
  %spec.select.1 = select i1 %60, i32 %61, i32 %spec.select
  %indvars.iv.next.1 = add nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph, !llvm.loop !11

62:                                               ; preds = %._crit_edge
  %63 = sitofp i32 %43 to double
  %64 = fmul double %63, 5.000000e-01
  %65 = tail call noundef double @_Z9getAnglesiid(i32 noundef %0, i32 noundef %1, double noundef %64)
  %66 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %67 = fcmp olt double %65, %66
  %68 = sitofp i32 %.078.lcssa to double
  br i1 %67, label %69, label %83

69:                                               ; preds = %62
  %70 = fmul double %66, %68
  br label %71

71:                                               ; preds = %69, %71
  %.079102 = phi i32 [ 0, %69 ], [ %82, %71 ]
  %.082101 = phi double [ %70, %69 ], [ %.082., %71 ]
  %.084100 = phi double [ %64, %69 ], [ %..084, %71 ]
  %72 = fsub double %.082101, %.084100
  %73 = fmul double %72, 5.000000e-01
  %74 = fadd double %.084100, %73
  %75 = tail call noundef double @_Z9getAnglesiid(i32 noundef %0, i32 noundef %40, double noundef %74)
  %76 = load i32, ptr %42, align 4, !tbaa !5
  %77 = sitofp i32 %76 to double
  %78 = fmul double %77, 5.000000e-01
  %79 = fdiv double %78, %74
  %80 = tail call double @asin(double noundef %79) #7
  %81 = fcmp olt double %75, %80
  %..084 = select i1 %81, double %74, double %.084100
  %.082. = select i1 %81, double %.082101, double %74
  %82 = add nuw nsw i32 %.079102, 1
  %exitcond113.not = icmp eq i32 %82, 50
  br i1 %exitcond113.not, label %.loopexit, label %71, !llvm.loop !13

83:                                               ; preds = %62
  %84 = fmul double %68, 5.000000e-01
  br label %85

85:                                               ; preds = %83, %85
  %.07799 = phi i32 [ 0, %83 ], [ %92, %85 ]
  %.298 = phi double [ %84, %83 ], [ %..2, %85 ]
  %.28697 = phi double [ %64, %83 ], [ %.286., %85 ]
  %86 = fsub double %.298, %.28697
  %87 = fmul double %86, 5.000000e-01
  %88 = fadd double %.28697, %87
  %89 = tail call noundef double @_Z9getAnglesiid(i32 noundef %0, i32 noundef %1, double noundef %88)
  %90 = load double, ptr @_ZL2pi, align 8, !tbaa !9
  %91 = fcmp olt double %89, %90
  %.286. = select i1 %91, double %.28697, double %88
  %..2 = select i1 %91, double %88, double %.298
  %92 = add nuw nsw i32 %.07799, 1
  %exitcond112.not = icmp eq i32 %92, 50
  br i1 %exitcond112.not, label %.loopexit, label %85, !llvm.loop !14

.loopexit:                                        ; preds = %85, %71
  %.4 = phi double [ %..084, %71 ], [ %.286., %85 ]
  %.neg = sext i1 %67 to i32
  %93 = add i32 %.neg, %1
  %94 = icmp sgt i32 %93, %0
  br i1 %94, label %.lr.ph106.preheader, label %._crit_edge107

.lr.ph106.preheader:                              ; preds = %.loopexit
  %wide.trip.count117 = sext i32 %93 to i64
  br label %.lr.ph106

._crit_edge107:                                   ; preds = %.lr.ph106, %.loopexit
  %.075.lcssa = phi double [ 0.000000e+00, %.loopexit ], [ %106, %.lr.ph106 ]
  br i1 %67, label %107, label %120

.lr.ph106:                                        ; preds = %.lr.ph106.preheader, %.lr.ph106
  %indvars.iv114 = phi i64 [ %8, %.lr.ph106.preheader ], [ %indvars.iv.next115, %.lr.ph106 ]
  %.075103 = phi double [ 0.000000e+00, %.lr.ph106.preheader ], [ %106, %.lr.ph106 ]
  %95 = getelementptr inbounds [501 x i32], ptr @a, i64 0, i64 %indvars.iv114
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sitofp i32 %96 to x86_fp80
  %98 = mul nsw i32 %96, %96
  %99 = uitofp nneg i32 %98 to double
  %100 = fmul double %99, -2.500000e-01
  %101 = tail call double @llvm.fmuladd.f64(double %.4, double %.4, double %100)
  %102 = fpext double %101 to x86_fp80
  %103 = tail call x86_fp80 @sqrtl(x86_fp80 noundef %102) #7
  %104 = fpext double %.075103 to x86_fp80
  %105 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %97, x86_fp80 %103, x86_fp80 %104)
  %106 = fptrunc x86_fp80 %105 to double
  %indvars.iv.next115 = add nsw i64 %indvars.iv114, 1
  %exitcond118.not = icmp eq i64 %indvars.iv.next115, %wide.trip.count117
  br i1 %exitcond118.not, label %._crit_edge107, label %.lr.ph106, !llvm.loop !15

107:                                              ; preds = %._crit_edge107
  %108 = load i32, ptr %42, align 4, !tbaa !5
  %109 = sitofp i32 %108 to x86_fp80
  %110 = mul nsw i32 %108, %108
  %111 = uitofp nneg i32 %110 to double
  %112 = fmul double %111, -2.500000e-01
  %113 = tail call double @llvm.fmuladd.f64(double %.4, double %.4, double %112)
  %114 = fpext double %113 to x86_fp80
  %115 = tail call x86_fp80 @sqrtl(x86_fp80 noundef %114) #7
  %116 = fpext double %.075.lcssa to x86_fp80
  %117 = fneg x86_fp80 %109
  %118 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %117, x86_fp80 %115, x86_fp80 %116)
  %119 = fptrunc x86_fp80 %118 to double
  br label %120

120:                                              ; preds = %107, %._crit_edge107
  %.1 = phi double [ %119, %107 ], [ %.075.lcssa, %._crit_edge107 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %121 = fmul double %.1, 5.000000e-01
  store double %121, ptr %4, align 8, !tbaa !9
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %123 = load double, ptr %122, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %124

124:                                              ; preds = %120, %._crit_edge
  %125 = phi double [ %123, %120 ], [ %35, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  br label %126

126:                                              ; preds = %12, %14, %23, %124
  %.076 = phi double [ %125, %124 ], [ 0.000000e+00, %23 ], [ 0.000000e+00, %14 ], [ 0.000000e+00, %12 ]
  ret double %.076
}

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare x86_fp80 @sqrtl(x86_fp80 noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #6

; 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 #4

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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 #6 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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}


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