; LLVM IR from ETH3D/dataset-pipeline :: thirdparty/cork/cork/isct (triangle)

; 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.otri = type { ptr, i32 }
%struct.mesh = type { %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, [4096 x ptr], [4096 x ptr], [4096 x i32], i32, ptr, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.otri }
%struct.memorypool = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i64, i64, i32, i32 }

@plus1mod3 = external dso_local global [3 x i32], align 4
@minus1mod3 = external dso_local global [3 x i32], align 4
@.str.1001 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1002 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1003 = external hidden unnamed_addr constant [19 x i8], align 1

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

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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @internalerror() #2

; Function Attrs: nounwind uwtable
declare dso_local double @counterclockwise(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @finddirection(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %struct.otri, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca double, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.otri, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.otri, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 8, !tbaa !12
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %26
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = add nsw i32 %28, 3
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds ptr, ptr %22, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %32, ptr %11, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.otri, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = load ptr, ptr %8, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.otri, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 8, !tbaa !12
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !13
  %42 = add nsw i32 %41, 3
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds ptr, ptr %35, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  store ptr %45, ptr %13, align 8, !tbaa !5
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.otri, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.otri, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !12
  %52 = add nsw i32 %51, 3
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds ptr, ptr %48, i64 %53
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  store ptr %55, ptr %12, align 8, !tbaa !5
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = load ptr, ptr %12, align 8, !tbaa !5
  %61 = call double @counterclockwise(ptr noundef %56, ptr noundef %57, ptr noundef %58, ptr noundef %59, ptr noundef %60)
  store double %61, ptr %14, align 8, !tbaa !14
  %62 = load double, ptr %14, align 8, !tbaa !14
  %63 = fcmp ogt double %62, 0.000000e+00
  %64 = zext i1 %63 to i32
  store i32 %64, ptr %16, align 4, !tbaa !13
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = load ptr, ptr %11, align 8, !tbaa !5
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = call double @counterclockwise(ptr noundef %65, ptr noundef %66, ptr noundef %67, ptr noundef %68, ptr noundef %69)
  store double %70, ptr %15, align 8, !tbaa !14
  %71 = load double, ptr %15, align 8, !tbaa !14
  %72 = fcmp ogt double %71, 0.000000e+00
  %73 = zext i1 %72 to i32
  store i32 %73, ptr %17, align 4, !tbaa !13
  %74 = load i32, ptr %16, align 4, !tbaa !13
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %120

76:                                               ; preds = %4
  %77 = load i32, ptr %17, align 4, !tbaa !13
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %120

79:                                               ; preds = %76
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.otri, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 0
  store ptr %82, ptr %83, align 8, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.otri, ptr %84, i32 0, i32 1
  %86 = load i32, ptr %85, align 8, !tbaa !12
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !13
  %90 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 1
  store i32 %89, ptr %90, align 8, !tbaa !12
  %91 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 1
  %94 = load i32, ptr %93, align 8, !tbaa !12
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds ptr, ptr %92, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !5
  store ptr %97, ptr %18, align 8, !tbaa !5
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = ptrtoint ptr %98 to i64
  %100 = and i64 %99, 3
  %101 = trunc i64 %100 to i32
  %102 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 1
  store i32 %101, ptr %102, align 8, !tbaa !12
  %103 = load ptr, ptr %18, align 8, !tbaa !5
  %104 = ptrtoint ptr %103 to i64
  %105 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 1
  %106 = load i32, ptr %105, align 8, !tbaa !12
  %107 = sext i32 %106 to i64
  %108 = xor i64 %104, %107
  %109 = inttoptr i64 %108 to ptr
  %110 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 0
  store ptr %109, ptr %110, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct.otri, ptr %10, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !9
  %113 = load ptr, ptr %6, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.mesh, ptr %113, i32 0, i32 48
  %115 = load ptr, ptr %114, align 8, !tbaa !16
  %116 = icmp eq ptr %112, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %79
  store i32 0, ptr %16, align 4, !tbaa !13
  br label %119

118:                                              ; preds = %79
  store i32 0, ptr %17, align 4, !tbaa !13
  br label %119

119:                                              ; preds = %118, %117
  br label %120

120:                                              ; preds = %119, %76, %4
  br label %121

121:                                              ; preds = %181, %120
  %122 = load i32, ptr %16, align 4, !tbaa !13
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %202

124:                                              ; preds = %121
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.otri, ptr %125, i32 0, i32 1
  %127 = load i32, ptr %126, align 8, !tbaa !12
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !13
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.otri, ptr %131, i32 0, i32 1
  store i32 %130, ptr %132, align 8, !tbaa !12
  %133 = load ptr, ptr %8, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.otri, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !9
  %136 = load ptr, ptr %8, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.otri, ptr %136, i32 0, i32 1
  %138 = load i32, ptr %137, align 8, !tbaa !12
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds ptr, ptr %135, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !5
  store ptr %141, ptr %18, align 8, !tbaa !5
  %142 = load ptr, ptr %18, align 8, !tbaa !5
  %143 = ptrtoint ptr %142 to i64
  %144 = and i64 %143, 3
  %145 = trunc i64 %144 to i32
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.otri, ptr %146, i32 0, i32 1
  store i32 %145, ptr %147, align 8, !tbaa !12
  %148 = load ptr, ptr %18, align 8, !tbaa !5
  %149 = ptrtoint ptr %148 to i64
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.otri, ptr %150, i32 0, i32 1
  %152 = load i32, ptr %151, align 8, !tbaa !12
  %153 = sext i32 %152 to i64
  %154 = xor i64 %149, %153
  %155 = inttoptr i64 %154 to ptr
  %156 = load ptr, ptr %8, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.otri, ptr %156, i32 0, i32 0
  store ptr %155, ptr %157, align 8, !tbaa !9
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.otri, ptr %158, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !9
  %161 = load ptr, ptr %6, align 8, !tbaa !5
  %162 = getelementptr inbounds %struct.mesh, ptr %161, i32 0, i32 48
  %163 = load ptr, ptr %162, align 8, !tbaa !16
  %164 = icmp eq ptr %160, %163
  br i1 %164, label %165, label %181

165:                                              ; preds = %124
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.1001)
  %167 = load ptr, ptr %11, align 8, !tbaa !5
  %168 = getelementptr inbounds double, ptr %167, i64 0
  %169 = load double, ptr %168, align 8, !tbaa !14
  %170 = load ptr, ptr %11, align 8, !tbaa !5
  %171 = getelementptr inbounds double, ptr %170, i64 1
  %172 = load double, ptr %171, align 8, !tbaa !14
  %173 = call i32 (ptr, ...) @printf(ptr noundef @.str.1002, double noundef %169, double noundef %172)
  %174 = load ptr, ptr %9, align 8, !tbaa !5
  %175 = getelementptr inbounds double, ptr %174, i64 0
  %176 = load double, ptr %175, align 8, !tbaa !14
  %177 = load ptr, ptr %9, align 8, !tbaa !5
  %178 = getelementptr inbounds double, ptr %177, i64 1
  %179 = load double, ptr %178, align 8, !tbaa !14
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.1003, double noundef %176, double noundef %179)
  call void @internalerror()
  br label %181

