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

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

@stdin = external global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @str_trim(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
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #2

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

declare i32 @fclose(ptr noundef) #3

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local i32 @table_find_field(ptr noundef byval(%struct.table_info) align 8, ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @row_size(ptr noundef byval(%struct.table_info) align 8) #0

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

; Function Attrs: nounwind
declare i32 @__isoc99_sscanf(ptr noundef, ptr noundef, ...) #2

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

; Function Attrs: nounwind
declare ptr @strtok(ptr noundef, ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @create_temp_table(i32 noundef, ptr noundef, i64 noundef) #0

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

declare i32 @fputs(ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @parse_create_index(ptr noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca [32 x i8], align 16
  %5 = alloca [2048 x i8], align 16
  %6 = alloca [32 x i8], align 16
  %7 = alloca [2048 x i8], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca [32 x i32], align 16
  %12 = alloca [32 x %struct.field], align 16
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca [2048 x i8], align 16
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca [4096 x i8], align 16
  %21 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 2048, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 2048, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %24 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %25 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %22, ptr noundef @.str.37, ptr noundef %23, ptr noundef %24) #6
  store i32 %25, ptr %8, align 4, !tbaa !9
  %26 = load i32, ptr %8, align 4, !tbaa !9
  %27 = icmp ne i32 %26, 2
  br i1 %27, label %28, label %29

28:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %192

29:                                               ; preds = %1
  %30 = getelementptr inbounds [2048 x i8], ptr %7, i64 0, i64 0
  %31 = load ptr, ptr @stdin, align 8, !tbaa !5
  %32 = call ptr @fgets(ptr noundef %30, i32 noundef 2048, ptr noundef %31)
  %33 = getelementptr inbounds [2048 x i8], ptr %7, i64 0, i64 0
  %34 = call ptr @str_trim(ptr noundef %33)
  %35 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 0
  %36 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %34, ptr noundef @.str.38, ptr noundef %35) #6
  store i32 %36, ptr %8, align 4, !tbaa !9
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = icmp ne i32 %37, 1
  br i1 %38, label %39, label %40

39:                                               ; preds = %29
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %192

40:                                               ; preds = %29
  %41 = getelementptr inbounds [2048 x i8], ptr %7, i64 0, i64 0
  %42 = load ptr, ptr @stdin, align 8, !tbaa !5
  %43 = call ptr @fgets(ptr noundef %41, i32 noundef 2048, ptr noundef %42)
  %44 = getelementptr inbounds [2048 x i8], ptr %7, i64 0, i64 0
  %45 = call ptr @str_trim(ptr noundef %44)
  %46 = call i32 @strcmp(ptr noundef @.str.12, ptr noundef %45) #7
  %47 = icmp ne i32 %46, 0
  br i1 %47, label %48, label %52

48:                                               ; preds = %40
  %49 = load ptr, ptr @stderr, align 8, !tbaa !5
  %50 = getelementptr inbounds [2048 x i8], ptr %7, i64 0, i64 0
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.39, ptr noundef %50) #6
  br label %52

52:                                               ; preds = %48, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %53 = getelementptr inbounds [32 x i8], ptr %4, i64 0, i64 0
  %54 = call ptr @open_table(ptr noundef %53)
  store ptr %54, ptr %10, align 8, !tbaa !5
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %60

57:                                               ; preds = %52
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call i32 @fputs(ptr noundef @.str.40, ptr noundef %58)
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %191

60:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 128, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 1536, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %61 = getelementptr inbounds [2048 x i8], ptr %5, i64 0, i64 0
  %62 = call ptr @strtok(ptr noundef %61, ptr noundef @.str.14) #6
  store ptr %62, ptr %14, align 8, !tbaa !5
  br label %63

63:                                               ; preds = %94, %60
  %64 = load ptr, ptr %14, align 8, !tbaa !5
  %65 = icmp ne ptr %64, null
  br i1 %65, label %66, label %95

66:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %67 = load ptr, ptr %10, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.table, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %14, align 8, !tbaa !5
  %70 = call ptr @str_trim(ptr noundef %69)
  %71 = call i32 @table_find_field(ptr noundef byval(%struct.table_info) align 8 %68, ptr noundef %70)
  store i32 %71, ptr %15, align 4, !tbaa !9
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = icmp ne i32 %72, -1
  br i1 %73, label %74, label %89

74:                                               ; preds = %66
  %75 = load i32, ptr %15, align 4, !tbaa !9
  %76 = load i32, ptr %13, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [32 x i32], ptr %11, i64 0, i64 %77
  store i32 %75, ptr %78, align 4, !tbaa !9
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %13, align 4, !tbaa !9
  %81 = sext i32 %79 to i64
  %82 = getelementptr inbounds [32 x %struct.field], ptr %12, i64 0, i64 %81
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.table, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.table_info, ptr %84, i32 0, i32 2
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [32 x %struct.field], ptr %85, i64 0, i64 %87
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %82, ptr align 8 %88, i64 48, i1 false), !tbaa.struct !11
  br label %90

89:                                               ; preds = %66
  store i1 false, ptr %2, align 1
  store i32 1, ptr %9, align 4
  br label %92

90:                                               ; preds = %74
  %91 = call ptr @strtok(ptr noundef null, ptr noundef @.str.14) #6
  store ptr %91, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %9, align 4
  br label %92

92:                                               ; preds = %90, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  %93 = load i32, ptr %9, align 4
  switch i32 %93, label %190 [
    i32 0, label %94
  ]

94:                                               ; preds = %92
  br label %63, !llvm.loop !15

95:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %96 = load i32, ptr %13, align 4, !tbaa !9
  %97 = getelementptr inbounds [32 x %struct.field], ptr %12, i64 0, i64 0
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.table, ptr %98, i32 0, i32 0
  %100 = getelementptr inbounds %struct.table_info, ptr %99, i32 0, i32 3
  %101 = load i64, ptr %100, align 8, !tbaa !17
  %102 = call ptr @create_temp_table(i32 noundef %96, ptr noundef %97, i64 noundef %101)
  store ptr %102, ptr %16, align 8, !tbaa !5
  %103 = load ptr, ptr %10, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.table, ptr %103, i32 0, i32 0
  %105 = getelementptr inbounds %struct.table_info, ptr %104, i32 0, i32 3
  %106 = load i64, ptr %105, align 8, !tbaa !17
  %107 = load ptr, ptr %16, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.table, ptr %107, i32 0, i32 0
  %109 = getelementptr inbounds %struct.table_info, ptr %108, i32 0, i32 3
  store i64 %106, ptr %109, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 2048, ptr %17) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  store i32 0, ptr %18, align 4, !tbaa !9
  br label %110

