; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/WF/Easy Medium/WALL/A.ll (Z5solvev)

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

@d = external dso_local global [524298 x i64], align 16
@x = external dso_local global [524298 x i64], align 16
@f = external dso_local global [524298 x i32], align 16
@pos = external dso_local global [524298 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [104 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

27:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %38

28:                                               ; preds = %22
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [524298 x i32], ptr @f, i64 0, i64 %30
  store i32 0, ptr %31, align 4, !tbaa !5
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %33
  store i32 -1, ptr %34, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %28
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %4, align 4, !tbaa !5
  br label %22, !llvm.loop !11

38:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %39 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %5, ptr noundef %6, ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %51, %38
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = load i64, ptr %3, align 8, !tbaa !9
  %44 = icmp slt i64 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %54

46:                                               ; preds = %40
  %47 = load i32, ptr %8, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds i64, ptr @d, i64 %48
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %49)
  br label %51

51:                                               ; preds = %46
  %52 = load i32, ptr %8, align 4, !tbaa !5
  %53 = add nsw i32 %52, 1
  store i32 %53, ptr %8, align 4, !tbaa !5
  br label %40, !llvm.loop !13

54:                                               ; preds = %45
  %55 = load i64, ptr @x, align 16, !tbaa !9
  %56 = icmp eq i64 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  br label %60

58:                                               ; preds = %54
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 66, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

59:                                               ; No predecessors!
  br label %60

60:                                               ; preds = %59, %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %95, %60
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = load i64, ptr %3, align 8, !tbaa !9
  %65 = add nsw i64 %64, 1
  %66 = icmp sle i64 %63, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %61
  %69 = load i64, ptr %7, align 8, !tbaa !9
  %70 = getelementptr inbounds [524298 x i32], ptr @f, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !5
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = load i64, ptr %7, align 8, !tbaa !9
  %75 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %74
  store i32 %73, ptr %75, align 4, !tbaa !5
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = sub nsw i32 %76, 1
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !9
  %81 = load i64, ptr %7, align 8, !tbaa !9
  %82 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %81
  %83 = load i64, ptr %82, align 8, !tbaa !9
  %84 = add nsw i64 %80, %83
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %86
  store i64 %84, ptr %87, align 8, !tbaa !9
  %88 = load i64, ptr %5, align 8, !tbaa !9
  %89 = load i64, ptr %7, align 8, !tbaa !9
  %90 = mul nsw i64 %88, %89
  %91 = load i64, ptr %6, align 8, !tbaa !9
  %92 = add nsw i64 %90, %91
  %93 = load i64, ptr %3, align 8, !tbaa !9
  %94 = srem i64 %92, %93
  store i64 %94, ptr %7, align 8, !tbaa !9
  br label %95

95:                                               ; preds = %68
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %9, align 4, !tbaa !5
  br label %61, !llvm.loop !14

98:                                               ; preds = %67
  %99 = load i64, ptr %2, align 8, !tbaa !9
  %100 = sub nsw i64 %99, 1
  %101 = load i64, ptr %3, align 8, !tbaa !9
  %102 = add nsw i64 %101, 1
  %103 = icmp sle i64 %100, %102
  br i1 %103, label %104, label %123

104:                                              ; preds = %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %105 = load i64, ptr %1, align 8, !tbaa !9
  %106 = load i64, ptr %2, align 8, !tbaa !9
  %107 = sub nsw i64 %106, 1
  %108 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !9
  %110 = mul nsw i64 %105, %109
  store i64 %110, ptr %10, align 8, !tbaa !9
  %111 = load i64, ptr %10, align 8, !tbaa !9
  %112 = srem i64 %111, 2
  %113 = icmp eq i64 %112, 0
  br i1 %113, label %114, label %118

114:                                              ; preds = %104
  %115 = load i64, ptr %10, align 8, !tbaa !9
  %116 = sdiv i64 %115, 2
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %116)
  br label %122

118:                                              ; preds = %104
  %119 = load i64, ptr %10, align 8, !tbaa !9
  %120 = sdiv i64 %119, 2
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %120)
  br label %122

