; LLVM IR from recrsn/tinydb :: database (single_query)

; 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.query = type { i32, i32, i32, [32 x ptr], [32 x %struct.query_field], [32 x %struct.query_condition] }
%struct.query_field = type { [32 x i8], [32 x i8], i32 }
%struct.query_condition = type { %struct.literal, %struct.literal, i32, i32 }
%struct.literal = type { i32, [2048 x i8], ptr, i32 }
%struct.table = type { %struct.table_info, i8, ptr, ptr }
%struct.table_info = type { [32 x i8], i32, [32 x %struct.field], i64 }
%struct.field = type { [32 x i8], i64, i32 }

@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [1 x i8], align 1

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @decode_field(ptr noundef, ptr noundef, i32 noundef) #2

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @read_field(ptr noundef, ptr noundef, i64 noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @index_query(ptr noundef byval(%struct.query) align 8) #2

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

declare i32 @puts(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @single_query(ptr noundef byval(%struct.query) align 8 %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca [2048 x i8], align 16
  %6 = alloca i64, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca [2048 x i8], align 16
  %10 = alloca [2048 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i32, align 4
  %15 = alloca [2048 x i8], align 16
  %16 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %17 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 3
  %18 = getelementptr inbounds [32 x ptr], ptr %17, i64 0, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %19, ptr %3, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.table, ptr %20, i32 0, i32 1
  %22 = load i8, ptr %21, align 8, !tbaa !9, !range !15, !noundef !16
  %23 = trunc i8 %22 to i1
  br i1 %23, label %24, label %26

24:                                               ; preds = %1
  %25 = call zeroext i1 @index_query(ptr noundef byval(%struct.query) align 8 %0)
  store i1 %25, ptr %2, align 1
  store i32 1, ptr %4, align 4
  br label %236

26:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 2048, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !17
  br label %27

27:                                               ; preds = %232, %26
  %28 = load i64, ptr %6, align 8, !tbaa !17
  %29 = load ptr, ptr %3, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.table, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %struct.table_info, ptr %30, i32 0, i32 3
  %32 = load i64, ptr %31, align 8, !tbaa !18
  %33 = icmp ult i64 %28, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %27
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %235

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 1, ptr %7, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !20
  br label %36

36:                                               ; preds = %177, %35
  %37 = load i32, ptr %8, align 4, !tbaa !20
  %38 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 2
  %39 = load i32, ptr %38, align 8, !tbaa !21
  %40 = icmp slt i32 %37, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %36
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %180

42:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 2048, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 2048, ptr %10) #5
  %43 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %44 = load i32, ptr %8, align 4, !tbaa !20
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds [32 x %struct.query_condition], ptr %43, i64 0, i64 %45
  %47 = getelementptr inbounds %struct.query_condition, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %struct.literal, ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !23
  %50 = icmp eq i32 %49, 1
  br i1 %50, label %51, label %80

51:                                               ; preds = %42
  %52 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %53 = load ptr, ptr %3, align 8, !tbaa !5
  %54 = load i64, ptr %6, align 8, !tbaa !17
  %55 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %56 = load i32, ptr %8, align 4, !tbaa !20
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [32 x %struct.query_condition], ptr %55, i64 0, i64 %57
  %59 = getelementptr inbounds %struct.query_condition, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.literal, ptr %59, i32 0, i32 3
  %61 = load i32, ptr %60, align 8, !tbaa !26
  %62 = call zeroext i1 @read_field(ptr noundef %52, ptr noundef %53, i64 noundef %54, i32 noundef %61)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.table, ptr %63, i32 0, i32 0
  %65 = getelementptr inbounds %struct.table_info, ptr %64, i32 0, i32 2
  %66 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %67 = load i32, ptr %8, align 4, !tbaa !20
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [32 x %struct.query_condition], ptr %66, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.query_condition, ptr %69, i32 0, i32 0
  %71 = getelementptr inbounds %struct.literal, ptr %70, i32 0, i32 3
  %72 = load i32, ptr %71, align 8, !tbaa !26
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [32 x %struct.field], ptr %65, i64 0, i64 %73
  %75 = getelementptr inbounds %struct.field, ptr %74, i32 0, i32 2
  %76 = load i32, ptr %75, align 8, !tbaa !27
  store i32 %76, ptr %11, align 4, !tbaa !20
  %77 = getelementptr inbounds [2048 x i8], ptr %9, i64 0, i64 0
  %78 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %79 = load i32, ptr %11, align 4, !tbaa !20
  call void @decode_field(ptr noundef %77, ptr noundef %78, i32 noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %94

80:                                               ; preds = %42
  %81 = getelementptr inbounds [2048 x i8], ptr %9, i64 0, i64 0
  %82 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %83 = load i32, ptr %8, align 4, !tbaa !20
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [32 x %struct.query_condition], ptr %82, i64 0, i64 %84
  %86 = getelementptr inbounds %struct.query_condition, ptr %85, i32 0, i32 0
  %87 = getelementptr inbounds %struct.literal, ptr %86, i32 0, i32 1
  %88 = getelementptr inbounds [2048 x i8], ptr %87, i64 0, i64 0
  %89 = call ptr @strcpy(ptr noundef %81, ptr noundef %88) #5
  %90 = getelementptr inbounds [2048 x i8], ptr %9, i64 0, i64 0
  %91 = call i64 @strlen(ptr noundef %90) #6
  %92 = sub i64 %91, 1
  %93 = getelementptr inbounds [2048 x i8], ptr %9, i64 0, i64 %92
  store i8 0, ptr %93, align 1, !tbaa !29
  br label %94

94:                                               ; preds = %80, %51
  %95 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %96 = load i32, ptr %8, align 4, !tbaa !20
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [32 x %struct.query_condition], ptr %95, i64 0, i64 %97
  %99 = getelementptr inbounds %struct.query_condition, ptr %98, i32 0, i32 1
  %100 = getelementptr inbounds %struct.literal, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !30
  %102 = icmp eq i32 %101, 1
  br i1 %102, label %103, label %132

103:                                              ; preds = %94
  %104 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = load i64, ptr %6, align 8, !tbaa !17
  %107 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %108 = load i32, ptr %8, align 4, !tbaa !20
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [32 x %struct.query_condition], ptr %107, i64 0, i64 %109
  %111 = getelementptr inbounds %struct.query_condition, ptr %110, i32 0, i32 1
  %112 = getelementptr inbounds %struct.literal, ptr %111, i32 0, i32 3
  %113 = load i32, ptr %112, align 8, !tbaa !31
  %114 = call zeroext i1 @read_field(ptr noundef %104, ptr noundef %105, i64 noundef %106, i32 noundef %113)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.table, ptr %115, i32 0, i32 0
  %117 = getelementptr inbounds %struct.table_info, ptr %116, i32 0, i32 2
  %118 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %119 = load i32, ptr %8, align 4, !tbaa !20
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [32 x %struct.query_condition], ptr %118, i64 0, i64 %120
  %122 = getelementptr inbounds %struct.query_condition, ptr %121, i32 0, i32 1
  %123 = getelementptr inbounds %struct.literal, ptr %122, i32 0, i32 3
  %124 = load i32, ptr %123, align 8, !tbaa !31
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [32 x %struct.field], ptr %117, i64 0, i64 %125
  %127 = getelementptr inbounds %struct.field, ptr %126, i32 0, i32 2
  %128 = load i32, ptr %127, align 8, !tbaa !27
  store i32 %128, ptr %12, align 4, !tbaa !20
  %129 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  %130 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %131 = load i32, ptr %12, align 4, !tbaa !20
  call void @decode_field(ptr noundef %129, ptr noundef %130, i32 noundef %131)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %142

132:                                              ; preds = %94
  %133 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  %134 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %135 = load i32, ptr %8, align 4, !tbaa !20
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [32 x %struct.query_condition], ptr %134, i64 0, i64 %136
  %138 = getelementptr inbounds %struct.query_condition, ptr %137, i32 0, i32 1
  %139 = getelementptr inbounds %struct.literal, ptr %138, i32 0, i32 1
  %140 = getelementptr inbounds [2048 x i8], ptr %139, i64 0, i64 0
  %141 = call ptr @strcpy(ptr noundef %133, ptr noundef %140) #5
  br label %142

142:                                              ; preds = %132, %103
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #5
  %143 = getelementptr inbounds [2048 x i8], ptr %9, i64 0, i64 0
  %144 = getelementptr inbounds [2048 x i8], ptr %10, i64 0, i64 0
  %145 = call i32 @strcmp(ptr noundef %143, ptr noundef %144) #6
  %146 = icmp eq i32 %145, 0
  %147 = zext i1 %146 to i8
  store i8 %147, ptr %13, align 1, !tbaa !19
  %148 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 5
  %149 = load i32, ptr %8, align 4, !tbaa !20
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [32 x %struct.query_condition], ptr %148, i64 0, i64 %150
  %152 = getelementptr inbounds %struct.query_condition, ptr %151, i32 0, i32 2
  %153 = load i32, ptr %152, align 8, !tbaa !32
  %154 = icmp eq i32 %153, 1
  br i1 %154, label %155, label %164

155:                                              ; preds = %142
  %156 = load i8, ptr %7, align 1, !tbaa !19, !range !15, !noundef !16
  %157 = trunc i8 %156 to i1
  br i1 %157, label %158, label %161

158:                                              ; preds = %155
  %159 = load i8, ptr %13, align 1, !tbaa !19, !range !15, !noundef !16
  %160 = trunc i8 %159 to i1
  br label %161

161:                                              ; preds = %158, %155
  %162 = phi i1 [ false, %155 ], [ %160, %158 ]
  %163 = zext i1 %162 to i32
  br label %173

164:                                              ; preds = %142
  %165 = load i8, ptr %7, align 1, !tbaa !19, !range !15, !noundef !16
  %166 = trunc i8 %165 to i1
  br i1 %166, label %170, label %167

167:                                              ; preds = %164
  %168 = load i8, ptr %13, align 1, !tbaa !19, !range !15, !noundef !16
  %169 = trunc i8 %168 to i1
  br label %170

170:                                              ; preds = %167, %164
  %171 = phi i1 [ true, %164 ], [ %169, %167 ]
  %172 = zext i1 %171 to i32
  br label %173

173:                                              ; preds = %170, %161
  %174 = phi i32 [ %163, %161 ], [ %172, %170 ]
  %175 = icmp ne i32 %174, 0
  %176 = zext i1 %175 to i8
  store i8 %176, ptr %7, align 1, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %9) #5
  br label %177

177:                                              ; preds = %173
  %178 = load i32, ptr %8, align 4, !tbaa !20
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %8, align 4, !tbaa !20
  br label %36, !llvm.loop !33

180:                                              ; preds = %41
  %181 = load i8, ptr %7, align 1, !tbaa !19, !range !15, !noundef !16
  %182 = trunc i8 %181 to i1
  br i1 %182, label %184, label %183

183:                                              ; preds = %180
  store i32 4, ptr %4, align 4
  br label %229

184:                                              ; preds = %180
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !20
  br label %185

185:                                              ; preds = %224, %184
  %186 = load i32, ptr %14, align 4, !tbaa !20
  %187 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 1
  %188 = load i32, ptr %187, align 4, !tbaa !35
  %189 = icmp slt i32 %186, %188
  br i1 %189, label %191, label %190

190:                                              ; preds = %185
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %227

191:                                              ; preds = %185
  call void @llvm.lifetime.start.p0(i64 2048, ptr %15) #5
  %192 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %193 = load ptr, ptr %3, align 8, !tbaa !5
  %194 = load i64, ptr %6, align 8, !tbaa !17
  %195 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 4
  %196 = load i32, ptr %14, align 4, !tbaa !20
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [32 x %struct.query_field], ptr %195, i64 0, i64 %197
  %199 = getelementptr inbounds %struct.query_field, ptr %198, i32 0, i32 2
  %200 = load i32, ptr %199, align 4, !tbaa !36
  %201 = call zeroext i1 @read_field(ptr noundef %192, ptr noundef %193, i64 noundef %194, i32 noundef %200)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %202 = load ptr, ptr %3, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.table, ptr %202, i32 0, i32 0
  %204 = getelementptr inbounds %struct.table_info, ptr %203, i32 0, i32 2
  %205 = getelementptr inbounds %struct.query, ptr %0, i32 0, i32 4
  %206 = load i32, ptr %14, align 4, !tbaa !20
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [32 x %struct.query_field], ptr %205, i64 0, i64 %207
  %209 = getelementptr inbounds %struct.query_field, ptr %208, i32 0, i32 2
  %210 = load i32, ptr %209, align 4, !tbaa !36
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [32 x %struct.field], ptr %204, i64 0, i64 %211
  %213 = getelementptr inbounds %struct.field, ptr %212, i32 0, i32 2
  %214 = load i32, ptr %213, align 8, !tbaa !27
  store i32 %214, ptr %16, align 4, !tbaa !20
  %215 = getelementptr inbounds [2048 x i8], ptr %15, i64 0, i64 0
  %216 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %217 = load i32, ptr %16, align 4, !tbaa !20
  call void @decode_field(ptr noundef %215, ptr noundef %216, i32 noundef %217)
  %218 = load i32, ptr %14, align 4, !tbaa !20
  %219 = icmp eq i32 %218, 0
  %220 = zext i1 %219 to i64
  %221 = select i1 %219, ptr @.str.18, ptr @.str.14
  %222 = getelementptr inbounds [2048 x i8], ptr %15, i64 0, i64 0
  %223 = call i32 (ptr, ...) @printf(ptr noundef @.str.17, ptr noundef %221, ptr noundef %222)
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr %15) #5
  br label %224

224:                                              ; preds = %191
  %225 = load i32, ptr %14, align 4, !tbaa !20
  %226 = add nsw i32 %225, 1
  store i32 %226, ptr %14, align 4, !tbaa !20
  br label %185, !llvm.loop !38

227:                                              ; preds = %190
  %228 = call i32 @puts(ptr noundef @.str.18)
  store i32 0, ptr %4, align 4
  br label %229

229:                                              ; preds = %227, %183
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  %230 = load i32, ptr %4, align 4
  switch i32 %230, label %238 [
    i32 0, label %231
    i32 4, label %232
  ]

231:                                              ; preds = %229
  br label %232

232:                                              ; preds = %231, %229
  %233 = load i64, ptr %6, align 8, !tbaa !17
  %234 = add i64 %233, 1
  store i64 %234, ptr %6, align 8, !tbaa !17
  br label %27, !llvm.loop !39

235:                                              ; preds = %34
  store i1 true, ptr %2, align 1
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 2048, ptr %5) #5
  br label %236

236:                                              ; preds = %235, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %237 = load i1, ptr %2, align 1
  ret i1 %237

238:                                              ; preds = %229
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind "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 = { "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 willreturn memory(read) }

