; LLVM IR from themisvaltinos/Partitioned-Hash-Join :: programs/sigmod (joiner)

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

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.queue = type { ptr, i32, i32, i32 }
%struct.results = type { i64, ptr }
%struct.query_job = type { ptr, i8 }
%struct.relation = type { ptr, i64, i64 }

@pool_mutex = external dso_local global %union.pthread_mutex_t, align 8
@empty_pool = external dso_local global %union.pthread_cond_t, align 8
@full_pool = external dso_local global %union.pthread_cond_t, align 8
@l2size = external dso_local global i32, align 4
@thread_pool = external dso_local global %struct.queue, align 8
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@stdin = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@relations = external dso_local global [14 x ptr], align 16
@data_statistics = external dso_local global [14 x ptr], align 16
@batch_results = external dso_local global [15 x ptr], align 16
@threads = external dso_local global i8, align 1
@stdout = external global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @initQueue(ptr noundef) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [128 x i8], align 16
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca [1024 x i8], align 16
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %16 = call i32 @getL2CacheSize()
  %17 = udiv i32 %16, 3
  store i32 %17, ptr @l2size, align 4, !tbaa !5
  call void @initQueue(ptr noundef @thread_pool)
  call void @llvm.lifetime.start.p0(i64 128, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  %18 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %19 = call ptr @strcpy(ptr noundef %18, ptr noundef @.str.2) #7
  %20 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %21 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %22 = call i64 @strlen(ptr noundef %21) #8
  %23 = getelementptr inbounds i8, ptr %20, i64 %22
  store ptr %23, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %62, %0
  br i1 true, label %26, label %25

25:                                               ; preds = %24
  store i32 2, ptr %5, align 4
  br label %65

26:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 1024, ptr %6) #7
  %27 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %28 = load ptr, ptr @stdin, align 8, !tbaa !9
  %29 = call ptr @fgets(ptr noundef %27, i32 noundef 1024, ptr noundef %28)
  %30 = icmp ne ptr %29, null
  br i1 %30, label %31, label %32

31:                                               ; preds = %26
  br label %33

32:                                               ; preds = %26
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.4, i32 noundef 179, ptr noundef @__PRETTY_FUNCTION__.main) #9
  unreachable

33:                                               ; preds = %31
  %34 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %35 = call i64 @strlen(ptr noundef %34) #8
  %36 = sub i64 %35, 1
  %37 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 %36
  store i8 0, ptr %37, align 1, !tbaa !11
  %38 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %39 = call i32 @strcmp(ptr noundef %38, ptr noundef @.str.5) #8
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %42

41:                                               ; preds = %33
  store i32 2, ptr %5, align 4
  br label %59

42:                                               ; preds = %33
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = getelementptr inbounds [1024 x i8], ptr %6, i64 0, i64 0
  %45 = call ptr @strcpy(ptr noundef %43, ptr noundef %44) #7
  %46 = getelementptr inbounds [128 x i8], ptr %2, i64 0, i64 0
  %47 = call ptr @loadRelation(ptr noundef %46)
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = zext i32 %48 to i64
  %50 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %49
  store ptr %47, ptr %50, align 8, !tbaa !9
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = zext i32 %51 to i64
  %53 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %52
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call ptr @gatherStatistics(ptr noundef %54)
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = zext i32 %56 to i64
  %58 = getelementptr inbounds [14 x ptr], ptr @data_statistics, i64 0, i64 %57
  store ptr %55, ptr %58, align 8, !tbaa !9
  store i32 0, ptr %5, align 4
  br label %59

59:                                               ; preds = %42, %41
  call void @llvm.lifetime.end.p0(i64 1024, ptr %6) #7
  %60 = load i32, ptr %5, align 4
  switch i32 %60, label %65 [
    i32 0, label %61
  ]

61:                                               ; preds = %59
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = add i32 %63, 1
  store i32 %64, ptr %4, align 4, !tbaa !5
  br label %24

65:                                               ; preds = %59, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %66

66:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %76, %66
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = icmp slt i32 %68, 15
  br i1 %69, label %71, label %70

70:                                               ; preds = %67
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %79

71:                                               ; preds = %67
  %72 = call noalias ptr @malloc(i64 noundef 8) #10
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %74
  store ptr %72, ptr %75, align 8, !tbaa !9
  br label %76

76:                                               ; preds = %71
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %7, align 4, !tbaa !5
  br label %67, !llvm.loop !12