122:                                              ; preds = %118, %114
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %263

123:                                              ; preds = %98
  store i64 -1, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %124

124:                                              ; preds = %140, %123
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = load i64, ptr %3, align 8, !tbaa !9
  %128 = icmp slt i64 %126, %127
  br i1 %128, label %130, label %129

129:                                              ; preds = %124
  store i32 11, ptr %11, align 4
  br label %143

130:                                              ; preds = %124
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [524298 x i32], ptr @f, i64 0, i64 %132
  %134 = load i32, ptr %133, align 4, !tbaa !5
  %135 = icmp sgt i32 %134, 1
  br i1 %135, label %136, label %139

136:                                              ; preds = %130
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  store i64 %138, ptr %7, align 8, !tbaa !9
  store i32 11, ptr %11, align 4
  br label %143

139:                                              ; preds = %130
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %12, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %12, align 4, !tbaa !5
  br label %124, !llvm.loop !15

143:                                              ; preds = %136, %129
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %144

144:                                              ; preds = %143
  %145 = load i64, ptr %7, align 8, !tbaa !9
  %146 = icmp ne i64 %145, -1
  br i1 %146, label %147, label %148

147:                                              ; preds = %144
  br label %150

148:                                              ; preds = %144
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.4, i32 noundef 95, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

149:                                              ; No predecessors!
  br label %150

150:                                              ; preds = %149, %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  %151 = load i64, ptr %7, align 8, !tbaa !9
  %152 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !9
  store i64 %153, ptr %13, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %154 = load i64, ptr %7, align 8, !tbaa !9
  %155 = load i64, ptr %5, align 8, !tbaa !9
  %156 = mul nsw i64 %154, %155
  %157 = load i64, ptr %6, align 8, !tbaa !9
  %158 = add nsw i64 %156, %157
  %159 = load i64, ptr %3, align 8, !tbaa !9
  %160 = srem i64 %158, %159
  store i64 %160, ptr %14, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store i64 1, ptr %15, align 8, !tbaa !9
  br label %161

161:                                              ; preds = %165, %150
  %162 = load i64, ptr %14, align 8, !tbaa !9
  %163 = load i64, ptr %7, align 8, !tbaa !9
  %164 = icmp ne i64 %162, %163
  br i1 %164, label %165, label %180

165:                                              ; preds = %161
  %166 = load i64, ptr %14, align 8, !tbaa !9
  %167 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %166
  %168 = load i64, ptr %167, align 8, !tbaa !9
  %169 = load i64, ptr %13, align 8, !tbaa !9
  %170 = add nsw i64 %169, %168
  store i64 %170, ptr %13, align 8, !tbaa !9
  %171 = load i64, ptr %15, align 8, !tbaa !9
  %172 = add nsw i64 %171, 1
  store i64 %172, ptr %15, align 8, !tbaa !9
  %173 = load i64, ptr %14, align 8, !tbaa !9
  %174 = load i64, ptr %5, align 8, !tbaa !9
  %175 = mul nsw i64 %173, %174
  %176 = load i64, ptr %6, align 8, !tbaa !9
  %177 = add nsw i64 %175, %176
  %178 = load i64, ptr %3, align 8, !tbaa !9
  %179 = srem i64 %177, %178
  store i64 %179, ptr %14, align 8, !tbaa !9
  br label %161, !llvm.loop !16

180:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %181 = load i64, ptr %7, align 8, !tbaa !9
  %182 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %181
  %183 = load i32, ptr %182, align 4, !tbaa !5
  %184 = sub nsw i32 %183, 1
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %185
  %187 = load i64, ptr %186, align 8, !tbaa !9
  store i64 %187, ptr %16, align 8, !tbaa !9
  %188 = load i64, ptr %13, align 8, !tbaa !9
  %189 = load i64, ptr %2, align 8, !tbaa !9
  %190 = sub nsw i64 %189, 1
  %191 = load i64, ptr %7, align 8, !tbaa !9
  %192 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = sext i32 %193 to i64
  %195 = sub nsw i64 %190, %194
  %196 = add nsw i64 %195, 1
  %197 = load i64, ptr %15, align 8, !tbaa !9
  %198 = sdiv i64 %196, %197
  %199 = mul nsw i64 %188, %198
  %200 = load i64, ptr %16, align 8, !tbaa !9
  %201 = add nsw i64 %200, %199
  store i64 %201, ptr %16, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %202 = load i64, ptr %2, align 8, !tbaa !9
  %203 = sub nsw i64 %202, 1
  %204 = load i64, ptr %7, align 8, !tbaa !9
  %205 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = sub nsw i64 %203, %207
  %209 = add nsw i64 %208, 1
  %210 = load i64, ptr %15, align 8, !tbaa !9
  %211 = srem i64 %209, %210
  store i64 %211, ptr %17, align 8, !tbaa !9
  %212 = load i64, ptr %14, align 8, !tbaa !9
  %213 = load i64, ptr %7, align 8, !tbaa !9
  %214 = icmp eq i64 %212, %213
  br i1 %214, label %215, label %216

215:                                              ; preds = %180
  br label %218

216:                                              ; preds = %180
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.4, i32 noundef 112, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

217:                                              ; No predecessors!
  br label %218

218:                                              ; preds = %217, %215
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %219

219:                                              ; preds = %238, %218
  %220 = load i32, ptr %18, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = load i64, ptr %17, align 8, !tbaa !9
  %223 = icmp slt i64 %221, %222
  br i1 %223, label %225, label %224

224:                                              ; preds = %219
  store i32 16, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %241

225:                                              ; preds = %219
  %226 = load i64, ptr %14, align 8, !tbaa !9
  %227 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %226
  %228 = load i64, ptr %227, align 8, !tbaa !9
  %229 = load i64, ptr %16, align 8, !tbaa !9
  %230 = add nsw i64 %229, %228
  store i64 %230, ptr %16, align 8, !tbaa !9
  %231 = load i64, ptr %14, align 8, !tbaa !9
  %232 = load i64, ptr %5, align 8, !tbaa !9
  %233 = mul nsw i64 %231, %232
  %234 = load i64, ptr %6, align 8, !tbaa !9
  %235 = add nsw i64 %233, %234
  %236 = load i64, ptr %3, align 8, !tbaa !9
  %237 = srem i64 %235, %236
  store i64 %237, ptr %14, align 8, !tbaa !9
  br label %238

238:                                              ; preds = %225
  %239 = load i32, ptr %18, align 4, !tbaa !5
  %240 = add nsw i32 %239, 1
  store i32 %240, ptr %18, align 4, !tbaa !5
  br label %219, !llvm.loop !17

241:                                              ; preds = %224
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  %242 = load i64, ptr %16, align 8, !tbaa !9
  %243 = load i64, ptr %1, align 8, !tbaa !9
  %244 = mul nsw i64 %242, %243
  store i64 %244, ptr %19, align 8, !tbaa !9
  %245 = load i64, ptr %19, align 8, !tbaa !9
  %246 = icmp sgt i64 %245, 0
  br i1 %246, label %247, label %248

247:                                              ; preds = %241
  br label %250

248:                                              ; preds = %241
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.4, i32 noundef 120, ptr noundef @__PRETTY_FUNCTION__._Z5solvev) #5
  unreachable

249:                                              ; No predecessors!
  br label %250

250:                                              ; preds = %249, %247
  %251 = load i64, ptr %19, align 8, !tbaa !9
  %252 = srem i64 %251, 2
  %253 = icmp eq i64 %252, 0
  br i1 %253, label %254, label %258

254:                                              ; preds = %250
  %255 = load i64, ptr %19, align 8, !tbaa !9
  %256 = sdiv i64 %255, 2
  %257 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i64 noundef %256)
  br label %262

258:                                              ; preds = %250
  %259 = load i64, ptr %19, align 8, !tbaa !9
  %260 = sdiv i64 %259, 2
  %261 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %260)
  br label %262

