; LLVM IR from tangjz/acm-icpc :: lydsy/4215.ll (Z5checki)

; 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.uint128 = type { i64, i64 }

@all = external dso_local global %struct.uint128, align 8
@pos = external dso_local global [100001 x %struct.uint128], align 16
@n = external dso_local global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@buf = external dso_local global [100001 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checki(i32 noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i8, align 1
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i8, align 1
  %21 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %22 = load i32, ptr %3, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 128
  br i1 %23, label %24, label %25

24:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %237

25:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %26 = load i32, ptr @n, align 4, !tbaa !5
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sub nsw i32 %26, %27
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %36, %25
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %39

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  store i8 1, ptr %7, align 1, !tbaa !9
  call void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 1 dereferenceable(1) %7)
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  br label %36

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

39:                                               ; preds = %34
  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 = %80, %39
  %41 = load i32, ptr %8, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %45, label %44

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

45:                                               ; preds = %40
  %46 = load i32, ptr %8, align 4, !tbaa !5
  %47 = load i32, ptr %8, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %48
  store i32 %46, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 0, ptr %10, align 4, !tbaa !5
  %50 = load i32, ptr %8, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %51
  call void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %76, %45
  %54 = load i32, ptr %11, align 4, !tbaa !5
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %58, label %57

57:                                               ; preds = %53
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  br label %79

58:                                               ; preds = %53
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %60
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #4
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %63
  %65 = load i8, ptr %64, align 1, !tbaa !13
  %66 = sext i8 %65 to i32
  %67 = load i32, ptr %8, align 4, !tbaa !5
  %68 = load i32, ptr %11, align 4, !tbaa !5
  %69 = add nsw i32 %67, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !13
  %73 = sext i8 %72 to i32
  %74 = icmp eq i32 %66, %73
  %75 = zext i1 %74 to i8
  store i8 %75, ptr %12, align 1, !tbaa !9
  call void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16) %61, ptr noundef nonnull align 1 dereferenceable(1) %12)
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #4
  br label %76

76:                                               ; preds = %58
  %77 = load i32, ptr %11, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %11, align 4, !tbaa !5
  br label %53, !llvm.loop !14

79:                                               ; preds = %57
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !5
  br label %40, !llvm.loop !15

83:                                               ; preds = %44
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds i32, ptr @ord, i64 %85
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef @ord, ptr noundef %86, ptr noundef @_Z3cmpRKiS0_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  br label %87

87:                                               ; preds = %231, %83
  %88 = load i32, ptr %14, align 4, !tbaa !5
  %89 = load i32, ptr %4, align 4, !tbaa !5
  %90 = icmp slt i32 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 11, ptr %9, align 4
  br label %233

92:                                               ; preds = %87
  %93 = load i32, ptr %14, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %15, align 4, !tbaa !5
  br label %95

95:                                               ; preds = %134, %92
  %96 = load i32, ptr %15, align 4, !tbaa !5
  %97 = load i32, ptr %4, align 4, !tbaa !5
  %98 = icmp slt i32 %96, %97
  br i1 %98, label %99, label %131

99:                                               ; preds = %95
  %100 = load i32, ptr %14, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %104
  %106 = load i32, ptr %15, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %110
  %112 = call noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %105, ptr noundef nonnull align 8 dereferenceable(16) %111)
  br i1 %112, label %113, label %131

113:                                              ; preds = %99
  %114 = load i32, ptr %14, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %118
  %120 = load i8, ptr %119, align 1, !tbaa !13
  %121 = sext i8 %120 to i32
  %122 = load i32, ptr %15, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %126
  %128 = load i8, ptr %127, align 1, !tbaa !13
  %129 = sext i8 %128 to i32
  %130 = icmp eq i32 %121, %129
  br label %131

131:                                              ; preds = %113, %99, %95
  %132 = phi i1 [ false, %99 ], [ false, %95 ], [ %130, %113 ]
  br i1 %132, label %133, label %137

133:                                              ; preds = %131
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %15, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %15, align 4, !tbaa !5
  br label %95, !llvm.loop !16

137:                                              ; preds = %131
  %138 = load i32, ptr %14, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %142
  %144 = call noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %143, ptr noundef nonnull align 8 dereferenceable(16) @all)
  br i1 %144, label %145, label %146

145:                                              ; preds = %137
  br label %231

146:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %147 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %147, ptr %16, align 4, !tbaa !5
  br label %148

148:                                              ; preds = %225, %146
  %149 = load i32, ptr %16, align 4, !tbaa !5
  %150 = load i32, ptr %15, align 4, !tbaa !5
  %151 = icmp slt i32 %149, %150
  br i1 %151, label %153, label %152

