; LLVM IR from osmart/hole2 :: src (sos_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"

@culled_tri_count = external dso_local global i32, align 4
@smooth = external dso_local global i32, align 4
@dots = external dso_local global [30000 x [7 x double]], align 16
@culled_tri = external dso_local global [30000 x [6 x i32]], align 16

; 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

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

; Function Attrs: nounwind uwtable
define dso_local void @reorder_triangle() #2 {
  %1 = alloca i32, align 4
  %2 = alloca [3 x double], align 16
  %3 = alloca [3 x double], align 16
  %4 = alloca [3 x double], align 16
  %5 = alloca [3 x double], align 16
  %6 = alloca double, align 8
  %7 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  store i32 0, ptr %7, align 4, !tbaa !5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %301, %0
  %9 = load i32, ptr %7, align 4, !tbaa !5
  %10 = load i32, ptr @culled_tri_count, align 4, !tbaa !5
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %12, label %304

12:                                               ; preds = %8
  %13 = load i32, ptr @smooth, align 4, !tbaa !5
  %14 = icmp eq i32 %13, 1
  br i1 %14, label %15, label %300

15:                                               ; preds = %12
  %16 = load i32, ptr %7, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %17
  %19 = getelementptr inbounds [6 x i32], ptr %18, i64 0, i64 0
  %20 = load i32, ptr %19, align 8, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %21
  %23 = getelementptr inbounds [7 x double], ptr %22, i64 0, i64 4
  %24 = load double, ptr %23, align 8, !tbaa !9
  %25 = load i32, ptr %7, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %26
  %28 = getelementptr inbounds [6 x i32], ptr %27, i64 0, i64 1
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %30
  %32 = getelementptr inbounds [7 x double], ptr %31, i64 0, i64 4
  %33 = load double, ptr %32, align 8, !tbaa !9
  %34 = fadd double %24, %33
  %35 = load i32, ptr %7, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %36
  %38 = getelementptr inbounds [6 x i32], ptr %37, i64 0, i64 2
  %39 = load i32, ptr %38, align 8, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %40
  %42 = getelementptr inbounds [7 x double], ptr %41, i64 0, i64 4
  %43 = load double, ptr %42, align 8, !tbaa !9
  %44 = fadd double %34, %43
  %45 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 0
  store double %44, ptr %45, align 16, !tbaa !9
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %47
  %49 = getelementptr inbounds [6 x i32], ptr %48, i64 0, i64 0
  %50 = load i32, ptr %49, align 8, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %51
  %53 = getelementptr inbounds [7 x double], ptr %52, i64 0, i64 5
  %54 = load double, ptr %53, align 8, !tbaa !9
  %55 = load i32, ptr %7, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %56
  %58 = getelementptr inbounds [6 x i32], ptr %57, i64 0, i64 1
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %60
  %62 = getelementptr inbounds [7 x double], ptr %61, i64 0, i64 5
  %63 = load double, ptr %62, align 8, !tbaa !9
  %64 = fadd double %54, %63
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %66
  %68 = getelementptr inbounds [6 x i32], ptr %67, i64 0, i64 2
  %69 = load i32, ptr %68, align 8, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %70
  %72 = getelementptr inbounds [7 x double], ptr %71, i64 0, i64 5
  %73 = load double, ptr %72, align 8, !tbaa !9
  %74 = fadd double %64, %73
  %75 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 1
  store double %74, ptr %75, align 8, !tbaa !9
  %76 = load i32, ptr %7, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %77
  %79 = getelementptr inbounds [6 x i32], ptr %78, i64 0, i64 0
  %80 = load i32, ptr %79, align 8, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %81
  %83 = getelementptr inbounds [7 x double], ptr %82, i64 0, i64 6
  %84 = load double, ptr %83, align 8, !tbaa !9
  %85 = load i32, ptr %7, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %86
  %88 = getelementptr inbounds [6 x i32], ptr %87, i64 0, i64 1
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %90
  %92 = getelementptr inbounds [7 x double], ptr %91, i64 0, i64 6
  %93 = load double, ptr %92, align 8, !tbaa !9
  %94 = fadd double %84, %93
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %96
  %98 = getelementptr inbounds [6 x i32], ptr %97, i64 0, i64 2
  %99 = load i32, ptr %98, align 8, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %100
  %102 = getelementptr inbounds [7 x double], ptr %101, i64 0, i64 6
  %103 = load double, ptr %102, align 8, !tbaa !9
  %104 = fadd double %94, %103
  %105 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 2
  store double %104, ptr %105, align 16, !tbaa !9
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %107
  %109 = getelementptr inbounds [6 x i32], ptr %108, i64 0, i64 1
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %111
  %113 = getelementptr inbounds [7 x double], ptr %112, i64 0, i64 0
  %114 = load double, ptr %113, align 8, !tbaa !9
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %116
  %118 = getelementptr inbounds [6 x i32], ptr %117, i64 0, i64 0
  %119 = load i32, ptr %118, align 8, !tbaa !5
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %120
  %122 = getelementptr inbounds [7 x double], ptr %121, i64 0, i64 0
  %123 = load double, ptr %122, align 8, !tbaa !9
  %124 = fsub double %114, %123
  %125 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 0
  store double %124, ptr %125, align 16, !tbaa !9
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %127
  %129 = getelementptr inbounds [6 x i32], ptr %128, i64 0, i64 1
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %131
  %133 = getelementptr inbounds [7 x double], ptr %132, i64 0, i64 1
  %134 = load double, ptr %133, align 8, !tbaa !9
  %135 = load i32, ptr %7, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %136
  %138 = getelementptr inbounds [6 x i32], ptr %137, i64 0, i64 0
  %139 = load i32, ptr %138, align 8, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %140
  %142 = getelementptr inbounds [7 x double], ptr %141, i64 0, i64 1
  %143 = load double, ptr %142, align 8, !tbaa !9
  %144 = fsub double %134, %143
  %145 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 1
  store double %144, ptr %145, align 8, !tbaa !9
  %146 = load i32, ptr %7, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %147
  %149 = getelementptr inbounds [6 x i32], ptr %148, i64 0, i64 1
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %151
  %153 = getelementptr inbounds [7 x double], ptr %152, i64 0, i64 2
  %154 = load double, ptr %153, align 8, !tbaa !9
  %155 = load i32, ptr %7, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %156
  %158 = getelementptr inbounds [6 x i32], ptr %157, i64 0, i64 0
  %159 = load i32, ptr %158, align 8, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %160
  %162 = getelementptr inbounds [7 x double], ptr %161, i64 0, i64 2
  %163 = load double, ptr %162, align 8, !tbaa !9
  %164 = fsub double %154, %163
  %165 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 2
  store double %164, ptr %165, align 16, !tbaa !9
  %166 = load i32, ptr %7, align 4, !tbaa !5
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %167
  %169 = getelementptr inbounds [6 x i32], ptr %168, i64 0, i64 2
  %170 = load i32, ptr %169, align 8, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %171
  %173 = getelementptr inbounds [7 x double], ptr %172, i64 0, i64 0
  %174 = load double, ptr %173, align 8, !tbaa !9
  %175 = load i32, ptr %7, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %176
  %178 = getelementptr inbounds [6 x i32], ptr %177, i64 0, i64 0
  %179 = load i32, ptr %178, align 8, !tbaa !5
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %180
  %182 = getelementptr inbounds [7 x double], ptr %181, i64 0, i64 0
  %183 = load double, ptr %182, align 8, !tbaa !9
  %184 = fsub double %174, %183
  %185 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 0
  store double %184, ptr %185, align 16, !tbaa !9
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %187
  %189 = getelementptr inbounds [6 x i32], ptr %188, i64 0, i64 2
  %190 = load i32, ptr %189, align 8, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %191
  %193 = getelementptr inbounds [7 x double], ptr %192, i64 0, i64 1
  %194 = load double, ptr %193, align 8, !tbaa !9
  %195 = load i32, ptr %7, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %196
  %198 = getelementptr inbounds [6 x i32], ptr %197, i64 0, i64 0
  %199 = load i32, ptr %198, align 8, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %200
  %202 = getelementptr inbounds [7 x double], ptr %201, i64 0, i64 1
  %203 = load double, ptr %202, align 8, !tbaa !9
  %204 = fsub double %194, %203
  %205 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 1
  store double %204, ptr %205, align 8, !tbaa !9
  %206 = load i32, ptr %7, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %207
  %209 = getelementptr inbounds [6 x i32], ptr %208, i64 0, i64 2
  %210 = load i32, ptr %209, align 8, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %211
  %213 = getelementptr inbounds [7 x double], ptr %212, i64 0, i64 2
  %214 = load double, ptr %213, align 8, !tbaa !9
  %215 = load i32, ptr %7, align 4, !tbaa !5
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %216
  %218 = getelementptr inbounds [6 x i32], ptr %217, i64 0, i64 0
  %219 = load i32, ptr %218, align 8, !tbaa !5
  %220 = sext i32 %219 to i64
  %221 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %220
  %222 = getelementptr inbounds [7 x double], ptr %221, i64 0, i64 2
  %223 = load double, ptr %222, align 8, !tbaa !9
  %224 = fsub double %214, %223
  %225 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 2
  store double %224, ptr %225, align 16, !tbaa !9
  %226 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 1
  %227 = load double, ptr %226, align 8, !tbaa !9
  %228 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 2
  %229 = load double, ptr %228, align 16, !tbaa !9
  %230 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 2
  %231 = load double, ptr %230, align 16, !tbaa !9
  %232 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 1
  %233 = load double, ptr %232, align 8, !tbaa !9
  %234 = fmul double %231, %233
  %235 = fneg double %234
  %236 = call double @llvm.fmuladd.f64(double %227, double %229, double %235)
  %237 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 0
  store double %236, ptr %237, align 16, !tbaa !9
  %238 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 2
  %239 = load double, ptr %238, align 16, !tbaa !9
  %240 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 0
  %241 = load double, ptr %240, align 16, !tbaa !9
  %242 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 0
  %243 = load double, ptr %242, align 16, !tbaa !9
  %244 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 2
  %245 = load double, ptr %244, align 16, !tbaa !9
  %246 = fmul double %243, %245
  %247 = fneg double %246
  %248 = call double @llvm.fmuladd.f64(double %239, double %241, double %247)
  %249 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 1
  store double %248, ptr %249, align 8, !tbaa !9
  %250 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 0
  %251 = load double, ptr %250, align 16, !tbaa !9
  %252 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 1
  %253 = load double, ptr %252, align 8, !tbaa !9
  %254 = getelementptr inbounds [3 x double], ptr %2, i64 0, i64 1
  %255 = load double, ptr %254, align 8, !tbaa !9
  %256 = getelementptr inbounds [3 x double], ptr %3, i64 0, i64 0
  %257 = load double, ptr %256, align 16, !tbaa !9
  %258 = fmul double %255, %257
  %259 = fneg double %258
  %260 = call double @llvm.fmuladd.f64(double %251, double %253, double %259)
  %261 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 2
  store double %260, ptr %261, align 16, !tbaa !9
  %262 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 0
  %263 = load double, ptr %262, align 16, !tbaa !9
  %264 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 0
  %265 = load double, ptr %264, align 16, !tbaa !9
  %266 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 1
  %267 = load double, ptr %266, align 8, !tbaa !9
  %268 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 1
  %269 = load double, ptr %268, align 8, !tbaa !9
  %270 = fmul double %267, %269
  %271 = call double @llvm.fmuladd.f64(double %263, double %265, double %270)
  %272 = getelementptr inbounds [3 x double], ptr %4, i64 0, i64 2
  %273 = load double, ptr %272, align 16, !tbaa !9
  %274 = getelementptr inbounds [3 x double], ptr %5, i64 0, i64 2
  %275 = load double, ptr %274, align 16, !tbaa !9
  %276 = call double @llvm.fmuladd.f64(double %273, double %275, double %271)
  store double %276, ptr %6, align 8, !tbaa !9
  %277 = load double, ptr %6, align 8, !tbaa !9
  %278 = fcmp olt double %277, 0.000000e+00
  br i1 %278, label %279, label %299

279:                                              ; preds = %15
  %280 = load i32, ptr %7, align 4, !tbaa !5
  %281 = sext i32 %280 to i64
  %282 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %281
  %283 = getelementptr inbounds [6 x i32], ptr %282, i64 0, i64 1
  %284 = load i32, ptr %283, align 4, !tbaa !5
  store i32 %284, ptr %1, align 4, !tbaa !5
  %285 = load i32, ptr %7, align 4, !tbaa !5
  %286 = sext i32 %285 to i64
  %287 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %286
  %288 = getelementptr inbounds [6 x i32], ptr %287, i64 0, i64 0
  %289 = load i32, ptr %288, align 8, !tbaa !5
  %290 = load i32, ptr %7, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %291
  %293 = getelementptr inbounds [6 x i32], ptr %292, i64 0, i64 1
  store i32 %289, ptr %293, align 4, !tbaa !5
  %294 = load i32, ptr %1, align 4, !tbaa !5
  %295 = load i32, ptr %7, align 4, !tbaa !5
  %296 = sext i32 %295 to i64
  %297 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %296
  %298 = getelementptr inbounds [6 x i32], ptr %297, i64 0, i64 0
  store i32 %294, ptr %298, align 8, !tbaa !5
  br label %299

299:                                              ; preds = %279, %15
  br label %300

300:                                              ; preds = %299, %12
  br label %301

301:                                              ; preds = %300
  %302 = load i32, ptr %7, align 4, !tbaa !5
  %303 = add nsw i32 %302, 1
  store i32 %303, ptr %7, align 4, !tbaa !5
  br label %8, !llvm.loop !11

304:                                              ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!"int", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

@culled_tri_count = external dso_local local_unnamed_addr global i32, align 4
@smooth = external dso_local local_unnamed_addr global i32, align 4
@dots = external dso_local local_unnamed_addr global [30000 x [7 x double]], align 16
@culled_tri = external dso_local local_unnamed_addr global [30000 x [6 x i32]], align 16

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

; Function Attrs: nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) uwtable
define dso_local void @reorder_triangle() local_unnamed_addr #1 {
  %1 = load i32, ptr @culled_tri_count, align 4, !tbaa !5
  %2 = icmp sgt i32 %1, 0
  %3 = load i32, ptr @smooth, align 4
  %4 = icmp eq i32 %3, 1
  %or.cond = select i1 %2, i1 %4, i1 false
  br i1 %or.cond, label %.lr.ph.split.us.preheader, label %._crit_edge

