; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_mesh)

; 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.RcsMeshData = type { i32, ptr, i32, ptr }

@Rcs_calloc = external global ptr, align 8
@RCS_GLOBAL_RLOG_CB = external global ptr, align 8
@.str = external hidden unnamed_addr constant [67 x i8], align 1
@__func__.RcsMesh_compressVertices = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@RcsLogLevel = external global i32, align 4
@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [90 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @RcsMesh_compressVertices(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca double, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store double %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %17 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.RcsMeshData, ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 8, !tbaa !13
  %21 = mul i32 %20, 3
  %22 = zext i32 %21 to i64
  %23 = call ptr %17(i64 noundef %22, i64 noundef 4)
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %51

26:                                               ; preds = %2
  br label %27

27:                                               ; preds = %26
  %28 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  %31 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.RcsMeshData, ptr %32, i32 0, i32 2
  %34 = load i32, ptr %33, align 8, !tbaa !13
  call void (i32, ptr, ptr, i32, ptr, ...) %31(i32 noundef 4, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 85, ptr noundef @.str.1, i32 noundef %34)
  br label %35

35:                                               ; preds = %30, %27
  %36 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %37 = icmp sle i32 4, %36
  br i1 %37, label %38, label %48

38:                                               ; preds = %35
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef @.str.2, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 85) #4
  %41 = load ptr, ptr @stderr, align 8, !tbaa !5
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.RcsMeshData, ptr %42, i32 0, i32 2
  %44 = load i32, ptr %43, align 8, !tbaa !13
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %41, ptr noundef @.str.1, i32 noundef %44) #4
  %46 = load ptr, ptr @stderr, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.3) #4
  br label %48

48:                                               ; preds = %38, %35
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %249

51:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %52 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !5
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.RcsMeshData, ptr %53, i32 0, i32 0
  %55 = load i32, ptr %54, align 8, !tbaa !15
  %56 = mul i32 %55, 3
  %57 = zext i32 %56 to i64
  %58 = call ptr %52(i64 noundef %57, i64 noundef 8)
  store ptr %58, ptr %10, align 8, !tbaa !5
  %59 = load ptr, ptr %8, align 8, !tbaa !5
  %60 = icmp eq ptr %59, null
  br i1 %60, label %61, label %87

61:                                               ; preds = %51
  br label %62

62:                                               ; preds = %61
  %63 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %70

65:                                               ; preds = %62
  %66 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.RcsMeshData, ptr %67, i32 0, i32 0
  %69 = load i32, ptr %68, align 8, !tbaa !15
  call void (i32, ptr, ptr, i32, ptr, ...) %66(i32 noundef 4, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 93, ptr noundef @.str.4, i32 noundef %69)
  br label %70

70:                                               ; preds = %65, %62
  %71 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %72 = icmp sle i32 4, %71
  br i1 %72, label %73, label %83

73:                                               ; preds = %70
  %74 = load ptr, ptr @stderr, align 8, !tbaa !5
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.2, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 93) #4
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.RcsMeshData, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 8, !tbaa !15
  %80 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str.4, i32 noundef %79) #4
  %81 = load ptr, ptr @stderr, align 8, !tbaa !5
  %82 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %81, ptr noundef @.str.3) #4
  br label %83

83:                                               ; preds = %73, %70
  br label %84

84:                                               ; preds = %83
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %86) #4
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %248

87:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %88

88:                                               ; preds = %217, %87
  %89 = load i32, ptr %11, align 4, !tbaa !11
  %90 = load ptr, ptr %4, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.RcsMeshData, ptr %90, i32 0, i32 2
  %92 = load i32, ptr %91, align 8, !tbaa !13
  %93 = mul i32 3, %92
  %94 = icmp ult i32 %89, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %88
  store i32 6, ptr %9, align 4
  br label %220