!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, !14, i64 1584}
!10 = !{!"", !11, i64 0, !14, i64 1584, !6, i64 1592, !6, i64 1600}
!11 = !{!"", !7, i64 0, !12, i64 32, !7, i64 40, !13, i64 1576}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!13, !13, i64 0}
!18 = !{!10, !13, i64 1576}
!19 = !{!14, !14, i64 0}
!20 = !{!12, !12, i64 0}
!21 = !{!22, !12, i64 8}
!22 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !7, i64 16, !7, i64 272, !7, i64 2448}
!23 = !{!24, !12, i64 0}
!24 = !{!"", !25, i64 0, !25, i64 2072, !12, i64 4144, !12, i64 4148}
!25 = !{!"", !12, i64 0, !7, i64 4, !6, i64 2056, !12, i64 2064}
!26 = !{!24, !12, i64 2064}
!27 = !{!28, !12, i64 40}
!28 = !{!"", !7, i64 0, !13, i64 32, !12, i64 40}
!29 = !{!7, !7, i64 0}
!30 = !{!24, !12, i64 2072}
!31 = !{!24, !12, i64 4136}
!32 = !{!24, !12, i64 4144}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = !{!22, !12, i64 4}
!36 = !{!37, !12, i64 64}
!37 = !{!"", !7, i64 0, !7, i64 32, !12, i64 64}
!38 = distinct !{!38, !34}
!39 = distinct !{!39, !34}


