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

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

@.str.1 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #2

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #4

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

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

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

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

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

25:                                               ; preds = %5
  store ptr null, ptr %17, align 8, !tbaa !5
  br label %36

26:                                               ; preds = %5
  %27 = load i32, ptr %19, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = mul i64 8, %28
  %30 = call noalias ptr @malloc(i64 noundef %29) #7
  store ptr %30, ptr %17, align 8, !tbaa !5
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %35

33:                                               ; preds = %26
  %34 = call i32 @SMerror(i32 noundef 604, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null)
  store i32 %34, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

35:                                               ; preds = %26
  br label %36

36:                                               ; preds = %35, %25
  %37 = load i32, ptr %19, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = mul i64 8, %38
  %40 = icmp eq i64 %39, 0
  br i1 %40, label %41, label %42

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

42:                                               ; preds = %36
  %43 = load i32, ptr %19, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = mul i64 8, %44
  %46 = call noalias ptr @malloc(i64 noundef %45) #7
  store ptr %46, ptr %18, align 8, !tbaa !5
  %47 = load ptr, ptr %18, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %49, label %51

49:                                               ; preds = %42
  %50 = call i32 @SMerror(i32 noundef 605, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null)
  store i32 %50, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

51:                                               ; preds = %42
  br label %52

52:                                               ; preds = %51, %41
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %53

53:                                               ; preds = %72, %52
  %54 = load i32, ptr %13, align 4, !tbaa !9
  %55 = load i32, ptr %19, align 4, !tbaa !9
  %56 = icmp slt i32 %54, %55
  br i1 %56, label %57, label %75

57:                                               ; preds = %53
  %58 = call noalias ptr @malloc(i64 noundef 16) #7
  %59 = load ptr, ptr %18, align 8, !tbaa !5
  %60 = load i32, ptr %13, align 4, !tbaa !9
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds ptr, ptr %59, i64 %61
  store ptr %58, ptr %62, align 8, !tbaa !5
  %63 = load ptr, ptr %18, align 8, !tbaa !5
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds ptr, ptr %63, i64 %65
  %67 = load ptr, ptr %66, align 8, !tbaa !5
  %68 = icmp eq ptr %67, null
  br i1 %68, label %69, label %71

69:                                               ; preds = %57
  %70 = call i32 @SMerror(i32 noundef 607, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null)
  store i32 %70, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

71:                                               ; preds = %57
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %13, align 4, !tbaa !9
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %13, align 4, !tbaa !9
  br label %53, !llvm.loop !11

75:                                               ; preds = %53
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = load ptr, ptr %17, align 8, !tbaa !5
  %80 = load ptr, ptr %11, align 8, !tbaa !5
  %81 = call i32 @SMcomputeTriCosines(ptr noundef %76, ptr noundef %77, ptr noundef %78, ptr noundef %79, ptr noundef %80)
  store i32 %81, ptr %12, align 4, !tbaa !9
  %82 = load i32, ptr %12, align 4, !tbaa !9
  %83 = icmp ne i32 %82, 0
  br i1 %83, label %84, label %87

84:                                               ; preds = %75
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = call i32 @SMerror(i32 noundef 610, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef %85, i32 noundef 0, ptr noundef null)
  store i32 %86, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

87:                                               ; preds = %75
  %88 = load ptr, ptr %7, align 8, !tbaa !5
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = load ptr, ptr %9, align 8, !tbaa !5
  %91 = load ptr, ptr %18, align 8, !tbaa !5
  %92 = load ptr, ptr %11, align 8, !tbaa !5
  %93 = call i32 @SMcomputeCosGradients(ptr noundef %88, ptr noundef %89, ptr noundef %90, ptr noundef %91, ptr noundef %92)
  store i32 %93, ptr %12, align 4, !tbaa !9
  %94 = load i32, ptr %12, align 4, !tbaa !9
  %95 = icmp ne i32 %94, 0
  br i1 %95, label %96, label %99