96:                                               ; preds = %88
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.RcsMeshData, ptr %97, i32 0, i32 3
  %99 = load ptr, ptr %98, align 8, !tbaa !16
  %100 = load i32, ptr %11, align 4, !tbaa !11
  %101 = zext i32 %100 to i64
  %102 = getelementptr inbounds i32, ptr %99, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !11
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.RcsMeshData, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 8, !tbaa !15
  %107 = icmp uge i32 %103, %106
  br i1 %107, label %108, label %151

108:                                              ; preds = %96
  br label %109

109:                                              ; preds = %108
  %110 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %111 = icmp ne ptr %110, null
  br i1 %111, label %112, label %125

112:                                              ; preds = %109
  %113 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %114 = load i32, ptr %11, align 4, !tbaa !11
  %115 = load ptr, ptr %4, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.RcsMeshData, ptr %115, i32 0, i32 3
  %117 = load ptr, ptr %116, align 8, !tbaa !16
  %118 = load i32, ptr %11, align 4, !tbaa !11
  %119 = zext i32 %118 to i64
  %120 = getelementptr inbounds i32, ptr %117, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !11
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.RcsMeshData, ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 8, !tbaa !15
  call void (i32, ptr, ptr, i32, ptr, ...) %113(i32 noundef 1, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 103, ptr noundef @.str.5, i32 noundef %114, i32 noundef %121, i32 noundef %124)
  br label %125

125:                                              ; preds = %112, %109
  %126 = load i32, ptr @RcsLogLevel, align 4, !tbaa !11
  %127 = icmp sle i32 1, %126
  br i1 %127, label %128, label %146

128:                                              ; preds = %125
  %129 = load ptr, ptr @stderr, align 8, !tbaa !5
  %130 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %129, ptr noundef @.str.2, ptr noundef @.str, ptr noundef @__func__.RcsMesh_compressVertices, i32 noundef 103) #4
  %131 = load ptr, ptr @stderr, align 8, !tbaa !5
  %132 = load i32, ptr %11, align 4, !tbaa !11
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.RcsMeshData, ptr %133, i32 0, i32 3
  %135 = load ptr, ptr %134, align 8, !tbaa !16
  %136 = load i32, ptr %11, align 4, !tbaa !11
  %137 = zext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %135, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !11
  %140 = load ptr, ptr %4, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.RcsMeshData, ptr %140, i32 0, i32 0
  %142 = load i32, ptr %141, align 8, !tbaa !15
  %143 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %131, ptr noundef @.str.5, i32 noundef %132, i32 noundef %139, i32 noundef %142) #4
  %144 = load ptr, ptr @stderr, align 8, !tbaa !5
  %145 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %144, ptr noundef @.str.3) #4
  br label %146

146:                                              ; preds = %128, %125
  br label %147

147:                                              ; preds = %146
  br label %148

148:                                              ; preds = %147
  %149 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %149) #4
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  call void @free(ptr noundef %150) #4
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %9, align 4
  br label %220

151:                                              ; preds = %96
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %152 = load ptr, ptr %4, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.RcsMeshData, ptr %152, i32 0, i32 1
  %154 = load ptr, ptr %153, align 8, !tbaa !17
  %155 = load ptr, ptr %4, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.RcsMeshData, ptr %155, i32 0, i32 3
  %157 = load ptr, ptr %156, align 8, !tbaa !16
  %158 = load i32, ptr %11, align 4, !tbaa !11
  %159 = zext i32 %158 to i64
  %160 = getelementptr inbounds i32, ptr %157, i64 %159
  %161 = load i32, ptr %160, align 4, !tbaa !11
  %162 = mul i32 3, %161
  %163 = zext i32 %162 to i64
  %164 = getelementptr inbounds double, ptr %154, i64 %163
  store ptr %164, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  store i8 0, ptr %13, align 1, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %165

