; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (5794)

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

%struct.node = type { i64, i64 }

@dp = external dso_local global [2010 x i64], align 16
@point = external dso_local global [2010 x %struct.node], align 16
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3cmp4nodeS_(i64, i64, i64, i64) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5Lucasxx(i64 noundef, i64 noundef) #2

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

19:                                               ; preds = %251, %249, %0
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4)
  %21 = icmp ne i32 %20, -1
  br i1 %21, label %22, label %252

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  store i32 0, ptr %6, align 4, !tbaa !9
  call void @llvm.memset.p0.i64(ptr align 16 @dp, i8 0, i64 16080, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %52, %22
  %24 = load i32, ptr %9, align 4, !tbaa !9
  %25 = sext i32 %24 to i64
  %26 = load i64, ptr %4, align 8, !tbaa !5
  %27 = icmp slt i64 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %55

29:                                               ; preds = %23
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %7, ptr noundef %8)
  %31 = load i64, ptr %7, align 8, !tbaa !5
  %32 = load i64, ptr %2, align 8, !tbaa !5
  %33 = icmp eq i64 %31, %32
  br i1 %33, label %34, label %39

34:                                               ; preds = %29
  %35 = load i64, ptr %8, align 8, !tbaa !5
  %36 = load i64, ptr %3, align 8, !tbaa !5
  %37 = icmp eq i64 %35, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %34
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %39

39:                                               ; preds = %38, %34, %29
  %40 = load i64, ptr %7, align 8, !tbaa !5
  %41 = sub nsw i64 %40, 1
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %43
  %45 = getelementptr inbounds %struct.node, ptr %44, i32 0, i32 0
  store i64 %41, ptr %45, align 16, !tbaa !11
  %46 = load i64, ptr %8, align 8, !tbaa !5
  %47 = sub nsw i64 %46, 1
  %48 = load i32, ptr %9, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.node, ptr %50, i32 0, i32 1
  store i64 %47, ptr %51, align 8, !tbaa !13
  br label %52

52:                                               ; preds = %39
  %53 = load i32, ptr %9, align 4, !tbaa !9
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %9, align 4, !tbaa !9
  br label %23, !llvm.loop !14

55:                                               ; preds = %28
  %56 = load i64, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.node, ptr @point, i64 %56
  call void @_ZSt4sortIP4nodePFxS0_S0_EEvT_S4_T0_(ptr noundef @point, ptr noundef %57, ptr noundef @_Z3cmp4nodeS_)
  %58 = load i64, ptr %2, align 8, !tbaa !5
  %59 = sub nsw i64 %58, 1
  %60 = load i64, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %60
  %62 = getelementptr inbounds %struct.node, ptr %61, i32 0, i32 0
  store i64 %59, ptr %62, align 16, !tbaa !11
  %63 = load i64, ptr %3, align 8, !tbaa !5
  %64 = sub nsw i64 %63, 1
  %65 = load i64, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.node, ptr %66, i32 0, i32 1
  store i64 %64, ptr %67, align 8, !tbaa !13
  %68 = load i64, ptr %4, align 8, !tbaa !5
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %4, align 8, !tbaa !5
  %70 = load i64, ptr %4, align 8, !tbaa !5
  %71 = sub nsw i64 %70, 1
  %72 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %71
  %73 = getelementptr inbounds %struct.node, ptr %72, i32 0, i32 0
  %74 = load i64, ptr %73, align 16, !tbaa !11
  %75 = load i64, ptr %4, align 8, !tbaa !5
  %76 = sub nsw i64 %75, 1
  %77 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %76
  %78 = getelementptr inbounds %struct.node, ptr %77, i32 0, i32 1
  %79 = load i64, ptr %78, align 8, !tbaa !13
  %80 = add nsw i64 %74, %79
  %81 = srem i64 %80, 3
  %82 = icmp ne i64 %81, 0
  br i1 %82, label %86, label %83

83:                                               ; preds = %55
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %83, %55
  %87 = load i64, ptr %5, align 8, !tbaa !5
  %88 = add nsw i64 %87, 1
  store i64 %88, ptr %5, align 8, !tbaa !5
  %89 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %87, i32 noundef 0)
  store i32 2, ptr %10, align 4
  br label %249, !llvm.loop !16

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

