; LLVM IR from tangjz/acm-icpc :: codeforces (605C)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%class.anon = type { i8 }

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16
@ord = external dso_local global [100001 x i32], align 16
@tot = external dso_local global i32, align 4
@stk = external dso_local global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

20:                                               ; preds = %15
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds i32, ptr @a, i64 %22
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr @b, i64 %25
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %23, ptr noundef %26)
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %30
  store i32 %28, ptr %31, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %20
  %33 = load i32, ptr %2, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %2, align 4, !tbaa !5
  br label %15, !llvm.loop !9

35:                                               ; preds = %19
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr @ord, i64 %37
  %39 = getelementptr inbounds i32, ptr %38, i64 1
  call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef @ord, ptr noundef %39)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %120, %35
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %123

45:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %47
  %49 = load i32, ptr %48, align 4, !tbaa !5
  store i32 %49, ptr %6, align 4, !tbaa !5
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %53, label %52

52:                                               ; preds = %45
  store i32 7, ptr %5, align 4
  br label %117

53:                                               ; preds = %45
  br label %54

54:                                               ; preds = %74, %53
  %55 = load i32, ptr @tot, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 1
  br i1 %56, label %57, label %71

57:                                               ; preds = %54
  %58 = load i32, ptr @tot, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 2
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = load i32, ptr @tot, align 4, !tbaa !5
  %64 = sub nsw i32 %63, 1
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = call noundef i64 @_Z6cross3iii(i32 noundef %62, i32 noundef %67, i32 noundef %68)
  %70 = icmp sle i64 %69, 0
  br label %71

71:                                               ; preds = %57, %54
  %72 = phi i1 [ false, %54 ], [ %70, %57 ]
  br i1 %72, label %73, label %77

73:                                               ; preds = %71
  br label %74

74:                                               ; preds = %73
  %75 = load i32, ptr @tot, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr @tot, align 4, !tbaa !5
  br label %54, !llvm.loop !11

77:                                               ; preds = %71
  %78 = load i32, ptr @tot, align 4, !tbaa !5
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %89

80:                                               ; preds = %77
  %81 = load i32, ptr @tot, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = call noundef i64 @_Z6cross2ii(i32 noundef %85, i32 noundef %86)
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %89, label %95

89:                                               ; preds = %80, %77
  %90 = load i32, ptr %6, align 4, !tbaa !5
  %91 = load i32, ptr @tot, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr @tot, align 4, !tbaa !5
  %93 = sext i32 %91 to i64
  %94 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %93
  store i32 %90, ptr %94, align 4, !tbaa !5
  br label %116

95:                                               ; preds = %80
  %96 = load i32, ptr @tot, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %98
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = icmp slt i32 %103, %107
  br i1 %108, label %109, label %115

109:                                              ; preds = %95
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = load i32, ptr @tot, align 4, !tbaa !5
  %112 = sub nsw i32 %111, 1
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %113
  store i32 %110, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %109, %95
  br label %116

116:                                              ; preds = %115, %89
  store i32 0, ptr %5, align 4
  br label %117

117:                                              ; preds = %116, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %118 = load i32, ptr %5, align 4
  switch i32 %118, label %278 [
    i32 0, label %119
    i32 7, label %120
  ]

119:                                              ; preds = %117
  br label %120

120:                                              ; preds = %119, %117
  %121 = load i32, ptr %4, align 4, !tbaa !5
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !12

123:                                              ; preds = %44
  br label %124

124:                                              ; preds = %149, %123
  %125 = load i32, ptr @tot, align 4, !tbaa !5
  %126 = icmp sgt i32 %125, 1
  br i1 %126, label %127, label %146

127:                                              ; preds = %124
  %128 = load i32, ptr @tot, align 4, !tbaa !5
  %129 = sub nsw i32 %128, 1
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = load i32, ptr @tot, align 4, !tbaa !5
  %137 = sub nsw i32 %136, 2
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sub nsw i32 %135, %143
  %145 = icmp slt i32 %144, 0
  br label %146