165:                                              ; preds = %191, %151
  %166 = load i32, ptr %14, align 4, !tbaa !11
  %167 = load i32, ptr %6, align 4, !tbaa !11
  %168 = icmp ult i32 %166, %167
  br i1 %168, label %170, label %169

169:                                              ; preds = %165
  store i32 11, ptr %9, align 4
  br label %194

170:                                              ; preds = %165
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %171 = load ptr, ptr %10, align 8, !tbaa !5
  %172 = load i32, ptr %14, align 4, !tbaa !11
  %173 = mul i32 3, %172
  %174 = zext i32 %173 to i64
  %175 = getelementptr inbounds double, ptr %171, i64 %174
  store ptr %175, ptr %15, align 8, !tbaa !5
  %176 = load ptr, ptr %12, align 8, !tbaa !5
  %177 = load ptr, ptr %15, align 8, !tbaa !5
  %178 = call double @Vec3d_distance(ptr noundef %176, ptr noundef %177)
  %179 = load double, ptr %5, align 8, !tbaa !9
  %180 = fcmp olt double %178, %179
  br i1 %180, label %181, label %187

181:                                              ; preds = %170
  %182 = load i32, ptr %14, align 4, !tbaa !11
  %183 = load ptr, ptr %8, align 8, !tbaa !5
  %184 = load i32, ptr %7, align 4, !tbaa !11
  %185 = zext i32 %184 to i64
  %186 = getelementptr inbounds i32, ptr %183, i64 %185
  store i32 %182, ptr %186, align 4, !tbaa !11
  store i8 1, ptr %13, align 1, !tbaa !18
  store i32 11, ptr %9, align 4
  br label %188

187:                                              ; preds = %170
  store i32 0, ptr %9, align 4
  br label %188

188:                                              ; preds = %187, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  %189 = load i32, ptr %9, align 4
  switch i32 %189, label %194 [
    i32 0, label %190
  ]

190:                                              ; preds = %188
  br label %191

191:                                              ; preds = %190
  %192 = load i32, ptr %14, align 4, !tbaa !11
  %193 = add i32 %192, 1
  store i32 %193, ptr %14, align 4, !tbaa !11
  br label %165, !llvm.loop !20

194:                                              ; preds = %188, %169
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  br label %195

195:                                              ; preds = %194
  %196 = load i8, ptr %13, align 1, !tbaa !18, !range !22, !noundef !23
  %197 = trunc i8 %196 to i1
  %198 = zext i1 %197 to i32
  %199 = icmp eq i32 %198, 0
  br i1 %199, label %200, label %214

200:                                              ; preds = %195
  %201 = load ptr, ptr %10, align 8, !tbaa !5
  %202 = load i32, ptr %6, align 4, !tbaa !11
  %203 = mul i32 3, %202
  %204 = zext i32 %203 to i64
  %205 = getelementptr inbounds double, ptr %201, i64 %204
  %206 = load ptr, ptr %12, align 8, !tbaa !5
  call void @Vec3d_copy(ptr noundef %205, ptr noundef %206)
  %207 = load i32, ptr %6, align 4, !tbaa !11
  %208 = load ptr, ptr %8, align 8, !tbaa !5
  %209 = load i32, ptr %7, align 4, !tbaa !11
  %210 = zext i32 %209 to i64
  %211 = getelementptr inbounds i32, ptr %208, i64 %210
  store i32 %207, ptr %211, align 4, !tbaa !11
  %212 = load i32, ptr %6, align 4, !tbaa !11
  %213 = add i32 %212, 1
  store i32 %213, ptr %6, align 4, !tbaa !11
  br label %214

214:                                              ; preds = %200, %195
  %215 = load i32, ptr %7, align 4, !tbaa !11
  %216 = add i32 %215, 1
  store i32 %216, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %217

217:                                              ; preds = %214
  %218 = load i32, ptr %11, align 4, !tbaa !11
  %219 = add i32 %218, 1
  store i32 %219, ptr %11, align 4, !tbaa !11
  br label %88, !llvm.loop !24

