; LLVM IR from upupming/algorithm :: AdvancedLevel_C++/1012. The Best Rank (25) (main)

; 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 { i32, i32, [4 x i32], [4 x i32] }

@stu = external dso_local global [2005 x %struct.node], align 16
@exist = external dso_local global [1000000 x i32], align 16
@flag = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@__const.main.c = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmp14nodeS_(ptr noundef byval(%struct.node) align 8, ptr noundef byval(%struct.node) align 8) #0

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

16:                                               ; preds = %71, %0
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %74

21:                                               ; preds = %16
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %23
  %25 = getelementptr inbounds %struct.node, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.node, ptr %28, i32 0, i32 2
  %30 = getelementptr inbounds [4 x i32], ptr %29, i64 0, i64 1
  %31 = load i32, ptr %5, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.node, ptr %33, i32 0, i32 2
  %35 = getelementptr inbounds [4 x i32], ptr %34, i64 0, i64 2
  %36 = load i32, ptr %5, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.node, ptr %38, i32 0, i32 2
  %40 = getelementptr inbounds [4 x i32], ptr %39, i64 0, i64 3
  %41 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %25, ptr noundef %30, ptr noundef %35, ptr noundef %40)
  %42 = load i32, ptr %5, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %43
  %45 = getelementptr inbounds %struct.node, ptr %44, i32 0, i32 2
  %46 = getelementptr inbounds [4 x i32], ptr %45, i64 0, i64 1
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = load i32, ptr %5, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.node, ptr %50, i32 0, i32 2
  %52 = getelementptr inbounds [4 x i32], ptr %51, i64 0, i64 2
  %53 = load i32, ptr %52, align 8, !tbaa !5
  %54 = add nsw i32 %47, %53
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %56
  %58 = getelementptr inbounds %struct.node, ptr %57, i32 0, i32 2
  %59 = getelementptr inbounds [4 x i32], ptr %58, i64 0, i64 3
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add nsw i32 %54, %60
  %62 = sitofp i32 %61 to double
  %63 = fdiv double %62, 3.000000e+00
  %64 = fadd double %63, 5.000000e-01
  %65 = fptosi double %64 to i32
  %66 = load i32, ptr %5, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %67
  %69 = getelementptr inbounds %struct.node, ptr %68, i32 0, i32 2
  %70 = getelementptr inbounds [4 x i32], ptr %69, i64 0, i64 0
  store i32 %65, ptr %70, align 8, !tbaa !5
  br label %71

71:                                               ; preds = %21
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %5, align 4, !tbaa !5
  br label %16, !llvm.loop !9

74:                                               ; preds = %20
  store i32 0, ptr @flag, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %140, %74
  %76 = load i32, ptr @flag, align 4, !tbaa !5
  %77 = icmp sle i32 %76, 3
  br i1 %77, label %78, label %143

78:                                               ; preds = %75
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds %struct.node, ptr @stu, i64 %80
  call void @_ZSt4sortIP4nodePFbS0_S0_EEvT_S4_T0_(ptr noundef @stu, ptr noundef %81, ptr noundef @_Z4cmp14nodeS_)
  %82 = load i32, ptr @flag, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [4 x i32], ptr getelementptr inbounds (%struct.node, ptr @stu, i32 0, i32 3), i64 0, i64 %83
  store i32 1, ptr %84, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %85

85:                                               ; preds = %136, %78
  %86 = load i32, ptr %6, align 4, !tbaa !5
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = icmp slt i32 %86, %87
  br i1 %88, label %90, label %89

89:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %139

90:                                               ; preds = %85
  %91 = load i32, ptr %6, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %94
  %96 = getelementptr inbounds %struct.node, ptr %95, i32 0, i32 3
  %97 = load i32, ptr @flag, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [4 x i32], ptr %96, i64 0, i64 %98
  store i32 %92, ptr %99, align 4, !tbaa !5
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %101
  %103 = getelementptr inbounds %struct.node, ptr %102, i32 0, i32 2
  %104 = load i32, ptr @flag, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [4 x i32], ptr %103, i64 0, i64 %105
  %107 = load i32, ptr %106, align 4, !tbaa !5
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sub nsw i32 %108, 1
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %110
  %112 = getelementptr inbounds %struct.node, ptr %111, i32 0, i32 2
  %113 = load i32, ptr @flag, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [4 x i32], ptr %112, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %117 = icmp eq i32 %107, %116
  br i1 %117, label %118, label %135

