; LLVM IR from sourceryinstitute/MORFEUS-Source :: src/FV/src/mesh_optimize/OptMS (SMfunction)

; 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.__SMlocal_mesh = type { i32, i32, i32, [3 x double], [3 x double], [3 x double], ptr, ptr, ptr, i32, double, ptr, double, i32, i32, i32, ptr, ptr, ptr }
%struct.__SMparam = type { i32, i32, i32, double, double, double, double, i32, i32, i32, double, double, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1

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

24:                                               ; preds = %3
  %25 = call i32 @SMerror(i32 noundef 29, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null)
  store i32 %25, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

26:                                               ; preds = %3
  %27 = load ptr, ptr %6, align 8, !tbaa !5
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %26
  %30 = call i32 @SMerror(i32 noundef 30, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null)
  store i32 %30, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

31:                                               ; preds = %26
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = icmp eq ptr %32, null
  br i1 %33, label %34, label %36

34:                                               ; preds = %31
  %35 = call i32 @SMerror(i32 noundef 31, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null)
  store i32 %35, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

36:                                               ; preds = %31
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 8, !tbaa !11
  store i32 %39, ptr %17, align 4, !tbaa !9
  %40 = load i32, ptr %17, align 4, !tbaa !9
  %41 = icmp eq i32 %40, 2
  br i1 %41, label %42, label %141

42:                                               ; preds = %36
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.__SMparam, ptr %43, i32 0, i32 12
  %45 = load ptr, ptr %44, align 8, !tbaa !14
  store ptr %45, ptr %19, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.__SMparam, ptr %46, i32 0, i32 9
  %48 = load i32, ptr %47, align 8, !tbaa !16
  %49 = sext i32 %48 to i64
  %50 = mul i64 8, %49
  %51 = icmp eq i64 %50, 0
  br i1 %51, label %52, label %53

52:                                               ; preds = %42
  store ptr null, ptr %18, align 8, !tbaa !5
  br label %65

53:                                               ; preds = %42
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.__SMparam, ptr %54, i32 0, i32 9
  %56 = load i32, ptr %55, align 8, !tbaa !16
  %57 = sext i32 %56 to i64
  %58 = mul i64 8, %57
  %59 = call noalias ptr @malloc(i64 noundef %58) #6
  store ptr %59, ptr %18, align 8, !tbaa !5
  %60 = load ptr, ptr %18, align 8, !tbaa !5
  %61 = icmp eq ptr %60, null
  br i1 %61, label %62, label %64

62:                                               ; preds = %53
  %63 = call i32 @SMerror(i32 noundef 39, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null)
  store i32 %63, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

64:                                               ; preds = %53
  br label %65

65:                                               ; preds = %64, %52
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %66, i32 0, i32 2
  %68 = load i32, ptr %67, align 8, !tbaa !17
  store i32 %68, ptr %16, align 4, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %69

69:                                               ; preds = %137, %65
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = load i32, ptr %16, align 4, !tbaa !9
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %73, label %140

73:                                               ; preds = %69
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %74, i32 0, i32 7
  %76 = load ptr, ptr %75, align 8, !tbaa !18
  %77 = load i32, ptr %13, align 4, !tbaa !9
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %76, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !5
  %81 = getelementptr inbounds i32, ptr %80, i64 0
  %82 = load i32, ptr %81, align 4, !tbaa !9
  store i32 %82, ptr %10, align 4, !tbaa !9
  %83 = load ptr, ptr %5, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %83, i32 0, i32 7
  %85 = load ptr, ptr %84, align 8, !tbaa !18
  %86 = load i32, ptr %13, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds ptr, ptr %85, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !5
  %90 = getelementptr inbounds i32, ptr %89, i64 1
  %91 = load i32, ptr %90, align 4, !tbaa !9
  store i32 %91, ptr %11, align 4, !tbaa !9
  %92 = load ptr, ptr %19, align 8, !tbaa !5
  %93 = load ptr, ptr %5, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %93, i32 0, i32 5
  %95 = getelementptr inbounds [3 x double], ptr %94, i64 0, i64 0
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %96, i32 0, i32 6
  %98 = load ptr, ptr %97, align 8, !tbaa !19
  %99 = load i32, ptr %10, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds ptr, ptr %98, i64 %100
  %102 = load ptr, ptr %101, align 8, !tbaa !5
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %103, i32 0, i32 6
  %105 = load ptr, ptr %104, align 8, !tbaa !19
  %106 = load i32, ptr %11, align 4, !tbaa !9
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds ptr, ptr %105, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !5
  %110 = load ptr, ptr %18, align 8, !tbaa !5
  %111 = call i32 %92(ptr noundef %95, ptr noundef %102, ptr noundef %109, ptr noundef %110, ptr noundef %15)
  store i32 %111, ptr %8, align 4, !tbaa !9
  %112 = load i32, ptr %8, align 4, !tbaa !9
  %113 = icmp ne i32 %112, 0
  br i1 %113, label %114, label %117

114:                                              ; preds = %73
  %115 = load i32, ptr %8, align 4, !tbaa !9
  %116 = call i32 @SMerror(i32 noundef 48, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef %115, i32 noundef 0, ptr noundef null)
  store i32 %116, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

117:                                              ; preds = %73
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %118

118:                                              ; preds = %133, %117
  %119 = load i32, ptr %14, align 4, !tbaa !9
  %120 = load i32, ptr %15, align 4, !tbaa !9
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %122, label %136

122:                                              ; preds = %118
  %123 = load ptr, ptr %18, align 8, !tbaa !5
  %124 = load i32, ptr %14, align 4, !tbaa !9
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds double, ptr %123, i64 %125
  %127 = load double, ptr %126, align 8, !tbaa !20
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = load i32, ptr %9, align 4, !tbaa !9
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %9, align 4, !tbaa !9
  %131 = sext i32 %129 to i64
  %132 = getelementptr inbounds double, ptr %128, i64 %131
  store double %127, ptr %132, align 8, !tbaa !20
  br label %133

133:                                              ; preds = %122
  %134 = load i32, ptr %14, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %14, align 4, !tbaa !9
  br label %118, !llvm.loop !21

136:                                              ; preds = %118
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %13, align 4, !tbaa !9
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %13, align 4, !tbaa !9
  br label %69, !llvm.loop !23

140:                                              ; preds = %69
  br label %256

141:                                              ; preds = %36
  %142 = load i32, ptr %17, align 4, !tbaa !9
  %143 = icmp eq i32 %142, 3
  br i1 %143, label %144, label %253

144:                                              ; preds = %141
  %145 = load ptr, ptr %6, align 8, !tbaa !5
  %146 = getelementptr inbounds %struct.__SMparam, ptr %145, i32 0, i32 14
  %147 = load ptr, ptr %146, align 8, !tbaa !24
  store ptr %147, ptr %20, align 8, !tbaa !5
  store i32 0, ptr %9, align 4, !tbaa !9
  store i32 0, ptr %10, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !9
  %148 = load ptr, ptr %6, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.__SMparam, ptr %148, i32 0, i32 9
  %150 = load i32, ptr %149, align 8, !tbaa !16
  %151 = sext i32 %150 to i64
  %152 = mul i64 8, %151
  %153 = icmp eq i64 %152, 0
  br i1 %153, label %154, label %155

154:                                              ; preds = %144
  store ptr null, ptr %18, align 8, !tbaa !5
  br label %167

155:                                              ; preds = %144
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.__SMparam, ptr %156, i32 0, i32 9
  %158 = load i32, ptr %157, align 8, !tbaa !16
  %159 = sext i32 %158 to i64
  %160 = mul i64 8, %159
  %161 = call noalias ptr @malloc(i64 noundef %160) #6
  store ptr %161, ptr %18, align 8, !tbaa !5
  %162 = load ptr, ptr %18, align 8, !tbaa !5
  %163 = icmp eq ptr %162, null
  br i1 %163, label %164, label %166

164:                                              ; preds = %155
  %165 = call i32 @SMerror(i32 noundef 55, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null)
  store i32 %165, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

166:                                              ; preds = %155
  br label %167

167:                                              ; preds = %166, %154
  %168 = load ptr, ptr %5, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %168, i32 0, i32 2
  %170 = load i32, ptr %169, align 8, !tbaa !17
  store i32 %170, ptr %16, align 4, !tbaa !9
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %171

171:                                              ; preds = %249, %167
  %172 = load i32, ptr %13, align 4, !tbaa !9
  %173 = load i32, ptr %16, align 4, !tbaa !9
  %174 = icmp slt i32 %172, %173
  br i1 %174, label %175, label %252

175:                                              ; preds = %171
  %176 = load ptr, ptr %5, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %176, i32 0, i32 7
  %178 = load ptr, ptr %177, align 8, !tbaa !18
  %179 = load i32, ptr %13, align 4, !tbaa !9
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds ptr, ptr %178, i64 %180
  %182 = load ptr, ptr %181, align 8, !tbaa !5
  %183 = getelementptr inbounds i32, ptr %182, i64 0
  %184 = load i32, ptr %183, align 4, !tbaa !9
  store i32 %184, ptr %10, align 4, !tbaa !9
  %185 = load ptr, ptr %5, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %185, i32 0, i32 7
  %187 = load ptr, ptr %186, align 8, !tbaa !18
  %188 = load i32, ptr %13, align 4, !tbaa !9
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds ptr, ptr %187, i64 %189
  %191 = load ptr, ptr %190, align 8, !tbaa !5
  %192 = getelementptr inbounds i32, ptr %191, i64 1
  %193 = load i32, ptr %192, align 4, !tbaa !9
  store i32 %193, ptr %11, align 4, !tbaa !9
  %194 = load ptr, ptr %5, align 8, !tbaa !5
  %195 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %194, i32 0, i32 7
  %196 = load ptr, ptr %195, align 8, !tbaa !18
  %197 = load i32, ptr %13, align 4, !tbaa !9
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds ptr, ptr %196, i64 %198
  %200 = load ptr, ptr %199, align 8, !tbaa !5
  %201 = getelementptr inbounds i32, ptr %200, i64 2
  %202 = load i32, ptr %201, align 4, !tbaa !9
  store i32 %202, ptr %12, align 4, !tbaa !9
  %203 = load ptr, ptr %20, align 8, !tbaa !5
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %204, i32 0, i32 5
  %206 = getelementptr inbounds [3 x double], ptr %205, i64 0, i64 0
  %207 = load ptr, ptr %5, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %207, i32 0, i32 6
  %209 = load ptr, ptr %208, align 8, !tbaa !19
  %210 = load i32, ptr %10, align 4, !tbaa !9
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds ptr, ptr %209, i64 %211
  %213 = load ptr, ptr %212, align 8, !tbaa !5
  %214 = load ptr, ptr %5, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %214, i32 0, i32 6
  %216 = load ptr, ptr %215, align 8, !tbaa !19
  %217 = load i32, ptr %11, align 4, !tbaa !9
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds ptr, ptr %216, i64 %218
  %220 = load ptr, ptr %219, align 8, !tbaa !5
  %221 = load ptr, ptr %5, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.__SMlocal_mesh, ptr %221, i32 0, i32 6
  %223 = load ptr, ptr %222, align 8, !tbaa !19
  %224 = load i32, ptr %12, align 4, !tbaa !9
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds ptr, ptr %223, i64 %225
  %227 = load ptr, ptr %226, align 8, !tbaa !5
  %228 = load ptr, ptr %18, align 8, !tbaa !5
  %229 = call i32 %203(ptr noundef %206, ptr noundef %213, ptr noundef %220, ptr noundef %227, ptr noundef %228, ptr noundef %15)
  store i32 0, ptr %14, align 4, !tbaa !9
  br label %230

230:                                              ; preds = %245, %175
  %231 = load i32, ptr %14, align 4, !tbaa !9
  %232 = load i32, ptr %15, align 4, !tbaa !9
  %233 = icmp slt i32 %231, %232
  br i1 %233, label %234, label %248

234:                                              ; preds = %230
  %235 = load ptr, ptr %18, align 8, !tbaa !5
  %236 = load i32, ptr %14, align 4, !tbaa !9
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds double, ptr %235, i64 %237
  %239 = load double, ptr %238, align 8, !tbaa !20
  %240 = load ptr, ptr %7, align 8, !tbaa !5
  %241 = load i32, ptr %9, align 4, !tbaa !9
  %242 = add nsw i32 %241, 1
  store i32 %242, ptr %9, align 4, !tbaa !9
  %243 = sext i32 %241 to i64
  %244 = getelementptr inbounds double, ptr %240, i64 %243
  store double %239, ptr %244, align 8, !tbaa !20
  br label %245

245:                                              ; preds = %234
  %246 = load i32, ptr %14, align 4, !tbaa !9
  %247 = add nsw i32 %246, 1
  store i32 %247, ptr %14, align 4, !tbaa !9
  br label %230, !llvm.loop !25

248:                                              ; preds = %230
  br label %249

249:                                              ; preds = %248
  %250 = load i32, ptr %13, align 4, !tbaa !9
  %251 = add nsw i32 %250, 1
  store i32 %251, ptr %13, align 4, !tbaa !9
  br label %171, !llvm.loop !26

252:                                              ; preds = %171
  br label %255

253:                                              ; preds = %141
  %254 = call i32 @SMerror(i32 noundef 70, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef @.str.3)
  store i32 %254, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

255:                                              ; preds = %252
  br label %256

256:                                              ; preds = %255, %140
  %257 = load ptr, ptr %18, align 8, !tbaa !5
  %258 = icmp eq ptr %257, null
  br i1 %258, label %259, label %261

259:                                              ; preds = %256
  %260 = call i32 @SMerror(i32 noundef 74, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null)
  store i32 %260, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

261:                                              ; preds = %256
  %262 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %262) #5
  br label %263