110:                                              ; preds = %144, %95
  %111 = load i32, ptr %18, align 4, !tbaa !9
  %112 = sext i32 %111 to i64
  %113 = load ptr, ptr %16, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.table, ptr %113, i32 0, i32 0
  %115 = getelementptr inbounds %struct.table_info, ptr %114, i32 0, i32 3
  %116 = load i64, ptr %115, align 8, !tbaa !17
  %117 = icmp ult i64 %112, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %110
  store i32 4, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  br label %147

119:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %120

120:                                              ; preds = %140, %119
  %121 = load i32, ptr %19, align 4, !tbaa !9
  %122 = load i32, ptr %13, align 4, !tbaa !9
  %123 = icmp slt i32 %121, %122
  br i1 %123, label %125, label %124

124:                                              ; preds = %120
  store i32 7, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %143

125:                                              ; preds = %120
  %126 = getelementptr inbounds [2048 x i8], ptr %17, i64 0, i64 0
  %127 = load ptr, ptr %10, align 8, !tbaa !5
  %128 = load i32, ptr %18, align 4, !tbaa !9
  %129 = sext i32 %128 to i64
  %130 = load i32, ptr %19, align 4, !tbaa !9
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [32 x i32], ptr %11, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !9
  %134 = call zeroext i1 @read_field(ptr noundef %126, ptr noundef %127, i64 noundef %129, i32 noundef %133)
  %135 = load ptr, ptr %16, align 8, !tbaa !5
  %136 = load i32, ptr %18, align 4, !tbaa !9
  %137 = sext i32 %136 to i64
  %138 = load i32, ptr %19, align 4, !tbaa !9
  %139 = getelementptr inbounds [2048 x i8], ptr %17, i64 0, i64 0
  call void @set_temp_table_field(ptr noundef %135, i64 noundef %137, i32 noundef %138, ptr noundef %139)
  br label %140

140:                                              ; preds = %125
  %141 = load i32, ptr %19, align 4, !tbaa !9
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %19, align 4, !tbaa !9
  br label %120, !llvm.loop !21

143:                                              ; preds = %124
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %18, align 4, !tbaa !9
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %18, align 4, !tbaa !9
  br label %110, !llvm.loop !22

