; LLVM IR from leonmavr/gfx-v4 :: src (algos)

; 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.node_t = type { %struct.vec2i_t, %struct.vec3u8_t, ptr }
%struct.vec2i_t = type { i32, i32 }
%struct.vec3u8_t = type { i8, i8, i8 }
%struct.queue_t = type { ptr, ptr }

; 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: nounwind uwtable
declare dso_local void @algos_line_bres_col(ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @queue_length(ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @algos_triangle_fill_bres(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %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 ptr, align 8
  %13 = alloca %struct.node_t, align 8
  %14 = alloca %struct.node_t, align 8
  %15 = alloca %struct.node_t, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %21 = 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
  store ptr %5, ptr %12, align 8, !tbaa !5
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.node_t, ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.vec2i_t, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %24, align 4, !tbaa !9
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.node_t, ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %struct.vec2i_t, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = icmp sgt i32 %25, %29
  br i1 %30, label %31, label %38

31:                                               ; preds = %6
  br label %32

32:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %33, i64 24, i1 false), !tbaa.struct !14
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %34, ptr align 8 %35, i64 24, i1 false), !tbaa.struct !14
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %36, ptr align 8 %13, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #5
  br label %37

37:                                               ; preds = %32
  br label %38

38:                                               ; preds = %37, %6
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.node_t, ptr %39, i32 0, i32 0
  %41 = getelementptr inbounds %struct.vec2i_t, ptr %40, i32 0, i32 1
  %42 = load i32, ptr %41, align 4, !tbaa !9
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.node_t, ptr %43, i32 0, i32 0
  %45 = getelementptr inbounds %struct.vec2i_t, ptr %44, i32 0, i32 1
  %46 = load i32, ptr %45, align 4, !tbaa !9
  %47 = icmp sgt i32 %42, %46
  br i1 %47, label %48, label %55

48:                                               ; preds = %38
  br label %49

49:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #5
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %14, ptr align 8 %50, i64 24, i1 false), !tbaa.struct !14
  %51 = load ptr, ptr %7, align 8, !tbaa !5
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %51, ptr align 8 %52, i64 24, i1 false), !tbaa.struct !14
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %53, ptr align 8 %14, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #5
  br label %54

54:                                               ; preds = %49
  br label %55

55:                                               ; preds = %54, %38
  %56 = load ptr, ptr %8, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.node_t, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.vec2i_t, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.node_t, ptr %60, i32 0, i32 0
  %62 = getelementptr inbounds %struct.vec2i_t, ptr %61, i32 0, i32 1
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = icmp sgt i32 %59, %63
  br i1 %64, label %65, label %72

65:                                               ; preds = %55
  br label %66

66:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %15, ptr align 8 %67, i64 24, i1 false), !tbaa.struct !14
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %68, ptr align 8 %69, i64 24, i1 false), !tbaa.struct !14
  %70 = load ptr, ptr %9, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %70, ptr align 8 %15, i64 24, i1 false), !tbaa.struct !14
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  br label %71

71:                                               ; preds = %66
  br label %72

72:                                               ; preds = %71, %55
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  call void @algos_line_bres_col(ptr noundef %73, ptr noundef %74, ptr noundef %75)
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = load ptr, ptr %9, align 8, !tbaa !5
  %78 = load ptr, ptr %11, align 8, !tbaa !5
  call void @algos_line_bres_col(ptr noundef %76, ptr noundef %77, ptr noundef %78)
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  call void @algos_line_bres_col(ptr noundef %79, ptr noundef %80, ptr noundef %81)
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #5
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.queue_t, ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !17
  store ptr %84, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %85 = load ptr, ptr %11, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.queue_t, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !17
  store ptr %87, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #5
  %88 = load ptr, ptr %12, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.queue_t, ptr %88, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  store ptr %90, ptr %18, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #5
  %91 = call noalias ptr @malloc(i64 noundef 16) #6
  store ptr %91, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  store i32 0, ptr %20, align 4, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = call i32 @queue_length(ptr noundef %92)
  store i32 %93, ptr %21, align 4, !tbaa !15
  br label %94