96:                                               ; preds = %87
  %97 = load i32, ptr %12, align 4, !tbaa !9
  %98 = call i32 @SMerror(i32 noundef 612, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef %97, i32 noundef 0, ptr noundef null)
  store i32 %98, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

99:                                               ; preds = %87
  %100 = load ptr, ptr %17, align 8, !tbaa !5
  %101 = getelementptr inbounds double, ptr %100, i64 0
  %102 = load double, ptr %101, align 8, !tbaa !13
  %103 = load ptr, ptr %17, align 8, !tbaa !5
  %104 = getelementptr inbounds double, ptr %103, i64 0
  %105 = load double, ptr %104, align 8, !tbaa !13
  %106 = fneg double %102
  %107 = call double @llvm.fmuladd.f64(double %106, double %105, double 1.000000e+00)
  %108 = call double @sqrt(double noundef %107) #6
  store double %108, ptr %14, align 8, !tbaa !13
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = getelementptr inbounds double, ptr %109, i64 1
  %111 = load double, ptr %110, align 8, !tbaa !13
  %112 = load ptr, ptr %17, align 8, !tbaa !5
  %113 = getelementptr inbounds double, ptr %112, i64 1
  %114 = load double, ptr %113, align 8, !tbaa !13
  %115 = fneg double %111
  %116 = call double @llvm.fmuladd.f64(double %115, double %114, double 1.000000e+00)
  %117 = call double @sqrt(double noundef %116) #6
  store double %117, ptr %15, align 8, !tbaa !13
  %118 = load ptr, ptr %17, align 8, !tbaa !5
  %119 = getelementptr inbounds double, ptr %118, i64 2
  %120 = load double, ptr %119, align 8, !tbaa !13
  %121 = load ptr, ptr %17, align 8, !tbaa !5
  %122 = getelementptr inbounds double, ptr %121, i64 2
  %123 = load double, ptr %122, align 8, !tbaa !13
  %124 = fneg double %120
  %125 = call double @llvm.fmuladd.f64(double %124, double %123, double 1.000000e+00)
  %126 = call double @sqrt(double noundef %125) #6
  store double %126, ptr %16, align 8, !tbaa !13
  %127 = load double, ptr %14, align 8, !tbaa !13
  %128 = fcmp olt double %127, 1.000000e-15
  br i1 %128, label %135, label %129

129:                                              ; preds = %99
  %130 = load double, ptr %15, align 8, !tbaa !13
  %131 = fcmp olt double %130, 1.000000e-15
  br i1 %131, label %135, label %132

132:                                              ; preds = %129
  %133 = load double, ptr %16, align 8, !tbaa !13
  %134 = fcmp olt double %133, 1.000000e-15
  br i1 %134, label %135, label %137

135:                                              ; preds = %132, %129, %99
  %136 = call i32 @SMerror(i32 noundef 621, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef @.str.3)
  store i32 %136, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