118:                                              ; preds = %90
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %121
  %123 = getelementptr inbounds %struct.node, ptr %122, i32 0, i32 3
  %124 = load i32, ptr @flag, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [4 x i32], ptr %123, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = load i32, ptr %6, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %129
  %131 = getelementptr inbounds %struct.node, ptr %130, i32 0, i32 3
  %132 = load i32, ptr @flag, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [4 x i32], ptr %131, i64 0, i64 %133
  store i32 %127, ptr %134, align 4, !tbaa !5
  br label %135

135:                                              ; preds = %118, %90
  br label %136

136:                                              ; preds = %135
  %137 = load i32, ptr %6, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %6, align 4, !tbaa !5
  br label %85, !llvm.loop !11

139:                                              ; preds = %89
  br label %140

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

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

144:                                              ; preds = %203, %143
  %145 = load i32, ptr %7, align 4, !tbaa !5
  %146 = load i32, ptr %2, align 4, !tbaa !5
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %149, label %148

148:                                              ; preds = %144
  store i32 11, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %206

149:                                              ; preds = %144
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  %152 = load i32, ptr %7, align 4, !tbaa !5
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %153
  %155 = getelementptr inbounds %struct.node, ptr %154, i32 0, i32 0
  %156 = load i32, ptr %155, align 8, !tbaa !13
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [1000000 x i32], ptr @exist, i64 0, i64 %157
  store i32 %151, ptr %158, align 4, !tbaa !5
  %159 = load i32, ptr %7, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %160
  %162 = getelementptr inbounds %struct.node, ptr %161, i32 0, i32 1
  store i32 0, ptr %162, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %163 = load i32, ptr %7, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %164
  %166 = getelementptr inbounds %struct.node, ptr %165, i32 0, i32 3
  %167 = getelementptr inbounds [4 x i32], ptr %166, i64 0, i64 0
  %168 = load i32, ptr %167, align 8, !tbaa !5
  store i32 %168, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %169

169:                                              ; preds = %199, %149
  %170 = load i32, ptr %10, align 4, !tbaa !5
  %171 = icmp sle i32 %170, 3
  br i1 %171, label %173, label %172

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

173:                                              ; preds = %169
  %174 = load i32, ptr %7, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %175
  %177 = getelementptr inbounds %struct.node, ptr %176, i32 0, i32 3
  %178 = load i32, ptr %10, align 4, !tbaa !5
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [4 x i32], ptr %177, i64 0, i64 %179
  %181 = load i32, ptr %180, align 4, !tbaa !5
  %182 = load i32, ptr %9, align 4, !tbaa !5
  %183 = icmp slt i32 %181, %182
  br i1 %183, label %184, label %198

184:                                              ; preds = %173
  %185 = load i32, ptr %7, align 4, !tbaa !5
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %186
  %188 = getelementptr inbounds %struct.node, ptr %187, i32 0, i32 3
  %189 = load i32, ptr %10, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [4 x i32], ptr %188, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  store i32 %192, ptr %9, align 4, !tbaa !5
  %193 = load i32, ptr %10, align 4, !tbaa !5
  %194 = load i32, ptr %7, align 4, !tbaa !5
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %195
  %197 = getelementptr inbounds %struct.node, ptr %196, i32 0, i32 1
  store i32 %193, ptr %197, align 4, !tbaa !15
  br label %198

198:                                              ; preds = %184, %173
  br label %199

199:                                              ; preds = %198
  %200 = load i32, ptr %10, align 4, !tbaa !5
  %201 = add nsw i32 %200, 1
  store i32 %201, ptr %10, align 4, !tbaa !5
  br label %169, !llvm.loop !16

202:                                              ; preds = %172
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %203

203:                                              ; preds = %202
  %204 = load i32, ptr %7, align 4, !tbaa !5
  %205 = add nsw i32 %204, 1
  store i32 %205, ptr %7, align 4, !tbaa !5
  br label %144, !llvm.loop !17

206:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 5, ptr %11) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %11, ptr align 1 @__const.main.c, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %245, %206
  %208 = load i32, ptr %12, align 4, !tbaa !5
  %209 = load i32, ptr %3, align 4, !tbaa !5
  %210 = icmp slt i32 %208, %209
  br i1 %210, label %212, label %211

