; LLVM IR from kalininalab/rinminer :: rinminer (rinminer)

; 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.database_entry_t = type { ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.subgraph_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, ptr }
%struct.dfs_code_t = type { i16, i16, i32, i32, %struct.edge_label_t, i32 }
%struct.edge_label_t = type { i32, i32 }
%struct.neighbor_t = type { i16, %struct.edge_label_t, i32 }

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @canonical_database_entry(ptr dead_on_unwind noalias writable sret(%struct.database_entry_t) align 8 %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  store ptr %1, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.subgraph_t, ptr %10, i32 0, i32 18
  %12 = load i16, ptr %11, align 8, !tbaa !9
  %13 = zext i16 %12 to i32
  %14 = add nsw i32 %13, 1
  store i32 %14, ptr %4, align 4, !tbaa !13
  %15 = load i32, ptr %4, align 4, !tbaa !13
  %16 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 5
  store i32 %15, ptr %16, align 8, !tbaa !14
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.subgraph_t, ptr %17, i32 0, i32 14
  %19 = load i32, ptr %18, align 8, !tbaa !16
  %20 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 6
  store i32 %19, ptr %20, align 4, !tbaa !17
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.subgraph_t, ptr %21, i32 0, i32 1
  %23 = load ptr, ptr %22, align 8, !tbaa !18
  %24 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 0
  store ptr %23, ptr %24, align 8, !tbaa !19
  %25 = load i32, ptr %4, align 4, !tbaa !13
  %26 = zext i32 %25 to i64
  %27 = mul i64 %26, 8
  %28 = call noalias ptr @malloc(i64 noundef %27) #8
  %29 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  store ptr %28, ptr %29, align 8, !tbaa !20
  %30 = load i32, ptr %4, align 4, !tbaa !13
  %31 = zext i32 %30 to i64
  %32 = call noalias ptr @calloc(i64 noundef %31, i64 noundef 4) #9
  %33 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  store ptr %32, ptr %33, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.subgraph_t, ptr %34, i32 0, i32 14
  %36 = load i32, ptr %35, align 8, !tbaa !16
  %37 = mul i32 2, %36
  %38 = zext i32 %37 to i64
  %39 = mul i64 %38, 16
  %40 = call noalias ptr @malloc(i64 noundef %39) #8
  store ptr %40, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.subgraph_t, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  store ptr %43, ptr %6, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %75, %2
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.subgraph_t, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !22
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.subgraph_t, ptr %49, i32 0, i32 14
  %51 = load i32, ptr %50, align 8, !tbaa !16
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds %struct.dfs_code_t, ptr %48, i64 %52
  %54 = icmp ult ptr %45, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %78

56:                                               ; preds = %44
  %57 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !21
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.dfs_code_t, ptr %59, i32 0, i32 0
  %61 = load i16, ptr %60, align 4, !tbaa !23
  %62 = zext i16 %61 to i64
  %63 = getelementptr inbounds i32, ptr %58, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %65 = add i32 %64, 1
  store i32 %65, ptr %63, align 4, !tbaa !13
  %66 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %67 = load ptr, ptr %66, align 8, !tbaa !21
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.dfs_code_t, ptr %68, i32 0, i32 1
  %70 = load i16, ptr %69, align 2, !tbaa !26
  %71 = zext i16 %70 to i64
  %72 = getelementptr inbounds i32, ptr %67, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !13
  %74 = add i32 %73, 1
  store i32 %74, ptr %72, align 4, !tbaa !13
  br label %75

75:                                               ; preds = %56
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.dfs_code_t, ptr %76, i32 1
  store ptr %77, ptr %6, align 8, !tbaa !5
  br label %44, !llvm.loop !27

78:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !13
  br label %79

79:                                               ; preds = %102, %78
  %80 = load i32, ptr %8, align 4, !tbaa !13
  %81 = load i32, ptr %4, align 4, !tbaa !13
  %82 = icmp ult i32 %80, %81
  br i1 %82, label %84, label %83

83:                                               ; preds = %79
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %105

84:                                               ; preds = %79
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = load i32, ptr %7, align 4, !tbaa !13
  %87 = zext i32 %86 to i64
  %88 = getelementptr inbounds %struct.neighbor_t, ptr %85, i64 %87
  %89 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %90 = load ptr, ptr %89, align 8, !tbaa !20
  %91 = load i32, ptr %8, align 4, !tbaa !13
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %90, i64 %92
  store ptr %88, ptr %93, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !21
  %96 = load i32, ptr %8, align 4, !tbaa !13
  %97 = zext i32 %96 to i64
  %98 = getelementptr inbounds i32, ptr %95, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !13
  %100 = load i32, ptr %7, align 4, !tbaa !13
  %101 = add i32 %100, %99
  store i32 %101, ptr %7, align 4, !tbaa !13
  br label %102

102:                                              ; preds = %84
  %103 = load i32, ptr %8, align 4, !tbaa !13
  %104 = add i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !13
  br label %79, !llvm.loop !29

105:                                              ; preds = %83
  %106 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %107 = load ptr, ptr %106, align 8, !tbaa !21
  %108 = load i32, ptr %4, align 4, !tbaa !13
  %109 = zext i32 %108 to i64
  %110 = mul i64 %109, 4
  call void @llvm.memset.p0.i64(ptr align 4 %107, i8 0, i64 %110, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.subgraph_t, ptr %111, i32 0, i32 0
  %113 = load ptr, ptr %112, align 8, !tbaa !22
  store ptr %113, ptr %9, align 8, !tbaa !5
  br label %114

114:                                              ; preds = %276, %105
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.subgraph_t, ptr %116, i32 0, i32 0
  %118 = load ptr, ptr %117, align 8, !tbaa !22
  %119 = load ptr, ptr %3, align 8, !tbaa !5
  %120 = getelementptr inbounds %struct.subgraph_t, ptr %119, i32 0, i32 14
  %121 = load i32, ptr %120, align 8, !tbaa !16
  %122 = zext i32 %121 to i64
  %123 = getelementptr inbounds %struct.dfs_code_t, ptr %118, i64 %122
  %124 = icmp ult ptr %115, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %114
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %279

126:                                              ; preds = %114
  %127 = load ptr, ptr %9, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.dfs_code_t, ptr %127, i32 0, i32 1
  %129 = load i16, ptr %128, align 2, !tbaa !26
  %130 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %131 = load ptr, ptr %130, align 8, !tbaa !20
  %132 = load ptr, ptr %9, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.dfs_code_t, ptr %132, i32 0, i32 0
  %134 = load i16, ptr %133, align 4, !tbaa !23
  %135 = zext i16 %134 to i64
  %136 = getelementptr inbounds ptr, ptr %131, i64 %135
  %137 = load ptr, ptr %136, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %139 = load ptr, ptr %138, align 8, !tbaa !21
  %140 = load ptr, ptr %9, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.dfs_code_t, ptr %140, i32 0, i32 0
  %142 = load i16, ptr %141, align 4, !tbaa !23
  %143 = zext i16 %142 to i64
  %144 = getelementptr inbounds i32, ptr %139, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !13
  %146 = zext i32 %145 to i64
  %147 = getelementptr inbounds %struct.neighbor_t, ptr %137, i64 %146
  %148 = getelementptr inbounds %struct.neighbor_t, ptr %147, i32 0, i32 0
  store i16 %129, ptr %148, align 4, !tbaa !30
  %149 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %150 = load ptr, ptr %149, align 8, !tbaa !20
  %151 = load ptr, ptr %9, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.dfs_code_t, ptr %151, i32 0, i32 0
  %153 = load i16, ptr %152, align 4, !tbaa !23
  %154 = zext i16 %153 to i64
  %155 = getelementptr inbounds ptr, ptr %150, i64 %154
  %156 = load ptr, ptr %155, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %158 = load ptr, ptr %157, align 8, !tbaa !21
  %159 = load ptr, ptr %9, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.dfs_code_t, ptr %159, i32 0, i32 0
  %161 = load i16, ptr %160, align 4, !tbaa !23
  %162 = zext i16 %161 to i64
  %163 = getelementptr inbounds i32, ptr %158, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !13
  %165 = zext i32 %164 to i64
  %166 = getelementptr inbounds %struct.neighbor_t, ptr %156, i64 %165
  %167 = getelementptr inbounds %struct.neighbor_t, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %9, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.dfs_code_t, ptr %168, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %167, ptr align 4 %169, i64 8, i1 false), !tbaa.struct !32
  %170 = load ptr, ptr %9, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.dfs_code_t, ptr %170, i32 0, i32 5
  %172 = load i32, ptr %171, align 4, !tbaa !33
  %173 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %174 = load ptr, ptr %173, align 8, !tbaa !20
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.dfs_code_t, ptr %175, i32 0, i32 0
  %177 = load i16, ptr %176, align 4, !tbaa !23
  %178 = zext i16 %177 to i64
  %179 = getelementptr inbounds ptr, ptr %174, i64 %178
  %180 = load ptr, ptr %179, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %182 = load ptr, ptr %181, align 8, !tbaa !21
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.dfs_code_t, ptr %183, i32 0, i32 0
  %185 = load i16, ptr %184, align 4, !tbaa !23
  %186 = zext i16 %185 to i64
  %187 = getelementptr inbounds i32, ptr %182, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !13
  %189 = zext i32 %188 to i64
  %190 = getelementptr inbounds %struct.neighbor_t, ptr %180, i64 %189
  %191 = getelementptr inbounds %struct.neighbor_t, ptr %190, i32 0, i32 2
  store i32 %172, ptr %191, align 4, !tbaa !34
  %192 = load ptr, ptr %9, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.dfs_code_t, ptr %192, i32 0, i32 0
  %194 = load i16, ptr %193, align 4, !tbaa !23
  %195 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %196 = load ptr, ptr %195, align 8, !tbaa !20
  %197 = load ptr, ptr %9, align 8, !tbaa !5
  %198 = getelementptr inbounds %struct.dfs_code_t, ptr %197, i32 0, i32 1
  %199 = load i16, ptr %198, align 2, !tbaa !26
  %200 = zext i16 %199 to i64
  %201 = getelementptr inbounds ptr, ptr %196, i64 %200
  %202 = load ptr, ptr %201, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %204 = load ptr, ptr %203, align 8, !tbaa !21
  %205 = load ptr, ptr %9, align 8, !tbaa !5
  %206 = getelementptr inbounds %struct.dfs_code_t, ptr %205, i32 0, i32 1
  %207 = load i16, ptr %206, align 2, !tbaa !26
  %208 = zext i16 %207 to i64
  %209 = getelementptr inbounds i32, ptr %204, i64 %208
  %210 = load i32, ptr %209, align 4, !tbaa !13
  %211 = zext i32 %210 to i64
  %212 = getelementptr inbounds %struct.neighbor_t, ptr %202, i64 %211
  %213 = getelementptr inbounds %struct.neighbor_t, ptr %212, i32 0, i32 0
  store i16 %194, ptr %213, align 4, !tbaa !30
  %214 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %215 = load ptr, ptr %214, align 8, !tbaa !20
  %216 = load ptr, ptr %9, align 8, !tbaa !5
  %217 = getelementptr inbounds %struct.dfs_code_t, ptr %216, i32 0, i32 1
  %218 = load i16, ptr %217, align 2, !tbaa !26
  %219 = zext i16 %218 to i64
  %220 = getelementptr inbounds ptr, ptr %215, i64 %219
  %221 = load ptr, ptr %220, align 8, !tbaa !5
  %222 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %223 = load ptr, ptr %222, align 8, !tbaa !21
  %224 = load ptr, ptr %9, align 8, !tbaa !5
  %225 = getelementptr inbounds %struct.dfs_code_t, ptr %224, i32 0, i32 1
  %226 = load i16, ptr %225, align 2, !tbaa !26
  %227 = zext i16 %226 to i64
  %228 = getelementptr inbounds i32, ptr %223, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !13
  %230 = zext i32 %229 to i64
  %231 = getelementptr inbounds %struct.neighbor_t, ptr %221, i64 %230
  %232 = getelementptr inbounds %struct.neighbor_t, ptr %231, i32 0, i32 1
  %233 = load ptr, ptr %9, align 8, !tbaa !5
  %234 = getelementptr inbounds %struct.dfs_code_t, ptr %233, i32 0, i32 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %232, ptr align 4 %234, i64 8, i1 false), !tbaa.struct !32
  %235 = load ptr, ptr %9, align 8, !tbaa !5
  %236 = getelementptr inbounds %struct.dfs_code_t, ptr %235, i32 0, i32 5
  %237 = load i32, ptr %236, align 4, !tbaa !33
  %238 = call i32 @invert_direction(i32 noundef %237)
  %239 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 2
  %240 = load ptr, ptr %239, align 8, !tbaa !20
  %241 = load ptr, ptr %9, align 8, !tbaa !5
  %242 = getelementptr inbounds %struct.dfs_code_t, ptr %241, i32 0, i32 1
  %243 = load i16, ptr %242, align 2, !tbaa !26
  %244 = zext i16 %243 to i64
  %245 = getelementptr inbounds ptr, ptr %240, i64 %244
  %246 = load ptr, ptr %245, align 8, !tbaa !5
  %247 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %248 = load ptr, ptr %247, align 8, !tbaa !21
  %249 = load ptr, ptr %9, align 8, !tbaa !5
  %250 = getelementptr inbounds %struct.dfs_code_t, ptr %249, i32 0, i32 1
  %251 = load i16, ptr %250, align 2, !tbaa !26
  %252 = zext i16 %251 to i64
  %253 = getelementptr inbounds i32, ptr %248, i64 %252
  %254 = load i32, ptr %253, align 4, !tbaa !13
  %255 = zext i32 %254 to i64
  %256 = getelementptr inbounds %struct.neighbor_t, ptr %246, i64 %255
  %257 = getelementptr inbounds %struct.neighbor_t, ptr %256, i32 0, i32 2
  store i32 %238, ptr %257, align 4, !tbaa !34
  %258 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %259 = load ptr, ptr %258, align 8, !tbaa !21
  %260 = load ptr, ptr %9, align 8, !tbaa !5
  %261 = getelementptr inbounds %struct.dfs_code_t, ptr %260, i32 0, i32 0
  %262 = load i16, ptr %261, align 4, !tbaa !23
  %263 = zext i16 %262 to i64
  %264 = getelementptr inbounds i32, ptr %259, i64 %263
  %265 = load i32, ptr %264, align 4, !tbaa !13
  %266 = add i32 %265, 1
  store i32 %266, ptr %264, align 4, !tbaa !13
  %267 = getelementptr inbounds %struct.database_entry_t, ptr %0, i32 0, i32 1
  %268 = load ptr, ptr %267, align 8, !tbaa !21
  %269 = load ptr, ptr %9, align 8, !tbaa !5
  %270 = getelementptr inbounds %struct.dfs_code_t, ptr %269, i32 0, i32 1
  %271 = load i16, ptr %270, align 2, !tbaa !26
  %272 = zext i16 %271 to i64
  %273 = getelementptr inbounds i32, ptr %268, i64 %272
  %274 = load i32, ptr %273, align 4, !tbaa !13
  %275 = add i32 %274, 1
  store i32 %275, ptr %273, align 4, !tbaa !13
  br label %276