94:                                               ; preds = %180, %72
  %95 = load ptr, ptr %16, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %183

97:                                               ; preds = %94
  %98 = load ptr, ptr %16, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %100, label %134

100:                                              ; preds = %97
  br label %101

101:                                              ; preds = %123, %100
  %102 = load ptr, ptr %16, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.node_t, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !19
  %105 = icmp ne ptr %104, null
  br i1 %105, label %106, label %124

106:                                              ; preds = %101
  %107 = load ptr, ptr %16, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.node_t, ptr %107, i32 0, i32 2
  %109 = load ptr, ptr %108, align 8, !tbaa !19
  %110 = getelementptr inbounds %struct.node_t, ptr %109, i32 0, i32 0
  %111 = getelementptr inbounds %struct.vec2i_t, ptr %110, i32 0, i32 1
  %112 = load i32, ptr %111, align 4, !tbaa !9
  %113 = load ptr, ptr %16, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.node_t, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.vec2i_t, ptr %114, i32 0, i32 1
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = icmp eq i32 %112, %116
  br i1 %117, label %118, label %122

118:                                              ; preds = %106
  %119 = load ptr, ptr %16, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.node_t, ptr %119, i32 0, i32 2
  %121 = load ptr, ptr %120, align 8, !tbaa !19
  store ptr %121, ptr %16, align 8, !tbaa !5
  br label %123

122:                                              ; preds = %106
  br label %124

123:                                              ; preds = %118
  br label %101, !llvm.loop !20

124:                                              ; preds = %122, %101
  %125 = load i32, ptr %20, align 4, !tbaa !15
  %126 = load i32, ptr %21, align 4, !tbaa !15
  %127 = sub nsw i32 %126, 1
  %128 = icmp ne i32 %125, %127
  br i1 %128, label %129, label %133

129:                                              ; preds = %124
  %130 = load ptr, ptr %16, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.node_t, ptr %130, i32 0, i32 2
  %132 = load ptr, ptr %131, align 8, !tbaa !19
  store ptr %132, ptr %16, align 8, !tbaa !5
  br label %133

133:                                              ; preds = %129, %124
  br label %134

134:                                              ; preds = %133, %97
  %135 = load ptr, ptr %17, align 8, !tbaa !5
  %136 = icmp ne ptr %135, null
  br i1 %136, label %137, label %171

137:                                              ; preds = %134
  br label %138

138:                                              ; preds = %160, %137
  %139 = load ptr, ptr %17, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.node_t, ptr %139, i32 0, i32 2
  %141 = load ptr, ptr %140, align 8, !tbaa !19
  %142 = icmp ne ptr %141, null
  br i1 %142, label %143, label %161

143:                                              ; preds = %138
  %144 = load ptr, ptr %17, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.node_t, ptr %144, i32 0, i32 2
  %146 = load ptr, ptr %145, align 8, !tbaa !19
  %147 = getelementptr inbounds %struct.node_t, ptr %146, i32 0, i32 0
  %148 = getelementptr inbounds %struct.vec2i_t, ptr %147, i32 0, i32 1
  %149 = load i32, ptr %148, align 4, !tbaa !9
  %150 = load ptr, ptr %17, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.node_t, ptr %150, i32 0, i32 0
  %152 = getelementptr inbounds %struct.vec2i_t, ptr %151, i32 0, i32 1
  %153 = load i32, ptr %152, align 4, !tbaa !9
  %154 = icmp eq i32 %149, %153
  br i1 %154, label %155, label %159

155:                                              ; preds = %143
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.node_t, ptr %156, i32 0, i32 2
  %158 = load ptr, ptr %157, align 8, !tbaa !19
  store ptr %158, ptr %17, align 8, !tbaa !5
  br label %160

159:                                              ; preds = %143
  br label %161

160:                                              ; preds = %155
  br label %138, !llvm.loop !22

161:                                              ; preds = %159, %138
  %162 = load i32, ptr %20, align 4, !tbaa !15
  %163 = load i32, ptr %21, align 4, !tbaa !15
  %164 = sub nsw i32 %163, 1
  %165 = icmp ne i32 %162, %164
  br i1 %165, label %166, label %170

