; LLVM IR from GGiecold-zz/Cluster_Ensembles :: src/Cluster_Ensembles/Hypergraph_Partitioning/metis-5.1.0/programs (io)

; 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.params_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, float, float, float, i64 }
%struct.mesh_t = type { i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [77 x i8], align 1
@__func__.ReadMesh = external hidden unnamed_addr constant [9 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [102 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [41 x i8], align 1

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

declare i32 @gk_fexists(ptr noundef) #1

declare void @errexit(ptr noundef, ...) #1

declare ptr @gk_fopen(ptr noundef, ptr noundef, ptr noundef) #1

declare i64 @gk_getline(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #2

declare ptr @libmetis__ismalloc(i64 noundef, i32 noundef, ptr noundef) #1

declare ptr @libmetis__imalloc(i64 noundef, ptr noundef) #1

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #2

declare void @gk_fclose(ptr noundef) #1

declare void @gk_free(ptr noundef, ...) #1

; 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
define dso_local ptr @ReadMesh(ptr noundef %0) #3 {
  %2 = alloca ptr, align 8
  %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 ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i64, align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store ptr null, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  store i64 0, ptr %18, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #4
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.params_t, ptr %21, i32 0, i32 22
  %23 = load ptr, ptr %22, align 8, !tbaa !11
  %24 = call i32 @gk_fexists(ptr noundef %23)
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %30, label %26

26:                                               ; preds = %1
  %27 = load ptr, ptr %2, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.params_t, ptr %27, i32 0, i32 22
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  call void (ptr, ...) @errexit(ptr noundef @.str, ptr noundef %29)
  br label %30

30:                                               ; preds = %26, %1
  %31 = call ptr @libmetis__CreateMesh()
  store ptr %31, ptr %20, align 8, !tbaa !5
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.params_t, ptr %32, i32 0, i32 22
  %34 = load ptr, ptr %33, align 8, !tbaa !11
  call void @gk_getfilestats(ptr noundef %34, ptr noundef %13, ptr noundef %14, ptr noundef null, ptr noundef null)
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.params_t, ptr %35, i32 0, i32 22
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = call ptr @gk_fopen(ptr noundef %37, ptr noundef @.str.1, ptr noundef @__func__.ReadMesh)
  store ptr %38, ptr %19, align 8, !tbaa !5
  br label %39

39:                                               ; preds = %48, %30
  %40 = load ptr, ptr %19, align 8, !tbaa !5
  %41 = call i64 @gk_getline(ptr noundef %15, ptr noundef %18, ptr noundef %40)
  %42 = icmp eq i64 %41, -1
  br i1 %42, label %43, label %47

43:                                               ; preds = %39
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.params_t, ptr %44, i32 0, i32 22
  %46 = load ptr, ptr %45, align 8, !tbaa !11
  call void (ptr, ...) @errexit(ptr noundef @.str.3, ptr noundef %46)
  br label %47

47:                                               ; preds = %43, %39
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %15, align 8, !tbaa !5
  %50 = getelementptr inbounds i8, ptr %49, i64 0
  %51 = load i8, ptr %50, align 1, !tbaa !15
  %52 = sext i8 %51 to i32
  %53 = icmp eq i32 %52, 37
  br i1 %53, label %39, label %54, !llvm.loop !16

54:                                               ; preds = %48
  %55 = load ptr, ptr %20, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mesh_t, ptr %55, i32 0, i32 2
  store i32 0, ptr %56, align 8, !tbaa !18
  %57 = load ptr, ptr %15, align 8, !tbaa !5
  %58 = load ptr, ptr %20, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.mesh_t, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %20, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mesh_t, ptr %60, i32 0, i32 2
  %62 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %57, ptr noundef @.str.31, ptr noundef %59, ptr noundef %61) #4
  store i32 %62, ptr %7, align 4, !tbaa !20
  %63 = load i32, ptr %7, align 4, !tbaa !20
  %64 = icmp slt i32 %63, 1
  br i1 %64, label %65, label %66

65:                                               ; preds = %54
  call void (ptr, ...) @errexit(ptr noundef @.str.32)
  br label %66

66:                                               ; preds = %65, %54
  %67 = load ptr, ptr %20, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.mesh_t, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !21
  %70 = icmp sle i32 %69, 0
  br i1 %70, label %71, label %75

71:                                               ; preds = %66
  %72 = load ptr, ptr %20, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.mesh_t, ptr %72, i32 0, i32 0
  %74 = load i32, ptr %73, align 8, !tbaa !21
  call void (ptr, ...) @errexit(ptr noundef @.str.33, i32 noundef %74)
  br label %75

75:                                               ; preds = %71, %66
  %76 = load ptr, ptr %20, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mesh_t, ptr %76, i32 0, i32 0
  %78 = load i32, ptr %77, align 8, !tbaa !21
  %79 = sext i32 %78 to i64
  %80 = load i64, ptr %13, align 8, !tbaa !9
  %81 = icmp ugt i64 %79, %80
  br i1 %81, label %82, label %87

82:                                               ; preds = %75
  %83 = load i64, ptr %13, align 8, !tbaa !9
  %84 = load ptr, ptr %20, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mesh_t, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !21
  call void (ptr, ...) @errexit(ptr noundef @.str.34, i64 noundef %83, i32 noundef %86)
  br label %87

87:                                               ; preds = %82, %75
  %88 = load ptr, ptr %20, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.mesh_t, ptr %88, i32 0, i32 2
  %90 = load i32, ptr %89, align 8, !tbaa !18
  store i32 %90, ptr %8, align 4, !tbaa !20
  %91 = load ptr, ptr %20, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mesh_t, ptr %91, i32 0, i32 0
  %93 = load i32, ptr %92, align 8, !tbaa !21
  %94 = add nsw i32 %93, 1
  %95 = sext i32 %94 to i64
  %96 = call ptr @libmetis__ismalloc(i64 noundef %95, i32 noundef 0, ptr noundef @.str.35)
  %97 = load ptr, ptr %20, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.mesh_t, ptr %97, i32 0, i32 3
  store ptr %96, ptr %98, align 8, !tbaa !22
  store ptr %96, ptr %10, align 8, !tbaa !5
  %99 = load i64, ptr %14, align 8, !tbaa !9
  %100 = call ptr @libmetis__imalloc(i64 noundef %99, ptr noundef @.str.36)
  %101 = load ptr, ptr %20, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.mesh_t, ptr %101, i32 0, i32 4
  store ptr %100, ptr %102, align 8, !tbaa !23
  store ptr %100, ptr %11, align 8, !tbaa !5
  %103 = load i32, ptr %8, align 4, !tbaa !20
  %104 = icmp eq i32 %103, 0
  br i1 %104, label %105, label %106

105:                                              ; preds = %87
  br label %108

106:                                              ; preds = %87
  %107 = load i32, ptr %8, align 4, !tbaa !20
  br label %108

108:                                              ; preds = %106, %105
  %109 = phi i32 [ 1, %105 ], [ %107, %106 ]
  %110 = load ptr, ptr %20, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.mesh_t, ptr %110, i32 0, i32 0
  %112 = load i32, ptr %111, align 8, !tbaa !21
  %113 = mul nsw i32 %109, %112
  %114 = sext i32 %113 to i64
  %115 = call ptr @libmetis__ismalloc(i64 noundef %114, i32 noundef 1, ptr noundef @.str.37)
  %116 = load ptr, ptr %20, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.mesh_t, ptr %116, i32 0, i32 5
  store ptr %115, ptr %117, align 8, !tbaa !24
  store ptr %115, ptr %12, align 8, !tbaa !5
  %118 = load ptr, ptr %10, align 8, !tbaa !5
  %119 = getelementptr inbounds i32, ptr %118, i64 0
  store i32 0, ptr %119, align 4, !tbaa !20
  store i32 0, ptr %5, align 4, !tbaa !20
  store i32 0, ptr %3, align 4, !tbaa !20
  br label %120

120:                                              ; preds = %219, %108
  %121 = load i32, ptr %3, align 4, !tbaa !20
  %122 = load ptr, ptr %20, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.mesh_t, ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !21
  %125 = icmp slt i32 %121, %124
  br i1 %125, label %126, label %222

126:                                              ; preds = %120
  br label %127

127:                                              ; preds = %135, %126
  %128 = load ptr, ptr %19, align 8, !tbaa !5
  %129 = call i64 @gk_getline(ptr noundef %15, ptr noundef %18, ptr noundef %128)
  %130 = icmp eq i64 %129, -1
  br i1 %130, label %131, label %134

131:                                              ; preds = %127
  %132 = load i32, ptr %3, align 4, !tbaa !20
  %133 = add nsw i32 %132, 1
  call void (ptr, ...) @errexit(ptr noundef @.str.38, i32 noundef %133)
  br label %134

134:                                              ; preds = %131, %127
  br label %135

135:                                              ; preds = %134
  %136 = load ptr, ptr %15, align 8, !tbaa !5
  %137 = getelementptr inbounds i8, ptr %136, i64 0
  %138 = load i8, ptr %137, align 1, !tbaa !15
  %139 = sext i8 %138 to i32
  %140 = icmp eq i32 %139, 37
  br i1 %140, label %127, label %141, !llvm.loop !25

141:                                              ; preds = %135
  %142 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %142, ptr %16, align 8, !tbaa !5
  store ptr null, ptr %17, align 8, !tbaa !5
  store i32 0, ptr %6, align 4, !tbaa !20
  br label %143

143:                                              ; preds = %183, %141
  %144 = load i32, ptr %6, align 4, !tbaa !20
  %145 = load i32, ptr %8, align 4, !tbaa !20
  %146 = icmp slt i32 %144, %145
  br i1 %146, label %147, label %186

147:                                              ; preds = %143
  %148 = load ptr, ptr %16, align 8, !tbaa !5
  %149 = call i64 @strtol(ptr noundef %148, ptr noundef %17, i32 noundef 10) #4
  %150 = trunc i64 %149 to i32
  %151 = load ptr, ptr %12, align 8, !tbaa !5
  %152 = load i32, ptr %3, align 4, !tbaa !20
  %153 = load i32, ptr %8, align 4, !tbaa !20
  %154 = mul nsw i32 %152, %153
  %155 = load i32, ptr %6, align 4, !tbaa !20
  %156 = add nsw i32 %154, %155
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds i32, ptr %151, i64 %157
  store i32 %150, ptr %158, align 4, !tbaa !20
  %159 = load ptr, ptr %17, align 8, !tbaa !5
  %160 = load ptr, ptr %16, align 8, !tbaa !5
  %161 = icmp eq ptr %159, %160
  br i1 %161, label %162, label %166

162:                                              ; preds = %147
  %163 = load i32, ptr %3, align 4, !tbaa !20
  %164 = add nsw i32 %163, 1
  %165 = load i32, ptr %8, align 4, !tbaa !20
  call void (ptr, ...) @errexit(ptr noundef @.str.18, i32 noundef %164, i32 noundef %165)
  br label %166

166:                                              ; preds = %162, %147
  %167 = load ptr, ptr %12, align 8, !tbaa !5
  %168 = load i32, ptr %3, align 4, !tbaa !20
  %169 = load i32, ptr %8, align 4, !tbaa !20
  %170 = mul nsw i32 %168, %169
  %171 = load i32, ptr %6, align 4, !tbaa !20
  %172 = add nsw i32 %170, %171
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds i32, ptr %167, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !20
  %176 = icmp slt i32 %175, 0
  br i1 %176, label %177, label %181

177:                                              ; preds = %166
  %178 = load i32, ptr %3, align 4, !tbaa !20
  %179 = add nsw i32 %178, 1
  %180 = load i32, ptr %6, align 4, !tbaa !20
  call void (ptr, ...) @errexit(ptr noundef @.str.39, i32 noundef %179, i32 noundef %180)
  br label %181

181:                                              ; preds = %177, %166
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %182, ptr %16, align 8, !tbaa !5
  br label %183

183:                                              ; preds = %181
  %184 = load i32, ptr %6, align 4, !tbaa !20
  %185 = add nsw i32 %184, 1
  store i32 %185, ptr %6, align 4, !tbaa !20
  br label %143, !llvm.loop !26

186:                                              ; preds = %143
  br label %187

187:                                              ; preds = %204, %186
  br label %188

188:                                              ; preds = %187
  %189 = load ptr, ptr %16, align 8, !tbaa !5
  %190 = call i64 @strtol(ptr noundef %189, ptr noundef %17, i32 noundef 10) #4
  %191 = trunc i64 %190 to i32
  store i32 %191, ptr %9, align 4, !tbaa !20
  %192 = load ptr, ptr %17, align 8, !tbaa !5
  %193 = load ptr, ptr %16, align 8, !tbaa !5
  %194 = icmp eq ptr %192, %193
  br i1 %194, label %195, label %196

195:                                              ; preds = %188
  br label %212

196:                                              ; preds = %188
  %197 = load ptr, ptr %17, align 8, !tbaa !5
  store ptr %197, ptr %16, align 8, !tbaa !5
  %198 = load i32, ptr %9, align 4, !tbaa !20
  %199 = icmp slt i32 %198, 1
  br i1 %199, label %200, label %204

200:                                              ; preds = %196
  %201 = load i32, ptr %9, align 4, !tbaa !20
  %202 = load i32, ptr %3, align 4, !tbaa !20
  %203 = add nsw i32 %202, 1
  call void (ptr, ...) @errexit(ptr noundef @.str.40, i32 noundef %201, i32 noundef %203)
  br label %204

204:                                              ; preds = %200, %196
  %205 = load i32, ptr %9, align 4, !tbaa !20
  %206 = sub nsw i32 %205, 1
  %207 = load ptr, ptr %11, align 8, !tbaa !5
  %208 = load i32, ptr %5, align 4, !tbaa !20
  %209 = add nsw i32 %208, 1
  store i32 %209, ptr %5, align 4, !tbaa !20
  %210 = sext i32 %208 to i64
  %211 = getelementptr inbounds i32, ptr %207, i64 %210
  store i32 %206, ptr %211, align 4, !tbaa !20
  br label %187

212:                                              ; preds = %195
  %213 = load i32, ptr %5, align 4, !tbaa !20
  %214 = load ptr, ptr %10, align 8, !tbaa !5
  %215 = load i32, ptr %3, align 4, !tbaa !20
  %216 = add nsw i32 %215, 1
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds i32, ptr %214, i64 %217
  store i32 %213, ptr %218, align 4, !tbaa !20
  br label %219

219:                                              ; preds = %212
  %220 = load i32, ptr %3, align 4, !tbaa !20
  %221 = add nsw i32 %220, 1
  store i32 %221, ptr %3, align 4, !tbaa !20
  br label %120, !llvm.loop !27

222:                                              ; preds = %120
  %223 = load ptr, ptr %19, align 8, !tbaa !5
  call void @gk_fclose(ptr noundef %223)
  %224 = load i32, ptr %8, align 4, !tbaa !20
  %225 = icmp eq i32 %224, 0
  br i1 %225, label %226, label %227

226:                                              ; preds = %222
  br label %229

227:                                              ; preds = %222
  %228 = load i32, ptr %8, align 4, !tbaa !20
  br label %229

229:                                              ; preds = %227, %226
  %230 = phi i32 [ 1, %226 ], [ %228, %227 ]
  %231 = load ptr, ptr %20, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.mesh_t, ptr %231, i32 0, i32 2
  store i32 %230, ptr %232, align 8, !tbaa !18
  %233 = load ptr, ptr %10, align 8, !tbaa !5
  %234 = load ptr, ptr %20, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.mesh_t, ptr %234, i32 0, i32 0
  %236 = load i32, ptr %235, align 8, !tbaa !21
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds i32, ptr %233, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !20
  %240 = sext i32 %239 to i64
  %241 = load ptr, ptr %11, align 8, !tbaa !5
  %242 = call i32 @libmetis__imax(i64 noundef %240, ptr noundef %241)
  %243 = add nsw i32 %242, 1
  %244 = load ptr, ptr %20, align 8, !tbaa !5
  %245 = getelementptr inbounds %struct.mesh_t, ptr %244, i32 0, i32 1
  store i32 %243, ptr %245, align 4, !tbaa !28
  call void (ptr, ...) @gk_free(ptr noundef %15, ptr noundef null)
  %246 = load ptr, ptr %20, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  ret ptr %246
}

declare ptr @libmetis__CreateMesh() #1

declare void @gk_getfilestats(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @libmetis__imax(i64 noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 88}
!12 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !13, i64 132, !6, i64 136, !6, i64 144, !14, i64 152, !14, i64 156, !14, i64 160, !10, i64 168}
!13 = !{!"int", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !13, i64 8}
!19 = !{!"mesh_t", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!20 = !{!13, !13, i64 0}
!21 = !{!19, !13, i64 0}
!22 = !{!19, !6, i64 16}
!23 = !{!19, !6, i64 24}
!24 = !{!19, !6, i64 32}
!25 = distinct !{!25, !17}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !17}
!28 = !{!19, !13, i64 4}


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

@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [77 x i8], align 1
@__func__.ReadMesh = external hidden unnamed_addr constant [9 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [57 x i8], align 1
@.str.33 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [102 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [58 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [41 x i8], align 1

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

declare i32 @gk_fexists(ptr noundef) local_unnamed_addr #1

declare void @errexit(ptr noundef, ...) local_unnamed_addr #1

declare ptr @gk_fopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i64 @gk_getline(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare ptr @libmetis__ismalloc(i64 noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare ptr @libmetis__imalloc(i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #3

declare void @gk_fclose(ptr noundef) local_unnamed_addr #1

declare void @gk_free(ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ReadMesh(ptr nocapture noundef readonly %0) local_unnamed_addr #4 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  store ptr null, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = tail call i32 @gk_fexists(ptr noundef %8) #6
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %10, label %12

10:                                               ; preds = %1
  %11 = load ptr, ptr %7, align 8, !tbaa !11
  tail call void (ptr, ...) @errexit(ptr noundef nonnull @.str, ptr noundef %11) #6
  br label %12

12:                                               ; preds = %10, %1
  %13 = tail call ptr @libmetis__CreateMesh() #6
  %14 = load ptr, ptr %7, align 8, !tbaa !11
  call void @gk_getfilestats(ptr noundef %14, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef null, ptr noundef null) #6
  %15 = load ptr, ptr %7, align 8, !tbaa !11
  %16 = call ptr @gk_fopen(ptr noundef %15, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.ReadMesh) #6
  br label %17

17:                                               ; preds = %22, %12
  %18 = call i64 @gk_getline(ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef %16) #6
  %19 = icmp eq i64 %18, -1
  br i1 %19, label %20, label %22

20:                                               ; preds = %17
  %21 = load ptr, ptr %7, align 8, !tbaa !11
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.3, ptr noundef %21) #6
  br label %22

22:                                               ; preds = %17, %20
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load i8, ptr %23, align 1, !tbaa !15
  %25 = icmp eq i8 %24, 37
  br i1 %25, label %17, label %26, !llvm.loop !16

26:                                               ; preds = %22
  %27 = getelementptr inbounds i8, ptr %13, i64 8
  store i32 0, ptr %27, align 8, !tbaa !18
  %28 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef nonnull %23, ptr noundef nonnull @.str.31, ptr noundef %13, ptr noundef nonnull %27) #6
  %29 = icmp slt i32 %28, 1
  br i1 %29, label %30, label %31

30:                                               ; preds = %26
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.32) #6
  br label %31

31:                                               ; preds = %30, %26
  %32 = load i32, ptr %13, align 8, !tbaa !20
  %33 = icmp slt i32 %32, 1
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.33, i32 noundef %32) #6
  %.pre = load i32, ptr %13, align 8, !tbaa !20
  br label %35

35:                                               ; preds = %34, %31
  %36 = phi i32 [ %.pre, %34 ], [ %32, %31 ]
  %37 = sext i32 %36 to i64
  %38 = load i64, ptr %2, align 8, !tbaa !9
  %39 = icmp ult i64 %38, %37
  br i1 %39, label %40, label %41

40:                                               ; preds = %35
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.34, i64 noundef %38, i32 noundef %36) #6
  %.pre93 = load i32, ptr %13, align 8, !tbaa !20
  br label %41

41:                                               ; preds = %40, %35
  %42 = phi i32 [ %.pre93, %40 ], [ %36, %35 ]
  %43 = load i32, ptr %27, align 8, !tbaa !18
  %44 = add nsw i32 %42, 1
  %45 = sext i32 %44 to i64
  %46 = call ptr @libmetis__ismalloc(i64 noundef %45, i32 noundef 0, ptr noundef nonnull @.str.35) #6
  %47 = getelementptr inbounds i8, ptr %13, i64 16
  store ptr %46, ptr %47, align 8, !tbaa !21
  %48 = load i64, ptr %3, align 8, !tbaa !9
  %49 = call ptr @libmetis__imalloc(i64 noundef %48, ptr noundef nonnull @.str.36) #6
  %50 = getelementptr inbounds i8, ptr %13, i64 24
  store ptr %49, ptr %50, align 8, !tbaa !22
  %51 = call i32 @llvm.umax.i32(i32 %43, i32 1)
  %52 = load i32, ptr %13, align 8, !tbaa !20
  %53 = mul nsw i32 %52, %51
  %54 = sext i32 %53 to i64
  %55 = call ptr @libmetis__ismalloc(i64 noundef %54, i32 noundef 1, ptr noundef nonnull @.str.37) #6
  %56 = getelementptr inbounds i8, ptr %13, i64 32
  store ptr %55, ptr %56, align 8, !tbaa !23
  store i32 0, ptr %46, align 4, !tbaa !24
  %57 = load i32, ptr %13, align 8, !tbaa !20
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.preheader73.lr.ph, label %._crit_edge82

.preheader73.lr.ph:                               ; preds = %41
  %59 = icmp sgt i32 %43, 0
  %60 = zext i32 %43 to i64
  br label %.preheader73

.preheader73:                                     ; preds = %.preheader73.lr.ph, %._crit_edge
  %indvars.iv90 = phi i64 [ 0, %.preheader73.lr.ph ], [ %indvars.iv.next91, %._crit_edge ]
  %.06480 = phi i32 [ 0, %.preheader73.lr.ph ], [ %.1.lcssa, %._crit_edge ]
  %indvars.iv.next91 = add nuw nsw i64 %indvars.iv90, 1
  %61 = trunc nuw nsw i64 %indvars.iv.next91 to i32
  br label %62

62:                                               ; preds = %.preheader73, %66
  %63 = call i64 @gk_getline(ptr noundef nonnull %4, ptr noundef nonnull %6, ptr noundef %16) #6
  %64 = icmp eq i64 %63, -1
  br i1 %64, label %65, label %66

65:                                               ; preds = %62
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.38, i32 noundef %61) #6
  br label %66

66:                                               ; preds = %62, %65
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = load i8, ptr %67, align 1, !tbaa !15
  %69 = icmp eq i8 %68, 37
  br i1 %69, label %62, label %70, !llvm.loop !25

70:                                               ; preds = %66
  store ptr null, ptr %5, align 8, !tbaa !5
  br i1 %59, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %70
  %71 = mul nuw nsw i64 %indvars.iv90, %60
  %invariant.gep = getelementptr inbounds i32, ptr %55, i64 %71
  %72 = trunc nuw nsw i64 %indvars.iv.next91 to i32
  %73 = trunc nuw nsw i64 %indvars.iv.next91 to i32
  br label %79

.preheader:                                       ; preds = %90, %70
  %.065.lcssa = phi ptr [ %67, %70 ], [ %82, %90 ]
  %74 = call i64 @strtol(ptr noundef %.065.lcssa, ptr noundef nonnull %5, i32 noundef 10) #6
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = icmp eq ptr %75, %.065.lcssa
  br i1 %76, label %._crit_edge, label %.lr.ph78

.lr.ph78:                                         ; preds = %.preheader
  %77 = sext i32 %.06480 to i64
  %78 = trunc nuw nsw i64 %indvars.iv.next91 to i32
  br label %91

79:                                               ; preds = %.lr.ph, %90
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %90 ]
  %.06576 = phi ptr [ %67, %.lr.ph ], [ %82, %90 ]
  %80 = call i64 @strtol(ptr noundef %.06576, ptr noundef nonnull %5, i32 noundef 10) #6
  %81 = trunc i64 %80 to i32
  %gep = getelementptr inbounds i32, ptr %invariant.gep, i64 %indvars.iv
  store i32 %81, ptr %gep, align 4, !tbaa !24
  %82 = load ptr, ptr %5, align 8, !tbaa !5
  %83 = icmp eq ptr %82, %.06576
  br i1 %83, label %84, label %85

84:                                               ; preds = %79
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.18, i32 noundef %72, i32 noundef %43) #6
  %.pr = load i32, ptr %gep, align 4, !tbaa !24
  br label %85

85:                                               ; preds = %84, %79
  %86 = phi i32 [ %.pr, %84 ], [ %81, %79 ]
  %87 = icmp slt i32 %86, 0
  br i1 %87, label %88, label %90

88:                                               ; preds = %85
  %89 = trunc nuw nsw i64 %indvars.iv to i32
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.39, i32 noundef %73, i32 noundef %89) #6
  br label %90