79:                                               ; preds = %70
  store i8 3, ptr @threads, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #7
  store i8 0, ptr %8, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %80 = call noalias ptr @malloc(i64 noundef 24) #10
  store ptr %80, ptr %9, align 8, !tbaa !9
  %81 = call i32 @pthread_mutex_init(ptr noundef @pool_mutex, ptr noundef null) #7
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %82

82:                                               ; preds = %91, %79
  %83 = load i32, ptr %10, align 4, !tbaa !5
  %84 = icmp slt i32 %83, 3
  br i1 %84, label %85, label %94

85:                                               ; preds = %82
  %86 = load ptr, ptr %9, align 8, !tbaa !9
  %87 = load i32, ptr %10, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i64, ptr %86, i64 %88
  %90 = call i32 @pthread_create(ptr noundef %89, ptr noundef null, ptr noundef @query_job, ptr noundef %10) #7
  br label %91

91:                                               ; preds = %85
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %10, align 4, !tbaa !5
  br label %82, !llvm.loop !14

94:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %95 = load ptr, ptr @stdin, align 8, !tbaa !9
  %96 = call i32 @fgetc(ptr noundef %95)
  store i32 %96, ptr %11, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %177, %94
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = icmp ne i32 %98, -1
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %180

101:                                              ; preds = %97
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = icmp eq i32 %102, 70
  br i1 %103, label %107, label %104

104:                                              ; preds = %101
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = icmp eq i32 %105, 10
  br i1 %106, label %107, label %150

107:                                              ; preds = %104, %101
  %108 = call i32 @pthread_mutex_lock(ptr noundef @pool_mutex) #7
  br label %109

109:                                              ; preds = %113, %107
  %110 = load i8, ptr @threads, align 1, !tbaa !11
  %111 = zext i8 %110 to i32
  %112 = icmp slt i32 %111, 3
  br i1 %112, label %113, label %115

113:                                              ; preds = %109
  %114 = call i32 @pthread_cond_wait(ptr noundef @full_pool, ptr noundef @pool_mutex)
  br label %109, !llvm.loop !15

115:                                              ; preds = %109
  %116 = call i32 @pthread_mutex_unlock(ptr noundef @pool_mutex) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %144, %115
  %118 = load i32, ptr %12, align 4, !tbaa !5
  %119 = load i8, ptr %8, align 1, !tbaa !11
  %120 = zext i8 %119 to i32
  %121 = icmp slt i32 %118, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %117
  store i32 16, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %147

123:                                              ; preds = %117
  %124 = load ptr, ptr @stdout, align 8, !tbaa !9
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %126
  %128 = load ptr, ptr %127, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.results, ptr %128, i32 0, i32 1
  %130 = load ptr, ptr %129, align 8, !tbaa !16
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %132
  %134 = load ptr, ptr %133, align 8, !tbaa !9
  %135 = getelementptr inbounds %struct.results, ptr %134, i32 0, i32 0
  %136 = load i64, ptr %135, align 8, !tbaa !19
  %137 = trunc i64 %136 to i32
  call void @printChecksums(ptr noundef %124, ptr noundef %130, i32 noundef %137)
  %138 = load i32, ptr %12, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %139
  %141 = load ptr, ptr %140, align 8, !tbaa !9
  %142 = getelementptr inbounds %struct.results, ptr %141, i32 0, i32 1
  %143 = load ptr, ptr %142, align 8, !tbaa !16
  call void @free(ptr noundef %143) #7
  br label %144

144:                                              ; preds = %123
  %145 = load i32, ptr %12, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %12, align 4, !tbaa !5
  br label %117, !llvm.loop !20

147:                                              ; preds = %122
  store i8 0, ptr %8, align 1, !tbaa !11
  %148 = load ptr, ptr @stdout, align 8, !tbaa !9
  %149 = call i32 @fflush(ptr noundef %148)
  br label %177

150:                                              ; preds = %104
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = load ptr, ptr @stdin, align 8, !tbaa !9
  %153 = call i32 @ungetc(i32 noundef %151, ptr noundef %152)
  %154 = call i32 @pthread_mutex_lock(ptr noundef @pool_mutex) #7
  br label %155

155:                                              ; preds = %159, %150
  %156 = load i8, ptr @threads, align 1, !tbaa !11
  %157 = zext i8 %156 to i32
  %158 = icmp slt i32 %157, 1
  br i1 %158, label %159, label %161

159:                                              ; preds = %155
  %160 = call i32 @pthread_cond_wait(ptr noundef @full_pool, ptr noundef @pool_mutex)
  br label %155, !llvm.loop !21

161:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %162 = call noalias ptr @malloc(i64 noundef 16) #10
  store ptr %162, ptr %13, align 8, !tbaa !9
  %163 = load ptr, ptr @stdin, align 8, !tbaa !9
  %164 = call ptr @parseQuery(ptr noundef %163)
  %165 = load ptr, ptr %13, align 8, !tbaa !9
  %166 = getelementptr inbounds %struct.query_job, ptr %165, i32 0, i32 0
  store ptr %164, ptr %166, align 8, !tbaa !22
  %167 = load i8, ptr %8, align 1, !tbaa !11
  %168 = load ptr, ptr %13, align 8, !tbaa !9
  %169 = getelementptr inbounds %struct.query_job, ptr %168, i32 0, i32 1
  store i8 %167, ptr %169, align 8, !tbaa !24
  %170 = load i8, ptr %8, align 1, !tbaa !11
  %171 = add i8 %170, 1
  store i8 %171, ptr %8, align 1, !tbaa !11
  %172 = load ptr, ptr %13, align 8, !tbaa !9
  call void @enQueue(ptr noundef @thread_pool, ptr noundef %172)
  %173 = load i8, ptr @threads, align 1, !tbaa !11
  %174 = add i8 %173, -1
  store i8 %174, ptr @threads, align 1, !tbaa !11
  %175 = call i32 @pthread_cond_signal(ptr noundef @empty_pool) #7
  %176 = call i32 @pthread_mutex_unlock(ptr noundef @pool_mutex) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %177

177:                                              ; preds = %161, %147
  %178 = load ptr, ptr @stdin, align 8, !tbaa !9
  %179 = call i32 @fgetc(ptr noundef %178)
  store i32 %179, ptr %11, align 4, !tbaa !5
  br label %97, !llvm.loop !25

180:                                              ; preds = %100
  %181 = load ptr, ptr @stdout, align 8, !tbaa !9
  %182 = call i32 @fflush(ptr noundef %181)
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %183

183:                                              ; preds = %192, %180
  %184 = load i32, ptr %14, align 4, !tbaa !5
  %185 = icmp slt i32 %184, 15
  br i1 %185, label %187, label %186

186:                                              ; preds = %183
  store i32 21, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %195

187:                                              ; preds = %183
  %188 = load i32, ptr %14, align 4, !tbaa !5
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %189
  %191 = load ptr, ptr %190, align 8, !tbaa !9
  call void @free(ptr noundef %191) #7
  br label %192

192:                                              ; preds = %187
  %193 = load i32, ptr %14, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %14, align 4, !tbaa !5
  br label %183, !llvm.loop !26

195:                                              ; preds = %186
  %196 = load ptr, ptr @thread_pool, align 8, !tbaa !27
  call void @free(ptr noundef %196) #7
  call void @destroyStats(ptr noundef @data_statistics, i32 noundef 14)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %219, %195
  %198 = load i32, ptr %15, align 4, !tbaa !5
  %199 = icmp ult i32 %198, 14
  br i1 %199, label %201, label %200

200:                                              ; preds = %197
  store i32 24, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %222

201:                                              ; preds = %197
  %202 = load i32, ptr %15, align 4, !tbaa !5
  %203 = zext i32 %202 to i64
  %204 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %203
  %205 = load ptr, ptr %204, align 8, !tbaa !9
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %218

207:                                              ; preds = %201
  %208 = load i32, ptr %15, align 4, !tbaa !5
  %209 = zext i32 %208 to i64
  %210 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %209
  %211 = load ptr, ptr %210, align 8, !tbaa !9
  %212 = getelementptr inbounds %struct.relation, ptr %211, i32 0, i32 0
  %213 = load ptr, ptr %212, align 8, !tbaa !29
  call void @free(ptr noundef %213) #7
  %214 = load i32, ptr %15, align 4, !tbaa !5
  %215 = zext i32 %214 to i64
  %216 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %215
  %217 = load ptr, ptr %216, align 8, !tbaa !9
  call void @free(ptr noundef %217) #7
  br label %218

218:                                              ; preds = %207, %201
  br label %219

219:                                              ; preds = %218
  %220 = load i32, ptr %15, align 4, !tbaa !5
  %221 = add i32 %220, 1
  store i32 %221, ptr %15, align 4, !tbaa !5
  br label %197, !llvm.loop !31

222:                                              ; preds = %200
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr %2) #7
  %223 = load i32, ptr %1, align 4
  ret i32 %223
}

declare i32 @getL2CacheSize() #2