166:                                              ; preds = %161
  %167 = load ptr, ptr %17, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.node_t, ptr %167, i32 0, i32 2
  %169 = load ptr, ptr %168, align 8, !tbaa !19
  store ptr %169, ptr %17, align 8, !tbaa !5
  br label %170

170:                                              ; preds = %166, %161
  br label %171

171:                                              ; preds = %170, %134
  %172 = load ptr, ptr %16, align 8, !tbaa !5
  %173 = icmp ne ptr %172, null
  br i1 %173, label %174, label %180

174:                                              ; preds = %171
  %175 = load ptr, ptr %16, align 8, !tbaa !5
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = load ptr, ptr %19, align 8, !tbaa !5
  call void @algos_line_bres_col(ptr noundef %175, ptr noundef %176, ptr noundef %177)
  %178 = load ptr, ptr %19, align 8, !tbaa !5
  %179 = call i32 @queue_del(ptr noundef %178)
  br label %180

180:                                              ; preds = %174, %171
  %181 = load i32, ptr %20, align 4, !tbaa !15
  %182 = add nsw i32 %181, 1
  store i32 %182, ptr %20, align 4, !tbaa !15
  br label %94, !llvm.loop !23

183:                                              ; preds = %94
  br label %184

184:                                              ; preds = %266, %183
  %185 = load ptr, ptr %18, align 8, !tbaa !5
  %186 = icmp ne ptr %185, null
  br i1 %186, label %187, label %190

187:                                              ; preds = %184
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = icmp ne ptr %188, null
  br label %190

190:                                              ; preds = %187, %184
  %191 = phi i1 [ false, %184 ], [ %189, %187 ]
  br i1 %191, label %192, label %267

192:                                              ; preds = %190
  %193 = load ptr, ptr %18, align 8, !tbaa !5
  %194 = icmp ne ptr %193, null
  br i1 %194, label %195, label %204

195:                                              ; preds = %192
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  %197 = icmp ne ptr %196, null
  br i1 %197, label %198, label %204

198:                                              ; preds = %195
  %199 = load ptr, ptr %18, align 8, !tbaa !5
  %200 = load ptr, ptr %17, align 8, !tbaa !5
  %201 = load ptr, ptr %19, align 8, !tbaa !5
  call void @algos_line_bres_col(ptr noundef %199, ptr noundef %200, ptr noundef %201)
  %202 = load ptr, ptr %19, align 8, !tbaa !5
  %203 = call i32 @queue_del(ptr noundef %202)
  br label %204

204:                                              ; preds = %198, %195, %192
  %205 = load ptr, ptr %18, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %235

207:                                              ; preds = %204
  br label %208

208:                                              ; preds = %230, %207
  %209 = load ptr, ptr %18, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.node_t, ptr %209, i32 0, i32 2
  %211 = load ptr, ptr %210, align 8, !tbaa !19
  %212 = icmp ne ptr %211, null
  br i1 %212, label %213, label %231

213:                                              ; preds = %208
  %214 = load ptr, ptr %18, align 8, !tbaa !5
  %215 = getelementptr inbounds %struct.node_t, ptr %214, i32 0, i32 2
  %216 = load ptr, ptr %215, align 8, !tbaa !19
  %217 = getelementptr inbounds %struct.node_t, ptr %216, i32 0, i32 0
  %218 = getelementptr inbounds %struct.vec2i_t, ptr %217, i32 0, i32 1
  %219 = load i32, ptr %218, align 4, !tbaa !9
  %220 = load ptr, ptr %18, align 8, !tbaa !5
  %221 = getelementptr inbounds %struct.node_t, ptr %220, i32 0, i32 0
  %222 = getelementptr inbounds %struct.vec2i_t, ptr %221, i32 0, i32 1
  %223 = load i32, ptr %222, align 4, !tbaa !9
  %224 = icmp eq i32 %219, %223
  br i1 %224, label %225, label %229

225:                                              ; preds = %213
  %226 = load ptr, ptr %18, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.node_t, ptr %226, i32 0, i32 2
  %228 = load ptr, ptr %227, align 8, !tbaa !19
  store ptr %228, ptr %18, align 8, !tbaa !5
  br label %230