152:                                              ; preds = %148
  store i32 17, ptr %9, align 4
  br label %228

153:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %154 = load i32, ptr %16, align 4, !tbaa !5
  %155 = add nsw i32 %154, 1
  store i32 %155, ptr %17, align 4, !tbaa !5
  br label %156

156:                                              ; preds = %219, %153
  %157 = load i32, ptr %17, align 4, !tbaa !5
  %158 = load i32, ptr %15, align 4, !tbaa !5
  %159 = icmp slt i32 %157, %158
  br i1 %159, label %161, label %160

160:                                              ; preds = %156
  store i32 20, ptr %9, align 4
  br label %222

161:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %162 = load i32, ptr %16, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %163
  %165 = load i32, ptr %164, align 4, !tbaa !5
  store i32 %165, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #4
  %166 = load i32, ptr %17, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  store i32 %169, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %20) #4
  store i8 1, ptr %20, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #4
  store i32 0, ptr %21, align 4, !tbaa !5
  br label %170

170:                                              ; preds = %207, %161
  %171 = load i32, ptr %21, align 4, !tbaa !5
  %172 = load i32, ptr %3, align 4, !tbaa !5
  %173 = icmp slt i32 %171, %172
  br i1 %173, label %175, label %174

174:                                              ; preds = %170
  store i32 23, ptr %9, align 4
  br label %210

175:                                              ; preds = %170
  %176 = load i32, ptr %18, align 4, !tbaa !5
  %177 = load i32, ptr %21, align 4, !tbaa !5
  %178 = add nsw i32 %176, %177
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %179
  %181 = load i8, ptr %180, align 1, !tbaa !13
  %182 = sext i8 %181 to i32
  %183 = load i32, ptr %19, align 4, !tbaa !5
  %184 = load i32, ptr %21, align 4, !tbaa !5
  %185 = add nsw i32 %183, %184
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %186
  %188 = load i8, ptr %187, align 1, !tbaa !13
  %189 = sext i8 %188 to i32
  %190 = icmp eq i32 %182, %189
  br i1 %190, label %191, label %206

191:                                              ; preds = %175
  %192 = load i32, ptr %18, align 4, !tbaa !5
  %193 = load i32, ptr %21, align 4, !tbaa !5
  %194 = add nsw i32 %192, %193
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %195
  %197 = load i8, ptr %196, align 1, !tbaa !13
  %198 = sext i8 %197 to i32
  %199 = load i32, ptr %18, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %200
  %202 = load i8, ptr %201, align 1, !tbaa !13
  %203 = sext i8 %202 to i32
  %204 = icmp ne i32 %198, %203
  br i1 %204, label %205, label %206

205:                                              ; preds = %191
  store i8 0, ptr %20, align 1, !tbaa !9
  store i32 23, ptr %9, align 4
  br label %210

206:                                              ; preds = %191, %175
  br label %207

207:                                              ; preds = %206
  %208 = load i32, ptr %21, align 4, !tbaa !5
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %21, align 4, !tbaa !5
  br label %170, !llvm.loop !17

210:                                              ; preds = %205, %174
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #4
  br label %211

211:                                              ; preds = %210
  %212 = load i8, ptr %20, align 1, !tbaa !9, !range !18, !noundef !19
  %213 = trunc i8 %212 to i1
  br i1 %213, label %214, label %215

214:                                              ; preds = %211
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %216

215:                                              ; preds = %211
  store i32 0, ptr %9, align 4
  br label %216