146:                                              ; preds = %127, %124
  %147 = phi i1 [ false, %124 ], [ %145, %127 ]
  br i1 %147, label %148, label %152

148:                                              ; preds = %146
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr @tot, align 4, !tbaa !5
  %151 = add nsw i32 %150, -1
  store i32 %151, ptr @tot, align 4, !tbaa !5
  br label %124, !llvm.loop !13

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

153:                                              ; preds = %179, %152
  %154 = load i32, ptr %7, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  %156 = load i32, ptr @tot, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %158, label %176

158:                                              ; preds = %153
  %159 = load i32, ptr %7, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = add nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = sub nsw i32 %165, %173
  %175 = icmp slt i32 %174, 0
  br label %176

176:                                              ; preds = %158, %153
  %177 = phi i1 [ false, %153 ], [ %175, %158 ]
  br i1 %177, label %178, label %182

178:                                              ; preds = %176
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %7, align 4, !tbaa !5
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %7, align 4, !tbaa !5
  br label %153, !llvm.loop !14

182:                                              ; preds = %176
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %183 = load i32, ptr @a, align 16, !tbaa !5
  %184 = sitofp i32 %183 to double
  %185 = load i32, ptr %7, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %189
  %191 = load i32, ptr %190, align 4, !tbaa !5
  %192 = sitofp i32 %191 to double
  %193 = fdiv double %184, %192
  store double %193, ptr %9, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %194 = load i32, ptr @b, align 16, !tbaa !5
  %195 = sitofp i32 %194 to double
  %196 = load i32, ptr @tot, align 4, !tbaa !5
  %197 = sub nsw i32 %196, 1
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %198
  %200 = load i32, ptr %199, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %201
  %203 = load i32, ptr %202, align 4, !tbaa !5
  %204 = sitofp i32 %203 to double
  %205 = fdiv double %195, %204
  store double %205, ptr %10, align 8, !tbaa !15
  %206 = 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) %10)
  %207 = load double, ptr %206, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  store double %207, ptr %8, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %208 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %208, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %209 = load i32, ptr %11, align 4, !tbaa !5
  %210 = add nsw i32 %209, 1
  store i32 %210, ptr %12, align 4, !tbaa !5
  br label %211

211:                                              ; preds = %270, %182
  %212 = load i32, ptr %12, align 4, !tbaa !5
  %213 = load i32, ptr @tot, align 4, !tbaa !5
  %214 = icmp slt i32 %212, %213
  br i1 %214, label %216, label %215

215:                                              ; preds = %211
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %274

216:                                              ; preds = %211
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %217 = load i32, ptr @a, align 16, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = load i32, ptr %12, align 4, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %220
  %222 = load i32, ptr %221, align 4, !tbaa !5
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %223
  %225 = load i32, ptr %224, align 4, !tbaa !5
  %226 = load i32, ptr %11, align 4, !tbaa !5
  %227 = sext i32 %226 to i64
  %228 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %230
  %232 = load i32, ptr %231, align 4, !tbaa !5
  %233 = sub nsw i32 %225, %232
  %234 = sext i32 %233 to i64
  %235 = mul nsw i64 %218, %234
  %236 = load i32, ptr @b, align 16, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = load i32, ptr %11, align 4, !tbaa !5
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !5
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %242
  %244 = load i32, ptr %243, align 4, !tbaa !5
  %245 = load i32, ptr %12, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %246
  %248 = load i32, ptr %247, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %249
  %251 = load i32, ptr %250, align 4, !tbaa !5
  %252 = sub nsw i32 %244, %251
  %253 = sext i32 %252 to i64
  %254 = mul nsw i64 %237, %253
  %255 = add nsw i64 %235, %254
  %256 = sitofp i64 %255 to double
  %257 = load i32, ptr %11, align 4, !tbaa !5
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !5
  %261 = load i32, ptr %12, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %262
  %264 = load i32, ptr %263, align 4, !tbaa !5
  %265 = call noundef i64 @_Z6cross2ii(i32 noundef %260, i32 noundef %264)
  %266 = sitofp i64 %265 to double
  %267 = fdiv double %256, %266
  store double %267, ptr %13, align 8, !tbaa !15
  %268 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %13)
  %269 = load double, ptr %268, align 8, !tbaa !15
  store double %269, ptr %8, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  br label %270