229:                                              ; preds = %213
  br label %231

230:                                              ; preds = %225
  br label %208, !llvm.loop !24

231:                                              ; preds = %229, %208
  %232 = load ptr, ptr %18, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.node_t, ptr %232, i32 0, i32 2
  %234 = load ptr, ptr %233, align 8, !tbaa !19
  store ptr %234, ptr %18, align 8, !tbaa !5
  br label %235

235:                                              ; preds = %231, %204
  %236 = load ptr, ptr %17, align 8, !tbaa !5
  %237 = icmp ne ptr %236, null
  br i1 %237, label %238, label %266

238:                                              ; preds = %235
  br label %239

239:                                              ; preds = %261, %238
  %240 = load ptr, ptr %17, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.node_t, ptr %240, i32 0, i32 2
  %242 = load ptr, ptr %241, align 8, !tbaa !19
  %243 = icmp ne ptr %242, null
  br i1 %243, label %244, label %262

244:                                              ; preds = %239
  %245 = load ptr, ptr %17, align 8, !tbaa !5
  %246 = getelementptr inbounds %struct.node_t, ptr %245, i32 0, i32 2
  %247 = load ptr, ptr %246, align 8, !tbaa !19
  %248 = getelementptr inbounds %struct.node_t, ptr %247, i32 0, i32 0
  %249 = getelementptr inbounds %struct.vec2i_t, ptr %248, i32 0, i32 1
  %250 = load i32, ptr %249, align 4, !tbaa !9
  %251 = load ptr, ptr %17, align 8, !tbaa !5
  %252 = getelementptr inbounds %struct.node_t, ptr %251, i32 0, i32 0
  %253 = getelementptr inbounds %struct.vec2i_t, ptr %252, i32 0, i32 1
  %254 = load i32, ptr %253, align 4, !tbaa !9
  %255 = icmp eq i32 %250, %254
  br i1 %255, label %256, label %260

256:                                              ; preds = %244
  %257 = load ptr, ptr %17, align 8, !tbaa !5
  %258 = getelementptr inbounds %struct.node_t, ptr %257, i32 0, i32 2
  %259 = load ptr, ptr %258, align 8, !tbaa !19
  store ptr %259, ptr %17, align 8, !tbaa !5
  br label %261

260:                                              ; preds = %244
  br label %262

261:                                              ; preds = %256
  br label %239, !llvm.loop !25

262:                                              ; preds = %260, %239
  %263 = load ptr, ptr %17, align 8, !tbaa !5
  %264 = getelementptr inbounds %struct.node_t, ptr %263, i32 0, i32 2
  %265 = load ptr, ptr %264, align 8, !tbaa !19
  store ptr %265, ptr %17, align 8, !tbaa !5
  br label %266

266:                                              ; preds = %262, %235
  br label %184, !llvm.loop !26

267:                                              ; preds = %190
  %268 = load ptr, ptr %19, align 8, !tbaa !5
  %269 = call i32 @queue_del(ptr noundef %268)
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #5
  ret void
}

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