216:                                              ; preds = %215, %214
  call void @llvm.lifetime.end.p0(i64 1, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  %217 = load i32, ptr %9, align 4
  switch i32 %217, label %222 [
    i32 0, label %218
  ]

218:                                              ; preds = %216
  br label %219

219:                                              ; preds = %218
  %220 = load i32, ptr %17, align 4, !tbaa !5
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %17, align 4, !tbaa !5
  br label %156, !llvm.loop !20

222:                                              ; preds = %216, %160
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %223 = load i32, ptr %9, align 4
  switch i32 %223, label %228 [
    i32 20, label %224
  ]

224:                                              ; preds = %222
  br label %225

225:                                              ; preds = %224
  %226 = load i32, ptr %16, align 4, !tbaa !5
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %16, align 4, !tbaa !5
  br label %148, !llvm.loop !21

228:                                              ; preds = %222, %152
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  %229 = load i32, ptr %9, align 4
  switch i32 %229, label %233 [
    i32 17, label %230
  ]

230:                                              ; preds = %228
  br label %231

231:                                              ; preds = %230, %145
  %232 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %232, ptr %14, align 4, !tbaa !5
  br label %87, !llvm.loop !22

233:                                              ; preds = %228, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %234 = load i32, ptr %9, align 4
  switch i32 %234, label %236 [
    i32 11, label %235
  ]

235:                                              ; preds = %233
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %236

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

237:                                              ; preds = %236, %24
  %238 = load i1, ptr %2, align 1
  ret i1 %238
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 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 = { 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 #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 = { 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 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !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"

%struct.uint128 = type { i64, i64 }

@all = external dso_local global %struct.uint128, align 8
@pos = external dso_local global [100001 x %struct.uint128], align 16
@n = external dso_local local_unnamed_addr global i32, align 4
@ord = external dso_local global [100001 x i32], align 16
@buf = external dso_local local_unnamed_addr global [100001 x i8], align 16

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z5checki(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i8, align 1
  %4 = alloca i32, align 4
  %5 = alloca i8, align 1
  %6 = icmp sgt i32 %0, 128
  br i1 %6, label %.critedge86, label %7

7:                                                ; preds = %1
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sub i32 %8, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %10 = icmp sgt i32 %0, 0
  br i1 %10, label %.lr.ph, label %.preheader88.thread

.preheader88:                                     ; preds = %.lr.ph
  %.not92 = icmp slt i32 %9, 0
  br i1 %.not92, label %._crit_edge95.thread, label %.lr.ph94

.preheader88.thread:                              ; preds = %7
  %.not92142 = icmp slt i32 %9, 0
  br i1 %.not92142, label %._crit_edge95.thread, label %.lr.ph94.split.preheader

.lr.ph94:                                         ; preds = %.preheader88
  br i1 %10, label %.lr.ph91.us.preheader, label %.lr.ph94.split.preheader

.lr.ph94.split.preheader:                         ; preds = %.preheader88.thread, %.lr.ph94
  %11 = add i32 %8, 1
  %12 = sub i32 %11, %0
  %wide.trip.count = zext i32 %12 to i64
  br label %.lr.ph94.split

.lr.ph91.us.preheader:                            ; preds = %.lr.ph94
  %13 = add i32 %8, 1
  %14 = sub i32 %13, %0
  %wide.trip.count121 = zext i32 %14 to i64
  %wide.trip.count116 = zext nneg i32 %0 to i64
  br label %.lr.ph91.us

.lr.ph91.us:                                      ; preds = %.lr.ph91.us.preheader, %._crit_edge.us
  %indvars.iv118 = phi i64 [ 0, %.lr.ph91.us.preheader ], [ %indvars.iv.next119, %._crit_edge.us ]
  %15 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv118
  %16 = trunc nuw nsw i64 %indvars.iv118 to i32
  store i32 %16, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  %17 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %indvars.iv118
  call void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %18 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %indvars.iv118
  br label %19

19:                                               ; preds = %.lr.ph91.us, %19
  %indvars.iv113 = phi i64 [ 0, %.lr.ph91.us ], [ %indvars.iv.next114, %19 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #5
  %20 = load i8, ptr %18, align 1, !tbaa !9
  %21 = add nuw nsw i64 %indvars.iv113, %indvars.iv118
  %22 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = icmp eq i8 %20, %23
  %25 = zext i1 %24 to i8
  store i8 %25, ptr %5, align 1, !tbaa !10
  call void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #5
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %exitcond117.not = icmp eq i64 %indvars.iv.next114, %wide.trip.count116
  br i1 %exitcond117.not, label %._crit_edge.us, label %19, !llvm.loop !12

._crit_edge.us:                                   ; preds = %19
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
  br i1 %exitcond122.not, label %._crit_edge95, label %.lr.ph91.us, !llvm.loop !14

.lr.ph:                                           ; preds = %7, %.lr.ph
  %.06189 = phi i32 [ %26, %.lr.ph ], [ 0, %7 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  store i8 1, ptr %3, align 1, !tbaa !10
  call void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16) @all, ptr noundef nonnull align 1 dereferenceable(1) %3)
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  %26 = add nuw nsw i32 %.06189, 1
  %exitcond.not = icmp eq i32 %26, %0
  br i1 %exitcond.not, label %.preheader88, label %.lr.ph, !llvm.loop !15

._crit_edge95.thread:                             ; preds = %.preheader88.thread, %.preheader88
  %27 = sext i32 %9 to i64
  %28 = getelementptr i32, ptr @ord, i64 %27
  %29 = getelementptr i8, ptr %28, i64 4
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %29, ptr noundef nonnull @_Z3cmpRKiS0_)
  br label %.critedge86

._crit_edge95:                                    ; preds = %.lr.ph94.split, %._crit_edge.us
  %30 = sext i32 %9 to i64
  %31 = getelementptr i32, ptr @ord, i64 %30
  %32 = getelementptr i8, ptr %31, i64 4
  call void @_ZSt4sortIPiPFbRKiS2_EEvT_S5_T0_(ptr noundef nonnull @ord, ptr noundef nonnull %32, ptr noundef nonnull @_Z3cmpRKiS0_)
  %.not75107 = icmp sgt i32 %9, -1
  br i1 %.not75107, label %.preheader.lr.ph, label %.critedge86

.preheader.lr.ph:                                 ; preds = %._crit_edge95
  %wide.trip.count129 = zext nneg i32 %0 to i64
  br label %.preheader

.lr.ph94.split:                                   ; preds = %.lr.ph94.split.preheader, %.lr.ph94.split
  %indvars.iv = phi i64 [ 0, %.lr.ph94.split.preheader ], [ %indvars.iv.next, %.lr.ph94.split ]
  %33 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv
  %34 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %34, ptr %33, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  %35 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %indvars.iv
  call void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16) %35, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond112.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond112.not, label %._crit_edge95, label %.lr.ph94.split, !llvm.loop !14

.preheader:                                       ; preds = %.preheader.lr.ph, %.critedge84
  %.065108 = phi i32 [ 0, %.preheader.lr.ph ], [ %.064.lcssa, %.critedge84 ]
  %36 = sext i32 %.065108 to i64
  %37 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %36
  %smax = call i32 @llvm.smax.i32(i32 %.065108, i32 %9)
  %38 = add nuw i32 %smax, 1
  %.pre140.pre = load i32, ptr %37, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %.preheader, %49
  %.pre140 = phi i32 [ %.pre140.pre, %.preheader ], [ %.pre, %49 ]
  %indvars.iv123 = phi i64 [ %36, %.preheader ], [ %indvars.iv.next124, %49 ]
  %indvars.iv.next124 = add nsw i64 %indvars.iv123, 1
  %40 = icmp slt i64 %indvars.iv123, %30
  br i1 %40, label %41, label %.critedge

41:                                               ; preds = %39
  %42 = sext i32 %.pre140 to i64
  %43 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %42
  %44 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv.next124
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %46
  %48 = call noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %43, ptr noundef nonnull align 8 dereferenceable(16) %47)
  %.pre = load i32, ptr %37, align 4, !tbaa !5
  br i1 %48, label %49, label %.critedge.split.loop.exit