263:                                              ; preds = %261
  store i32 0, ptr %8, align 4, !tbaa !9
  store i32 0, ptr %4, align 4
  store i32 1, ptr %21, align 4
  br label %264

264:                                              ; preds = %263, %259, %253, %164, %114, %62, %34, %29, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %265 = load i32, ptr %4, align 4
  ret i32 %265
}

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

declare i32 @SMerror(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

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

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 = { "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 allocsize(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 "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 }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!12, !10, i64 0}
!12 = !{!"__SMlocal_mesh", !10, i64 0, !10, i64 4, !10, i64 8, !7, i64 16, !7, i64 40, !7, i64 64, !6, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !13, i64 120, !6, i64 128, !13, i64 136, !10, i64 144, !10, i64 148, !10, i64 152, !6, i64 160, !6, i64 168, !6, i64 176}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !6, i64 80}
!15 = !{!"__SMparam", !10, i64 0, !10, i64 4, !10, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 64, !13, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104}
!16 = !{!15, !10, i64 56}
!17 = !{!12, !10, i64 8}
!18 = !{!12, !6, i64 96}
!19 = !{!12, !6, i64 88}
!20 = !{!13, !13, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!15, !6, i64 96}
!25 = distinct !{!25, !22}
!26 = distinct !{!26, !22}