; 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.query = type { i32, i32, i32, [32 x ptr], [32 x %struct.query_field], [32 x %struct.query_condition] }
%struct.query_field = type { [32 x i8], [32 x i8], i32 }
%struct.query_condition = type { %struct.literal, %struct.literal, i32, i32 }
%struct.literal = type { i32, [2048 x i8], ptr, i32 }
%struct.field = type { [32 x i8], i64, i32 }

@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [1 x i8], align 1

; 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local void @decode_field(ptr noundef, ptr noundef, i32 noundef) 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: nounwind uwtable
declare dso_local zeroext i1 @read_field(ptr noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @index_query(ptr noundef byval(%struct.query) align 8) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @single_query(ptr noundef byval(%struct.query) align 8 %0) local_unnamed_addr #2 {
  %2 = alloca [2048 x i8], align 16
  %3 = alloca [2048 x i8], align 16
  %4 = alloca [2048 x i8], align 16
  %5 = alloca [2048 x i8], align 16
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 1584
  %9 = load i8, ptr %8, align 8, !tbaa !9, !range !15, !noundef !16
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %11, label %13

11:                                               ; preds = %1
  %12 = tail call zeroext i1 @index_query(ptr noundef nonnull byval(%struct.query) align 8 %0)
  br label %88

13:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %2) #5
  %14 = getelementptr inbounds i8, ptr %7, i64 1576
  %15 = load i64, ptr %14, align 8, !tbaa !17
  %.not = icmp eq i64 %15, 0
  br i1 %.not, label %._crit_edge49, label %.preheader41.lr.ph