49:                                               ; preds = %41
  %50 = sext i32 %.pre to i64
  %51 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %50
  %52 = load i8, ptr %51, align 1, !tbaa !9
  %53 = load i32, ptr %44, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %54
  %56 = load i8, ptr %55, align 1, !tbaa !9
  %57 = icmp eq i8 %52, %56
  br i1 %57, label %39, label %.critedge.split.loop.exit150, !llvm.loop !16

.critedge.split.loop.exit:                        ; preds = %41
  %58 = trunc nsw i64 %indvars.iv.next124 to i32
  %59 = trunc nsw i64 %indvars.iv123 to i32
  br label %.critedge

.critedge.split.loop.exit150:                     ; preds = %49
  %60 = trunc nsw i64 %indvars.iv.next124 to i32
  %61 = trunc nsw i64 %indvars.iv123 to i32
  br label %.critedge

.critedge:                                        ; preds = %39, %.critedge.split.loop.exit150, %.critedge.split.loop.exit
  %62 = phi i32 [ %.pre, %.critedge.split.loop.exit ], [ %.pre, %.critedge.split.loop.exit150 ], [ %.pre140, %39 ]
  %.064.in.lcssa = phi i32 [ %59, %.critedge.split.loop.exit ], [ %61, %.critedge.split.loop.exit150 ], [ %smax, %39 ]
  %.064.lcssa = phi i32 [ %58, %.critedge.split.loop.exit ], [ %60, %.critedge.split.loop.exit150 ], [ %38, %39 ]
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [100001 x %struct.uint128], ptr @pos, i64 0, i64 %63
  %65 = call noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16) %64, ptr noundef nonnull align 8 dereferenceable(16) @all)
  %.not76103 = icmp sgt i32 %.065108, %.064.in.lcssa
  %or.cond = select i1 %65, i1 true, i1 %.not76103
  br i1 %or.cond, label %.critedge84, label %.lr.ph105

.lr.ph105:                                        ; preds = %.critedge
  br i1 %10, label %.lr.ph105.split.us.preheader, label %.lr.ph105.split