262:                                              ; preds = %258, %254
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  store i32 0, ptr %11, align 4
  br label %263

263:                                              ; preds = %262, %122
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  %264 = load i32, ptr %11, align 4
  switch i32 %264, label %266 [
    i32 0, label %265
    i32 1, label %265
  ]

265:                                              ; preds = %263, %263
  ret void

266:                                              ; preds = %263
  unreachable
}

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

declare i32 @__isoc99_scanf(ptr 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

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


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

@d = external dso_local global [524298 x i64], align 16
@x = external dso_local local_unnamed_addr global [524298 x i64], align 16
@f = external dso_local local_unnamed_addr global [524298 x i32], align 16
@pos = external dso_local local_unnamed_addr global [524298 x i32], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [104 x i8], align 1
@__PRETTY_FUNCTION__._Z5solvev = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %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
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %9 = load i64, ptr %3, align 8, !tbaa !5
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %0
  %11 = shl nuw i64 %9, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @f, i8 0, i64 %11, i1 false), !tbaa !9
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @pos, i8 -1, i64 %11, i1 false), !tbaa !9
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6)
  %13 = load i64, ptr %3, align 8, !tbaa !5
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph68, label %._crit_edge69

._crit_edge69:                                    ; preds = %.lr.ph68, %._crit_edge
  %.lcssa64 = phi i64 [ %13, %._crit_edge ], [ %22, %.lr.ph68 ]
  %15 = load i64, ptr @x, align 16, !tbaa !5
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %.preheader, label %24

.preheader:                                       ; preds = %._crit_edge69
  %17 = add i64 %.lcssa64, 1
  %.not70 = icmp slt i64 %.lcssa64, 0
  br i1 %.not70, label %25, label %.lr.ph72

.lr.ph72:                                         ; preds = %.preheader
  %.promoted = load i64, ptr %6, align 8, !tbaa !5
  %18 = load i64, ptr %4, align 8, !tbaa !5
  %19 = load i64, ptr %5, align 8, !tbaa !5
  %smax = call i64 @llvm.smax.i64(i64 %17, i64 1)
  br label %28

.lr.ph68:                                         ; preds = %._crit_edge, %.lr.ph68
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph68 ], [ 0, %._crit_edge ]
  %20 = getelementptr inbounds i64, ptr @d, i64 %indvars.iv
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %20)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i64, ptr %3, align 8, !tbaa !5
  %23 = icmp sgt i64 %22, %indvars.iv.next
  br i1 %23, label %.lr.ph68, label %._crit_edge69, !llvm.loop !11

24:                                               ; preds = %._crit_edge69
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 66, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

._crit_edge73:                                    ; preds = %28
  store i64 %42, ptr %6, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %._crit_edge73, %.preheader
  %26 = load i64, ptr %2, align 8, !tbaa !5
  %27 = add nsw i64 %26, -1
  %.not57 = icmp sgt i64 %27, %17
  br i1 %.not57, label %56, label %43

28:                                               ; preds = %.lr.ph72, %28
  %29 = phi i64 [ 0, %.lr.ph72 ], [ %38, %28 ]
  %indvars.iv109 = phi i64 [ 1, %.lr.ph72 ], [ %indvars.iv.next110, %28 ]
  %30 = phi i64 [ %.promoted, %.lr.ph72 ], [ %42, %28 ]
  %31 = getelementptr inbounds [524298 x i32], ptr @f, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %31, align 4, !tbaa !9
  %34 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %30
  %35 = trunc nuw nsw i64 %indvars.iv109 to i32
  store i32 %35, ptr %34, align 4, !tbaa !9
  %36 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %30
  %37 = load i64, ptr %36, align 8, !tbaa !5
  %38 = add nsw i64 %37, %29
  %39 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %indvars.iv109
  store i64 %38, ptr %39, align 8, !tbaa !5
  %40 = mul nsw i64 %18, %30
  %41 = add nsw i64 %40, %19
  %42 = srem i64 %41, %.lcssa64
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %exitcond = icmp eq i64 %indvars.iv109, %smax
  br i1 %exitcond, label %._crit_edge73, label %28, !llvm.loop !13