181:                                              ; preds = %165, %124
  %182 = load ptr, ptr %8, align 8, !tbaa !5
  %183 = getelementptr inbounds %struct.otri, ptr %182, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !9
  %185 = load ptr, ptr %8, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.otri, ptr %185, i32 0, i32 1
  %187 = load i32, ptr %186, align 8, !tbaa !12
  %188 = add nsw i32 %187, 3
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds ptr, ptr %184, i64 %189
  %191 = load ptr, ptr %190, align 8, !tbaa !5
  store ptr %191, ptr %12, align 8, !tbaa !5
  %192 = load double, ptr %14, align 8, !tbaa !14
  store double %192, ptr %15, align 8, !tbaa !14
  %193 = load ptr, ptr %6, align 8, !tbaa !5
  %194 = load ptr, ptr %7, align 8, !tbaa !5
  %195 = load ptr, ptr %9, align 8, !tbaa !5
  %196 = load ptr, ptr %11, align 8, !tbaa !5
  %197 = load ptr, ptr %12, align 8, !tbaa !5
  %198 = call double @counterclockwise(ptr noundef %193, ptr noundef %194, ptr noundef %195, ptr noundef %196, ptr noundef %197)
  store double %198, ptr %14, align 8, !tbaa !14
  %199 = load double, ptr %14, align 8, !tbaa !14
  %200 = fcmp ogt double %199, 0.000000e+00
  %201 = zext i1 %200 to i32
  store i32 %201, ptr %16, align 4, !tbaa !13
  br label %121, !llvm.loop !20

202:                                              ; preds = %121
  br label %203