137:                                              ; preds = %132
  %138 = load double, ptr %14, align 8, !tbaa !13
  %139 = fdiv double -1.000000e+00, %138
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = getelementptr inbounds double, ptr %140, i64 0
  %142 = load double, ptr %141, align 8, !tbaa !13
  %143 = fmul double %139, %142
  %144 = load ptr, ptr %18, align 8, !tbaa !5
  %145 = getelementptr inbounds ptr, ptr %144, i64 0
  %146 = load ptr, ptr %145, align 8, !tbaa !5
  %147 = getelementptr inbounds double, ptr %146, i64 0
  %148 = load double, ptr %147, align 8, !tbaa !13
  %149 = fmul double %143, %148
  %150 = load ptr, ptr %10, align 8, !tbaa !5
  %151 = getelementptr inbounds ptr, ptr %150, i64 0
  %152 = load ptr, ptr %151, align 8, !tbaa !5
  %153 = getelementptr inbounds double, ptr %152, i64 0
  store double %149, ptr %153, align 8, !tbaa !13
  %154 = load double, ptr %14, align 8, !tbaa !13
  %155 = fdiv double -1.000000e+00, %154
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = getelementptr inbounds double, ptr %156, i64 0
  %158 = load double, ptr %157, align 8, !tbaa !13
  %159 = fmul double %155, %158
  %160 = load ptr, ptr %18, align 8, !tbaa !5
  %161 = getelementptr inbounds ptr, ptr %160, i64 0
  %162 = load ptr, ptr %161, align 8, !tbaa !5
  %163 = getelementptr inbounds double, ptr %162, i64 1
  %164 = load double, ptr %163, align 8, !tbaa !13
  %165 = fmul double %159, %164
  %166 = load ptr, ptr %10, align 8, !tbaa !5
  %167 = getelementptr inbounds ptr, ptr %166, i64 0
  %168 = load ptr, ptr %167, align 8, !tbaa !5
  %169 = getelementptr inbounds double, ptr %168, i64 1
  store double %165, ptr %169, align 8, !tbaa !13
  %170 = load double, ptr %15, align 8, !tbaa !13
  %171 = fdiv double -1.000000e+00, %170
  %172 = load ptr, ptr %17, align 8, !tbaa !5
  %173 = getelementptr inbounds double, ptr %172, i64 1
  %174 = load double, ptr %173, align 8, !tbaa !13
  %175 = fmul double %171, %174
  %176 = load ptr, ptr %18, align 8, !tbaa !5
  %177 = getelementptr inbounds ptr, ptr %176, i64 1
  %178 = load ptr, ptr %177, align 8, !tbaa !5
  %179 = getelementptr inbounds double, ptr %178, i64 0
  %180 = load double, ptr %179, align 8, !tbaa !13
  %181 = fmul double %175, %180
  %182 = load ptr, ptr %10, align 8, !tbaa !5
  %183 = getelementptr inbounds ptr, ptr %182, i64 1
  %184 = load ptr, ptr %183, align 8, !tbaa !5
  %185 = getelementptr inbounds double, ptr %184, i64 0
  store double %181, ptr %185, align 8, !tbaa !13
  %186 = load double, ptr %15, align 8, !tbaa !13
  %187 = fdiv double -1.000000e+00, %186
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = getelementptr inbounds double, ptr %188, i64 1
  %190 = load double, ptr %189, align 8, !tbaa !13
  %191 = fmul double %187, %190
  %192 = load ptr, ptr %18, align 8, !tbaa !5
  %193 = getelementptr inbounds ptr, ptr %192, i64 1
  %194 = load ptr, ptr %193, align 8, !tbaa !5
  %195 = getelementptr inbounds double, ptr %194, i64 1
  %196 = load double, ptr %195, align 8, !tbaa !13
  %197 = fmul double %191, %196
  %198 = load ptr, ptr %10, align 8, !tbaa !5
  %199 = getelementptr inbounds ptr, ptr %198, i64 1
  %200 = load ptr, ptr %199, align 8, !tbaa !5
  %201 = getelementptr inbounds double, ptr %200, i64 1
  store double %197, ptr %201, align 8, !tbaa !13
  %202 = load double, ptr %16, align 8, !tbaa !13
  %203 = fdiv double -1.000000e+00, %202
  %204 = load ptr, ptr %17, align 8, !tbaa !5
  %205 = getelementptr inbounds double, ptr %204, i64 2
  %206 = load double, ptr %205, align 8, !tbaa !13
  %207 = fmul double %203, %206
  %208 = load ptr, ptr %18, align 8, !tbaa !5
  %209 = getelementptr inbounds ptr, ptr %208, i64 2
  %210 = load ptr, ptr %209, align 8, !tbaa !5
  %211 = getelementptr inbounds double, ptr %210, i64 0
  %212 = load double, ptr %211, align 8, !tbaa !13
  %213 = fmul double %207, %212
  %214 = load ptr, ptr %10, align 8, !tbaa !5
  %215 = getelementptr inbounds ptr, ptr %214, i64 2
  %216 = load ptr, ptr %215, align 8, !tbaa !5
  %217 = getelementptr inbounds double, ptr %216, i64 0
  store double %213, ptr %217, align 8, !tbaa !13
  %218 = load double, ptr %16, align 8, !tbaa !13
  %219 = fdiv double -1.000000e+00, %218
  %220 = load ptr, ptr %17, align 8, !tbaa !5
  %221 = getelementptr inbounds double, ptr %220, i64 2
  %222 = load double, ptr %221, align 8, !tbaa !13
  %223 = fmul double %219, %222
  %224 = load ptr, ptr %18, align 8, !tbaa !5
  %225 = getelementptr inbounds ptr, ptr %224, i64 2
  %226 = load ptr, ptr %225, align 8, !tbaa !5
  %227 = getelementptr inbounds double, ptr %226, i64 1
  %228 = load double, ptr %227, align 8, !tbaa !13
  %229 = fmul double %223, %228
  %230 = load ptr, ptr %10, align 8, !tbaa !5
  %231 = getelementptr inbounds ptr, ptr %230, i64 2
  %232 = load ptr, ptr %231, align 8, !tbaa !5
  %233 = getelementptr inbounds double, ptr %232, i64 1
  store double %229, ptr %233, align 8, !tbaa !13
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %234