; Function Attrs: nounwind
declare ptr @strcpy(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

declare ptr @fgets(ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #4

declare ptr @loadRelation(ptr noundef) #2

declare ptr @gatherStatistics(ptr noundef) #2

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden ptr @query_job(ptr noundef) #0

declare i32 @fgetc(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) #3

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) #3

declare void @printChecksums(ptr noundef, ptr noundef, i32 noundef) #2

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

declare i32 @fflush(ptr noundef) #2

declare i32 @ungetc(i32 noundef, ptr noundef) #2

declare ptr @parseQuery(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @pthread_cond_signal(ptr noundef) #3

declare void @destroyStats(ptr noundef, i32 noundef) #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind willreturn memory(read) "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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}
!16 = !{!17, !10, i64 8}
!17 = !{!"results", !18, i64 0, !10, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!17, !18, i64 0}
!20 = distinct !{!20, !13}
!21 = distinct !{!21, !13}
!22 = !{!23, !10, i64 0}
!23 = !{!"query_job", !10, i64 0, !7, i64 8}
!24 = !{!23, !7, i64 8}
!25 = distinct !{!25, !13}
!26 = distinct !{!26, !13}
!27 = !{!28, !10, i64 0}
!28 = !{!"", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!29 = !{!30, !10, i64 0}
!30 = !{!"relation", !10, i64 0, !18, i64 8, !18, i64 16}
!31 = distinct !{!31, !13}


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

%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.queue = type { ptr, i32, i32, i32 }

@pool_mutex = external dso_local global %union.pthread_mutex_t, align 8
@empty_pool = external dso_local global %union.pthread_cond_t, align 8
@full_pool = external dso_local global %union.pthread_cond_t, align 8
@l2size = external dso_local local_unnamed_addr global i32, align 4
@thread_pool = external dso_local global %struct.queue, align 8
@.str.2 = external hidden unnamed_addr constant [13 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [67 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [95 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [15 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@relations = external dso_local local_unnamed_addr global [14 x ptr], align 16
@data_statistics = external dso_local global [14 x ptr], align 16
@batch_results = external dso_local local_unnamed_addr global [15 x ptr], align 16
@threads = external dso_local local_unnamed_addr global i8, align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @initQueue(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [128 x i8], align 16
  %2 = alloca [1024 x i8], align 16
  %3 = alloca i32, align 4
  %4 = tail call i32 @getL2CacheSize() #10
  %5 = udiv i32 %4, 3
  store i32 %5, ptr @l2size, align 4, !tbaa !5
  tail call void @initQueue(ptr noundef nonnull @thread_pool)
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %1) #10
  %6 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) @.str.2) #10
  %7 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #11
  %8 = getelementptr inbounds i8, ptr %1, i64 %7
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %2) #10
  %9 = load ptr, ptr @stdin, align 8, !tbaa !9
  %10 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 1024, ptr noundef %9)
  %.not46 = icmp eq ptr %10, null
  br i1 %.not46, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %15, %0
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, i32 noundef 179, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #12
  unreachable

.lr.ph:                                           ; preds = %0, %15
  %.03747 = phi i32 [ %22, %15 ], [ 0, %0 ]
  %11 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %2) #11
  %12 = add i64 %11, -1
  %13 = getelementptr inbounds [1024 x i8], ptr %2, i64 0, i64 %12
  store i8 0, ptr %13, align 1, !tbaa !11
  %14 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) @.str.5) #11
  %.not43 = icmp eq i32 %14, 0
  br i1 %.not43, label %.critedge, label %15

15:                                               ; preds = %.lr.ph
  %16 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %8, ptr noundef nonnull dereferenceable(1) %2) #10
  %17 = call ptr @loadRelation(ptr noundef nonnull %1) #10
  %18 = zext i32 %.03747 to i64
  %19 = getelementptr inbounds [14 x ptr], ptr @relations, i64 0, i64 %18
  store ptr %17, ptr %19, align 8, !tbaa !9
  %20 = call ptr @gatherStatistics(ptr noundef %17) #10
  %21 = getelementptr inbounds [14 x ptr], ptr @data_statistics, i64 0, i64 %18
  store ptr %20, ptr %21, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %2) #10
  %22 = add i32 %.03747, 1
  call void @llvm.lifetime.start.p0(i64 1024, ptr nonnull %2) #10
  %23 = load ptr, ptr @stdin, align 8, !tbaa !9
  %24 = call ptr @fgets(ptr noundef nonnull %2, i32 noundef 1024, ptr noundef %23)
  %.not = icmp eq ptr %24, null
  br i1 %.not, label %._crit_edge, label %.lr.ph