203:                                              ; preds = %263, %202
  %204 = load i32, ptr %17, align 4, !tbaa !13
  %205 = icmp ne i32 %204, 0
  br i1 %205, label %206, label %287

206:                                              ; preds = %203
  %207 = load ptr, ptr %8, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.otri, ptr %207, i32 0, i32 0
  %209 = load ptr, ptr %208, align 8, !tbaa !9
  %210 = load ptr, ptr %8, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.otri, ptr %210, i32 0, i32 1
  %212 = load i32, ptr %211, align 8, !tbaa !12
  %213 = sext i32 %212 to i64
  %214 = getelementptr inbounds ptr, ptr %209, i64 %213
  %215 = load ptr, ptr %214, align 8, !tbaa !5
  store ptr %215, ptr %18, align 8, !tbaa !5
  %216 = load ptr, ptr %18, align 8, !tbaa !5
  %217 = ptrtoint ptr %216 to i64
  %218 = and i64 %217, 3
  %219 = trunc i64 %218 to i32
  %220 = load ptr, ptr %8, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.otri, ptr %220, i32 0, i32 1
  store i32 %219, ptr %221, align 8, !tbaa !12
  %222 = load ptr, ptr %18, align 8, !tbaa !5
  %223 = ptrtoint ptr %222 to i64
  %224 = load ptr, ptr %8, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.otri, ptr %224, i32 0, i32 1
  %226 = load i32, ptr %225, align 8, !tbaa !12
  %227 = sext i32 %226 to i64
  %228 = xor i64 %223, %227
  %229 = inttoptr i64 %228 to ptr
  %230 = load ptr, ptr %8, align 8, !tbaa !5
  %231 = getelementptr inbounds %struct.otri, ptr %230, i32 0, i32 0
  store ptr %229, ptr %231, align 8, !tbaa !9
  %232 = load ptr, ptr %8, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.otri, ptr %232, i32 0, i32 1
  %234 = load i32, ptr %233, align 8, !tbaa !12
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %235
  %237 = load i32, ptr %236, align 4, !tbaa !13
  %238 = load ptr, ptr %8, align 8, !tbaa !5
  %239 = getelementptr inbounds %struct.otri, ptr %238, i32 0, i32 1
  store i32 %237, ptr %239, align 8, !tbaa !12
  %240 = load ptr, ptr %8, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.otri, ptr %240, i32 0, i32 0
  %242 = load ptr, ptr %241, align 8, !tbaa !9
  %243 = load ptr, ptr %6, align 8, !tbaa !5
  %244 = getelementptr inbounds %struct.mesh, ptr %243, i32 0, i32 48
  %245 = load ptr, ptr %244, align 8, !tbaa !16
  %246 = icmp eq ptr %242, %245
  br i1 %246, label %247, label %263

247:                                              ; preds = %206
  %248 = call i32 (ptr, ...) @printf(ptr noundef @.str.1001)
  %249 = load ptr, ptr %11, align 8, !tbaa !5
  %250 = getelementptr inbounds double, ptr %249, i64 0
  %251 = load double, ptr %250, align 8, !tbaa !14
  %252 = load ptr, ptr %11, align 8, !tbaa !5
  %253 = getelementptr inbounds double, ptr %252, i64 1
  %254 = load double, ptr %253, align 8, !tbaa !14
  %255 = call i32 (ptr, ...) @printf(ptr noundef @.str.1002, double noundef %251, double noundef %254)
  %256 = load ptr, ptr %9, align 8, !tbaa !5
  %257 = getelementptr inbounds double, ptr %256, i64 0
  %258 = load double, ptr %257, align 8, !tbaa !14
  %259 = load ptr, ptr %9, align 8, !tbaa !5
  %260 = getelementptr inbounds double, ptr %259, i64 1
  %261 = load double, ptr %260, align 8, !tbaa !14
  %262 = call i32 (ptr, ...) @printf(ptr noundef @.str.1003, double noundef %258, double noundef %261)
  call void @internalerror()
  br label %263