276:                                              ; preds = %126
  %277 = load ptr, ptr %9, align 8, !tbaa !5
  %278 = getelementptr inbounds %struct.dfs_code_t, ptr %277, i32 1
  store ptr %278, ptr %9, align 8, !tbaa !5
  br label %114, !llvm.loop !35

279:                                              ; preds = %125
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  ret void
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @invert_direction(i32 noundef) #6

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { nounwind allocsize(0,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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind allocsize(0,1) }

!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 104}
!10 = !{!"subgraph_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !12, i64 104, !11, i64 108, !6, i64 112}
!11 = !{!"int", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!11, !11, i64 0}
!14 = !{!15, !11, i64 32}
!15 = !{!"database_entry_t", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36}
!16 = !{!10, !11, i64 88}
!17 = !{!15, !11, i64 36}
!18 = !{!10, !6, i64 8}
!19 = !{!15, !6, i64 0}
!20 = !{!15, !6, i64 16}
!21 = !{!15, !6, i64 8}
!22 = !{!10, !6, i64 0}
!23 = !{!24, !12, i64 0}
!24 = !{!"dfs_code_t", !12, i64 0, !12, i64 2, !11, i64 4, !11, i64 8, !25, i64 12, !11, i64 20}
!25 = !{!"edge_label_t", !11, i64 0, !11, i64 4}
!26 = !{!24, !12, i64 2}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = distinct !{!29, !28}
!30 = !{!31, !12, i64 0}
!31 = !{!"neighbor_t", !12, i64 0, !25, i64 4, !11, i64 12}
!32 = !{i64 0, i64 4, !13, i64 4, i64 4, !13}
!33 = !{!24, !11, i64 20}
!34 = !{!31, !11, i64 12}
!35 = distinct !{!35, !28}


; 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.database_entry_t = type { ptr, ptr, ptr, i32, i32, i32, i32 }
%struct.dfs_code_t = type { i16, i16, i32, i32, %struct.edge_label_t, i32 }
%struct.edge_label_t = type { i32, i32 }
%struct.neighbor_t = type { i16, %struct.edge_label_t, i32 }

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local void @canonical_database_entry(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.database_entry_t) align 8 %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %1, i64 104
  %4 = load i16, ptr %3, align 8, !tbaa !5
  %5 = zext i16 %4 to i32
  %6 = add nuw nsw i32 %5, 1
  %7 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %6, ptr %7, align 8, !tbaa !12
  %8 = getelementptr inbounds i8, ptr %1, i64 88
  %9 = load i32, ptr %8, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 %9, ptr %10, align 4, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  store ptr %12, ptr %0, align 8, !tbaa !17
  %13 = zext nneg i32 %6 to i64
  %14 = shl nuw nsw i64 %13, 3
  %15 = tail call noalias ptr @malloc(i64 noundef %14) #5
  %16 = getelementptr inbounds i8, ptr %0, i64 16
  store ptr %15, ptr %16, align 8, !tbaa !18
  %17 = tail call noalias ptr @calloc(i64 noundef %13, i64 noundef 4) #6
  %18 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %17, ptr %18, align 8, !tbaa !19
  %19 = shl i32 %9, 1
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 4
  %22 = tail call noalias ptr @malloc(i64 noundef %21) #5
  %23 = load ptr, ptr %1, align 8, !tbaa !20
  %24 = zext i32 %9 to i64
  %25 = getelementptr inbounds %struct.dfs_code_t, ptr %23, i64 %24
  %.not55 = icmp eq i32 %9, 0
  br i1 %.not55, label %.preheader.preheader, label %.lr.ph

.preheader.preheader:                             ; preds = %.lr.ph, %2
  %xtraiter = and i64 %13, 3
  %26 = icmp ult i16 %4, 3
  br i1 %26, label %.unr-lcssa, label %.preheader.preheader.new

.preheader.preheader.new:                         ; preds = %.preheader.preheader
  %unroll_iter = and i64 %13, 131068
  br label %.preheader

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.04950 = phi ptr [ %38, %.lr.ph ], [ %23, %2 ]
  %27 = load i16, ptr %.04950, align 4, !tbaa !21
  %28 = zext i16 %27 to i64
  %29 = getelementptr inbounds i32, ptr %17, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !24
  %31 = add i32 %30, 1
  store i32 %31, ptr %29, align 4, !tbaa !24
  %32 = getelementptr inbounds i8, ptr %.04950, i64 2
  %33 = load i16, ptr %32, align 2, !tbaa !25
  %34 = zext i16 %33 to i64
  %35 = getelementptr inbounds i32, ptr %17, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !24
  %37 = add i32 %36, 1
  store i32 %37, ptr %35, align 4, !tbaa !24
  %38 = getelementptr inbounds i8, ptr %.04950, i64 24
  %39 = icmp ult ptr %38, %25
  br i1 %39, label %.lr.ph, label %.preheader.preheader, !llvm.loop !26

.unr-lcssa:                                       ; preds = %.preheader, %.preheader.preheader
  %indvars.iv.unr = phi i64 [ 0, %.preheader.preheader ], [ %indvars.iv.next.3, %.preheader ]
  %.04851.unr = phi i32 [ 0, %.preheader.preheader ], [ %70, %.preheader ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.epilog-lcssa, label %.preheader.epil

.preheader.epil:                                  ; preds = %.unr-lcssa, %.preheader.epil
  %indvars.iv.epil = phi i64 [ %indvars.iv.next.epil, %.preheader.epil ], [ %indvars.iv.unr, %.unr-lcssa ]
  %.04851.epil = phi i32 [ %45, %.preheader.epil ], [ %.04851.unr, %.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.preheader.epil ], [ 0, %.unr-lcssa ]
  %40 = zext i32 %.04851.epil to i64
  %41 = getelementptr inbounds %struct.neighbor_t, ptr %22, i64 %40
  %42 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv.epil
  store ptr %41, ptr %42, align 8, !tbaa !28
  %43 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.epil
  %44 = load i32, ptr %43, align 4, !tbaa !24
  %45 = add i32 %44, %.04851.epil
  %indvars.iv.next.epil = add nuw nsw i64 %indvars.iv.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.epilog-lcssa, label %.preheader.epil, !llvm.loop !29

.epilog-lcssa:                                    ; preds = %.preheader.epil, %.unr-lcssa
  %46 = shl nuw nsw i64 %13, 2
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(1) %17, i8 0, i64 %46, i1 false)
  br i1 %.not55, label %._crit_edge, label %.lr.ph54

.preheader:                                       ; preds = %.preheader, %.preheader.preheader.new
  %indvars.iv = phi i64 [ 0, %.preheader.preheader.new ], [ %indvars.iv.next.3, %.preheader ]
  %.04851 = phi i32 [ 0, %.preheader.preheader.new ], [ %70, %.preheader ]
  %niter = phi i64 [ 0, %.preheader.preheader.new ], [ %niter.next.3, %.preheader ]
  %47 = zext i32 %.04851 to i64
  %48 = getelementptr inbounds %struct.neighbor_t, ptr %22, i64 %47
  %49 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv
  store ptr %48, ptr %49, align 8, !tbaa !28
  %50 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv
  %51 = load i32, ptr %50, align 4, !tbaa !24
  %52 = add i32 %51, %.04851
  %indvars.iv.next = or disjoint i64 %indvars.iv, 1
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds %struct.neighbor_t, ptr %22, i64 %53
  %55 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv.next
  store ptr %54, ptr %55, align 8, !tbaa !28
  %56 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next
  %57 = load i32, ptr %56, align 4, !tbaa !24
  %58 = add i32 %57, %52
  %indvars.iv.next.1 = or disjoint i64 %indvars.iv, 2
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds %struct.neighbor_t, ptr %22, i64 %59
  %61 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv.next.1
  store ptr %60, ptr %61, align 8, !tbaa !28
  %62 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next.1
  %63 = load i32, ptr %62, align 4, !tbaa !24
  %64 = add i32 %63, %58
  %indvars.iv.next.2 = or disjoint i64 %indvars.iv, 3
  %65 = zext i32 %64 to i64
  %66 = getelementptr inbounds %struct.neighbor_t, ptr %22, i64 %65
  %67 = getelementptr inbounds ptr, ptr %15, i64 %indvars.iv.next.2
  store ptr %66, ptr %67, align 8, !tbaa !28
  %68 = getelementptr inbounds i32, ptr %17, i64 %indvars.iv.next.2
  %69 = load i32, ptr %68, align 4, !tbaa !24
  %70 = add i32 %69, %64
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.unr-lcssa, label %.preheader, !llvm.loop !31

._crit_edge:                                      ; preds = %.lr.ph54, %.epilog-lcssa
  ret void

.lr.ph54:                                         ; preds = %.epilog-lcssa, %.lr.ph54
  %.053 = phi ptr [ %121, %.lr.ph54 ], [ %23, %.epilog-lcssa ]
  %71 = getelementptr inbounds i8, ptr %.053, i64 2
  %72 = load i16, ptr %71, align 2, !tbaa !25
  %73 = load i16, ptr %.053, align 4, !tbaa !21
  %74 = zext i16 %73 to i64
  %75 = getelementptr inbounds ptr, ptr %15, i64 %74
  %76 = load ptr, ptr %75, align 8, !tbaa !28
  %77 = getelementptr inbounds i32, ptr %17, i64 %74
  %78 = load i32, ptr %77, align 4, !tbaa !24
  %79 = zext i32 %78 to i64
  %80 = getelementptr inbounds %struct.neighbor_t, ptr %76, i64 %79
  store i16 %72, ptr %80, align 4, !tbaa !32
  %81 = getelementptr inbounds %struct.neighbor_t, ptr %76, i64 %79, i32 1
  %82 = getelementptr inbounds i8, ptr %.053, i64 12
  %83 = load i64, ptr %82, align 4
  store i64 %83, ptr %81, align 4
  %84 = getelementptr inbounds i8, ptr %.053, i64 20
  %85 = load i32, ptr %84, align 4, !tbaa !34
  %86 = load i16, ptr %.053, align 4, !tbaa !21
  %87 = zext i16 %86 to i64
  %88 = getelementptr inbounds ptr, ptr %15, i64 %87
  %89 = load ptr, ptr %88, align 8, !tbaa !28
  %90 = getelementptr inbounds i32, ptr %17, i64 %87
  %91 = load i32, ptr %90, align 4, !tbaa !24
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds %struct.neighbor_t, ptr %89, i64 %92, i32 2
  store i32 %85, ptr %93, align 4, !tbaa !35
  %94 = load i16, ptr %71, align 2, !tbaa !25
  %95 = zext i16 %94 to i64
  %96 = getelementptr inbounds ptr, ptr %15, i64 %95
  %97 = load ptr, ptr %96, align 8, !tbaa !28
  %98 = getelementptr inbounds i32, ptr %17, i64 %95
  %99 = load i32, ptr %98, align 4, !tbaa !24
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds %struct.neighbor_t, ptr %97, i64 %100
  store i16 %86, ptr %101, align 4, !tbaa !32
  %102 = getelementptr inbounds %struct.neighbor_t, ptr %97, i64 %100, i32 1
  %103 = load i64, ptr %82, align 4
  store i64 %103, ptr %102, align 4
  %104 = load i32, ptr %84, align 4, !tbaa !34
  %105 = tail call i32 @invert_direction(i32 noundef %104)
  %106 = load i16, ptr %71, align 2, !tbaa !25
  %107 = zext i16 %106 to i64
  %108 = getelementptr inbounds ptr, ptr %15, i64 %107
  %109 = load ptr, ptr %108, align 8, !tbaa !28
  %110 = getelementptr inbounds i32, ptr %17, i64 %107
  %111 = load i32, ptr %110, align 4, !tbaa !24
  %112 = zext i32 %111 to i64
  %113 = getelementptr inbounds %struct.neighbor_t, ptr %109, i64 %112, i32 2
  store i32 %105, ptr %113, align 4, !tbaa !35
  %114 = load i16, ptr %.053, align 4, !tbaa !21
  %115 = zext i16 %114 to i64
  %116 = getelementptr inbounds i32, ptr %17, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !24
  %118 = add i32 %117, 1
  store i32 %118, ptr %116, align 4, !tbaa !24
  %119 = load i32, ptr %110, align 4, !tbaa !24
  %120 = add i32 %119, 1
  store i32 %120, ptr %110, align 4, !tbaa !24
  %121 = getelementptr inbounds i8, ptr %.053, i64 24
  %122 = load ptr, ptr %1, align 8, !tbaa !20
  %123 = load i32, ptr %8, align 8, !tbaa !14
  %124 = zext i32 %123 to i64
  %125 = getelementptr inbounds %struct.dfs_code_t, ptr %122, i64 %124
  %126 = icmp ult ptr %121, %125
  br i1 %126, label %.lr.ph54, label %._crit_edge, !llvm.loop !36
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @invert_direction(i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { 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 #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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint 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 #5 = { nounwind allocsize(0) }
attributes #6 = { nounwind allocsize(0,1) }

!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, !11, i64 104}
!6 = !{!"subgraph_t", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !11, i64 104, !10, i64 108, !7, i64 112}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!13, !10, i64 32}
!13 = !{!"database_entry_t", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36}
!14 = !{!6, !10, i64 88}
!15 = !{!13, !10, i64 36}
!16 = !{!6, !7, i64 8}
!17 = !{!13, !7, i64 0}
!18 = !{!13, !7, i64 16}
!19 = !{!13, !7, i64 8}
!20 = !{!6, !7, i64 0}
!21 = !{!22, !11, i64 0}
!22 = !{!"dfs_code_t", !11, i64 0, !11, i64 2, !10, i64 4, !10, i64 8, !23, i64 12, !10, i64 20}
!23 = !{!"edge_label_t", !10, i64 0, !10, i64 4}
!24 = !{!10, !10, i64 0}
!25 = !{!22, !11, i64 2}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.unroll.disable"}
!31 = distinct !{!31, !27}
!32 = !{!33, !11, i64 0}
!33 = !{!"neighbor_t", !11, i64 0, !23, i64 4, !10, i64 12}
!34 = !{!22, !10, i64 20}
!35 = !{!33, !10, i64 12}
!36 = distinct !{!36, !27}


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