declare i32 @queue_del(ptr noundef) #2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 4}
!10 = !{!"node_t", !11, i64 0, !13, i64 8, !6, i64 16}
!11 = !{!"vec2i_t", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!"vec3u8_t", !7, i64 0, !7, i64 1, !7, i64 2}
!14 = !{i64 0, i64 4, !15, i64 4, i64 4, !15, i64 8, i64 1, !16, i64 9, i64 1, !16, i64 10, i64 1, !16, i64 16, i64 8, !5}
!15 = !{!12, !12, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"queue_t", !6, i64 0, !6, i64 8}
!19 = !{!10, !6, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = distinct !{!24, !21}
!25 = distinct !{!25, !21}
!26 = distinct !{!26, !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"

%struct.node_t = type { %struct.vec2i_t, %struct.vec3u8_t, ptr }
%struct.vec2i_t = type { i32, i32 }
%struct.vec3u8_t = type { i8, i8, i8 }

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

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

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

declare i32 @queue_length(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local void @algos_triangle_fill_bres(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = alloca %struct.node_t, align 8
  %8 = alloca %struct.node_t, align 8
  %9 = alloca %struct.node_t, align 8
  %10 = getelementptr inbounds i8, ptr %0, i64 4
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %2, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = icmp sgt i32 %11, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %7, ptr noundef nonnull align 8 dereferenceable(24) %0, i64 24, i1 false), !tbaa.struct !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %7, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7)
  %.pre = load i32, ptr %10, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %15, %6
  %17 = phi i32 [ %.pre, %15 ], [ %11, %6 ]
  %18 = getelementptr inbounds i8, ptr %1, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp sgt i32 %17, %19
  br i1 %20, label %21, label %22

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %8)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %8, ptr noundef nonnull align 8 dereferenceable(24) %0, i64 24, i1 false), !tbaa.struct !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %8, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %8)
  %.pre109 = load i32, ptr %18, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %21, %16
  %23 = phi i32 [ %.pre109, %21 ], [ %19, %16 ]
  %24 = load i32, ptr %12, align 4, !tbaa !5
  %25 = icmp sgt i32 %23, %24
  br i1 %25, label %26, label %27

26:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %9)
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %9, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa.struct !13
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %1, ptr noundef nonnull align 8 dereferenceable(24) %2, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef nonnull align 8 dereferenceable(24) %9, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %9)
  br label %27

27:                                               ; preds = %26, %22
  tail call void @algos_line_bres_col(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %3)
  tail call void @algos_line_bres_col(ptr noundef nonnull %0, ptr noundef nonnull %2, ptr noundef %4)
  tail call void @algos_line_bres_col(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef %5)
  %28 = load ptr, ptr %3, align 8, !tbaa !17
  %29 = load ptr, ptr %4, align 8, !tbaa !17
  %30 = load ptr, ptr %5, align 8, !tbaa !17
  %31 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #5
  %32 = tail call i32 @queue_length(ptr noundef nonnull %3) #6
  %.not100 = icmp eq ptr %28, null
  br i1 %.not100, label %.preheader, label %.preheader96.lr.ph

.preheader96.lr.ph:                               ; preds = %27
  %33 = add nsw i32 %32, -1
  br label %.preheader96

.preheader96:                                     ; preds = %57, %.preheader96.lr.ph
  %.0103 = phi ptr [ %28, %.preheader96.lr.ph ], [ %spec.select, %57 ]
  %.075102 = phi i32 [ 0, %.preheader96.lr.ph ], [ %59, %57 ]
  %.076101 = phi ptr [ %29, %.preheader96.lr.ph ], [ %.278, %57 ]
  br label %37

.preheader:                                       ; preds = %56, %27
  %.076.lcssa = phi ptr [ %29, %27 ], [ %.278, %56 ]
  %34 = icmp ne ptr %30, null
  %35 = icmp ne ptr %.076.lcssa, null
  %36 = select i1 %34, i1 %35, i1 false
  br i1 %36, label %.lr.ph, label %._crit_edge

37:                                               ; preds = %.preheader96, %40
  %.1 = phi ptr [ %39, %40 ], [ %.0103, %.preheader96 ]
  %38 = getelementptr inbounds i8, ptr %.1, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %.not88 = icmp eq ptr %39, null
  br i1 %.not88, label %46, label %40

40:                                               ; preds = %37
  %41 = getelementptr inbounds i8, ptr %39, i64 4
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = getelementptr inbounds i8, ptr %.1, i64 4
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = icmp eq i32 %42, %44
  br i1 %45, label %37, label %46, !llvm.loop !20

46:                                               ; preds = %40, %37
  %.not89 = icmp eq i32 %.075102, %33
  %spec.select = select i1 %.not89, ptr %.1, ptr %39
  %.not90 = icmp eq ptr %.076101, null
  br i1 %.not90, label %56, label %.preheader95

.preheader95:                                     ; preds = %46, %49
  %.177 = phi ptr [ %48, %49 ], [ %.076101, %46 ]
  %47 = getelementptr inbounds i8, ptr %.177, i64 16
  %48 = load ptr, ptr %47, align 8, !tbaa !19
  %.not91 = icmp eq ptr %48, null
  br i1 %.not91, label %55, label %49