220:                                              ; preds = %148, %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  %221 = load i32, ptr %9, align 4
  switch i32 %221, label %248 [
    i32 6, label %222
  ]

222:                                              ; preds = %220
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  %223 = load ptr, ptr %4, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.RcsMeshData, ptr %223, i32 0, i32 0
  %225 = load i32, ptr %224, align 8, !tbaa !15
  %226 = load i32, ptr %6, align 4, !tbaa !11
  %227 = sub i32 %225, %226
  store i32 %227, ptr %16, align 4, !tbaa !11
  %228 = load ptr, ptr %4, align 8, !tbaa !5
  %229 = getelementptr inbounds %struct.RcsMeshData, ptr %228, i32 0, i32 1
  %230 = load ptr, ptr %229, align 8, !tbaa !17
  call void @free(ptr noundef %230) #4
  %231 = load ptr, ptr %4, align 8, !tbaa !5
  %232 = getelementptr inbounds %struct.RcsMeshData, ptr %231, i32 0, i32 3
  %233 = load ptr, ptr %232, align 8, !tbaa !16
  call void @free(ptr noundef %233) #4
  %234 = load i32, ptr %6, align 4, !tbaa !11
  %235 = load ptr, ptr %4, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.RcsMeshData, ptr %235, i32 0, i32 0
  store i32 %234, ptr %236, align 8, !tbaa !15
  %237 = load i32, ptr %7, align 4, !tbaa !11
  %238 = udiv i32 %237, 3
  %239 = load ptr, ptr %4, align 8, !tbaa !5
  %240 = getelementptr inbounds %struct.RcsMeshData, ptr %239, i32 0, i32 2
  store i32 %238, ptr %240, align 8, !tbaa !13
  %241 = load ptr, ptr %10, align 8, !tbaa !5
  %242 = load ptr, ptr %4, align 8, !tbaa !5
  %243 = getelementptr inbounds %struct.RcsMeshData, ptr %242, i32 0, i32 1
  store ptr %241, ptr %243, align 8, !tbaa !17
  %244 = load ptr, ptr %8, align 8, !tbaa !5
  %245 = load ptr, ptr %4, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.RcsMeshData, ptr %245, i32 0, i32 3
  store ptr %244, ptr %246, align 8, !tbaa !16
  %247 = load i32, ptr %16, align 4, !tbaa !11
  store i32 %247, ptr %3, align 4
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %248

248:                                              ; preds = %222, %220, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %249

249:                                              ; preds = %248, %50
  call void @llvm.lifetime.end.p0(i64 8, 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
  %250 = load i32, ptr %3, align 4
  ret i32 %250
}

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #2

declare double @Vec3d_distance(ptr noundef, ptr noundef) #3

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

declare void @Vec3d_copy(ptr noundef, ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 16}
!14 = !{!"", !12, i64 0, !6, i64 8, !12, i64 16, !6, i64 24}
!15 = !{!14, !12, i64 0}
!16 = !{!14, !6, i64 24}
!17 = !{!14, !6, i64 8}
!18 = !{!19, !19, i64 0}
!19 = !{!"_Bool", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = distinct !{!24, !21}


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

@Rcs_calloc = external local_unnamed_addr global ptr, align 8
@RCS_GLOBAL_RLOG_CB = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [67 x i8], align 1
@__func__.RcsMesh_compressVertices = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [39 x i8], align 1
@RcsLogLevel = external local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [90 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @RcsMesh_compressVertices(ptr nocapture noundef %0, double noundef %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %6 = mul i32 %5, 3
  %7 = zext i32 %6 to i64
  %8 = tail call ptr %3(i64 noundef %7, i64 noundef 4) #4
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %25

10:                                               ; preds = %2
  %11 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not82 = icmp eq ptr %11, null
  br i1 %.not82, label %14, label %12

12:                                               ; preds = %10
  %13 = load i32, ptr %4, align 8, !tbaa !9
  tail call void (i32, ptr, ptr, i32, ptr, ...) %11(i32 noundef 4, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.RcsMesh_compressVertices, i32 noundef 85, ptr noundef nonnull @.str.1, i32 noundef %13) #4
  br label %14

14:                                               ; preds = %12, %10
  %15 = load i32, ptr @RcsLogLevel, align 4, !tbaa !12
  %16 = icmp sgt i32 %15, 3
  br i1 %16, label %17, label %87

17:                                               ; preds = %14
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.RcsMesh_compressVertices, i32 noundef 85) #5
  %20 = load ptr, ptr @stderr, align 8, !tbaa !5
  %21 = load i32, ptr %4, align 8, !tbaa !9
  %22 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %20, ptr noundef nonnull @.str.1, i32 noundef %21) #5
  %23 = load ptr, ptr @stderr, align 8, !tbaa !5
  %24 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.3) #5
  br label %87