; 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 [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [110 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @SMcomputeFunction(ptr noundef %0, ptr noundef readonly %1, ptr noundef writeonly %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %5 = icmp eq ptr %0, null
  br i1 %5, label %6, label %8

6:                                                ; preds = %3
  %7 = tail call i32 @SMerror(i32 noundef 29, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null) #6
  br label %115

8:                                                ; preds = %3
  %9 = icmp eq ptr %1, null
  br i1 %9, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call i32 @SMerror(i32 noundef 30, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null) #6
  br label %115

12:                                               ; preds = %8
  %13 = icmp eq ptr %2, null
  br i1 %13, label %14, label %16

14:                                               ; preds = %12
  %15 = tail call i32 @SMerror(i32 noundef 31, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 56, i32 noundef 0, ptr noundef null) #6
  br label %115

16:                                               ; preds = %12
  %17 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %17, label %109 [
    i32 2, label %18
    i32 3, label %62
  ]

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %1, i64 80
  %20 = load ptr, ptr %19, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %1, i64 56
  %22 = load i32, ptr %21, align 8, !tbaa !14
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %31, label %24

24:                                               ; preds = %18
  %25 = sext i32 %22 to i64
  %26 = shl nsw i64 %25, 3
  %27 = tail call noalias ptr @malloc(i64 noundef %26) #7
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %24
  %30 = tail call i32 @SMerror(i32 noundef 39, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null) #6
  br label %115

31:                                               ; preds = %18, %24
  %.064 = phi ptr [ %27, %24 ], [ null, %18 ]
  %32 = getelementptr inbounds i8, ptr %0, i64 8
  %33 = load i32, ptr %32, align 8, !tbaa !15
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.lr.ph96, label %.loopexit

.lr.ph96:                                         ; preds = %31
  %35 = getelementptr inbounds i8, ptr %0, i64 96
  %36 = getelementptr inbounds i8, ptr %0, i64 64
  %37 = getelementptr inbounds i8, ptr %0, i64 88
  %wide.trip.count121 = zext nneg i32 %33 to i64
  br label %38

38:                                               ; preds = %.lr.ph96, %._crit_edge91
  %indvars.iv118 = phi i64 [ 0, %.lr.ph96 ], [ %indvars.iv.next119, %._crit_edge91 ]
  %.06594 = phi i32 [ 0, %.lr.ph96 ], [ %.166.lcssa, %._crit_edge91 ]
  %39 = load ptr, ptr %35, align 8, !tbaa !16
  %40 = getelementptr inbounds ptr, ptr %39, i64 %indvars.iv118
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = load i32, ptr %41, align 4, !tbaa !18
  %43 = getelementptr inbounds i8, ptr %41, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !18
  %45 = load ptr, ptr %37, align 8, !tbaa !19
  %46 = sext i32 %42 to i64
  %47 = getelementptr inbounds ptr, ptr %45, i64 %46
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = sext i32 %44 to i64
  %50 = getelementptr inbounds ptr, ptr %45, i64 %49
  %51 = load ptr, ptr %50, align 8, !tbaa !17
  %52 = call i32 %20(ptr noundef nonnull %36, ptr noundef %48, ptr noundef %51, ptr noundef %.064, ptr noundef nonnull %4) #6
  %.not = icmp eq i32 %52, 0
  br i1 %.not, label %.preheader, label %60

.preheader:                                       ; preds = %38
  %53 = load i32, ptr %4, align 4, !tbaa !18
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.lr.ph90.preheader, label %._crit_edge91

.lr.ph90.preheader:                               ; preds = %.preheader
  %55 = sext i32 %.06594 to i64
  %56 = shl nsw i64 %55, 3
  %scevgep108 = getelementptr i8, ptr %2, i64 %56
  %57 = zext nneg i32 %53 to i64
  %58 = shl nuw nsw i64 %57, 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep108, ptr align 8 %.064, i64 %58, i1 false), !tbaa !20
  %59 = add i32 %.06594, %53
  br label %._crit_edge91

60:                                               ; preds = %38
  %61 = call i32 @SMerror(i32 noundef 48, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef %52, i32 noundef 0, ptr noundef null) #6
  br label %115

._crit_edge91:                                    ; preds = %.lr.ph90.preheader, %.preheader
  %.166.lcssa = phi i32 [ %.06594, %.preheader ], [ %59, %.lr.ph90.preheader ]
  %indvars.iv.next119 = add nuw nsw i64 %indvars.iv118, 1
  %exitcond122.not = icmp eq i64 %indvars.iv.next119, %wide.trip.count121
  br i1 %exitcond122.not, label %.loopexit, label %38, !llvm.loop !21

62:                                               ; preds = %16
  %63 = getelementptr inbounds i8, ptr %1, i64 96
  %64 = load ptr, ptr %63, align 8, !tbaa !23
  %65 = getelementptr inbounds i8, ptr %1, i64 56
  %66 = load i32, ptr %65, align 8, !tbaa !14
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %75, label %68

68:                                               ; preds = %62
  %69 = sext i32 %66 to i64
  %70 = shl nsw i64 %69, 3
  %71 = tail call noalias ptr @malloc(i64 noundef %70) #7
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %75

73:                                               ; preds = %68
  %74 = tail call i32 @SMerror(i32 noundef 55, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null) #6
  br label %115

75:                                               ; preds = %62, %68
  %.1 = phi ptr [ %71, %68 ], [ null, %62 ]
  %76 = getelementptr inbounds i8, ptr %0, i64 8
  %77 = load i32, ptr %76, align 8, !tbaa !15
  %78 = icmp sgt i32 %77, 0
  br i1 %78, label %.lr.ph87, label %.loopexit

.lr.ph87:                                         ; preds = %75
  %79 = getelementptr inbounds i8, ptr %0, i64 96
  %80 = getelementptr inbounds i8, ptr %0, i64 64
  %81 = getelementptr inbounds i8, ptr %0, i64 88
  %wide.trip.count107 = zext nneg i32 %77 to i64
  br label %82

82:                                               ; preds = %.lr.ph87, %._crit_edge
  %indvars.iv = phi i64 [ 0, %.lr.ph87 ], [ %indvars.iv.next, %._crit_edge ]
  %.26785 = phi i32 [ 0, %.lr.ph87 ], [ %.3.lcssa, %._crit_edge ]
  %83 = load ptr, ptr %79, align 8, !tbaa !16
  %84 = getelementptr inbounds ptr, ptr %83, i64 %indvars.iv
  %85 = load ptr, ptr %84, align 8, !tbaa !17
  %86 = load i32, ptr %85, align 4, !tbaa !18
  %87 = getelementptr inbounds i8, ptr %85, i64 4
  %88 = load i32, ptr %87, align 4, !tbaa !18
  %89 = getelementptr inbounds i8, ptr %85, i64 8
  %90 = load i32, ptr %89, align 4, !tbaa !18
  %91 = load ptr, ptr %81, align 8, !tbaa !19
  %92 = sext i32 %86 to i64
  %93 = getelementptr inbounds ptr, ptr %91, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !17
  %95 = sext i32 %88 to i64
  %96 = getelementptr inbounds ptr, ptr %91, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !17
  %98 = sext i32 %90 to i64
  %99 = getelementptr inbounds ptr, ptr %91, i64 %98
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = call i32 %64(ptr noundef nonnull %80, ptr noundef %94, ptr noundef %97, ptr noundef %100, ptr noundef %.1, ptr noundef nonnull %4) #6
  %102 = load i32, ptr %4, align 4, !tbaa !18
  %103 = icmp sgt i32 %102, 0
  br i1 %103, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %82
  %104 = sext i32 %.26785 to i64
  %105 = shl nsw i64 %104, 3
  %scevgep = getelementptr i8, ptr %2, i64 %105
  %106 = zext nneg i32 %102 to i64
  %107 = shl nuw nsw i64 %106, 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %scevgep, ptr align 8 %.1, i64 %107, i1 false), !tbaa !20
  %108 = add i32 %.26785, %102
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph.preheader, %82
  %.3.lcssa = phi i32 [ %.26785, %82 ], [ %108, %.lr.ph.preheader ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count107
  br i1 %exitcond.not, label %.loopexit, label %82, !llvm.loop !24

109:                                              ; preds = %16
  %110 = tail call i32 @SMerror(i32 noundef 70, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef nonnull @.str.3) #6
  br label %115

.loopexit:                                        ; preds = %._crit_edge, %._crit_edge91, %75, %31
  %.2 = phi ptr [ %.064, %31 ], [ %.1, %75 ], [ %.064, %._crit_edge91 ], [ %.1, %._crit_edge ]
  %111 = icmp eq ptr %.2, null
  br i1 %111, label %112, label %114

112:                                              ; preds = %.loopexit
  %113 = call i32 @SMerror(i32 noundef 74, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null) #6
  br label %115

114:                                              ; preds = %.loopexit
  call void @free(ptr noundef nonnull %.2) #6
  br label %115

115:                                              ; preds = %114, %112, %109, %73, %60, %29, %14, %10, %6
  %.0 = phi i32 [ %7, %6 ], [ %11, %10 ], [ %15, %14 ], [ %61, %60 ], [ %113, %112 ], [ 0, %114 ], [ %30, %29 ], [ %74, %73 ], [ %110, %109 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  ret i32 %.0
}

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

declare i32 @SMerror(i32 noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #3

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

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

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 allockind("alloc,uninitialized") allocsize(0) memory(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 #4 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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, !7, i64 0}
!6 = !{!"__SMlocal_mesh", !7, i64 0, !7, i64 4, !7, i64 8, !8, i64 16, !8, i64 40, !8, i64 64, !10, i64 88, !10, i64 96, !10, i64 104, !7, i64 112, !11, i64 120, !10, i64 128, !11, i64 136, !7, i64 144, !7, i64 148, !7, i64 152, !10, i64 160, !10, i64 168, !10, i64 176}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!13, !10, i64 80}
!13 = !{!"__SMparam", !7, i64 0, !7, i64 4, !7, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !11, i64 64, !11, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104}
!14 = !{!13, !7, i64 56}
!15 = !{!6, !7, i64 8}
!16 = !{!6, !10, i64 96}
!17 = !{!10, !10, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!6, !10, i64 88}
!20 = !{!11, !11, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{!13, !10, i64 96}
!24 = distinct !{!24, !22}


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