211:                                              ; preds = %207
  store i32 17, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %248

212:                                              ; preds = %207
  %213 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %214 = load i32, ptr %4, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [1000000 x i32], ptr @exist, i64 0, i64 %215
  %217 = load i32, ptr %216, align 4, !tbaa !5
  store i32 %217, ptr %13, align 4, !tbaa !5
  %218 = load i32, ptr %13, align 4, !tbaa !5
  %219 = icmp ne i32 %218, 0
  br i1 %219, label %220, label %242

220:                                              ; preds = %212
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %221 = load i32, ptr %13, align 4, !tbaa !5
  %222 = sub nsw i32 %221, 1
  %223 = sext i32 %222 to i64
  %224 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %223
  %225 = getelementptr inbounds %struct.node, ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 4, !tbaa !15
  store i32 %226, ptr %14, align 4, !tbaa !5
  %227 = load i32, ptr %13, align 4, !tbaa !5
  %228 = sub nsw i32 %227, 1
  %229 = sext i32 %228 to i64
  %230 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %229
  %231 = getelementptr inbounds %struct.node, ptr %230, i32 0, i32 3
  %232 = load i32, ptr %14, align 4, !tbaa !5
  %233 = sext i32 %232 to i64
  %234 = getelementptr inbounds [4 x i32], ptr %231, i64 0, i64 %233
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = load i32, ptr %14, align 4, !tbaa !5
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [5 x i8], ptr %11, i64 0, i64 %237
  %239 = load i8, ptr %238, align 1, !tbaa !18
  %240 = sext i8 %239 to i32
  %241 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %235, i32 noundef %240)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %244

242:                                              ; preds = %212
  %243 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  br label %244

244:                                              ; preds = %242, %220
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %245

245:                                              ; preds = %244
  %246 = load i32, ptr %12, align 4, !tbaa !5
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr %12, align 4, !tbaa !5
  br label %207, !llvm.loop !19

248:                                              ; preds = %211
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 5, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %249 = load i32, ptr %1, align 4
  ret i32 %249
}

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

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

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


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

%struct.node = type { i32, i32, [4 x i32], [4 x i32] }

@stu = external dso_local global [2005 x %struct.node], align 16
@exist = external dso_local local_unnamed_addr global [1000000 x i32], align 16
@flag = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@__const.main.c = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4cmp14nodeS_(ptr noundef byval(%struct.node) align 8, ptr noundef byval(%struct.node) align 8) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %.preheader49

.preheader49:                                     ; preds = %.lr.ph, %0
  %7 = phi i32 [ %5, %0 ], [ %23, %.lr.ph ]
  store i32 0, ptr @flag, align 4, !tbaa !5
  br label %27

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %8 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv
  %9 = getelementptr inbounds i8, ptr %8, i64 8
  %10 = getelementptr inbounds i8, ptr %8, i64 12
  %11 = getelementptr inbounds i8, ptr %8, i64 16
  %12 = getelementptr inbounds i8, ptr %8, i64 20
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %8, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12)
  %14 = load i32, ptr %10, align 4, !tbaa !5
  %15 = load i32, ptr %11, align 8, !tbaa !5
  %16 = add nsw i32 %15, %14
  %17 = load i32, ptr %12, align 4, !tbaa !5
  %18 = add nsw i32 %16, %17
  %19 = sitofp i32 %18 to double
  %20 = fdiv double %19, 3.000000e+00
  %21 = fadd double %20, 5.000000e-01
  %22 = fptosi double %21 to i32
  store i32 %22, ptr %9, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = load i32, ptr %1, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = icmp slt i64 %indvars.iv.next, %24
  br i1 %25, label %.lr.ph, label %.preheader49, !llvm.loop !9

.preheader48:                                     ; preds = %._crit_edge
  %26 = icmp sgt i32 %34, 0
  br i1 %26, label %.lr.ph56.preheader, label %.preheader

.lr.ph56.preheader:                               ; preds = %.preheader48
  %wide.trip.count71 = zext nneg i32 %34 to i64
  br label %.lr.ph56