91:                                               ; preds = %238, %90
  %92 = load i32, ptr %11, align 4, !tbaa !9
  %93 = sext i32 %92 to i64
  %94 = load i64, ptr %4, align 8, !tbaa !5
  %95 = icmp slt i64 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %91
  store i32 7, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %241

97:                                               ; preds = %91
  %98 = load i32, ptr %11, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.node, ptr %100, i32 0, i32 0
  %102 = load i64, ptr %101, align 16, !tbaa !11
  %103 = load i32, ptr %11, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %104
  %106 = getelementptr inbounds %struct.node, ptr %105, i32 0, i32 1
  %107 = load i64, ptr %106, align 8, !tbaa !13
  %108 = add nsw i64 %102, %107
  %109 = srem i64 %108, 3
  %110 = icmp eq i64 %109, 0
  br i1 %110, label %111, label %237

111:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %112 = load i32, ptr %11, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %113
  %115 = getelementptr inbounds %struct.node, ptr %114, i32 0, i32 0
  %116 = load i64, ptr %115, align 16, !tbaa !11
  %117 = load i32, ptr %11, align 4, !tbaa !9
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %118
  %120 = getelementptr inbounds %struct.node, ptr %119, i32 0, i32 1
  %121 = load i64, ptr %120, align 8, !tbaa !13
  %122 = add nsw i64 %116, %121
  %123 = sdiv i64 %122, 3
  store i64 %123, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  %124 = load i32, ptr %11, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.node, ptr %126, i32 0, i32 0
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.node, ptr %130, i32 0, i32 1
  %132 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef nonnull align 8 dereferenceable(8) %131)
  %133 = load i64, ptr %132, align 8, !tbaa !5
  %134 = load i64, ptr %12, align 8, !tbaa !5
  %135 = sub nsw i64 %133, %134
  store i64 %135, ptr %13, align 8, !tbaa !5
  %136 = load i64, ptr %12, align 8, !tbaa !5
  %137 = load i64, ptr %13, align 8, !tbaa !5
  %138 = call noundef i64 @_Z5Lucasxx(i64 noundef %136, i64 noundef %137)
  %139 = load i32, ptr %11, align 4, !tbaa !9
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %140
  store i64 %138, ptr %141, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #8
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %142

142:                                              ; preds = %233, %111
  %143 = load i32, ptr %14, align 4, !tbaa !9
  %144 = load i32, ptr %11, align 4, !tbaa !9
  %145 = icmp slt i32 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 10, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #8
  br label %236

147:                                              ; preds = %142
  %148 = load i32, ptr %14, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %149
  %151 = getelementptr inbounds %struct.node, ptr %150, i32 0, i32 1
  %152 = load i64, ptr %151, align 8, !tbaa !13
  %153 = load i32, ptr %11, align 4, !tbaa !9
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %154
  %156 = getelementptr inbounds %struct.node, ptr %155, i32 0, i32 1
  %157 = load i64, ptr %156, align 8, !tbaa !13
  %158 = icmp slt i64 %152, %157
  br i1 %158, label %159, label %232

159:                                              ; preds = %147
  %160 = load i32, ptr %14, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %161
  %163 = getelementptr inbounds %struct.node, ptr %162, i32 0, i32 0
  %164 = load i64, ptr %163, align 16, !tbaa !11
  %165 = load i32, ptr %11, align 4, !tbaa !9
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %166
  %168 = getelementptr inbounds %struct.node, ptr %167, i32 0, i32 0
  %169 = load i64, ptr %168, align 16, !tbaa !11
  %170 = icmp slt i64 %164, %169
  br i1 %170, label %171, label %232

