; LLVM IR from NongMindHouse/MasterNongMind :: Archives (mm-genetic)

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @CheckPopulationDuplicate(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateRandomGuess(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @rand() #2

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateRandomPopulation(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @FitnessScore(ptr noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Crossover(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Mutate(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local i32 @compare(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @GeneticEvolution(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) #1 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %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 i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store i32 %3, ptr %8, align 4, !tbaa !9
  %27 = load i32, ptr %8, align 4, !tbaa !9
  %28 = zext i32 %27 to i64
  %29 = call ptr @llvm.stacksave.p0()
  store ptr %29, ptr %9, align 8
  %30 = alloca [4 x i32], i64 %28, align 16
  store i64 %28, ptr %10, align 8
  call void @GenerateRandomPopulation(ptr noundef %30)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %262, %259, %4
  %32 = load i32, ptr %11, align 4, !tbaa !9
  %33 = load i32, ptr %8, align 4, !tbaa !9
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %35, label %38

35:                                               ; preds = %31
  %36 = load i32, ptr %12, align 4, !tbaa !9
  %37 = icmp slt i32 %36, 100
  br label %38

38:                                               ; preds = %35, %31
  %39 = phi i1 [ false, %31 ], [ %37, %35 ]
  br i1 %39, label %40, label %263

40:                                               ; preds = %38
  %41 = load i32, ptr %8, align 4, !tbaa !9
  %42 = zext i32 %41 to i64
  %43 = call ptr @llvm.stacksave.p0()
  store ptr %43, ptr %13, align 8
  %44 = alloca [5 x i32], i64 %42, align 16
  store i64 %42, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %45

45:                                               ; preds = %118, %40
  %46 = load i32, ptr %16, align 4, !tbaa !9
  %47 = load i32, ptr %8, align 4, !tbaa !9
  %48 = icmp slt i32 %46, %47
  br i1 %48, label %50, label %49

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

50:                                               ; preds = %45
  %51 = load i32, ptr %16, align 4, !tbaa !9
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [4 x i32], ptr %30, i64 %52
  %54 = getelementptr inbounds [4 x i32], ptr %53, i64 0, i64 0
  %55 = call i32 @rand() #5
  %56 = load i32, ptr %8, align 4, !tbaa !9
  %57 = srem i32 %55, %56
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [4 x i32], ptr %30, i64 %58
  %60 = getelementptr inbounds [4 x i32], ptr %59, i64 0, i64 0
  %61 = load i32, ptr %16, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [5 x i32], ptr %44, i64 %62
  %64 = getelementptr inbounds [5 x i32], ptr %63, i64 0, i64 0
  %65 = load i32, ptr %16, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [5 x i32], ptr %44, i64 %67
  %69 = getelementptr inbounds [5 x i32], ptr %68, i64 0, i64 0
  call void @Crossover(ptr noundef %54, ptr noundef %60, ptr noundef %64, ptr noundef %69)
  %70 = call i32 @rand() #5
  %71 = srem i32 %70, 100
  %72 = icmp slt i32 %71, 10
  br i1 %72, label %73, label %89

73:                                               ; preds = %50
  %74 = call i32 @rand() #5
  %75 = srem i32 %74, 2
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %77, label %82

77:                                               ; preds = %73
  %78 = load i32, ptr %16, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5 x i32], ptr %44, i64 %79
  %81 = getelementptr inbounds [5 x i32], ptr %80, i64 0, i64 0
  call void @Mutate(ptr noundef %81)
  br label %88

82:                                               ; preds = %73
  %83 = load i32, ptr %16, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [5 x i32], ptr %44, i64 %85
  %87 = getelementptr inbounds [5 x i32], ptr %86, i64 0, i64 0
  call void @Mutate(ptr noundef %87)
  br label %88

88:                                               ; preds = %82, %77
  br label %89

89:                                               ; preds = %88, %50
  %90 = load i32, ptr %16, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [5 x i32], ptr %44, i64 %91
  %93 = getelementptr inbounds [5 x i32], ptr %92, i64 0, i64 0
  %94 = load i32, ptr %16, align 4, !tbaa !9
  %95 = call i32 @CheckPopulationDuplicate(ptr noundef %44, ptr noundef %93, i32 noundef %94)
  %96 = icmp eq i32 %95, 1
  br i1 %96, label %97, label %102

97:                                               ; preds = %89
  %98 = load i32, ptr %16, align 4, !tbaa !9
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [5 x i32], ptr %44, i64 %99
  %101 = getelementptr inbounds [5 x i32], ptr %100, i64 0, i64 0
  call void @GenerateRandomGuess(ptr noundef %101)
  br label %102

102:                                              ; preds = %97, %89
  %103 = load i32, ptr %16, align 4, !tbaa !9
  %104 = add nsw i32 %103, 1
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [5 x i32], ptr %44, i64 %105
  %107 = getelementptr inbounds [5 x i32], ptr %106, i64 0, i64 0
  %108 = load i32, ptr %16, align 4, !tbaa !9
  %109 = call i32 @CheckPopulationDuplicate(ptr noundef %44, ptr noundef %107, i32 noundef %108)
  %110 = icmp eq i32 %109, 1
  br i1 %110, label %111, label %117

111:                                              ; preds = %102
  %112 = load i32, ptr %16, align 4, !tbaa !9
  %113 = add nsw i32 %112, 1
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [5 x i32], ptr %44, i64 %114
  %116 = getelementptr inbounds [5 x i32], ptr %115, i64 0, i64 0
  call void @GenerateRandomGuess(ptr noundef %116)
  br label %117

117:                                              ; preds = %111, %102
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %16, align 4, !tbaa !9
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %16, align 4, !tbaa !9
  br label %45, !llvm.loop !11

121:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %122

122:                                              ; preds = %144, %121
  %123 = load i32, ptr %17, align 4, !tbaa !9
  %124 = load i32, ptr %8, align 4, !tbaa !9
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %147

127:                                              ; preds = %122
  %128 = load i32, ptr %17, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [5 x i32], ptr %44, i64 %129
  %131 = getelementptr inbounds [5 x i32], ptr %130, i64 0, i64 0
  %132 = load ptr, ptr %6, align 8, !tbaa !5
  %133 = load i32, ptr %7, align 4, !tbaa !9
  call void @FitnessScore(ptr noundef %131, ptr noundef %132, i32 noundef %133)
  %134 = load i32, ptr %17, align 4, !tbaa !9
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [5 x i32], ptr %44, i64 %135
  %137 = getelementptr inbounds [5 x i32], ptr %136, i64 0, i64 4
  %138 = load i32, ptr %137, align 4, !tbaa !9
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %143

140:                                              ; preds = %127
  %141 = load i32, ptr %15, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %15, align 4, !tbaa !9
  br label %143

143:                                              ; preds = %140, %127
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %17, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %17, align 4, !tbaa !9
  br label %122, !llvm.loop !13

147:                                              ; preds = %126
  %148 = load i32, ptr %15, align 4, !tbaa !9
  %149 = icmp eq i32 %148, 0
  br i1 %149, label %150, label %153

150:                                              ; preds = %147
  %151 = load i32, ptr %12, align 4, !tbaa !9
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %12, align 4, !tbaa !9
  store i32 2, ptr %18, align 4
  br label %259, !llvm.loop !14

153:                                              ; preds = %147
  %154 = load i32, ptr %8, align 4, !tbaa !9
  %155 = sext i32 %154 to i64
  call void @qsort(ptr noundef %44, i64 noundef %155, i64 noundef 20, ptr noundef @compare)
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %156

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

160:                                              ; preds = %156
  store i32 10, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  br label %190

161:                                              ; preds = %156
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %162

162:                                              ; preds = %181, %161
  %163 = load i32, ptr %20, align 4, !tbaa !9
  %164 = icmp slt i32 %163, 5
  br i1 %164, label %166, label %165

165:                                              ; preds = %162
  store i32 13, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  br label %184

166:                                              ; preds = %162
  %167 = load i32, ptr %19, align 4, !tbaa !9
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [5 x i32], ptr %44, i64 %168
  %170 = load i32, ptr %20, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [5 x i32], ptr %169, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !9
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = load i32, ptr %19, align 4, !tbaa !9
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [5 x i32], ptr %174, i64 %176
  %178 = load i32, ptr %20, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds [5 x i32], ptr %177, i64 0, i64 %179
  store i32 %173, ptr %180, align 4, !tbaa !9
  br label %181

181:                                              ; preds = %166
  %182 = load i32, ptr %20, align 4, !tbaa !9
  %183 = add nsw i32 %182, 1
  store i32 %183, ptr %20, align 4, !tbaa !9
  br label %162, !llvm.loop !15

184:                                              ; preds = %165
  %185 = load i32, ptr %11, align 4, !tbaa !9
  %186 = add nsw i32 %185, 1
  store i32 %186, ptr %11, align 4, !tbaa !9
  br label %187

187:                                              ; preds = %184
  %188 = load i32, ptr %19, align 4, !tbaa !9
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %19, align 4, !tbaa !9
  br label %156, !llvm.loop !16

190:                                              ; preds = %160
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  store i32 0, ptr %21, align 4, !tbaa !9
  br label %191

191:                                              ; preds = %253, %190
  %192 = load i32, ptr %21, align 4, !tbaa !9
  %193 = load i32, ptr %8, align 4, !tbaa !9
  %194 = icmp slt i32 %192, %193
  br i1 %194, label %196, label %195

195:                                              ; preds = %191
  store i32 16, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  br label %256

196:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  %197 = load i32, ptr %8, align 4, !tbaa !9
  %198 = sitofp i32 %197 to double
  %199 = fmul double %198, 0x3FEE666666666666
  %200 = fptosi double %199 to i32
  store i32 %200, ptr %22, align 4, !tbaa !9
  %201 = load i32, ptr %21, align 4, !tbaa !9
  %202 = load i32, ptr %22, align 4, !tbaa !9
  %203 = icmp slt i32 %201, %202
  br i1 %203, label %204, label %227

204:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #5
  store i32 0, ptr %23, align 4, !tbaa !9
  br label %205

205:                                              ; preds = %223, %204
  %206 = load i32, ptr %23, align 4, !tbaa !9
  %207 = icmp slt i32 %206, 4
  br i1 %207, label %209, label %208

208:                                              ; preds = %205
  store i32 19, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #5
  br label %226

209:                                              ; preds = %205
  %210 = load i32, ptr %21, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [5 x i32], ptr %44, i64 %211
  %213 = load i32, ptr %23, align 4, !tbaa !9
  %214 = sext i32 %213 to i64
  %215 = getelementptr inbounds [5 x i32], ptr %212, i64 0, i64 %214
  %216 = load i32, ptr %215, align 4, !tbaa !9
  %217 = load i32, ptr %21, align 4, !tbaa !9
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [4 x i32], ptr %30, i64 %218
  %220 = load i32, ptr %23, align 4, !tbaa !9
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [4 x i32], ptr %219, i64 0, i64 %221
  store i32 %216, ptr %222, align 4, !tbaa !9
  br label %223

223:                                              ; preds = %209
  %224 = load i32, ptr %23, align 4, !tbaa !9
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %23, align 4, !tbaa !9
  br label %205, !llvm.loop !17

226:                                              ; preds = %208
  br label %252

227:                                              ; preds = %196
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #5
  store i32 0, ptr %24, align 4, !tbaa !9
  br label %228

228:                                              ; preds = %248, %227
  %229 = load i32, ptr %24, align 4, !tbaa !9
  %230 = icmp slt i32 %229, 4
  br i1 %230, label %232, label %231

231:                                              ; preds = %228
  store i32 22, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #5
  br label %251

232:                                              ; preds = %228
  %233 = load i32, ptr %21, align 4, !tbaa !9
  %234 = load i32, ptr %22, align 4, !tbaa !9
  %235 = sub nsw i32 %233, %234
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [4 x i32], ptr %30, i64 %236
  %238 = load i32, ptr %24, align 4, !tbaa !9
  %239 = sext i32 %238 to i64
  %240 = getelementptr inbounds [4 x i32], ptr %237, i64 0, i64 %239
  %241 = load i32, ptr %240, align 4, !tbaa !9
  %242 = load i32, ptr %21, align 4, !tbaa !9
  %243 = sext i32 %242 to i64
  %244 = getelementptr inbounds [4 x i32], ptr %30, i64 %243
  %245 = load i32, ptr %24, align 4, !tbaa !9
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [4 x i32], ptr %244, i64 0, i64 %246
  store i32 %241, ptr %247, align 4, !tbaa !9
  br label %248

248:                                              ; preds = %232
  %249 = load i32, ptr %24, align 4, !tbaa !9
  %250 = add nsw i32 %249, 1
  store i32 %250, ptr %24, align 4, !tbaa !9
  br label %228, !llvm.loop !18

251:                                              ; preds = %231
  br label %252

252:                                              ; preds = %251, %226
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  br label %253

253:                                              ; preds = %252
  %254 = load i32, ptr %21, align 4, !tbaa !9
  %255 = add nsw i32 %254, 1
  store i32 %255, ptr %21, align 4, !tbaa !9
  br label %191, !llvm.loop !19

256:                                              ; preds = %195
  %257 = load i32, ptr %12, align 4, !tbaa !9
  %258 = add nsw i32 %257, 1
  store i32 %258, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %18, align 4
  br label %259

259:                                              ; preds = %256, %150
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %260 = load ptr, ptr %13, align 8
  call void @llvm.stackrestore.p0(ptr %260)
  %261 = load i32, ptr %18, align 4
  switch i32 %261, label %295 [
    i32 0, label %262
    i32 2, label %31
  ]

262:                                              ; preds = %259
  br label %31, !llvm.loop !14

263:                                              ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #5
  %264 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %264, ptr %25, align 4, !tbaa !9
  br label %265

265:                                              ; preds = %289, %263
  %266 = load i32, ptr %25, align 4, !tbaa !9
  %267 = load i32, ptr %8, align 4, !tbaa !9
  %268 = icmp slt i32 %266, %267
  br i1 %268, label %270, label %269

269:                                              ; preds = %265
  store i32 25, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #5
  br label %292

270:                                              ; preds = %265
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #5
  store i32 0, ptr %26, align 4, !tbaa !9
  br label %271

271:                                              ; preds = %285, %270
  %272 = load i32, ptr %26, align 4, !tbaa !9
  %273 = icmp slt i32 %272, 4
  br i1 %273, label %275, label %274

274:                                              ; preds = %271
  store i32 28, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #5
  br label %288

275:                                              ; preds = %271
  %276 = call i32 @rand() #5
  %277 = srem i32 %276, 6
  %278 = load ptr, ptr %5, align 8, !tbaa !5
  %279 = load i32, ptr %25, align 4, !tbaa !9
  %280 = sext i32 %279 to i64
  %281 = getelementptr inbounds [5 x i32], ptr %278, i64 %280
  %282 = load i32, ptr %26, align 4, !tbaa !9
  %283 = sext i32 %282 to i64
  %284 = getelementptr inbounds [5 x i32], ptr %281, i64 0, i64 %283
  store i32 %277, ptr %284, align 4, !tbaa !9
  br label %285

285:                                              ; preds = %275
  %286 = load i32, ptr %26, align 4, !tbaa !9
  %287 = add nsw i32 %286, 1
  store i32 %287, ptr %26, align 4, !tbaa !9
  br label %271, !llvm.loop !20

288:                                              ; preds = %274
  br label %289

289:                                              ; preds = %288
  %290 = load i32, ptr %25, align 4, !tbaa !9
  %291 = add nsw i32 %290, 1
  store i32 %291, ptr %25, align 4, !tbaa !9
  br label %265, !llvm.loop !21

292:                                              ; preds = %269
  %293 = load i32, ptr %11, align 4, !tbaa !9
  store i32 1, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %294 = load ptr, ptr %9, align 8
  call void @llvm.stackrestore.p0(ptr %294)
  ret i32 %293

295:                                              ; preds = %259
  unreachable
}

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/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}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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"

; Function Attrs: nounwind uwtable
declare dso_local i32 @CheckPopulationDuplicate(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateRandomGuess(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @GenerateRandomPopulation(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @FitnessScore(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Crossover(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Mutate(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @compare(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @GeneticEvolution(ptr nocapture noundef writeonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = zext i32 %3 to i64
  %6 = alloca [4 x i32], i64 %5, align 16
  call void @GenerateRandomPopulation(ptr noundef nonnull %6)
  %7 = icmp sgt i32 %3, -1
  br i1 %7, label %.lr.ph111, label %.preheader88

.lr.ph111:                                        ; preds = %4
  %.not = icmp eq i32 %3, 0
  %8 = uitofp nneg i32 %3 to double
  %9 = fmul double %8, 0x3FEE666666666666
  %10 = fptosi double %9 to i32
  %11 = sext i32 %10 to i64
  br label %14

.preheader88:                                     ; preds = %.loopexit94, %4
  %.076.lcssa = phi i32 [ 0, %4 ], [ %.2, %.loopexit94 ]
  %12 = icmp slt i32 %.076.lcssa, %3
  br i1 %12, label %.preheader.preheader, label %._crit_edge115

.preheader.preheader:                             ; preds = %.preheader88
  %13 = sext i32 %.076.lcssa to i64
  br label %.preheader

14:                                               ; preds = %.lr.ph111, %.loopexit94
  %.076109 = phi i32 [ 0, %.lr.ph111 ], [ %.2, %.loopexit94 ]
  %.084108 = phi i32 [ 0, %.lr.ph111 ], [ %.185, %.loopexit94 ]
  %15 = call ptr @llvm.stacksave.p0()
  %16 = alloca [5 x i32], i64 %5, align 16
  br i1 %.not, label %.loopexit94, label %.lr.ph

.preheader95:                                     ; preds = %39
  br i1 %.not, label %.loopexit94, label %.lr.ph99

.lr.ph:                                           ; preds = %14, %39
  %indvars.iv = phi i64 [ %indvars.iv.next, %39 ], [ 0, %14 ]
  %17 = getelementptr inbounds [4 x i32], ptr %6, i64 %indvars.iv
  %18 = call i32 @rand() #5
  %19 = srem i32 %18, %3
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [4 x i32], ptr %6, i64 %20
  %22 = getelementptr inbounds [5 x i32], ptr %16, i64 %indvars.iv
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %23 = getelementptr inbounds [5 x i32], ptr %16, i64 %indvars.iv.next
  call void @Crossover(ptr noundef nonnull %17, ptr noundef nonnull %21, ptr noundef nonnull %22, ptr noundef nonnull %23)
  %24 = call i32 @rand() #5
  %25 = srem i32 %24, 100
  %26 = icmp slt i32 %25, 10
  br i1 %26, label %.sink.split, label %30

.sink.split:                                      ; preds = %.lr.ph
  %27 = call i32 @rand() #5
  %28 = and i32 %27, 1
  %29 = icmp eq i32 %28, 0
  %. = select i1 %29, ptr %22, ptr %23
  call void @Mutate(ptr noundef nonnull %.)
  br label %30

30:                                               ; preds = %.sink.split, %.lr.ph
  %31 = trunc nuw nsw i64 %indvars.iv to i32
  %32 = call i32 @CheckPopulationDuplicate(ptr noundef nonnull %16, ptr noundef nonnull %22, i32 noundef %31)
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %34, label %35

34:                                               ; preds = %30
  call void @GenerateRandomGuess(ptr noundef nonnull %22)
  br label %35

35:                                               ; preds = %34, %30
  %36 = call i32 @CheckPopulationDuplicate(ptr noundef nonnull %16, ptr noundef nonnull %23, i32 noundef %31)
  %37 = icmp eq i32 %36, 1
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  call void @GenerateRandomGuess(ptr noundef nonnull %23)
  br label %39

39:                                               ; preds = %35, %38
  %exitcond.not = icmp eq i64 %indvars.iv.next, %5
  br i1 %exitcond.not, label %.preheader95, label %.lr.ph, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph99
  %40 = icmp eq i32 %spec.select, 0
  br i1 %40, label %.loopexit94, label %.preheader92.preheader, !llvm.loop !7

.lr.ph99:                                         ; preds = %.preheader95, %.lr.ph99
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %.lr.ph99 ], [ 0, %.preheader95 ]
  %.08297 = phi i32 [ %spec.select, %.lr.ph99 ], [ 0, %.preheader95 ]
  %41 = getelementptr inbounds [5 x i32], ptr %16, i64 %indvars.iv120
  call void @FitnessScore(ptr noundef nonnull %41, ptr noundef %1, i32 noundef %2)
  %42 = getelementptr inbounds i8, ptr %41, i64 16
  %43 = load i32, ptr %42, align 4, !tbaa !8
  %44 = icmp eq i32 %43, 0
  %45 = zext i1 %44 to i32
  %spec.select = add nuw nsw i32 %.08297, %45
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %exitcond124.not = icmp eq i64 %indvars.iv.next121, %5
  br i1 %exitcond124.not, label %._crit_edge, label %.lr.ph99, !llvm.loop !12

.preheader92.preheader:                           ; preds = %._crit_edge
  call void @qsort(ptr noundef nonnull %16, i64 noundef %5, i64 noundef 20, ptr noundef nonnull @compare) #5
  %46 = zext nneg i32 %spec.select to i64
  %47 = mul nuw nsw i64 %46, 20
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %0, ptr nonnull align 16 %16, i64 %47, i1 false), !tbaa !8
  %48 = add i32 %.076109, %spec.select
  br i1 %.not, label %.loopexit94, label %.lr.ph107

.lr.ph107:                                        ; preds = %.preheader92.preheader, %.loopexit
  %indvar = phi i64 [ %indvar.next, %.loopexit ], [ 0, %.preheader92.preheader ]
  %49 = icmp slt i64 %indvar, %11
  br i1 %49, label %.preheader89, label %.preheader90

.preheader90:                                     ; preds = %.lr.ph107
  %50 = sub nsw i64 %indvar, %11
  %51 = getelementptr inbounds [4 x i32], ptr %6, i64 %50, i64 0
  %52 = getelementptr inbounds [4 x i32], ptr %6, i64 %indvar, i64 0
  %53 = load <4 x i32>, ptr %51, align 16, !tbaa !8
  store <4 x i32> %53, ptr %52, align 16, !tbaa !8
  br label %.loopexit

.preheader89:                                     ; preds = %.lr.ph107
  %54 = mul nuw nsw i64 %indvar, 20
  %scevgep135 = getelementptr i8, ptr %16, i64 %54
  %55 = shl nuw nsw i64 %indvar, 4
  %scevgep = getelementptr i8, ptr %6, i64 %55
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %scevgep, ptr noundef nonnull align 4 dereferenceable(16) %scevgep135, i64 16, i1 false), !tbaa !8
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader90, %.preheader89
  %indvar.next = add nuw nsw i64 %indvar, 1
  %exitcond141.not = icmp eq i64 %indvar.next, %5
  br i1 %exitcond141.not, label %.loopexit94, label %.lr.ph107, !llvm.loop !13

.loopexit94:                                      ; preds = %.loopexit, %14, %.preheader95, %.preheader92.preheader, %._crit_edge
  %.2 = phi i32 [ %.076109, %._crit_edge ], [ %48, %.preheader92.preheader ], [ %.076109, %.preheader95 ], [ %.076109, %14 ], [ %48, %.loopexit ]
  %.185 = add nuw nsw i32 %.084108, 1
  call void @llvm.stackrestore.p0(ptr %15)
  %56 = icmp sle i32 %.2, %3
  %57 = icmp ult i32 %.084108, 99
  %58 = select i1 %56, i1 %57, i1 false
  br i1 %58, label %14, label %.preheader88

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %indvars.iv146 = phi i64 [ %13, %.preheader.preheader ], [ %indvars.iv.next147, %.preheader ]
  %59 = call i32 @rand() #5
  %60 = srem i32 %59, 6
  %61 = getelementptr inbounds [5 x i32], ptr %0, i64 %indvars.iv146, i64 0
  store i32 %60, ptr %61, align 4, !tbaa !8
  %62 = call i32 @rand() #5
  %63 = srem i32 %62, 6
  %64 = getelementptr inbounds [5 x i32], ptr %0, i64 %indvars.iv146, i64 1
  store i32 %63, ptr %64, align 4, !tbaa !8
  %65 = call i32 @rand() #5
  %66 = srem i32 %65, 6
  %67 = getelementptr inbounds [5 x i32], ptr %0, i64 %indvars.iv146, i64 2
  store i32 %66, ptr %67, align 4, !tbaa !8
  %68 = call i32 @rand() #5
  %69 = srem i32 %68, 6
  %70 = getelementptr inbounds [5 x i32], ptr %0, i64 %indvars.iv146, i64 3
  store i32 %69, ptr %70, align 4, !tbaa !8
  %indvars.iv.next147 = add nsw i64 %indvars.iv146, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next147 to i32
  %exitcond149.not = icmp eq i32 %lftr.wideiv, %3
  br i1 %exitcond149.not, label %._crit_edge115, label %.preheader, !llvm.loop !14

._crit_edge115:                                   ; preds = %.preheader, %.preheader88
  ret i32 %.076.lcssa
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #2

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #2

; 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) #4

attributes #0 = { 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 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #3 = { nofree "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: readwrite) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}


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