.preheader41.lr.ph:                               ; preds = %13
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = getelementptr inbounds i8, ptr %0, i64 2448
  %18 = getelementptr inbounds i8, ptr %7, i64 40
  %19 = getelementptr inbounds i8, ptr %0, i64 4
  %20 = getelementptr inbounds i8, ptr %0, i64 272
  %.pre = load i32, ptr %16, align 8, !tbaa !18
  %21 = icmp sgt i32 %.pre, 0
  %22 = zext nneg i32 %.pre to i64
  %23 = getelementptr inbounds i8, ptr %0, i64 336
  br label %.preheader41

.preheader41:                                     ; preds = %.preheader41.lr.ph, %84
  %.03847 = phi i64 [ 0, %.preheader41.lr.ph ], [ %85, %84 ]
  br i1 %21, label %.lr.ph, label %.preheader

._crit_edge49:                                    ; preds = %84, %13
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %2) #5
  br label %88

._crit_edge:                                      ; preds = %73
  br i1 %.in, label %.preheader, label %84

.preheader:                                       ; preds = %.preheader41, %._crit_edge
  %24 = load i32, ptr %19, align 4, !tbaa !20
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %.lr.ph45.preheader, label %._crit_edge46

.lr.ph45.preheader:                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #5
  %26 = load i32, ptr %23, align 8, !tbaa !21
  %27 = call zeroext i1 @read_field(ptr noundef nonnull %2, ptr noundef %7, i64 noundef %.03847, i32 noundef %26)
  %28 = sext i32 %26 to i64
  %29 = getelementptr inbounds [32 x %struct.field], ptr %18, i64 0, i64 %28, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !23
  call void @decode_field(ptr noundef nonnull %5, ptr noundef nonnull %2, i32 noundef %30)
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef nonnull @.str.18, ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #5
  %32 = zext nneg i32 %24 to i64
  %.not54 = icmp eq i32 %24, 1
  br i1 %.not54, label %._crit_edge46, label %.lr.ph45