43:                                               ; preds = %25
  %44 = load i64, ptr %1, align 8, !tbaa !5
  %45 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %27
  %46 = load i64, ptr %45, align 8, !tbaa !5
  %47 = mul nsw i64 %46, %44
  %48 = and i64 %47, 1
  %49 = icmp eq i64 %48, 0
  br i1 %49, label %50, label %53

50:                                               ; preds = %43
  %51 = ashr exact i64 %47, 1
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %51)
  br label %114

53:                                               ; preds = %43
  %54 = sdiv i64 %47, 2
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %54)
  br label %114

56:                                               ; preds = %25
  store i64 -1, ptr %6, align 8, !tbaa !5
  %57 = icmp sgt i64 %.lcssa64, 0
  br i1 %57, label %.lr.ph78, label %._crit_edge79

58:                                               ; preds = %.lr.ph78
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %exitcond115.not = icmp eq i64 %indvars.iv.next113, %.lcssa64
  br i1 %exitcond115.not, label %._crit_edge79, label %.lr.ph78, !llvm.loop !14

.lr.ph78:                                         ; preds = %56, %58
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %58 ], [ 0, %56 ]
  %59 = getelementptr inbounds [524298 x i32], ptr @f, i64 0, i64 %indvars.iv112
  %60 = load i32, ptr %59, align 4, !tbaa !9
  %61 = icmp sgt i32 %60, 1
  br i1 %61, label %62, label %58

._crit_edge79:                                    ; preds = %58, %56
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.4, i32 noundef 95, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

62:                                               ; preds = %.lr.ph78
  store i64 %indvars.iv112, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %indvars.iv112
  %64 = load i64, ptr %63, align 8, !tbaa !5
  %65 = load i64, ptr %4, align 8, !tbaa !5
  %66 = load i64, ptr %5, align 8, !tbaa !5
  %.pn6180 = mul nsw i64 %indvars.iv112, %65
  %.pn81 = add nsw i64 %.pn6180, %66
  %.04482 = srem i64 %.pn81, %.lcssa64
  %.not5983 = icmp eq i64 %.04482, %indvars.iv112
  br i1 %.not5983, label %._crit_edge89, label %.lr.ph88

.lr.ph88:                                         ; preds = %62, %.lr.ph88
  %.04486 = phi i64 [ %.044, %.lr.ph88 ], [ %.04482, %62 ]
  %.04385 = phi i64 [ %70, %.lr.ph88 ], [ 1, %62 ]
  %.04584 = phi i64 [ %69, %.lr.ph88 ], [ %64, %62 ]
  %67 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %.04486
  %68 = load i64, ptr %67, align 8, !tbaa !5
  %69 = add nsw i64 %68, %.04584
  %70 = add nuw nsw i64 %.04385, 1
  %.pn61 = mul nsw i64 %.04486, %65
  %.pn = add nsw i64 %.pn61, %66
  %.044 = srem i64 %.pn, %.lcssa64
  %.not59 = icmp eq i64 %.044, %indvars.iv112
  br i1 %.not59, label %._crit_edge89, label %.lr.ph88, !llvm.loop !15

._crit_edge89:                                    ; preds = %.lr.ph88, %62
  %.045.lcssa = phi i64 [ %64, %62 ], [ %69, %.lr.ph88 ]
  %.043.lcssa = phi i64 [ 1, %62 ], [ %70, %.lr.ph88 ]
  %71 = getelementptr inbounds [524298 x i32], ptr @pos, i64 0, i64 %indvars.iv112
  %72 = load i32, ptr %71, align 4, !tbaa !9
  %73 = xor i32 %72, -1
  %74 = sext i32 %73 to i64
  %75 = add i64 %26, 1
  %76 = add i64 %75, %74
  %77 = srem i64 %76, %.043.lcssa
  %78 = add nsw i32 %72, -1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [524298 x i64], ptr @x, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !5
  %82 = sdiv i64 %76, %.043.lcssa
  %83 = mul nsw i64 %82, %.045.lcssa
  %84 = add nsw i64 %83, %81
  %85 = icmp sgt i64 %77, 0
  br i1 %85, label %.lr.ph97.preheader, label %._crit_edge98