.lr.ph105.split.us.preheader:                     ; preds = %.lr.ph105
  %66 = sext i32 %.064.in.lcssa to i64
  %67 = add i32 %.064.in.lcssa, 1
  br label %.lr.ph105.split.us

.lr.ph105.split.us:                               ; preds = %.lr.ph105.split.us.preheader, %.critedge82.loopexit.us
  %indvars.iv136 = phi i64 [ %36, %.lr.ph105.split.us.preheader ], [ %indvars.iv.next137, %.critedge82.loopexit.us ]
  %indvars.iv131.in = phi i32 [ %.065108, %.lr.ph105.split.us.preheader ], [ %indvars.iv131, %.critedge82.loopexit.us ]
  %indvars.iv131 = add i32 %indvars.iv131.in, 1
  %indvars.iv.next137 = add nsw i64 %indvars.iv136, 1
  %.not77100.us.not = icmp slt i64 %indvars.iv136, %66
  br i1 %.not77100.us.not, label %.lr.ph102.us, label %.critedge82.loopexit.us

.lr.ph98.us:                                      ; preds = %.lr.ph102.us, %81
  %indvars.iv133 = phi i64 [ %83, %.lr.ph102.us ], [ %indvars.iv.next134, %81 ]
  %68 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv133
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  br label %71

71:                                               ; preds = %82, %.lr.ph98.us
  %indvars.iv126 = phi i64 [ %indvars.iv.next127, %82 ], [ 0, %.lr.ph98.us ]
  %72 = add nsw i64 %indvars.iv126, %86
  %73 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %72
  %74 = load i8, ptr %73, align 1, !tbaa !9
  %75 = add nsw i64 %indvars.iv126, %70
  %76 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %75
  %77 = load i8, ptr %76, align 1, !tbaa !9
  %78 = icmp eq i8 %74, %77
  br i1 %78, label %79, label %82

79:                                               ; preds = %71
  %80 = load i8, ptr %87, align 1, !tbaa !9
  %.not78.us = icmp eq i8 %74, %80
  br i1 %.not78.us, label %82, label %81

81:                                               ; preds = %79
  %indvars.iv.next134 = add nsw i64 %indvars.iv133, 1
  %.not77.us.not = icmp slt i64 %indvars.iv133, %66
  br i1 %.not77.us.not, label %.lr.ph98.us, label %.critedge82.loopexit.us, !llvm.loop !17

82:                                               ; preds = %79, %71
  %indvars.iv.next127 = add nuw nsw i64 %indvars.iv126, 1
  %exitcond130.not = icmp eq i64 %indvars.iv.next127, %wide.trip.count129
  br i1 %exitcond130.not, label %.critedge86, label %71, !llvm.loop !18

.critedge82.loopexit.us:                          ; preds = %81, %.lr.ph105.split.us
  %lftr.wideiv = trunc i64 %indvars.iv.next137 to i32
  %exitcond139.not = icmp eq i32 %67, %lftr.wideiv
  br i1 %exitcond139.not, label %.critedge84, label %.lr.ph105.split.us, !llvm.loop !19

.lr.ph102.us:                                     ; preds = %.lr.ph105.split.us
  %83 = sext i32 %indvars.iv131 to i64
  %84 = getelementptr inbounds [100001 x i32], ptr @ord, i64 0, i64 %indvars.iv136
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [100001 x i8], ptr @buf, i64 0, i64 %86
  br label %.lr.ph98.us

.lr.ph105.split:                                  ; preds = %.lr.ph105
  %.not77100.not = icmp slt i32 %.065108, %.064.in.lcssa
  br i1 %.not77100.not, label %.critedge86, label %.critedge84

.critedge84:                                      ; preds = %.critedge82.loopexit.us, %.lr.ph105.split, %.critedge
  %.not75.not.not = icmp slt i32 %.064.in.lcssa, %9
  br i1 %.not75.not.not, label %.preheader, label %.critedge86, !llvm.loop !20

.critedge86:                                      ; preds = %.critedge84, %.lr.ph105.split, %82, %._crit_edge95.thread, %._crit_edge95, %1
  %.9 = phi i1 [ false, %1 ], [ false, %._crit_edge95 ], [ false, %._crit_edge95.thread ], [ true, %82 ], [ false, %.critedge84 ], [ true, %.lr.ph105.split ]
  ret i1 %.9
}

; 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 nounwind uwtable
declare dso_local void @_ZN7uint128aSERKi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7uint1288shiftAddERKb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #2 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRKiS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK7uint128eqERKS_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"bool", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}
!18 = distinct !{!18, !13}
!19 = distinct !{!19, !13}
!20 = distinct !{!20, !13}


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