.critedge:                                        ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 1024, ptr nonnull %2) #10
  %25 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %25, ptr @batch_results, align 16, !tbaa !9
  %26 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %26, ptr getelementptr inbounds (i8, ptr @batch_results, i64 8), align 8, !tbaa !9
  %27 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %27, ptr getelementptr inbounds (i8, ptr @batch_results, i64 16), align 16, !tbaa !9
  %28 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %28, ptr getelementptr inbounds (i8, ptr @batch_results, i64 24), align 8, !tbaa !9
  %29 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %29, ptr getelementptr inbounds (i8, ptr @batch_results, i64 32), align 16, !tbaa !9
  %30 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %30, ptr getelementptr inbounds (i8, ptr @batch_results, i64 40), align 8, !tbaa !9
  %31 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %31, ptr getelementptr inbounds (i8, ptr @batch_results, i64 48), align 16, !tbaa !9
  %32 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %32, ptr getelementptr inbounds (i8, ptr @batch_results, i64 56), align 8, !tbaa !9
  %33 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %33, ptr getelementptr inbounds (i8, ptr @batch_results, i64 64), align 16, !tbaa !9
  %34 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %34, ptr getelementptr inbounds (i8, ptr @batch_results, i64 72), align 8, !tbaa !9
  %35 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %35, ptr getelementptr inbounds (i8, ptr @batch_results, i64 80), align 16, !tbaa !9
  %36 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %36, ptr getelementptr inbounds (i8, ptr @batch_results, i64 88), align 8, !tbaa !9
  %37 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %37, ptr getelementptr inbounds (i8, ptr @batch_results, i64 96), align 16, !tbaa !9
  %38 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %38, ptr getelementptr inbounds (i8, ptr @batch_results, i64 104), align 8, !tbaa !9
  %39 = call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #13
  store ptr %39, ptr getelementptr inbounds (i8, ptr @batch_results, i64 112), align 16, !tbaa !9
  store i8 3, ptr @threads, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #10
  %40 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #13
  %41 = call i32 @pthread_mutex_init(ptr noundef nonnull @pool_mutex, ptr noundef null) #10
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %.critedge, %42
  %storemerge49 = phi i32 [ 0, %.critedge ], [ %47, %42 ]
  %43 = sext i32 %storemerge49 to i64
  %44 = getelementptr inbounds i64, ptr %40, i64 %43
  %45 = call i32 @pthread_create(ptr noundef %44, ptr noundef null, ptr noundef nonnull @query_job, ptr noundef nonnull %3) #10
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %3, align 4, !tbaa !5
  %48 = icmp slt i32 %46, 2
  br i1 %48, label %42, label %.preheader, !llvm.loop !12

.preheader:                                       ; preds = %42, %.preheader.backedge
  %.038 = phi i8 [ %.038.be, %.preheader.backedge ], [ 0, %42 ]
  %49 = load ptr, ptr @stdin, align 8, !tbaa !9
  %50 = call i32 @fgetc(ptr noundef %49)
  switch i32 %50, label %91 [
    i32 -1, label %51
    i32 70, label %71
    i32 10, label %71
  ]

51:                                               ; preds = %.preheader
  %52 = load ptr, ptr @stdout, align 8, !tbaa !9
  %53 = call i32 @fflush(ptr noundef %52)
  %54 = load ptr, ptr @batch_results, align 16, !tbaa !9
  call void @free(ptr noundef %54) #10
  %55 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 8), align 8, !tbaa !9
  call void @free(ptr noundef %55) #10
  %56 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 16), align 16, !tbaa !9
  call void @free(ptr noundef %56) #10
  %57 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 24), align 8, !tbaa !9
  call void @free(ptr noundef %57) #10
  %58 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 32), align 16, !tbaa !9
  call void @free(ptr noundef %58) #10
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 40), align 8, !tbaa !9
  call void @free(ptr noundef %59) #10
  %60 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 48), align 16, !tbaa !9
  call void @free(ptr noundef %60) #10
  %61 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 56), align 8, !tbaa !9
  call void @free(ptr noundef %61) #10
  %62 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 64), align 16, !tbaa !9
  call void @free(ptr noundef %62) #10
  %63 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 72), align 8, !tbaa !9
  call void @free(ptr noundef %63) #10
  %64 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 80), align 16, !tbaa !9
  call void @free(ptr noundef %64) #10
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 88), align 8, !tbaa !9
  call void @free(ptr noundef %65) #10
  %66 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 96), align 16, !tbaa !9
  call void @free(ptr noundef %66) #10
  %67 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 104), align 8, !tbaa !9
  call void @free(ptr noundef %67) #10
  %68 = load ptr, ptr getelementptr inbounds (i8, ptr @batch_results, i64 112), align 16, !tbaa !9
  call void @free(ptr noundef %68) #10
  %69 = load ptr, ptr @thread_pool, align 8, !tbaa !14
  call void @free(ptr noundef %69) #10
  call void @destroyStats(ptr noundef nonnull @data_statistics, i32 noundef 14) #10
  %70 = load ptr, ptr @relations, align 16, !tbaa !9
  %.not45 = icmp eq ptr %70, null
  br i1 %.not45, label %112, label %109