171:                                              ; preds = %159
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %172 = load i32, ptr %11, align 4, !tbaa !9
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %173
  %175 = getelementptr inbounds %struct.node, ptr %174, i32 0, i32 0
  %176 = load i64, ptr %175, align 16, !tbaa !11
  %177 = load i32, ptr %14, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %178
  %180 = getelementptr inbounds %struct.node, ptr %179, i32 0, i32 0
  %181 = load i64, ptr %180, align 16, !tbaa !11
  %182 = sub nsw i64 %176, %181
  store i64 %182, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  %183 = load i32, ptr %11, align 4, !tbaa !9
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %184
  %186 = getelementptr inbounds %struct.node, ptr %185, i32 0, i32 1
  %187 = load i64, ptr %186, align 8, !tbaa !13
  %188 = load i32, ptr %14, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %189
  %191 = getelementptr inbounds %struct.node, ptr %190, i32 0, i32 1
  %192 = load i64, ptr %191, align 8, !tbaa !13
  %193 = sub nsw i64 %187, %192
  store i64 %193, ptr %16, align 8, !tbaa !5
  %194 = load i64, ptr %15, align 8, !tbaa !5
  %195 = load i64, ptr %16, align 8, !tbaa !5
  %196 = add nsw i64 %194, %195
  %197 = srem i64 %196, 3
  %198 = icmp eq i64 %197, 0
  br i1 %198, label %199, label %231

199:                                              ; preds = %171
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %200 = load i64, ptr %15, align 8, !tbaa !5
  %201 = load i64, ptr %16, align 8, !tbaa !5
  %202 = add nsw i64 %200, %201
  %203 = sdiv i64 %202, 3
  store i64 %203, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %204 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %15, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %205 = load i64, ptr %204, align 8, !tbaa !5
  %206 = load i64, ptr %17, align 8, !tbaa !5
  %207 = sub nsw i64 %205, %206
  store i64 %207, ptr %18, align 8, !tbaa !5
  %208 = load i64, ptr %17, align 8, !tbaa !5
  %209 = load i64, ptr %18, align 8, !tbaa !5
  %210 = call noundef i64 @_Z5Lucasxx(i64 noundef %208, i64 noundef %209)
  %211 = load i32, ptr %14, align 4, !tbaa !9
  %212 = sext i32 %211 to i64
  %213 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %212
  %214 = load i64, ptr %213, align 8, !tbaa !5
  %215 = mul nsw i64 %210, %214
  %216 = srem i64 %215, 110119
  %217 = load i32, ptr %11, align 4, !tbaa !9
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %218
  %220 = load i64, ptr %219, align 8, !tbaa !5
  %221 = sub nsw i64 %220, %216
  store i64 %221, ptr %219, align 8, !tbaa !5
  %222 = load i32, ptr %11, align 4, !tbaa !9
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %223
  %225 = load i64, ptr %224, align 8, !tbaa !5
  %226 = add nsw i64 %225, 110119
  %227 = srem i64 %226, 110119
  %228 = load i32, ptr %11, align 4, !tbaa !9
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %229
  store i64 %227, ptr %230, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  br label %231

231:                                              ; preds = %199, %171
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %232

232:                                              ; preds = %231, %159, %147
  br label %233

233:                                              ; preds = %232
  %234 = load i32, ptr %14, align 4, !tbaa !9
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %14, align 4, !tbaa !9
  br label %142, !llvm.loop !17

236:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %237

237:                                              ; preds = %236, %97
  br label %238

238:                                              ; preds = %237
  %239 = load i32, ptr %11, align 4, !tbaa !9
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %11, align 4, !tbaa !9
  br label %91, !llvm.loop !18

241:                                              ; preds = %96
  %242 = load i64, ptr %5, align 8, !tbaa !5
  %243 = add nsw i64 %242, 1
  store i64 %243, ptr %5, align 8, !tbaa !5
  %244 = load i64, ptr %4, align 8, !tbaa !5
  %245 = sub nsw i64 %244, 1
  %246 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %245
  %247 = load i64, ptr %246, align 8, !tbaa !5
  %248 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %242, i64 noundef %247)
  store i32 0, ptr %10, align 4
  br label %249

249:                                              ; preds = %241, %86
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  %250 = load i32, ptr %10, align 4
  switch i32 %250, label %254 [
    i32 0, label %251
    i32 2, label %19
  ]

251:                                              ; preds = %249
  br label %19, !llvm.loop !16