49:                                               ; preds = %.preheader95
  %50 = getelementptr inbounds i8, ptr %48, i64 4
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = getelementptr inbounds i8, ptr %.177, i64 4
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp eq i32 %51, %53
  br i1 %54, label %.preheader95, label %55, !llvm.loop !22

55:                                               ; preds = %49, %.preheader95
  %spec.select94 = select i1 %.not89, ptr %.177, ptr %48
  br label %56

56:                                               ; preds = %55, %46
  %.278 = phi ptr [ null, %46 ], [ %spec.select94, %55 ]
  %.not93 = icmp eq ptr %spec.select, null
  br i1 %.not93, label %.preheader, label %57

57:                                               ; preds = %56
  tail call void @algos_line_bres_col(ptr noundef nonnull %spec.select, ptr noundef %.278, ptr noundef %31)
  %58 = tail call i32 @queue_del(ptr noundef %31) #6
  %59 = add nuw nsw i32 %.075102, 1
  br label %.preheader96, !llvm.loop !23

.lr.ph:                                           ; preds = %.preheader, %79
  %.3105 = phi ptr [ %72, %79 ], [ %.076.lcssa, %.preheader ]
  %.079104 = phi ptr [ %63, %79 ], [ %30, %.preheader ]
  tail call void @algos_line_bres_col(ptr noundef nonnull %.079104, ptr noundef nonnull %.3105, ptr noundef %31)
  %60 = tail call i32 @queue_del(ptr noundef %31) #6
  br label %61

61:                                               ; preds = %64, %.lr.ph
  %.180 = phi ptr [ %.079104, %.lr.ph ], [ %63, %64 ]
  %62 = getelementptr inbounds i8, ptr %.180, i64 16
  %63 = load ptr, ptr %62, align 8, !tbaa !19
  %.not86 = icmp eq ptr %63, null
  br i1 %.not86, label %.preheader122, label %64

64:                                               ; preds = %61
  %65 = getelementptr inbounds i8, ptr %63, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = getelementptr inbounds i8, ptr %.180, i64 4
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = icmp eq i32 %66, %68
  br i1 %69, label %61, label %.preheader122, !llvm.loop !24

.preheader122:                                    ; preds = %64, %61
  br label %70

70:                                               ; preds = %.preheader122, %73
  %.4 = phi ptr [ %72, %73 ], [ %.3105, %.preheader122 ]
  %71 = getelementptr inbounds i8, ptr %.4, i64 16
  %72 = load ptr, ptr %71, align 8, !tbaa !19
  %.not87 = icmp eq ptr %72, null
  br i1 %.not87, label %._crit_edge, label %73

73:                                               ; preds = %70
  %74 = getelementptr inbounds i8, ptr %72, i64 4
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = getelementptr inbounds i8, ptr %.4, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = icmp eq i32 %75, %77
  br i1 %78, label %70, label %79, !llvm.loop !25

79:                                               ; preds = %73
  %.not = icmp eq ptr %63, null
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !26

._crit_edge:                                      ; preds = %79, %70, %.preheader
  %80 = tail call i32 @queue_del(ptr noundef %31) #6
  ret void
}

; 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

declare i32 @queue_del(ptr noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind allocsize(0) }
attributes #6 = { 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, !8, i64 4}
!6 = !{!"node_t", !7, i64 0, !11, i64 8, !12, i64 16}
!7 = !{!"vec2i_t", !8, i64 0, !8, i64 4}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"vec3u8_t", !9, i64 0, !9, i64 1, !9, i64 2}
!12 = !{!"any pointer", !9, i64 0}
!13 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 1, !15, i64 9, i64 1, !15, i64 10, i64 1, !15, i64 16, i64 8, !16}
!14 = !{!8, !8, i64 0}
!15 = !{!9, !9, i64 0}
!16 = !{!12, !12, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"queue_t", !12, i64 0, !12, i64 8}
!19 = !{!6, !12, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21}
!24 = distinct !{!24, !21}
!25 = distinct !{!25, !21}
!26 = distinct !{!26, !21}


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