270:                                              ; preds = %216
  %271 = load i32, ptr %12, align 4, !tbaa !5
  store i32 %271, ptr %11, align 4, !tbaa !5
  %272 = load i32, ptr %12, align 4, !tbaa !5
  %273 = add nsw i32 %272, 1
  store i32 %273, ptr %12, align 4, !tbaa !5
  br label %211, !llvm.loop !17

274:                                              ; preds = %215
  %275 = load double, ptr %8, align 8, !tbaa !15
  %276 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %275)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %277 = load i32, ptr %1, align 4
  ret i32 %277

278:                                              ; preds = %117
  unreachable
}

declare i32 @__isoc99_scanf(ptr 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z6cross3iii(i32 noundef, i32 noundef, i32 noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z6cross2ii(i32 noundef, i32 noundef) #4

; 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

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

attributes #0 = { 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 #1 = { "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 = { 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 #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 = { nounwind }

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

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

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@b = external dso_local global [100001 x i32], align 16
@ord = external dso_local global [100001 x i32], align 16
@tot = external dso_local local_unnamed_addr global i32, align 4
@stk = external dso_local local_unnamed_addr global [100001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not53 = icmp slt i32 %6, 0
  br i1 %.not53, label %.._crit_edge_crit_edge, label %.lr.ph

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre85 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre85, %.._crit_edge_crit_edge ], [ %16, %.lr.ph ]
  %7 = getelementptr inbounds i32, ptr @ord, i64 %.pre-phi
  %8 = getelementptr inbounds i8, ptr %7, i64 4
  tail call void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @ord, ptr noundef nonnull %8)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %.not4557 = icmp slt i32 %9, 0
  br i1 %.not4557, label %thread-pre-split49, label %.lr.ph60

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %10 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %11 = getelementptr inbounds i32, ptr @b, i64 %indvars.iv
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %13 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %14, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %.not.not = icmp slt i64 %indvars.iv, %16
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.lr.ph60:                                         ; preds = %._crit_edge, %58
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %58 ], [ 0, %._crit_edge ]
  %17 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv71
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %.not46 = icmp eq i32 %18, 0
  br i1 %.not46, label %58, label %thread-pre-split

thread-pre-split:                                 ; preds = %.lr.ph60
  %.pr = load i32, ptr @tot, align 4, !tbaa !5
  %19 = icmp sgt i32 %.pr, 1
  br i1 %19, label %.lr.ph55, label %.critedge

.lr.ph55:                                         ; preds = %thread-pre-split, %31
  %20 = phi i32 [ %32, %31 ], [ %.pr, %thread-pre-split ]
  %21 = add nsw i32 %20, -2
  %22 = zext nneg i32 %21 to i64
  %23 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %22
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = add nsw i32 %20, -1
  %26 = zext nneg i32 %25 to i64
  %27 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = tail call noundef i64 @_Z6cross3iii(i32 noundef %24, i32 noundef %28, i32 noundef %18)
  %30 = icmp slt i64 %29, 1
  %.pre.pre = load i32, ptr @tot, align 4, !tbaa !5
  br i1 %30, label %31, label %.critedge

31:                                               ; preds = %.lr.ph55
  %32 = add nsw i32 %.pre.pre, -1
  store i32 %32, ptr @tot, align 4, !tbaa !5
  %33 = icmp sgt i32 %.pre.pre, 2
  br i1 %33, label %.lr.ph55, label %.critedge, !llvm.loop !11