263:                                              ; preds = %247, %206
  %264 = load ptr, ptr %8, align 8, !tbaa !5
  %265 = getelementptr inbounds %struct.otri, ptr %264, i32 0, i32 0
  %266 = load ptr, ptr %265, align 8, !tbaa !9
  %267 = load ptr, ptr %8, align 8, !tbaa !5
  %268 = getelementptr inbounds %struct.otri, ptr %267, i32 0, i32 1
  %269 = load i32, ptr %268, align 8, !tbaa !12
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %270
  %272 = load i32, ptr %271, align 4, !tbaa !13
  %273 = add nsw i32 %272, 3
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds ptr, ptr %266, i64 %274
  %276 = load ptr, ptr %275, align 8, !tbaa !5
  store ptr %276, ptr %13, align 8, !tbaa !5
  %277 = load double, ptr %15, align 8, !tbaa !14
  store double %277, ptr %14, align 8, !tbaa !14
  %278 = load ptr, ptr %6, align 8, !tbaa !5
  %279 = load ptr, ptr %7, align 8, !tbaa !5
  %280 = load ptr, ptr %11, align 8, !tbaa !5
  %281 = load ptr, ptr %9, align 8, !tbaa !5
  %282 = load ptr, ptr %13, align 8, !tbaa !5
  %283 = call double @counterclockwise(ptr noundef %278, ptr noundef %279, ptr noundef %280, ptr noundef %281, ptr noundef %282)
  store double %283, ptr %15, align 8, !tbaa !14
  %284 = load double, ptr %15, align 8, !tbaa !14
  %285 = fcmp ogt double %284, 0.000000e+00
  %286 = zext i1 %285 to i32
  store i32 %286, ptr %17, align 4, !tbaa !13
  br label %203, !llvm.loop !22

287:                                              ; preds = %203
  %288 = load double, ptr %14, align 8, !tbaa !14
  %289 = fcmp oeq double %288, 0.000000e+00
  br i1 %289, label %290, label %291

290:                                              ; preds = %287
  store i32 1, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %296

291:                                              ; preds = %287
  %292 = load double, ptr %15, align 8, !tbaa !14
  %293 = fcmp oeq double %292, 0.000000e+00
  br i1 %293, label %294, label %295

294:                                              ; preds = %291
  store i32 2, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %296

295:                                              ; preds = %291
  store i32 0, ptr %5, align 4
  store i32 1, ptr %19, align 4
  br label %296