147:                                              ; preds = %118
  %148 = load ptr, ptr %16, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.table, ptr %148, i32 0, i32 3
  %150 = load ptr, ptr %149, align 8, !tbaa !23
  %151 = load ptr, ptr %16, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.table, ptr %151, i32 0, i32 0
  %153 = getelementptr inbounds %struct.table_info, ptr %152, i32 0, i32 3
  %154 = load i64, ptr %153, align 8, !tbaa !17
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = getelementptr inbounds %struct.table, ptr %155, i32 0, i32 0
  %157 = call i64 @row_size(ptr noundef byval(%struct.table_info) align 8 %156)
  call void @qsort(ptr noundef %150, i64 noundef %154, i64 noundef %157, ptr noundef @strcmp_wrapper)
  call void @llvm.lifetime.start.p0(i64 4096, ptr %20) #6
  %158 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %159 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %160 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %158, ptr noundef @.str.22, ptr noundef %159) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %161 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %162 = call noalias ptr @fopen(ptr noundef %161, ptr noundef @.str.41)
  store ptr %162, ptr %21, align 8, !tbaa !5
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.table, ptr %163, i32 0, i32 0
  %165 = load ptr, ptr %21, align 8, !tbaa !5
  %166 = call i64 @fwrite(ptr noundef %164, i64 noundef 1584, i64 noundef 1, ptr noundef %165)
  %167 = load ptr, ptr %21, align 8, !tbaa !5
  %168 = call i32 @fclose(ptr noundef %167)
  %169 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %170 = getelementptr inbounds [32 x i8], ptr %6, i64 0, i64 0
  %171 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %169, ptr noundef @.str.23, ptr noundef %170) #6
  %172 = getelementptr inbounds [4096 x i8], ptr %20, i64 0, i64 0
  %173 = call noalias ptr @fopen(ptr noundef %172, ptr noundef @.str.41)
  store ptr %173, ptr %21, align 8, !tbaa !5
  %174 = load ptr, ptr %16, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.table, ptr %174, i32 0, i32 3
  %176 = load ptr, ptr %175, align 8, !tbaa !23
  %177 = load ptr, ptr %16, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.table, ptr %177, i32 0, i32 0
  %179 = call i64 @row_size(ptr noundef byval(%struct.table_info) align 8 %178)
  %180 = load ptr, ptr %16, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.table, ptr %180, i32 0, i32 0
  %182 = getelementptr inbounds %struct.table_info, ptr %181, i32 0, i32 3
  %183 = load i64, ptr %182, align 8, !tbaa !17
  %184 = mul i64 %179, %183
  %185 = mul i64 %184, 1
  %186 = load ptr, ptr %21, align 8, !tbaa !5
  %187 = call i64 @fwrite(ptr noundef %176, i64 noundef %185, i64 noundef 1, ptr noundef %186)
  %188 = load ptr, ptr %21, align 8, !tbaa !5
  %189 = call i32 @fclose(ptr noundef %188)
  store i1 true, ptr %2, align 1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4096, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 2048, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  br label %190

190:                                              ; preds = %147, %92
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 1536, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %11) #6
  br label %191

191:                                              ; preds = %190, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %192