252:                                              ; preds = %19
  store i32 0, ptr %1, align 4
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #8
  %253 = load i32, ptr %1, align 4
  ret i32 %253

254:                                              ; preds = %249
  unreachable
}

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

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

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

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

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

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 = { 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 #3 = { 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 #4 = { "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 nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS4node", !6, i64 0, !6, i64 8}
!13 = !{!12, !6, i64 8}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.node = type { i64, i64 }

@dp = external dso_local local_unnamed_addr global [2010 x i64], align 16
@point = external dso_local global [2010 x %struct.node], align 16
@.str = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3cmp4nodeS_(i64, i64, i64, i64) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z5Lucasxx(i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  tail call void @_Z4initv()
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %.not60 = icmp eq i32 %8, -1
  br i1 %.not60, label %._crit_edge64, label %.lr.ph63

.lr.ph63:                                         ; preds = %0, %92
  %.061 = phi i64 [ %.1, %92 ], [ 1, %0 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16080) @dp, i8 0, i64 16080, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph63
  %.040.lcssa = phi i32 [ 0, %.lr.ph63 ], [ %.141, %.lr.ph ]
  %.lcssa = phi i64 [ %9, %.lr.ph63 ], [ %37, %.lr.ph ]
  %11 = getelementptr inbounds %struct.node, ptr @point, i64 %.lcssa
  call void @_ZSt4sortIP4nodePFxS0_S0_EEvT_S4_T0_(ptr noundef nonnull @point, ptr noundef nonnull %11, ptr noundef nonnull @_Z3cmp4nodeS_)
  %12 = load i64, ptr %1, align 8, !tbaa !5
  %13 = add nsw i64 %12, -1
  %14 = load i64, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %14
  store i64 %13, ptr %15, align 16, !tbaa !9
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %17 = add nsw i64 %16, -1
  %18 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %14, i32 1
  store i64 %17, ptr %18, align 8, !tbaa !11
  %19 = add nsw i64 %14, 1
  store i64 %19, ptr %3, align 8, !tbaa !5
  %20 = add nsw i64 %17, %13
  %21 = srem i64 %20, 3
  %22 = icmp ne i64 %21, 0
  %23 = icmp ne i32 %.040.lcssa, 0
  %or.cond = select i1 %22, i1 true, i1 %23
  br i1 %or.cond, label %39, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %24 = icmp sgt i64 %14, -1
  br i1 %24, label %.lr.ph57, label %._crit_edge58

.lr.ph:                                           ; preds = %.lr.ph63, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph63 ]
  %.04050 = phi i32 [ %.141, %.lr.ph ], [ 0, %.lr.ph63 ]
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %26 = load i64, ptr %4, align 8, !tbaa !5
  %27 = load i64, ptr %1, align 8, !tbaa !5
  %28 = icmp eq i64 %26, %27
  %29 = load i64, ptr %5, align 8
  %30 = load i64, ptr %2, align 8
  %31 = icmp eq i64 %29, %30
  %32 = select i1 %28, i1 %31, i1 false
  %.141 = select i1 %32, i32 1, i32 %.04050
  %33 = add nsw i64 %26, -1
  %34 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %indvars.iv
  store i64 %33, ptr %34, align 16, !tbaa !9
  %35 = add nsw i64 %29, -1
  %36 = getelementptr inbounds i8, ptr %34, i64 8
  store i64 %35, ptr %36, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %37 = load i64, ptr %3, align 8, !tbaa !5
  %38 = icmp sgt i64 %37, %indvars.iv.next
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !12

39:                                               ; preds = %._crit_edge
  %40 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.061, i32 noundef 0)
  br label %92, !llvm.loop !14

._crit_edge58:                                    ; preds = %.loopexit, %.preheader
  %.lcssa48 = phi i64 [ %19, %.preheader ], [ %90, %.loopexit ]
  %41 = add nsw i64 %.lcssa48, -1
  %42 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !5
  %44 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %.061, i64 noundef %43)
  br label %92