.lr.ph.split.us.preheader:                        ; preds = %0
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph.split.us

.lr.ph.split.us:                                  ; preds = %.lr.ph.split.us.preheader, %76
  %indvars.iv = phi i64 [ 0, %.lr.ph.split.us.preheader ], [ %indvars.iv.next, %76 ]
  %5 = getelementptr inbounds [30000 x [6 x i32]], ptr @culled_tri, i64 0, i64 %indvars.iv
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = sext i32 %6 to i64
  %8 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %7
  %9 = getelementptr inbounds i8, ptr %8, i64 32
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %5, i64 4
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %13
  %15 = getelementptr inbounds i8, ptr %14, i64 32
  %16 = load double, ptr %15, align 8, !tbaa !9
  %17 = fadd double %10, %16
  %18 = getelementptr inbounds i8, ptr %5, i64 8
  %19 = load i32, ptr %18, align 8, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [30000 x [7 x double]], ptr @dots, i64 0, i64 %20
  %22 = getelementptr inbounds i8, ptr %21, i64 32
  %23 = load double, ptr %22, align 8, !tbaa !9
  %24 = fadd double %17, %23
  %25 = getelementptr inbounds i8, ptr %8, i64 40
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds i8, ptr %14, i64 40
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = fadd double %26, %28
  %30 = getelementptr inbounds i8, ptr %21, i64 40
  %31 = load double, ptr %30, align 8, !tbaa !9
  %32 = fadd double %29, %31
  %33 = getelementptr inbounds i8, ptr %8, i64 48
  %34 = load double, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds i8, ptr %14, i64 48
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = fadd double %34, %36
  %38 = getelementptr inbounds i8, ptr %21, i64 48
  %39 = load double, ptr %38, align 8, !tbaa !9
  %40 = fadd double %37, %39
  %41 = load double, ptr %14, align 8, !tbaa !9
  %42 = load double, ptr %8, align 8, !tbaa !9
  %43 = fsub double %41, %42
  %44 = getelementptr inbounds i8, ptr %14, i64 8
  %45 = load double, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %8, i64 8
  %47 = load double, ptr %46, align 8, !tbaa !9
  %48 = fsub double %45, %47
  %49 = getelementptr inbounds i8, ptr %14, i64 16
  %50 = load double, ptr %49, align 8, !tbaa !9
  %51 = getelementptr inbounds i8, ptr %8, i64 16
  %52 = load double, ptr %51, align 8, !tbaa !9
  %53 = fsub double %50, %52
  %54 = load double, ptr %21, align 8, !tbaa !9
  %55 = fsub double %54, %42
  %56 = getelementptr inbounds i8, ptr %21, i64 8
  %57 = load double, ptr %56, align 8, !tbaa !9
  %58 = fsub double %57, %47
  %59 = getelementptr inbounds i8, ptr %21, i64 16
  %60 = load double, ptr %59, align 8, !tbaa !9
  %61 = fsub double %60, %52
  %62 = fneg double %53
  %63 = fmul double %58, %62
  %64 = tail call double @llvm.fmuladd.f64(double %48, double %61, double %63)
  %65 = fneg double %43
  %66 = fmul double %61, %65
  %67 = tail call double @llvm.fmuladd.f64(double %53, double %55, double %66)
  %68 = fneg double %48
  %69 = fmul double %55, %68
  %70 = tail call double @llvm.fmuladd.f64(double %43, double %58, double %69)
  %71 = fmul double %32, %67
  %72 = tail call double @llvm.fmuladd.f64(double %64, double %24, double %71)
  %73 = tail call double @llvm.fmuladd.f64(double %70, double %40, double %72)
  %74 = fcmp olt double %73, 0.000000e+00
  br i1 %74, label %75, label %76

75:                                               ; preds = %.lr.ph.split.us
  store i32 %6, ptr %11, align 4, !tbaa !5
  store i32 %12, ptr %5, align 8, !tbaa !5
  br label %76

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

._crit_edge:                                      ; preds = %76, %0
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nofree norecurse nosync nounwind memory(readwrite, argmem: none, inaccessiblemem: none) 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, !6, i64 0}
!6 = !{!"int", !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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