90:                                               ; preds = %88, %85
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %60
  br i1 %exitcond.not, label %.preheader, label %79, !llvm.loop !26

91:                                               ; preds = %.lr.ph78, %96
  %indvars.iv87 = phi i64 [ %77, %.lr.ph78 ], [ %indvars.iv.next88, %96 ]
  %92 = phi ptr [ %75, %.lr.ph78 ], [ %100, %96 ]
  %.in = phi i64 [ %74, %.lr.ph78 ], [ %99, %96 ]
  %93 = trunc i64 %.in to i32
  %94 = icmp slt i32 %93, 1
  br i1 %94, label %95, label %96

95:                                               ; preds = %91
  call void (ptr, ...) @errexit(ptr noundef nonnull @.str.40, i32 noundef %93, i32 noundef %78) #6
  br label %96

96:                                               ; preds = %95, %91
  %97 = add nsw i32 %93, -1
  %indvars.iv.next88 = add nsw i64 %indvars.iv87, 1
  %98 = getelementptr inbounds i32, ptr %49, i64 %indvars.iv87
  store i32 %97, ptr %98, align 4, !tbaa !24
  %99 = call i64 @strtol(ptr noundef %92, ptr noundef nonnull %5, i32 noundef 10) #6
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = icmp eq ptr %100, %92
  br i1 %101, label %._crit_edge.loopexit, label %91