27:                                               ; preds = %.preheader49, %._crit_edge
  %28 = phi i32 [ %7, %.preheader49 ], [ %34, %._crit_edge ]
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds %struct.node, ptr @stu, i64 %29
  call void @_ZSt4sortIP4nodePFbS0_S0_EEvT_S4_T0_(ptr noundef nonnull @stu, ptr noundef nonnull %30, ptr noundef nonnull @_Z4cmp14nodeS_)
  %31 = load i32, ptr @flag, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [4 x i32], ptr getelementptr inbounds (i8, ptr @stu, i64 24), i64 0, i64 %32
  store i32 1, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = icmp sgt i32 %34, 1
  br i1 %35, label %.lr.ph52.preheader, label %._crit_edge

.lr.ph52.preheader:                               ; preds = %27
  %wide.trip.count = zext nneg i32 %34 to i64
  %.phi.trans.insert = getelementptr inbounds [4 x i32], ptr getelementptr inbounds (i8, ptr @stu, i64 8), i64 0, i64 %32
  %.pre = load i32, ptr %.phi.trans.insert, align 4, !tbaa !5
  %36 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %36, 1
  %37 = icmp eq i32 %34, 2
  br i1 %37, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph52.preheader.new

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

._crit_edge.loopexit.unr-lcssa:                   ; preds = %77, %.lr.ph52.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph52.preheader ], [ %72, %77 ]
  %indvars.iv61.unr = phi i64 [ 1, %.lr.ph52.preheader ], [ %indvars.iv.next62.1, %77 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph52.epil

.lr.ph52.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %38 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv61.unr
  %39 = getelementptr inbounds i8, ptr %38, i64 24
  %40 = getelementptr inbounds [4 x i32], ptr %39, i64 0, i64 %32
  %41 = trunc i64 %indvars.iv61.unr to i32
  %42 = add i32 %41, 1
  store i32 %42, ptr %40, align 4, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %38, i64 8
  %44 = getelementptr inbounds [4 x i32], ptr %43, i64 0, i64 %32
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = icmp eq i32 %45, %.unr
  br i1 %46, label %47, label %._crit_edge

47:                                               ; preds = %.lr.ph52.epil
  %48 = add nsw i64 %indvars.iv61.unr, -1
  %49 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %48, i32 3, i64 %32
  %50 = load i32, ptr %49, align 4, !tbaa !5
  store i32 %50, ptr %40, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %47, %.lr.ph52.epil, %27
  %51 = add nsw i32 %31, 1
  store i32 %51, ptr @flag, align 4, !tbaa !5
  %52 = icmp slt i32 %31, 3
  br i1 %52, label %27, label %.preheader48, !llvm.loop !11

.lr.ph52:                                         ; preds = %77, %.lr.ph52.preheader.new
  %53 = phi i32 [ %.pre, %.lr.ph52.preheader.new ], [ %72, %77 ]
  %indvars.iv61 = phi i64 [ 1, %.lr.ph52.preheader.new ], [ %indvars.iv.next62.1, %77 ]
  %niter = phi i64 [ 0, %.lr.ph52.preheader.new ], [ %niter.next.1, %77 ]
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %54 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv61
  %55 = getelementptr inbounds i8, ptr %54, i64 24
  %56 = getelementptr inbounds [4 x i32], ptr %55, i64 0, i64 %32
  %57 = trunc nuw nsw i64 %indvars.iv.next62 to i32
  store i32 %57, ptr %56, align 4, !tbaa !5
  %58 = getelementptr inbounds i8, ptr %54, i64 8
  %59 = getelementptr inbounds [4 x i32], ptr %58, i64 0, i64 %32
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = icmp eq i32 %60, %53
  br i1 %61, label %62, label %.lr.ph52.1

62:                                               ; preds = %.lr.ph52
  %63 = add nsw i64 %indvars.iv61, -1
  %64 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %63, i32 3, i64 %32
  %65 = load i32, ptr %64, align 4, !tbaa !5
  store i32 %65, ptr %56, align 4, !tbaa !5
  br label %.lr.ph52.1

.lr.ph52.1:                                       ; preds = %.lr.ph52, %62
  %indvars.iv.next62.1 = add nuw nsw i64 %indvars.iv61, 2
  %66 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv.next62
  %67 = getelementptr inbounds i8, ptr %66, i64 24
  %68 = getelementptr inbounds [4 x i32], ptr %67, i64 0, i64 %32
  %69 = trunc nuw nsw i64 %indvars.iv.next62.1 to i32
  store i32 %69, ptr %68, align 4, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %66, i64 8
  %71 = getelementptr inbounds [4 x i32], ptr %70, i64 0, i64 %32
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp eq i32 %72, %60
  br i1 %73, label %74, label %77

74:                                               ; preds = %.lr.ph52.1
  %75 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv61, i32 3, i64 %32
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %68, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %74, %.lr.ph52.1
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph52, !llvm.loop !12

.preheader:                                       ; preds = %.lr.ph56, %.preheader48
  %78 = load i32, ptr %2, align 4, !tbaa !5
  %79 = icmp sgt i32 %78, 0
  br i1 %79, label %.lr.ph58, label %._crit_edge59

.lr.ph56:                                         ; preds = %.lr.ph56.preheader, %.lr.ph56
  %indvars.iv68 = phi i64 [ 0, %.lr.ph56.preheader ], [ %indvars.iv.next69, %.lr.ph56 ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %80 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %indvars.iv68
  %81 = load i32, ptr %80, align 8, !tbaa !13
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1000000 x i32], ptr @exist, i64 0, i64 %82
  %84 = trunc nuw nsw i64 %indvars.iv.next69 to i32
  store i32 %84, ptr %83, align 4, !tbaa !5
  %85 = getelementptr inbounds i8, ptr %80, i64 4
  store i32 0, ptr %85, align 4, !tbaa !15
  %86 = getelementptr inbounds i8, ptr %80, i64 24
  %87 = load i32, ptr %86, align 8, !tbaa !5
  %88 = getelementptr inbounds i8, ptr %80, i64 28
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = icmp slt i32 %89, %87
  %spec.store.select = zext i1 %90 to i32
  store i32 %spec.store.select, ptr %85, align 4
  %spec.select = call i32 @llvm.smin.i32(i32 %89, i32 %87)
  %91 = getelementptr inbounds i8, ptr %80, i64 32
  %92 = load i32, ptr %91, align 8, !tbaa !5
  %93 = icmp slt i32 %92, %spec.select
  %spec.store.select74 = select i1 %93, i32 2, i32 %spec.store.select
  store i32 %spec.store.select74, ptr %85, align 4
  %spec.select75 = call i32 @llvm.smin.i32(i32 %92, i32 %spec.select)
  %94 = getelementptr inbounds i8, ptr %80, i64 36
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = icmp slt i32 %95, %spec.select75
  %spec.store.select76 = select i1 %96, i32 3, i32 %spec.store.select74
  store i32 %spec.store.select76, ptr %85, align 4
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
  br i1 %exitcond72.not, label %.preheader, label %.lr.ph56, !llvm.loop !16

._crit_edge59:                                    ; preds = %118, %.preheader
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0

.lr.ph58:                                         ; preds = %.preheader, %118
  %.04157 = phi i32 [ %119, %118 ], [ 0, %.preheader ]
  %97 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %3)
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000000 x i32], ptr @exist, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %.not = icmp eq i32 %101, 0
  br i1 %.not, label %116, label %102

102:                                              ; preds = %.lr.ph58
  %103 = add nsw i32 %101, -1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [2005 x %struct.node], ptr @stu, i64 0, i64 %104
  %106 = getelementptr inbounds i8, ptr %105, i64 4
  %107 = load i32, ptr %106, align 4, !tbaa !15
  %108 = getelementptr inbounds i8, ptr %105, i64 24
  %109 = sext i32 %107 to i64
  %110 = getelementptr inbounds [4 x i32], ptr %108, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !5
  %112 = getelementptr inbounds [5 x i8], ptr @__const.main.c, i64 0, i64 %109
  %113 = load i8, ptr %112, align 1, !tbaa !17
  %114 = sext i8 %113 to i32
  %115 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %111, i32 noundef %114)
  br label %118

116:                                              ; preds = %.lr.ph58
  %117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %118

118:                                              ; preds = %116, %102
  %119 = add nuw nsw i32 %.04157, 1
  %120 = load i32, ptr %2, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %.lr.ph58, label %._crit_edge59, !llvm.loop !18
}

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

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind }

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

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


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