234:                                              ; preds = %254, %137
  %235 = load i32, ptr %13, align 4, !tbaa !9
  %236 = load i32, ptr %19, align 4, !tbaa !9
  %237 = icmp slt i32 %235, %236
  br i1 %237, label %238, label %257

238:                                              ; preds = %234
  %239 = load ptr, ptr %18, align 8, !tbaa !5
  %240 = load i32, ptr %13, align 4, !tbaa !9
  %241 = sext i32 %240 to i64
  %242 = getelementptr inbounds ptr, ptr %239, i64 %241
  %243 = load ptr, ptr %242, align 8, !tbaa !5
  %244 = icmp eq ptr %243, null
  br i1 %244, label %245, label %247

245:                                              ; preds = %238
  %246 = call i32 @SMerror(i32 noundef 631, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null)
  store i32 %246, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

247:                                              ; preds = %238
  %248 = load ptr, ptr %18, align 8, !tbaa !5
  %249 = load i32, ptr %13, align 4, !tbaa !9
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds ptr, ptr %248, i64 %250
  %252 = load ptr, ptr %251, align 8, !tbaa !5
  call void @free(ptr noundef %252) #6
  br label %253

253:                                              ; preds = %247
  br label %254

254:                                              ; preds = %253
  %255 = load i32, ptr %13, align 4, !tbaa !9
  %256 = add nsw i32 %255, 1
  store i32 %256, ptr %13, align 4, !tbaa !9
  br label %234, !llvm.loop !15

257:                                              ; preds = %234
  %258 = load ptr, ptr %17, align 8, !tbaa !5
  %259 = icmp eq ptr %258, null
  br i1 %259, label %260, label %262

260:                                              ; preds = %257
  %261 = call i32 @SMerror(i32 noundef 632, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null)
  store i32 %261, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

262:                                              ; preds = %257
  %263 = load ptr, ptr %17, align 8, !tbaa !5
  call void @free(ptr noundef %263) #6
  br label %264

264:                                              ; preds = %262
  %265 = load ptr, ptr %18, align 8, !tbaa !5
  %266 = icmp eq ptr %265, null
  br i1 %266, label %267, label %269

267:                                              ; preds = %264
  %268 = call i32 @SMerror(i32 noundef 632, ptr noundef @.str.23, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null)
  store i32 %268, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

269:                                              ; preds = %264
  %270 = load ptr, ptr %18, align 8, !tbaa !5
  call void @free(ptr noundef %270) #6
  br label %271

271:                                              ; preds = %269
  %272 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 3, ptr %272, align 4, !tbaa !9
  store i32 0, ptr %12, align 4, !tbaa !9
  store i32 0, ptr %6, align 4
  store i32 1, ptr %20, align 4
  br label %273