.lr.ph:                                           ; preds = %.preheader41, %73
  %indvars.iv = phi i64 [ %indvars.iv.next, %73 ], [ 0, %.preheader41 ]
  %.03943 = phi i1 [ %.in, %73 ], [ true, %.preheader41 ]
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %4) #5
  %33 = getelementptr inbounds [32 x %struct.query_condition], ptr %17, i64 0, i64 %indvars.iv
  %34 = load i32, ptr %33, align 8, !tbaa !25
  %35 = icmp eq i32 %34, 1
  br i1 %35, label %36, label %43

36:                                               ; preds = %.lr.ph
  %37 = getelementptr inbounds i8, ptr %33, i64 2064
  %38 = load i32, ptr %37, align 8, !tbaa !28
  %39 = call zeroext i1 @read_field(ptr noundef nonnull %2, ptr noundef %7, i64 noundef %.03847, i32 noundef %38)
  %40 = sext i32 %38 to i64
  %41 = getelementptr inbounds [32 x %struct.field], ptr %18, i64 0, i64 %40, i32 2
  %42 = load i32, ptr %41, align 8, !tbaa !23
  call void @decode_field(ptr noundef nonnull %3, ptr noundef nonnull %2, i32 noundef %42)
  br label %49

43:                                               ; preds = %.lr.ph
  %44 = getelementptr inbounds i8, ptr %33, i64 4
  %45 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) %44) #5
  %46 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %3) #6
  %47 = add i64 %46, -1
  %48 = getelementptr inbounds [2048 x i8], ptr %3, i64 0, i64 %47
  store i8 0, ptr %48, align 1, !tbaa !29
  br label %49

49:                                               ; preds = %43, %36
  %50 = getelementptr inbounds i8, ptr %33, i64 2072
  %51 = load i32, ptr %50, align 8, !tbaa !30
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %53, label %60

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %33, i64 4136
  %55 = load i32, ptr %54, align 8, !tbaa !31
  %56 = call zeroext i1 @read_field(ptr noundef nonnull %2, ptr noundef %7, i64 noundef %.03847, i32 noundef %55)
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [32 x %struct.field], ptr %18, i64 0, i64 %57, i32 2
  %59 = load i32, ptr %58, align 8, !tbaa !23
  call void @decode_field(ptr noundef nonnull %4, ptr noundef nonnull %2, i32 noundef %59)
  br label %63