.lr.ph97.preheader:                               ; preds = %._crit_edge89
  %xtraiter = and i64 %77, 1
  %86 = icmp eq i64 %77, 1
  br i1 %86, label %._crit_edge98.loopexit.unr-lcssa, label %.lr.ph97.preheader.new

.lr.ph97.preheader.new:                           ; preds = %.lr.ph97.preheader
  %unroll_iter = and i64 %77, 9223372036854775806
  br label %.lr.ph97

._crit_edge98.loopexit.unr-lcssa:                 ; preds = %.lr.ph97, %.lr.ph97.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph97.preheader ], [ %101, %.lr.ph97 ]
  %.04294.unr = phi i64 [ %84, %.lr.ph97.preheader ], [ %101, %.lr.ph97 ]
  %.193.unr = phi i64 [ %indvars.iv112, %.lr.ph97.preheader ], [ %104, %.lr.ph97 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge98, label %.lr.ph97.epil

.lr.ph97.epil:                                    ; preds = %._crit_edge98.loopexit.unr-lcssa
  %87 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %.193.unr
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = add nsw i64 %88, %.04294.unr
  br label %._crit_edge98

._crit_edge98:                                    ; preds = %.lr.ph97.epil, %._crit_edge98.loopexit.unr-lcssa, %._crit_edge89
  %.042.lcssa = phi i64 [ %84, %._crit_edge89 ], [ %.lcssa.ph, %._crit_edge98.loopexit.unr-lcssa ], [ %89, %.lr.ph97.epil ]
  %90 = load i64, ptr %1, align 8, !tbaa !5
  %91 = mul nsw i64 %90, %.042.lcssa
  %92 = icmp sgt i64 %91, 0
  br i1 %92, label %106, label %105

.lr.ph97:                                         ; preds = %.lr.ph97, %.lr.ph97.preheader.new
  %.04294 = phi i64 [ %84, %.lr.ph97.preheader.new ], [ %101, %.lr.ph97 ]
  %.193 = phi i64 [ %indvars.iv112, %.lr.ph97.preheader.new ], [ %104, %.lr.ph97 ]
  %niter = phi i64 [ 0, %.lr.ph97.preheader.new ], [ %niter.next.1, %.lr.ph97 ]
  %93 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %.193
  %94 = load i64, ptr %93, align 8, !tbaa !5
  %95 = add nsw i64 %94, %.04294
  %96 = mul nsw i64 %.193, %65
  %97 = add nsw i64 %96, %66
  %98 = srem i64 %97, %.lcssa64
  %99 = getelementptr inbounds [524298 x i64], ptr @d, i64 0, i64 %98
  %100 = load i64, ptr %99, align 8, !tbaa !5
  %101 = add nsw i64 %100, %95
  %102 = mul nsw i64 %98, %65
  %103 = add nsw i64 %102, %66
  %104 = srem i64 %103, %.lcssa64
  %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_edge98.loopexit.unr-lcssa, label %.lr.ph97, !llvm.loop !16

105:                                              ; preds = %._crit_edge98
  call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.4, i32 noundef 120, ptr noundef nonnull @__PRETTY_FUNCTION__._Z5solvev) #7
  unreachable

106:                                              ; preds = %._crit_edge98
  %107 = and i64 %91, 1
  %108 = icmp eq i64 %107, 0
  %109 = lshr i64 %91, 1
  br i1 %108, label %110, label %112

110:                                              ; preds = %106
  %111 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i64 noundef %109)
  br label %114

112:                                              ; preds = %106
  %113 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %109)
  br label %114

114:                                              ; preds = %110, %112, %50, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret void
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

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

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

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 = { 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 #3 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { noreturn 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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