273:                                              ; preds = %271, %267, %260, %245, %135, %96, %84, %69, %49, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %274 = load i32, ptr %6, align 4
  ret i32 %274
}

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 "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 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 #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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !12}


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

@.str.1 = external hidden unnamed_addr constant [108 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [23 x i8], align 1

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #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 memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #3

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @SMcomputeSineGradients(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef readonly %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #6
  %7 = icmp eq ptr %6, null
  br i1 %7, label %8, label %10

8:                                                ; preds = %5
  %9 = tail call i32 @SMerror(i32 noundef 604, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null) #7
  br label %103

10:                                               ; preds = %5
  %11 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #6
  %12 = icmp eq ptr %11, null
  br i1 %12, label %15, label %.preheader.preheader

.preheader.preheader:                             ; preds = %10
  %13 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  store ptr %13, ptr %11, align 8, !tbaa !5
  %14 = icmp eq ptr %13, null
  br i1 %14, label %25, label %.preheader.1

15:                                               ; preds = %10
  %16 = tail call i32 @SMerror(i32 noundef 605, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null) #7
  br label %103

.preheader.1:                                     ; preds = %.preheader.preheader
  %17 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %18 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %17, ptr %18, align 8, !tbaa !5
  %19 = icmp eq ptr %17, null
  br i1 %19, label %25, label %.preheader.2

.preheader.2:                                     ; preds = %.preheader.1
  %20 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %21 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %20, ptr %21, align 8, !tbaa !5
  %22 = icmp eq ptr %20, null
  br i1 %22, label %25, label %23

23:                                               ; preds = %.preheader.2
  %24 = tail call i32 @SMcomputeTriCosines(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull %6, ptr noundef %4)
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %29, label %27

25:                                               ; preds = %.preheader.2, %.preheader.1, %.preheader.preheader
  %26 = tail call i32 @SMerror(i32 noundef 607, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 55, i32 noundef 0, ptr noundef null) #7
  br label %103

27:                                               ; preds = %23
  %28 = tail call i32 @SMerror(i32 noundef 610, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef %24, i32 noundef 0, ptr noundef null) #7
  br label %103

29:                                               ; preds = %23
  %30 = tail call i32 @SMcomputeCosGradients(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef nonnull %11, ptr noundef %4)
  %.not86 = icmp eq i32 %30, 0
  br i1 %.not86, label %33, label %31

31:                                               ; preds = %29
  %32 = tail call i32 @SMerror(i32 noundef 612, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef %30, i32 noundef 0, ptr noundef null) #7
  br label %103

33:                                               ; preds = %29
  %34 = load double, ptr %6, align 8, !tbaa !9
  %35 = fneg double %34
  %36 = tail call double @llvm.fmuladd.f64(double %35, double %34, double 1.000000e+00)
  %37 = tail call double @sqrt(double noundef %36) #7
  %38 = getelementptr inbounds i8, ptr %6, i64 8
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fneg double %39
  %41 = tail call double @llvm.fmuladd.f64(double %40, double %39, double 1.000000e+00)
  %42 = tail call double @sqrt(double noundef %41) #7
  %43 = getelementptr inbounds i8, ptr %6, i64 16
  %44 = load double, ptr %43, align 8, !tbaa !9
  %45 = fneg double %44
  %46 = tail call double @llvm.fmuladd.f64(double %45, double %44, double 1.000000e+00)
  %47 = tail call double @sqrt(double noundef %46) #7
  %48 = fcmp olt double %37, 1.000000e-15
  %49 = fcmp olt double %42, 1.000000e-15
  %or.cond = select i1 %48, i1 true, i1 %49
  %50 = fcmp olt double %47, 1.000000e-15
  %or.cond3 = select i1 %or.cond, i1 true, i1 %50
  br i1 %or.cond3, label %51, label %55

51:                                               ; preds = %33
  %52 = tail call i32 @SMerror(i32 noundef 621, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 57, i32 noundef 0, ptr noundef nonnull @.str.3) #7
  br label %103

53:                                               ; preds = %99, %55
  %54 = tail call i32 @SMerror(i32 noundef 631, ptr noundef nonnull @.str.23, ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 60, i32 noundef 0, ptr noundef null) #7
  br label %103

55:                                               ; preds = %33
  %56 = fdiv double -1.000000e+00, %37
  %57 = load double, ptr %6, align 8, !tbaa !9
  %58 = fmul double %56, %57
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = load double, ptr %59, align 8, !tbaa !9
  %61 = fmul double %58, %60
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  store double %61, ptr %62, align 8, !tbaa !9
  %63 = load double, ptr %6, align 8, !tbaa !9
  %64 = fmul double %56, %63
  %65 = getelementptr inbounds i8, ptr %59, i64 8
  %66 = load double, ptr %65, align 8, !tbaa !9
  %67 = fmul double %64, %66
  %68 = getelementptr inbounds i8, ptr %62, i64 8
  store double %67, ptr %68, align 8, !tbaa !9
  %69 = fdiv double -1.000000e+00, %42
  %70 = load double, ptr %38, align 8, !tbaa !9
  %71 = fmul double %69, %70
  %72 = load ptr, ptr %18, align 8, !tbaa !5
  %73 = load double, ptr %72, align 8, !tbaa !9
  %74 = fmul double %71, %73
  %75 = getelementptr inbounds i8, ptr %3, i64 8
  %76 = load ptr, ptr %75, align 8, !tbaa !5
  store double %74, ptr %76, align 8, !tbaa !9
  %77 = load double, ptr %38, align 8, !tbaa !9
  %78 = fmul double %69, %77
  %79 = getelementptr inbounds i8, ptr %72, i64 8
  %80 = load double, ptr %79, align 8, !tbaa !9
  %81 = fmul double %78, %80
  %82 = getelementptr inbounds i8, ptr %76, i64 8
  store double %81, ptr %82, align 8, !tbaa !9
  %83 = fdiv double -1.000000e+00, %47
  %84 = load double, ptr %43, align 8, !tbaa !9
  %85 = fmul double %83, %84
  %86 = load ptr, ptr %21, align 8, !tbaa !5
  %87 = load double, ptr %86, align 8, !tbaa !9
  %88 = fmul double %85, %87
  %89 = getelementptr inbounds i8, ptr %3, i64 16
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  store double %88, ptr %90, align 8, !tbaa !9
  %91 = load double, ptr %43, align 8, !tbaa !9
  %92 = fmul double %83, %91
  %93 = getelementptr inbounds i8, ptr %86, i64 8
  %94 = load double, ptr %93, align 8, !tbaa !9
  %95 = fmul double %92, %94
  %96 = getelementptr inbounds i8, ptr %90, i64 8
  store double %95, ptr %96, align 8, !tbaa !9
  tail call void @free(ptr noundef nonnull %59) #7
  %97 = load ptr, ptr %18, align 8, !tbaa !5
  %98 = icmp eq ptr %97, null
  br i1 %98, label %53, label %99

99:                                               ; preds = %55
  tail call void @free(ptr noundef nonnull %97) #7
  %100 = load ptr, ptr %21, align 8, !tbaa !5
  %101 = icmp eq ptr %100, null
  br i1 %101, label %53, label %102

102:                                              ; preds = %99
  tail call void @free(ptr noundef nonnull %100) #7
  tail call void @free(ptr noundef nonnull %6) #7
  tail call void @free(ptr noundef nonnull %11) #7
  store i32 3, ptr %4, align 4, !tbaa !11
  br label %103

103:                                              ; preds = %102, %53, %51, %31, %27, %25, %15, %8
  %.0 = phi i32 [ %26, %25 ], [ %28, %27 ], [ %32, %31 ], [ %52, %51 ], [ %54, %53 ], [ 0, %102 ], [ %16, %15 ], [ %9, %8 ]
  ret i32 %.0
}

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 speculatable willreturn memory(none) }
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 memory(write) "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 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 #5 = { 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 #6 = { nounwind allocsize(0) }
attributes #7 = { 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}


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