.critedge:                                        ; preds = %.lr.ph55, %31, %thread-pre-split
  %34 = phi i32 [ %.pr, %thread-pre-split ], [ %.pre.pre, %.lr.ph55 ], [ %32, %31 ]
  %.not47 = icmp eq i32 %34, 0
  br i1 %.not47, label %41, label %35

35:                                               ; preds = %.critedge
  %36 = add nsw i32 %34, -1
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = tail call noundef i64 @_Z6cross2ii(i32 noundef %39, i32 noundef %18)
  %.not48 = icmp eq i64 %40, 0
  %.pre83 = load i32, ptr @tot, align 4, !tbaa !5
  br i1 %.not48, label %46, label %41

41:                                               ; preds = %35, %.critedge
  %42 = phi i32 [ %.pre83, %35 ], [ 0, %.critedge ]
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr @tot, align 4, !tbaa !5
  %44 = sext i32 %42 to i64
  %45 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %44
  br label %.sink.split

46:                                               ; preds = %35
  %47 = add nsw i32 %.pre83, -1
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sext i32 %18 to i64
  %55 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = icmp slt i32 %53, %56
  br i1 %57, label %.sink.split, label %58

.sink.split:                                      ; preds = %46, %41
  %.sink = phi ptr [ %45, %41 ], [ %49, %46 ]
  store i32 %18, ptr %.sink, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %.sink.split, %46, %.lr.ph60
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %.not45.not = icmp slt i64 %indvars.iv71, %60
  br i1 %.not45.not, label %.lr.ph60, label %thread-pre-split49, !llvm.loop !12

thread-pre-split49:                               ; preds = %58, %._crit_edge
  %.pr50 = load i32, ptr @tot, align 4, !tbaa !5
  %61 = icmp sgt i32 %.pr50, 1
  br i1 %61, label %.lr.ph61.preheader, label %.critedge2

.lr.ph61.preheader:                               ; preds = %thread-pre-split49
  %62 = zext nneg i32 %.pr50 to i64
  br label %.lr.ph61

.lr.ph61:                                         ; preds = %.lr.ph61.preheader, %75
  %indvars.iv74 = phi i64 [ %62, %.lr.ph61.preheader ], [ %indvars.iv.next75, %75 ]
  %indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
  %63 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %indvars.iv.next75
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = add nsw i64 %indvars.iv74, -2
  %69 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp slt i32 %67, %73
  br i1 %74, label %75, label %.critedge2.loopexit.split.loop.exit95

75:                                               ; preds = %.lr.ph61
  %76 = trunc nuw nsw i64 %indvars.iv.next75 to i32
  store i32 %76, ptr @tot, align 4, !tbaa !5
  %77 = icmp ugt i64 %indvars.iv74, 2
  br i1 %77, label %.lr.ph61, label %.critedge2, !llvm.loop !13

.critedge2.loopexit.split.loop.exit95:            ; preds = %.lr.ph61
  %78 = trunc nuw nsw i64 %indvars.iv74 to i32
  br label %.critedge2

.critedge2:                                       ; preds = %75, %.critedge2.loopexit.split.loop.exit95, %thread-pre-split49
  %.lcssa51 = phi i32 [ %.pr50, %thread-pre-split49 ], [ %78, %.critedge2.loopexit.split.loop.exit95 ], [ 1, %75 ]
  %smax = tail call i32 @llvm.smax.i32(i32 %.lcssa51, i32 1)
  %79 = add nsw i32 %smax, -1
  %wide.trip.count = zext nneg i32 %79 to i64
  br label %80

80:                                               ; preds = %81, %.critedge2
  %indvars.iv77 = phi i64 [ %indvars.iv.next78, %81 ], [ 0, %.critedge2 ]
  %exitcond.not = icmp eq i64 %indvars.iv77, %wide.trip.count
  br i1 %exitcond.not, label %.critedge4, label %81

81:                                               ; preds = %80
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %82 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %indvars.iv77
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %indvars.iv.next78
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp slt i32 %86, %91
  br i1 %92, label %80, label %..critedge4_crit_edge, !llvm.loop !14