71:                                               ; preds = %.preheader, %.preheader
  %72 = call i32 @pthread_mutex_lock(ptr noundef nonnull @pool_mutex) #10
  %73 = load i8, ptr @threads, align 1, !tbaa !11
  %74 = icmp ult i8 %73, 3
  br i1 %74, label %.lr.ph51, label %._crit_edge52

.lr.ph51:                                         ; preds = %71, %.lr.ph51
  %75 = call i32 @pthread_cond_wait(ptr noundef nonnull @full_pool, ptr noundef nonnull @pool_mutex) #10
  %76 = load i8, ptr @threads, align 1, !tbaa !11
  %77 = icmp ult i8 %76, 3
  br i1 %77, label %.lr.ph51, label %._crit_edge52, !llvm.loop !16

._crit_edge52:                                    ; preds = %.lr.ph51, %71
  %78 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @pool_mutex) #10
  %.not62 = icmp eq i8 %.038, 0
  br i1 %.not62, label %._crit_edge56, label %.lr.ph55.preheader

.lr.ph55.preheader:                               ; preds = %._crit_edge52
  %wide.trip.count = zext i8 %.038 to i64
  br label %.lr.ph55

._crit_edge56:                                    ; preds = %.lr.ph55, %._crit_edge52
  %79 = load ptr, ptr @stdout, align 8, !tbaa !9
  %80 = call i32 @fflush(ptr noundef %79)
  br label %.preheader.backedge

.lr.ph55:                                         ; preds = %.lr.ph55.preheader, %.lr.ph55
  %indvars.iv = phi i64 [ 0, %.lr.ph55.preheader ], [ %indvars.iv.next, %.lr.ph55 ]
  %81 = load ptr, ptr @stdout, align 8, !tbaa !9
  %82 = getelementptr inbounds [15 x ptr], ptr @batch_results, i64 0, i64 %indvars.iv
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = getelementptr inbounds i8, ptr %83, i64 8
  %85 = load ptr, ptr %84, align 8, !tbaa !17
  %86 = load i64, ptr %83, align 8, !tbaa !20
  %87 = trunc i64 %86 to i32
  call void @printChecksums(ptr noundef %81, ptr noundef %85, i32 noundef %87) #10
  %88 = load ptr, ptr %82, align 8, !tbaa !9
  %89 = getelementptr inbounds i8, ptr %88, i64 8
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  call void @free(ptr noundef %90) #10
  %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_edge56, label %.lr.ph55, !llvm.loop !21

91:                                               ; preds = %.preheader
  %92 = load ptr, ptr @stdin, align 8, !tbaa !9
  %93 = call i32 @ungetc(i32 noundef %50, ptr noundef %92)
  %94 = call i32 @pthread_mutex_lock(ptr noundef nonnull @pool_mutex) #10
  %95 = load i8, ptr @threads, align 1, !tbaa !11
  %96 = icmp eq i8 %95, 0
  br i1 %96, label %.lr.ph58, label %._crit_edge59

.lr.ph58:                                         ; preds = %91, %.lr.ph58
  %97 = call i32 @pthread_cond_wait(ptr noundef nonnull @full_pool, ptr noundef nonnull @pool_mutex) #10
  %98 = load i8, ptr @threads, align 1, !tbaa !11
  %99 = icmp eq i8 %98, 0
  br i1 %99, label %.lr.ph58, label %._crit_edge59, !llvm.loop !22