._crit_edge.loopexit:                             ; preds = %96
  %102 = trunc nsw i64 %indvars.iv.next88 to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %.1.lcssa = phi i32 [ %.06480, %.preheader ], [ %102, %._crit_edge.loopexit ]
  %103 = getelementptr inbounds i32, ptr %46, i64 %indvars.iv.next91
  store i32 %.1.lcssa, ptr %103, align 4, !tbaa !24
  %104 = load i32, ptr %13, align 8, !tbaa !20
  %105 = sext i32 %104 to i64
  %106 = icmp slt i64 %indvars.iv.next91, %105
  br i1 %106, label %.preheader73, label %._crit_edge82, !llvm.loop !27

._crit_edge82:                                    ; preds = %._crit_edge, %41
  call void @gk_fclose(ptr noundef %16) #6
  store i32 %51, ptr %27, align 8, !tbaa !18
  %107 = load i32, ptr %13, align 8, !tbaa !20
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %46, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !24
  %111 = sext i32 %110 to i64
  %112 = call i32 @libmetis__imax(i64 noundef %111, ptr noundef %49) #6
  %113 = add nsw i32 %112, 1
  %114 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 %113, ptr %114, align 4, !tbaa !28
  call void (ptr, ...) @gk_free(ptr noundef nonnull %4, ptr noundef null) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  ret ptr %13
}

declare ptr @libmetis__CreateMesh() local_unnamed_addr #1

declare void @gk_getfilestats(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @libmetis__imax(i64 noundef, ptr noundef) local_unnamed_addr #1

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn "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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 88}
!12 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 40, !13, i64 44, !13, i64 48, !13, i64 52, !13, i64 56, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !13, i64 76, !13, i64 80, !13, i64 84, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !13, i64 128, !13, i64 132, !6, i64 136, !6, i64 144, !14, i64 152, !14, i64 156, !14, i64 160, !10, i64 168}
!13 = !{!"int", !7, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = !{!7, !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{!19, !13, i64 8}
!19 = !{!"mesh_t", !13, i64 0, !13, i64 4, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!20 = !{!19, !13, i64 0}
!21 = !{!19, !6, i64 16}
!22 = !{!19, !6, i64 24}
!23 = !{!19, !6, i64 32}
!24 = !{!13, !13, i64 0}
!25 = distinct !{!25, !17}
!26 = distinct !{!26, !17}
!27 = distinct !{!27, !17}
!28 = !{!19, !13, i64 4}


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