60:                                               ; preds = %49
  %61 = getelementptr inbounds i8, ptr %33, i64 2076
  %62 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) %61) #5
  br label %63

63:                                               ; preds = %60, %53
  %64 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %3, ptr noundef nonnull dereferenceable(1) %4) #6
  %65 = icmp eq i32 %64, 0
  %66 = getelementptr inbounds i8, ptr %33, i64 4144
  %67 = load i32, ptr %66, align 8, !tbaa !32
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %71

69:                                               ; preds = %63
  %70 = select i1 %.03943, i1 %65, i1 false
  br label %73

71:                                               ; preds = %63
  %72 = select i1 %.03943, i1 true, i1 %65
  br label %73

73:                                               ; preds = %71, %69
  %.in = phi i1 [ %70, %69 ], [ %72, %71 ]
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %3) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %74 = icmp ult i64 %indvars.iv.next, %22
  br i1 %74, label %.lr.ph, label %._crit_edge, !llvm.loop !33

._crit_edge46:                                    ; preds = %.lr.ph45, %.lr.ph45.preheader, %.preheader
  %75 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.18)
  br label %84

.lr.ph45:                                         ; preds = %.lr.ph45.preheader, %.lr.ph45
  %indvars.iv50 = phi i64 [ %indvars.iv.next51, %.lr.ph45 ], [ 1, %.lr.ph45.preheader ]
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #5
  %76 = getelementptr inbounds [32 x %struct.query_field], ptr %20, i64 0, i64 %indvars.iv50, i32 2
  %77 = load i32, ptr %76, align 4, !tbaa !21
  %78 = call zeroext i1 @read_field(ptr noundef nonnull %2, ptr noundef nonnull %7, i64 noundef %.03847, i32 noundef %77)
  %79 = sext i32 %77 to i64
  %80 = getelementptr inbounds [32 x %struct.field], ptr %18, i64 0, i64 %79, i32 2
  %81 = load i32, ptr %80, align 8, !tbaa !23
  call void @decode_field(ptr noundef nonnull %5, ptr noundef nonnull %2, i32 noundef %81)
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17, ptr noundef nonnull @.str.14, ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #5
  %indvars.iv.next51 = add nuw nsw i64 %indvars.iv50, 1
  %83 = icmp ult i64 %indvars.iv.next51, %32
  br i1 %83, label %.lr.ph45, label %._crit_edge46, !llvm.loop !35

84:                                               ; preds = %._crit_edge, %._crit_edge46
  %85 = add nuw i64 %.03847, 1
  %86 = load i64, ptr %14, align 8, !tbaa !17
  %87 = icmp ult i64 %85, %86
  br i1 %87, label %.preheader41, label %._crit_edge49, !llvm.loop !37

88:                                               ; preds = %._crit_edge49, %11
  %.0 = phi i1 [ %12, %11 ], [ true, %._crit_edge49 ]
  ret i1 %.0
}

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

!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, !14, i64 1584}
!10 = !{!"", !11, i64 0, !14, i64 1584, !6, i64 1592, !6, i64 1600}
!11 = !{!"", !7, i64 0, !12, i64 32, !7, i64 40, !13, i64 1576}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = !{!10, !13, i64 1576}
!18 = !{!19, !12, i64 8}
!19 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8, !7, i64 16, !7, i64 272, !7, i64 2448}
!20 = !{!19, !12, i64 4}
!21 = !{!22, !12, i64 64}
!22 = !{!"", !7, i64 0, !7, i64 32, !12, i64 64}
!23 = !{!24, !12, i64 40}
!24 = !{!"", !7, i64 0, !13, i64 32, !12, i64 40}
!25 = !{!26, !12, i64 0}
!26 = !{!"", !27, i64 0, !27, i64 2072, !12, i64 4144, !12, i64 4148}
!27 = !{!"", !12, i64 0, !7, i64 4, !6, i64 2056, !12, i64 2064}
!28 = !{!26, !12, i64 2064}
!29 = !{!7, !7, i64 0}
!30 = !{!26, !12, i64 2072}
!31 = !{!26, !12, i64 4136}
!32 = !{!26, !12, i64 4144}
!33 = distinct !{!33, !34}
!34 = !{!"llvm.loop.mustprogress"}
!35 = distinct !{!35, !34, !36}
!36 = !{!"llvm.loop.peeled.count", i32 1}
!37 = distinct !{!37, !34}


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