296:                                              ; preds = %295, %294, %290
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #3
  %297 = load i32, ptr %5, align 4
  ret i32 %297
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind 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 #3 = { 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, !6, i64 0}
!10 = !{!"otri", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!17, !6, i64 82856}
!17 = !{!"mesh", !18, i64 0, !18, i64 88, !18, i64 176, !18, i64 264, !18, i64 352, !18, i64 440, !18, i64 528, !18, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !11, i64 82624, !6, i64 82632, !15, i64 82640, !15, i64 82648, !15, i64 82656, !15, i64 82664, !15, i64 82672, !11, i64 82680, !11, i64 82684, !11, i64 82688, !11, i64 82692, !11, i64 82696, !11, i64 82700, !19, i64 82704, !11, i64 82712, !11, i64 82716, !11, i64 82720, !19, i64 82728, !11, i64 82736, !11, i64 82740, !11, i64 82744, !11, i64 82748, !11, i64 82752, !11, i64 82756, !11, i64 82760, !11, i64 82764, !11, i64 82768, !19, i64 82776, !19, i64 82784, !19, i64 82792, !19, i64 82800, !19, i64 82808, !19, i64 82816, !19, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !10, i64 82888}
!18 = !{!"memorypool", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !19, i64 64, !19, i64 72, !11, i64 80, !11, i64 84}
!19 = !{!"long", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !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"

@plus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4
@minus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4
@.str.1001 = external hidden unnamed_addr constant [54 x i8], align 1
@.str.1002 = external hidden unnamed_addr constant [42 x i8], align 1
@.str.1003 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @internalerror() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local double @counterclockwise(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @finddirection(ptr noundef %0, ptr noundef %1, ptr nocapture noundef %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !11
  %8 = sext i32 %7 to i64
  %9 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %8
  %10 = load i32, ptr %9, align 4, !tbaa !12
  %11 = sext i32 %10 to i64
  %12 = getelementptr ptr, ptr %5, i64 %11
  %13 = getelementptr i8, ptr %12, i64 24
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %8
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %17 = sext i32 %16 to i64
  %18 = getelementptr ptr, ptr %5, i64 %17
  %19 = getelementptr i8, ptr %18, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !13
  %21 = getelementptr ptr, ptr %5, i64 %8
  %22 = getelementptr i8, ptr %21, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = tail call double @counterclockwise(ptr noundef %0, ptr noundef %1, ptr noundef %3, ptr noundef %14, ptr noundef %23)
  %25 = fcmp ogt double %24, 0.000000e+00
  %26 = tail call double @counterclockwise(ptr noundef %0, ptr noundef %1, ptr noundef %14, ptr noundef %3, ptr noundef %20)
  %27 = fcmp ogt double %26, 0.000000e+00
  %or.cond = select i1 %25, i1 %27, i1 false
  br i1 %or.cond, label %28, label %43

28:                                               ; preds = %4
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = load i32, ptr %6, align 8, !tbaa !11
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %31
  %33 = load i32, ptr %32, align 4, !tbaa !12
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds ptr, ptr %29, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !13
  %37 = ptrtoint ptr %36 to i64
  %38 = and i64 %37, -4
  %39 = inttoptr i64 %38 to ptr
  %40 = getelementptr inbounds i8, ptr %0, i64 82856
  %41 = load ptr, ptr %40, align 8, !tbaa !14
  %42 = icmp eq ptr %41, %39
  br i1 %42, label %.preheader, label %.lr.ph

43:                                               ; preds = %4
  br i1 %25, label %.lr.ph, label %.preheader

.lr.ph:                                           ; preds = %28, %43
  %.0.shrunk100 = phi i1 [ %42, %28 ], [ %27, %43 ]
  %44 = getelementptr inbounds i8, ptr %0, i64 82856
  %45 = getelementptr inbounds i8, ptr %14, i64 8
  %46 = getelementptr inbounds i8, ptr %3, i64 8
  br label %50

.preheader:                                       ; preds = %74, %28, %43
  %.0.shrunk99 = phi i1 [ %27, %43 ], [ %42, %28 ], [ %.0.shrunk100, %74 ]
  %.084.lcssa = phi double [ %24, %43 ], [ %24, %28 ], [ %81, %74 ]
  %.082.lcssa = phi double [ %26, %43 ], [ %26, %28 ], [ %.08489, %74 ]
  br i1 %.0.shrunk99, label %.lr.ph92, label %._crit_edge

.lr.ph92:                                         ; preds = %.preheader
  %47 = getelementptr inbounds i8, ptr %0, i64 82856
  %48 = getelementptr inbounds i8, ptr %14, i64 8
  %49 = getelementptr inbounds i8, ptr %3, i64 8
  br label %83

50:                                               ; preds = %.lr.ph, %74
  %.08489 = phi double [ %24, %.lr.ph ], [ %81, %74 ]
  %51 = load i32, ptr %6, align 8, !tbaa !11
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !12
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = sext i32 %54 to i64
  %57 = getelementptr inbounds ptr, ptr %55, i64 %56
  %58 = load ptr, ptr %57, align 8, !tbaa !13
  %59 = ptrtoint ptr %58 to i64
  %60 = trunc i64 %59 to i32
  %61 = and i32 %60, 3
  store i32 %61, ptr %6, align 8, !tbaa !11
  %62 = and i64 %59, -4
  %63 = inttoptr i64 %62 to ptr
  store ptr %63, ptr %2, align 8, !tbaa !5
  %64 = load ptr, ptr %44, align 8, !tbaa !14
  %65 = icmp eq ptr %64, %63
  br i1 %65, label %66, label %74

66:                                               ; preds = %50
  %67 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1001)
  %68 = load double, ptr %14, align 8, !tbaa !19
  %69 = load double, ptr %45, align 8, !tbaa !19
  %70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1002, double noundef %68, double noundef %69)
  %71 = load double, ptr %3, align 8, !tbaa !19
  %72 = load double, ptr %46, align 8, !tbaa !19
  %73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1003, double noundef %71, double noundef %72)
  tail call void @internalerror()
  %.pre = load ptr, ptr %2, align 8, !tbaa !5
  %.pre96 = load i32, ptr %6, align 8, !tbaa !11
  br label %74

74:                                               ; preds = %66, %50
  %75 = phi i32 [ %.pre96, %66 ], [ %61, %50 ]
  %76 = phi ptr [ %.pre, %66 ], [ %63, %50 ]
  %77 = sext i32 %75 to i64
  %78 = getelementptr ptr, ptr %76, i64 %77
  %79 = getelementptr i8, ptr %78, i64 24
  %80 = load ptr, ptr %79, align 8, !tbaa !13
  %81 = tail call double @counterclockwise(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %3, ptr noundef %14, ptr noundef %80)
  %82 = fcmp ogt double %81, 0.000000e+00
  br i1 %82, label %50, label %.preheader, !llvm.loop !20