._crit_edge59:                                    ; preds = %.lr.ph58, %91
  %100 = call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #13
  %101 = load ptr, ptr @stdin, align 8, !tbaa !9
  %102 = call ptr @parseQuery(ptr noundef %101) #10
  store ptr %102, ptr %100, align 8, !tbaa !23
  %103 = getelementptr inbounds i8, ptr %100, i64 8
  store i8 %.038, ptr %103, align 8, !tbaa !25
  %104 = add i8 %.038, 1
  call void @enQueue(ptr noundef nonnull @thread_pool, ptr noundef nonnull %100)
  %105 = load i8, ptr @threads, align 1, !tbaa !11
  %106 = add i8 %105, -1
  store i8 %106, ptr @threads, align 1, !tbaa !11
  %107 = call i32 @pthread_cond_signal(ptr noundef nonnull @empty_pool) #10
  %108 = call i32 @pthread_mutex_unlock(ptr noundef nonnull @pool_mutex) #10
  br label %.preheader.backedge

.preheader.backedge:                              ; preds = %._crit_edge59, %._crit_edge56
  %.038.be = phi i8 [ 0, %._crit_edge56 ], [ %104, %._crit_edge59 ]
  br label %.preheader, !llvm.loop !26

109:                                              ; preds = %51
  %110 = load ptr, ptr %70, align 8, !tbaa !27
  call void @free(ptr noundef %110) #10
  %111 = load ptr, ptr @relations, align 16, !tbaa !9
  call void @free(ptr noundef %111) #10
  br label %112

112:                                              ; preds = %51, %109
  %113 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 8), align 8, !tbaa !9
  %.not45.1 = icmp eq ptr %113, null
  br i1 %.not45.1, label %117, label %114

114:                                              ; preds = %112
  %115 = load ptr, ptr %113, align 8, !tbaa !27
  call void @free(ptr noundef %115) #10
  %116 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 8), align 8, !tbaa !9
  call void @free(ptr noundef %116) #10
  br label %117

117:                                              ; preds = %114, %112
  %118 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 16), align 16, !tbaa !9
  %.not45.2 = icmp eq ptr %118, null
  br i1 %.not45.2, label %122, label %119

119:                                              ; preds = %117
  %120 = load ptr, ptr %118, align 8, !tbaa !27
  call void @free(ptr noundef %120) #10
  %121 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 16), align 16, !tbaa !9
  call void @free(ptr noundef %121) #10
  br label %122

122:                                              ; preds = %119, %117
  %123 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 24), align 8, !tbaa !9
  %.not45.3 = icmp eq ptr %123, null
  br i1 %.not45.3, label %127, label %124

124:                                              ; preds = %122
  %125 = load ptr, ptr %123, align 8, !tbaa !27
  call void @free(ptr noundef %125) #10
  %126 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 24), align 8, !tbaa !9
  call void @free(ptr noundef %126) #10
  br label %127

127:                                              ; preds = %124, %122
  %128 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 32), align 16, !tbaa !9
  %.not45.4 = icmp eq ptr %128, null
  br i1 %.not45.4, label %132, label %129

129:                                              ; preds = %127
  %130 = load ptr, ptr %128, align 8, !tbaa !27
  call void @free(ptr noundef %130) #10
  %131 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 32), align 16, !tbaa !9
  call void @free(ptr noundef %131) #10
  br label %132

132:                                              ; preds = %129, %127
  %133 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 40), align 8, !tbaa !9
  %.not45.5 = icmp eq ptr %133, null
  br i1 %.not45.5, label %137, label %134

134:                                              ; preds = %132
  %135 = load ptr, ptr %133, align 8, !tbaa !27
  call void @free(ptr noundef %135) #10
  %136 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 40), align 8, !tbaa !9
  call void @free(ptr noundef %136) #10
  br label %137

137:                                              ; preds = %134, %132
  %138 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 48), align 16, !tbaa !9
  %.not45.6 = icmp eq ptr %138, null
  br i1 %.not45.6, label %142, label %139

139:                                              ; preds = %137
  %140 = load ptr, ptr %138, align 8, !tbaa !27
  call void @free(ptr noundef %140) #10
  %141 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 48), align 16, !tbaa !9
  call void @free(ptr noundef %141) #10
  br label %142

142:                                              ; preds = %139, %137
  %143 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 56), align 8, !tbaa !9
  %.not45.7 = icmp eq ptr %143, null
  br i1 %.not45.7, label %147, label %144

144:                                              ; preds = %142
  %145 = load ptr, ptr %143, align 8, !tbaa !27
  call void @free(ptr noundef %145) #10
  %146 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 56), align 8, !tbaa !9
  call void @free(ptr noundef %146) #10
  br label %147