192:                                              ; preds = %191, %39, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 2048, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 2048, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr %4) #6
  %193 = load i1, ptr %2, align 1
  ret i1 %193
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

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 = { 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 #3 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 32, !12, i64 32, i64 8, !13, i64 40, i64 4, !9}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !14, i64 1576}
!18 = !{!"", !19, i64 0, !20, i64 1584, !6, i64 1592, !6, i64 1600}
!19 = !{!"", !7, i64 0, !10, i64 32, !7, i64 40, !14, i64 1576}
!20 = !{!"_Bool", !7, i64 0}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = !{!18, !6, i64 1600}


; 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.table_info = type { [32 x i8], i32, [32 x %struct.field], i64 }
%struct.field = type { [32 x i8], i64, i32 }

@stdin = external local_unnamed_addr global ptr, align 8
@.str.12 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.22 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @str_trim(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: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @table_find_field(ptr noundef byval(%struct.table_info) align 8, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @row_size(ptr noundef byval(%struct.table_info) align 8) local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress nofree nounwind willreturn
declare ptr @strtok(ptr noundef, ptr nocapture noundef readonly) local_unnamed_addr #4

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @create_temp_table(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nofree nounwind
declare noundef i32 @fputs(ptr nocapture noundef readonly, ptr nocapture noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @parse_create_index(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = alloca [32 x i8], align 16
  %3 = alloca [2048 x i8], align 16
  %4 = alloca [32 x i8], align 16
  %5 = alloca [2048 x i8], align 16
  %6 = alloca [32 x i32], align 16
  %7 = alloca [32 x %struct.field], align 16
  %8 = alloca [2048 x i8], align 16
  %9 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %3) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %5) #7
  %10 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %0, ptr noundef nonnull @.str.37, ptr noundef nonnull %4, ptr noundef nonnull %3) #7
  %.not = icmp eq i32 %10, 2
  br i1 %.not, label %11, label %70

11:                                               ; preds = %1
  %12 = load ptr, ptr @stdin, align 8, !tbaa !5
  %13 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 2048, ptr noundef %12)
  %14 = call ptr @str_trim(ptr noundef nonnull %5)
  %15 = call i32 (ptr, ptr, ...) @__isoc99_sscanf(ptr noundef %14, ptr noundef nonnull @.str.38, ptr noundef nonnull %2) #7
  %.not52 = icmp eq i32 %15, 1
  br i1 %.not52, label %16, label %70

16:                                               ; preds = %11
  %17 = load ptr, ptr @stdin, align 8, !tbaa !5
  %18 = call ptr @fgets(ptr noundef nonnull %5, i32 noundef 2048, ptr noundef %17)
  %19 = call ptr @str_trim(ptr noundef nonnull %5)
  %20 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) @.str.12, ptr noundef nonnull dereferenceable(1) %19) #8
  %.not53 = icmp eq i32 %20, 0
  br i1 %.not53, label %24, label %21

21:                                               ; preds = %16
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str.39, ptr noundef nonnull %5) #9
  br label %24

24:                                               ; preds = %21, %16
  %25 = call ptr @open_table(ptr noundef nonnull %2)
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %30

27:                                               ; preds = %24
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call i32 @fputs(ptr noundef nonnull @.str.40, ptr noundef %28) #10
  br label %70

30:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 1536, ptr nonnull %7) #7
  %31 = call ptr @strtok(ptr noundef nonnull %3, ptr noundef nonnull @.str.14) #7
  %.not5461 = icmp eq ptr %31, null
  br i1 %.not5461, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %30
  %32 = getelementptr inbounds i8, ptr %25, i64 40
  br label %33

33:                                               ; preds = %.lr.ph, %36
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %36 ]
  %.04463 = phi ptr [ %31, %.lr.ph ], [ %41, %36 ]
  %34 = call ptr @str_trim(ptr noundef nonnull %.04463)
  %35 = call i32 @table_find_field(ptr noundef nonnull byval(%struct.table_info) align 8 %25, ptr noundef %34)
  %.not55.not = icmp eq i32 %35, -1
  br i1 %.not55.not, label %.thread, label %36

36:                                               ; preds = %33
  %37 = getelementptr inbounds [32 x i32], ptr %6, i64 0, i64 %indvars.iv
  store i32 %35, ptr %37, align 4, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = getelementptr inbounds [32 x %struct.field], ptr %7, i64 0, i64 %indvars.iv
  %39 = sext i32 %35 to i64
  %40 = getelementptr inbounds [32 x %struct.field], ptr %32, i64 0, i64 %39
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(48) %38, ptr noundef nonnull align 8 dereferenceable(48) %40, i64 48, i1 false), !tbaa.struct !11
  %41 = call ptr @strtok(ptr noundef null, ptr noundef nonnull @.str.14) #7
  %.not54 = icmp eq ptr %41, null
  br i1 %.not54, label %._crit_edge.loopexit, label %33, !llvm.loop !15

._crit_edge.loopexit:                             ; preds = %36
  %42 = trunc nuw i64 %indvars.iv.next to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %30
  %.046.lcssa = phi i32 [ 0, %30 ], [ %42, %._crit_edge.loopexit ]
  %43 = getelementptr inbounds i8, ptr %25, i64 1576
  %44 = load i64, ptr %43, align 8, !tbaa !17
  %45 = call ptr @create_temp_table(i32 noundef %.046.lcssa, ptr noundef nonnull %7, i64 noundef %44)
  %46 = load i64, ptr %43, align 8, !tbaa !17
  %47 = getelementptr inbounds i8, ptr %45, i64 1576
  store i64 %46, ptr %47, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 2048, ptr nonnull %8) #7
  %.not72 = icmp eq i64 %46, 0
  br i1 %.not72, label %._crit_edge70, label %.preheader.lr.ph

.preheader.lr.ph:                                 ; preds = %._crit_edge
  %.not73 = icmp eq i32 %.046.lcssa, 0
  br i1 %.not73, label %._crit_edge70, label %.preheader.us.preheader