25:                                               ; preds = %2
  %26 = load ptr, ptr @Rcs_calloc, align 8, !tbaa !5
  %27 = load i32, ptr %0, align 8, !tbaa !13
  %28 = mul i32 %27, 3
  %29 = zext i32 %28 to i64
  %30 = tail call ptr %26(i64 noundef %29, i64 noundef 8) #4
  %31 = load i32, ptr %4, align 8, !tbaa !9
  %.not8195.not = icmp eq i32 %31, 0
  br i1 %.not8195.not, label %.critedge, label %.lr.ph100

.lr.ph100:                                        ; preds = %25
  %32 = getelementptr inbounds i8, ptr %0, i64 24
  %33 = getelementptr inbounds i8, ptr %0, i64 8
  br label %34

34:                                               ; preds = %.lr.ph100, %76
  %.06498 = phi i32 [ 0, %.lr.ph100 ], [ %.165, %76 ]
  %.07097 = phi i32 [ 0, %.lr.ph100 ], [ %77, %76 ]
  %35 = load ptr, ptr %32, align 8, !tbaa !14
  %36 = zext i32 %.07097 to i64
  %37 = getelementptr inbounds i32, ptr %35, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !12
  %39 = load i32, ptr %0, align 8, !tbaa !13
  %.not = icmp ult i32 %38, %39
  br i1 %.not, label %58, label %40

40:                                               ; preds = %34
  %41 = load ptr, ptr @RCS_GLOBAL_RLOG_CB, align 8, !tbaa !5
  %.not80 = icmp eq ptr %41, null
  br i1 %.not80, label %43, label %42

42:                                               ; preds = %40
  tail call void (i32, ptr, ptr, i32, ptr, ...) %41(i32 noundef 1, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.RcsMesh_compressVertices, i32 noundef 103, ptr noundef nonnull @.str.5, i32 noundef %.07097, i32 noundef %38, i32 noundef %39) #4
  br label %43

43:                                               ; preds = %42, %40
  %44 = load i32, ptr @RcsLogLevel, align 4, !tbaa !12
  %45 = icmp sgt i32 %44, 0
  br i1 %45, label %46, label %57

46:                                               ; preds = %43
  %47 = load ptr, ptr @stderr, align 8, !tbaa !5
  %48 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef nonnull @.str.2, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.RcsMesh_compressVertices, i32 noundef 103) #5
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = load ptr, ptr %32, align 8, !tbaa !14
  %51 = getelementptr inbounds i32, ptr %50, i64 %36
  %52 = load i32, ptr %51, align 4, !tbaa !12
  %53 = load i32, ptr %0, align 8, !tbaa !13
  %54 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str.5, i32 noundef %.07097, i32 noundef %52, i32 noundef %53) #5
  %55 = load ptr, ptr @stderr, align 8, !tbaa !5
  %56 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef nonnull @.str.3) #5
  br label %57