147:                                              ; preds = %144, %142
  %148 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 64), align 16, !tbaa !9
  %.not45.8 = icmp eq ptr %148, null
  br i1 %.not45.8, label %152, label %149

149:                                              ; preds = %147
  %150 = load ptr, ptr %148, align 8, !tbaa !27
  call void @free(ptr noundef %150) #10
  %151 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 64), align 16, !tbaa !9
  call void @free(ptr noundef %151) #10
  br label %152

152:                                              ; preds = %149, %147
  %153 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 72), align 8, !tbaa !9
  %.not45.9 = icmp eq ptr %153, null
  br i1 %.not45.9, label %157, label %154

154:                                              ; preds = %152
  %155 = load ptr, ptr %153, align 8, !tbaa !27
  call void @free(ptr noundef %155) #10
  %156 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 72), align 8, !tbaa !9
  call void @free(ptr noundef %156) #10
  br label %157

157:                                              ; preds = %154, %152
  %158 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 80), align 16, !tbaa !9
  %.not45.10 = icmp eq ptr %158, null
  br i1 %.not45.10, label %162, label %159

159:                                              ; preds = %157
  %160 = load ptr, ptr %158, align 8, !tbaa !27
  call void @free(ptr noundef %160) #10
  %161 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 80), align 16, !tbaa !9
  call void @free(ptr noundef %161) #10
  br label %162

162:                                              ; preds = %159, %157
  %163 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 88), align 8, !tbaa !9
  %.not45.11 = icmp eq ptr %163, null
  br i1 %.not45.11, label %167, label %164

164:                                              ; preds = %162
  %165 = load ptr, ptr %163, align 8, !tbaa !27
  call void @free(ptr noundef %165) #10
  %166 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 88), align 8, !tbaa !9
  call void @free(ptr noundef %166) #10
  br label %167

167:                                              ; preds = %164, %162
  %168 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 96), align 16, !tbaa !9
  %.not45.12 = icmp eq ptr %168, null
  br i1 %.not45.12, label %172, label %169

169:                                              ; preds = %167
  %170 = load ptr, ptr %168, align 8, !tbaa !27
  call void @free(ptr noundef %170) #10
  %171 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 96), align 16, !tbaa !9
  call void @free(ptr noundef %171) #10
  br label %172

172:                                              ; preds = %169, %167
  %173 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 104), align 8, !tbaa !9
  %.not45.13 = icmp eq ptr %173, null
  br i1 %.not45.13, label %177, label %174

174:                                              ; preds = %172
  %175 = load ptr, ptr %173, align 8, !tbaa !27
  call void @free(ptr noundef %175) #10
  %176 = load ptr, ptr getelementptr inbounds (i8, ptr @relations, i64 104), align 8, !tbaa !9
  call void @free(ptr noundef %176) #10
  br label %177

177:                                              ; preds = %174, %172
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #10
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %1) #10
  ret i32 0
}

declare i32 @getL2CacheSize() local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strcpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef ptr @fgets(ptr noundef, i32 noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

declare ptr @loadRelation(ptr noundef) local_unnamed_addr #2

declare ptr @gatherStatistics(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: nounwind
declare i32 @pthread_create(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #8

; Function Attrs: nounwind uwtable
declare hidden ptr @query_job(ptr noundef) #0

; Function Attrs: nofree nounwind
declare noundef i32 @fgetc(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i32 @pthread_mutex_lock(ptr noundef) local_unnamed_addr #8

declare i32 @pthread_cond_wait(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @pthread_mutex_unlock(ptr noundef) local_unnamed_addr #8

declare void @printChecksums(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @ungetc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #5

declare ptr @parseQuery(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i32 @pthread_cond_signal(ptr noundef) local_unnamed_addr #8

declare void @destroyStats(ptr noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { noreturn nounwind }
attributes #13 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!15, !10, i64 0}
!15 = !{!"", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!16 = distinct !{!16, !13}
!17 = !{!18, !10, i64 8}
!18 = !{!"results", !19, i64 0, !10, i64 8}
!19 = !{!"long", !7, i64 0}
!20 = !{!18, !19, i64 0}
!21 = distinct !{!21, !13}
!22 = distinct !{!22, !13}
!23 = !{!24, !10, i64 0}
!24 = !{!"query_job", !10, i64 0, !7, i64 8}
!25 = !{!24, !7, i64 8}
!26 = distinct !{!26, !13}
!27 = !{!28, !10, i64 0}
!28 = !{!"relation", !10, i64 0, !19, i64 8, !19, i64 16}


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