83:                                               ; preds = %.lr.ph92, %107
  %.18391 = phi double [ %.082.lcssa, %.lr.ph92 ], [ %117, %107 ]
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = load i32, ptr %6, align 8, !tbaa !11
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds ptr, ptr %84, i64 %86
  %88 = load ptr, ptr %87, align 8, !tbaa !13
  %89 = ptrtoint ptr %88 to i64
  %90 = trunc i64 %89 to i32
  %91 = and i32 %90, 3
  store i32 %91, ptr %6, align 8, !tbaa !11
  %92 = and i64 %89, -4
  %93 = inttoptr i64 %92 to ptr
  store ptr %93, ptr %2, align 8, !tbaa !5
  %94 = and i64 %89, 3
  %95 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !12
  store i32 %96, ptr %6, align 8, !tbaa !11
  %97 = load ptr, ptr %47, align 8, !tbaa !14
  %98 = icmp eq ptr %97, %93
  br i1 %98, label %99, label %107

99:                                               ; preds = %83
  %100 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1001)
  %101 = load double, ptr %14, align 8, !tbaa !19
  %102 = load double, ptr %48, align 8, !tbaa !19
  %103 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1002, double noundef %101, double noundef %102)
  %104 = load double, ptr %3, align 8, !tbaa !19
  %105 = load double, ptr %49, align 8, !tbaa !19
  %106 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1003, double noundef %104, double noundef %105)
  tail call void @internalerror()
  %.pre97 = load ptr, ptr %2, align 8, !tbaa !5
  %.pre98 = load i32, ptr %6, align 8, !tbaa !11
  br label %107

107:                                              ; preds = %99, %83
  %108 = phi i32 [ %.pre98, %99 ], [ %96, %83 ]
  %109 = phi ptr [ %.pre97, %99 ], [ %93, %83 ]
  %110 = sext i32 %108 to i64
  %111 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %110
  %112 = load i32, ptr %111, align 4, !tbaa !12
  %113 = sext i32 %112 to i64
  %114 = getelementptr ptr, ptr %109, i64 %113
  %115 = getelementptr i8, ptr %114, i64 24
  %116 = load ptr, ptr %115, align 8, !tbaa !13
  %117 = tail call double @counterclockwise(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %14, ptr noundef %3, ptr noundef %116)
  %118 = fcmp ogt double %117, 0.000000e+00
  br i1 %118, label %83, label %._crit_edge, !llvm.loop !22

._crit_edge:                                      ; preds = %107, %.preheader
  %.185.lcssa = phi double [ %.084.lcssa, %.preheader ], [ %.18391, %107 ]
  %.183.lcssa = phi double [ %.082.lcssa, %.preheader ], [ %117, %107 ]
  %119 = fcmp oeq double %.185.lcssa, 0.000000e+00
  %120 = fcmp oeq double %.183.lcssa, 0.000000e+00
  %.88 = select i1 %120, i32 2, i32 0
  %.086 = select i1 %119, i32 1, i32 %.88
  ret i32 %.086
}

attributes #0 = { 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 #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!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 = !{!"otri", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!10, !10, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 82856}
!15 = !{!"mesh", !16, i64 0, !16, i64 88, !16, i64 176, !16, i64 264, !16, i64 352, !16, i64 440, !16, i64 528, !16, i64 616, !8, i64 704, !8, i64 33472, !8, i64 66240, !10, i64 82624, !7, i64 82632, !18, i64 82640, !18, i64 82648, !18, i64 82656, !18, i64 82664, !18, i64 82672, !10, i64 82680, !10, i64 82684, !10, i64 82688, !10, i64 82692, !10, i64 82696, !10, i64 82700, !17, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !17, i64 82728, !10, i64 82736, !10, i64 82740, !10, i64 82744, !10, i64 82748, !10, i64 82752, !10, i64 82756, !10, i64 82760, !10, i64 82764, !10, i64 82768, !17, i64 82776, !17, i64 82784, !17, i64 82792, !17, i64 82800, !17, i64 82808, !17, i64 82816, !17, i64 82824, !7, i64 82832, !7, i64 82840, !7, i64 82848, !7, i64 82856, !7, i64 82864, !7, i64 82872, !7, i64 82880, !6, i64 82888}
!16 = !{!"memorypool", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !17, i64 64, !17, i64 72, !10, i64 80, !10, i64 84}
!17 = !{!"long", !8, i64 0}
!18 = !{!"double", !8, i64 0}
!19 = !{!18, !18, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}


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