.lr.ph57:                                         ; preds = %.preheader, %.loopexit
  %indvars.iv72 = phi i64 [ %indvars.iv.next73, %.loopexit ], [ 0, %.preheader ]
  %45 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %indvars.iv72
  %46 = load i64, ptr %45, align 16, !tbaa !9
  %47 = getelementptr inbounds i8, ptr %45, i64 8
  %48 = load i64, ptr %47, align 8, !tbaa !11
  %49 = add nsw i64 %48, %46
  %50 = srem i64 %49, 3
  %51 = sdiv i64 %49, 3
  %52 = icmp eq i64 %50, 0
  br i1 %52, label %53, label %.loopexit

53:                                               ; preds = %.lr.ph57
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %45, ptr noundef nonnull align 8 dereferenceable(8) %47)
  %55 = load i64, ptr %54, align 8, !tbaa !5
  %56 = sub nsw i64 %55, %51
  %57 = call noundef i64 @_Z5Lucasxx(i64 noundef %51, i64 noundef %56)
  %58 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %indvars.iv72
  store i64 %57, ptr %58, align 8, !tbaa !5
  %.not65 = icmp eq i64 %indvars.iv72, 0
  br i1 %.not65, label %.loopexit, label %.lr.ph54

.lr.ph54:                                         ; preds = %53, %89
  %indvars.iv69 = phi i64 [ %indvars.iv.next70, %89 ], [ 0, %53 ]
  %59 = getelementptr inbounds [2010 x %struct.node], ptr @point, i64 0, i64 %indvars.iv69
  %60 = getelementptr inbounds i8, ptr %59, i64 8
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = load i64, ptr %47, align 8, !tbaa !11
  %63 = icmp slt i64 %61, %62
  br i1 %63, label %64, label %89

64:                                               ; preds = %.lr.ph54
  %65 = load i64, ptr %59, align 16, !tbaa !9
  %66 = load i64, ptr %45, align 16, !tbaa !9
  %67 = icmp slt i64 %65, %66
  br i1 %67, label %68, label %89

68:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  %69 = sub nsw i64 %66, %65
  store i64 %69, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %70 = sub nsw i64 %62, %61
  store i64 %70, ptr %7, align 8, !tbaa !5
  %71 = add nsw i64 %69, %70
  %72 = srem i64 %71, 3
  %73 = sdiv i64 %71, 3
  %74 = icmp eq i64 %72, 0
  br i1 %74, label %75, label %88

75:                                               ; preds = %68
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %77 = load i64, ptr %76, align 8, !tbaa !5
  %78 = sub nsw i64 %77, %73
  %79 = call noundef i64 @_Z5Lucasxx(i64 noundef %73, i64 noundef %78)
  %80 = getelementptr inbounds [2010 x i64], ptr @dp, i64 0, i64 %indvars.iv69
  %81 = load i64, ptr %80, align 8, !tbaa !5
  %82 = mul nsw i64 %81, %79
  %83 = srem i64 %82, 110119
  %84 = load i64, ptr %58, align 8, !tbaa !5
  %85 = add i64 %84, 110119
  %86 = sub i64 %85, %83
  %87 = srem i64 %86, 110119
  store i64 %87, ptr %58, align 8, !tbaa !5
  br label %88

88:                                               ; preds = %75, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  br label %89

89:                                               ; preds = %.lr.ph54, %64, %88
  %indvars.iv.next70 = add nuw nsw i64 %indvars.iv69, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next70, %indvars.iv72
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph54, !llvm.loop !15

.loopexit:                                        ; preds = %89, %53, %.lr.ph57
  %indvars.iv.next73 = add nuw nsw i64 %indvars.iv72, 1
  %90 = load i64, ptr %3, align 8, !tbaa !5
  %91 = icmp sgt i64 %90, %indvars.iv.next73
  br i1 %91, label %.lr.ph57, label %._crit_edge58, !llvm.loop !16

92:                                               ; preds = %._crit_edge58, %39
  %.1 = add nuw nsw i64 %.061, 1
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  %93 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %.not = icmp eq i32 %93, -1
  br i1 %.not, label %._crit_edge64, label %.lr.ph63

._crit_edge64:                                    ; preds = %92, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0
}

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

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

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

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

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

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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress 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 #4 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { 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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4node", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}


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