57:                                               ; preds = %46, %43
  tail call void @free(ptr noundef nonnull %8) #4
  tail call void @free(ptr noundef %30) #4
  br label %87

58:                                               ; preds = %34
  %59 = load ptr, ptr %33, align 8, !tbaa !15
  %60 = mul i32 %38, 3
  %61 = zext i32 %60 to i64
  %62 = getelementptr inbounds double, ptr %59, i64 %61
  %.not102 = icmp eq i32 %.06498, 0
  br i1 %.not102, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %58
  %wide.trip.count = zext i32 %.06498 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %70
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %70 ]
  %63 = mul i64 %indvars.iv, 3
  %64 = and i64 %63, 4294967295
  %65 = getelementptr inbounds double, ptr %30, i64 %64
  %66 = tail call double @Vec3d_distance(ptr noundef %62, ptr noundef %65) #4
  %67 = fcmp uge double %66, %1
  br i1 %67, label %70, label %.thread85

.thread85:                                        ; preds = %.lr.ph
  %68 = trunc nuw i64 %indvars.iv to i32
  %69 = getelementptr inbounds i32, ptr %8, i64 %36
  store i32 %68, ptr %69, align 4, !tbaa !12
  br label %76

70:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16

._crit_edge:                                      ; preds = %70, %58
  %71 = mul i32 %.06498, 3
  %72 = zext i32 %71 to i64
  %73 = getelementptr inbounds double, ptr %30, i64 %72
  tail call void @Vec3d_copy(ptr noundef %73, ptr noundef %62) #4
  %74 = getelementptr inbounds i32, ptr %8, i64 %36
  store i32 %.06498, ptr %74, align 4, !tbaa !12
  %75 = add i32 %.06498, 1
  br label %76

76:                                               ; preds = %.thread85, %._crit_edge
  %.165 = phi i32 [ %75, %._crit_edge ], [ %.06498, %.thread85 ]
  %77 = add nuw i32 %.07097, 1
  %78 = load i32, ptr %4, align 8, !tbaa !9
  %79 = mul i32 %78, 3
  %.not81 = icmp ult i32 %77, %79
  br i1 %.not81, label %34, label %.critedge.loopexit, !llvm.loop !18

.critedge.loopexit:                               ; preds = %76
  %80 = udiv i32 %77, 3
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %25
  %.070.lcssa = phi i32 [ 0, %25 ], [ %80, %.critedge.loopexit ]
  %.064.lcssa = phi i32 [ 0, %25 ], [ %.165, %.critedge.loopexit ]
  %81 = load i32, ptr %0, align 8, !tbaa !13
  %82 = sub i32 %81, %.064.lcssa
  %83 = getelementptr inbounds i8, ptr %0, i64 8
  %84 = load ptr, ptr %83, align 8, !tbaa !15
  tail call void @free(ptr noundef %84) #4
  %85 = getelementptr inbounds i8, ptr %0, i64 24
  %86 = load ptr, ptr %85, align 8, !tbaa !14
  tail call void @free(ptr noundef %86) #4
  store i32 %.064.lcssa, ptr %0, align 8, !tbaa !13
  store i32 %.070.lcssa, ptr %4, align 8, !tbaa !9
  store ptr %30, ptr %83, align 8, !tbaa !15
  store ptr %8, ptr %85, align 8, !tbaa !14
  br label %87

87:                                               ; preds = %57, %.critedge, %14, %17
  %.2 = phi i32 [ -1, %17 ], [ -1, %14 ], [ %82, %.critedge ], [ -1, %57 ]
  ret i32 %.2
}

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #2

declare double @Vec3d_distance(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @Vec3d_copy(ptr noundef, ptr noundef) local_unnamed_addr #3

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 = { 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 #2 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind }
attributes #5 = { cold 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, !11, i64 16}
!10 = !{!"", !11, i64 0, !6, i64 8, !11, i64 16, !6, i64 24}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}


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