..critedge4_crit_edge:                            ; preds = %81
  %93 = trunc nuw nsw i64 %indvars.iv.next78 to i32
  %94 = trunc nuw nsw i64 %indvars.iv77 to i32
  %.pre86 = and i64 %indvars.iv77, 4294967295
  br label %.critedge4

.critedge4:                                       ; preds = %80, %..critedge4_crit_edge
  %.pre-phi87 = phi i64 [ %.pre86, %..critedge4_crit_edge ], [ %wide.trip.count, %80 ]
  %.037.lcssa = phi i32 [ %94, %..critedge4_crit_edge ], [ %79, %80 ]
  %.lcssa = phi i32 [ %93, %..critedge4_crit_edge ], [ %smax, %80 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %95 = load i32, ptr @a, align 16, !tbaa !5
  %96 = sitofp i32 %95 to double
  %97 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %.pre-phi87
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = sitofp i32 %101 to double
  %103 = fdiv double %96, %102
  store double %103, ptr %2, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %104 = load i32, ptr @b, align 16, !tbaa !5
  %105 = sitofp i32 %104 to double
  %106 = add nsw i32 %.lcssa51, -1
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !5
  %113 = sitofp i32 %112 to double
  %114 = fdiv double %105, %113
  store double %114, ptr %3, align 8, !tbaa !15
  %115 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %116 = load double, ptr %115, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  store double %116, ptr %1, align 8, !tbaa !15
  %117 = load i32, ptr @tot, align 4, !tbaa !5
  %118 = icmp slt i32 %.lcssa, %117
  br i1 %118, label %.lr.ph67.preheader, label %._crit_edge68

.lr.ph67.preheader:                               ; preds = %.critedge4
  %119 = zext nneg i32 %.lcssa to i64
  br label %.lr.ph67

._crit_edge68:                                    ; preds = %.lr.ph67, %.critedge4
  %120 = phi double [ %116, %.critedge4 ], [ %153, %.lr.ph67 ]
  %121 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %120)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

.lr.ph67:                                         ; preds = %.lr.ph67.preheader, %.lr.ph67
  %indvars.iv80 = phi i64 [ %119, %.lr.ph67.preheader ], [ %indvars.iv.next81, %.lr.ph67 ]
  %.03665 = phi i32 [ %.037.lcssa, %.lr.ph67.preheader ], [ %157, %.lr.ph67 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %122 = load i32, ptr @a, align 16, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %indvars.iv80
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = sext i32 %.03665 to i64
  %130 = getelementptr inbounds [100001 x i32], ptr @stk, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [100001 x i32], ptr @b, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = sub nsw i32 %128, %134
  %136 = sext i32 %135 to i64
  %137 = mul nsw i64 %136, %123
  %138 = load i32, ptr @b, align 16, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %132
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %126
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = sub nsw i32 %141, %143
  %145 = sext i32 %144 to i64
  %146 = mul nsw i64 %145, %139
  %147 = add nsw i64 %146, %137
  %148 = sitofp i64 %147 to double
  %149 = call noundef i64 @_Z6cross2ii(i32 noundef %131, i32 noundef %125)
  %150 = sitofp i64 %149 to double
  %151 = fdiv double %148, %150
  store double %151, ptr %4, align 8, !tbaa !15
  %152 = 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) %4)
  %153 = load double, ptr %152, align 8, !tbaa !15
  store double %153, ptr %1, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %154 = load i32, ptr @tot, align 4, !tbaa !5
  %155 = trunc nuw i64 %indvars.iv.next81 to i32
  %156 = icmp sgt i32 %154, %155
  %157 = trunc nuw nsw i64 %indvars.iv80 to i32
  br i1 %156, label %.lr.ph67, label %._crit_edge68, !llvm.loop !17
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPiZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i64 @_Z6cross3iii(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z6cross2ii(i32 noundef, i32 noundef) local_unnamed_addr #4

; 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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #5

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

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

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


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