.preheader.us.preheader:                          ; preds = %.preheader.lr.ph
  %wide.trip.count = zext i32 %.046.lcssa to i64
  br label %.preheader.us

.preheader.us:                                    ; preds = %.preheader.us.preheader, %._crit_edge68.us
  %indvars.iv82 = phi i64 [ 0, %.preheader.us.preheader ], [ %indvars.iv.next83, %._crit_edge68.us ]
  br label %48

48:                                               ; preds = %.preheader.us, %48
  %indvars.iv79 = phi i64 [ 0, %.preheader.us ], [ %indvars.iv.next80, %48 ]
  %49 = getelementptr inbounds [32 x i32], ptr %6, i64 0, i64 %indvars.iv79
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = call zeroext i1 @read_field(ptr noundef nonnull %8, ptr noundef nonnull %25, i64 noundef %indvars.iv82, i32 noundef %50)
  %52 = trunc nuw nsw i64 %indvars.iv79 to i32
  call void @set_temp_table_field(ptr noundef %45, i64 noundef %indvars.iv82, i32 noundef %52, ptr noundef nonnull %8)
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge68.us, label %48, !llvm.loop !21

._crit_edge68.us:                                 ; preds = %48
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %53 = load i64, ptr %47, align 8, !tbaa !17
  %54 = icmp ugt i64 %53, %indvars.iv.next83
  br i1 %54, label %.preheader.us, label %._crit_edge70, !llvm.loop !22

._crit_edge70:                                    ; preds = %._crit_edge68.us, %.preheader.lr.ph, %._crit_edge
  %.lcssa = phi i64 [ 0, %._crit_edge ], [ %46, %.preheader.lr.ph ], [ %53, %._crit_edge68.us ]
  %55 = getelementptr inbounds i8, ptr %45, i64 1600
  %56 = load ptr, ptr %55, align 8, !tbaa !23
  %57 = call i64 @row_size(ptr noundef nonnull byval(%struct.table_info) align 8 %45)
  call void @qsort(ptr noundef %56, i64 noundef %.lcssa, i64 noundef %57, ptr noundef nonnull @strcmp_wrapper) #7
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %9) #7
  %58 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) @.str.22, ptr noundef nonnull %4) #7
  %59 = call noalias ptr @fopen(ptr noundef nonnull %9, ptr noundef nonnull @.str.41)
  %60 = call i64 @fwrite(ptr noundef nonnull %45, i64 noundef 1584, i64 noundef 1, ptr noundef %59)
  %61 = call i32 @fclose(ptr noundef %59)
  %62 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) @.str.23, ptr noundef nonnull %4) #7
  %63 = call noalias ptr @fopen(ptr noundef nonnull %9, ptr noundef nonnull @.str.41)
  %64 = load ptr, ptr %55, align 8, !tbaa !23
  %65 = call i64 @row_size(ptr noundef nonnull byval(%struct.table_info) align 8 %45)
  %66 = load i64, ptr %47, align 8, !tbaa !17
  %67 = mul i64 %66, %65
  %68 = call i64 @fwrite(ptr noundef %64, i64 noundef %67, i64 noundef 1, ptr noundef %63)
  %69 = call i32 @fclose(ptr noundef %63)
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %8) #7
  br label %.thread

.thread:                                          ; preds = %33, %._crit_edge70
  %.not5459 = phi i1 [ true, %._crit_edge70 ], [ false, %33 ]
  call void @llvm.lifetime.end.p0(i64 1536, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %6) #7
  br label %70

70:                                               ; preds = %27, %.thread, %11, %1
  %.4 = phi i1 [ false, %1 ], [ false, %11 ], [ false, %27 ], [ %.not5459, %.thread ]
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 2048, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #7
  ret i1 %.4
}

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

; Function Attrs: nofree
declare void @qsort(ptr noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #6

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 = { 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 #3 = { 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 #4 = { mustprogress nofree nounwind willreturn "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nofree "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 = { cold nounwind }
attributes #10 = { cold }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{i64 0, i64 32, !12, i64 32, i64 8, !13, i64 40, i64 4, !9}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !14, i64 1576}
!18 = !{!"", !19, i64 0, !20, i64 1584, !6, i64 1592, !6, i64 1600}
!19 = !{!"", !7, i64 0, !10, i64 32, !7, i64 40, !14, i64 1576}
!20 = !{!"_Bool", !7, i64 0}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}
!23 = !{!18, !6, i64 1600}


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