; LLVM IR from attractivechaos/klib :: test (khash_keith2)

; 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.kh_str_s = type { i32, i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca [32 x i8], align 16
  %14 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1000, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %15 = call ptr @kh_init_str()
  store ptr %15, ptr %10, align 8, !tbaa !9
  %16 = call ptr @kh_init_str()
  store ptr %16, ptr %11, align 8, !tbaa !9
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = icmp sgt i32 %17, 1
  br i1 %18, label %19, label %24

19:                                               ; preds = %2
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = getelementptr inbounds ptr, ptr %20, i64 1
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = call i32 @atoi(ptr noundef %22) #7
  store i32 %23, ptr %8, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %19, %2
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %45, %24
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 10000
  br i1 %27, label %28, label %48

28:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 32, ptr %13) #6
  %29 = getelementptr inbounds [32 x i8], ptr %13, i64 0, i64 0
  %30 = call ptr @strcpy(ptr noundef %29, ptr noundef @.str) #6
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = getelementptr inbounds [32 x i8], ptr %13, i64 0, i64 0
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  call void @int2str(i32 noundef %31, i32 noundef 10, ptr noundef %33)
  %34 = load ptr, ptr %10, align 8, !tbaa !9
  %35 = getelementptr inbounds [32 x i8], ptr %13, i64 0, i64 0
  %36 = call noalias ptr @strdup(ptr noundef %35) #6
  %37 = call i32 @kh_put_str(ptr noundef %34, ptr noundef %36, ptr noundef %9)
  store i32 %37, ptr %12, align 4, !tbaa !5
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = load ptr, ptr %10, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.kh_str_s, ptr %39, i32 0, i32 6
  %41 = load ptr, ptr %40, align 8, !tbaa !11
  %42 = load i32, ptr %12, align 4, !tbaa !5
  %43 = zext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  store i32 %38, ptr %44, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 32, ptr %13) #6
  br label %45

45:                                               ; preds = %28
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !5
  br label %25, !llvm.loop !13

48:                                               ; preds = %25
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %49

49:                                               ; preds = %137, %48
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = load i32, ptr %8, align 4, !tbaa !5
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %53, label %140

53:                                               ; preds = %49
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %54

54:                                               ; preds = %133, %53
  %55 = load i32, ptr %12, align 4, !tbaa !5
  %56 = load ptr, ptr %10, align 8, !tbaa !9
  %57 = getelementptr inbounds %struct.kh_str_s, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !15
  %59 = icmp ne i32 %55, %58
  br i1 %59, label %60, label %136

60:                                               ; preds = %54
  %61 = load ptr, ptr %10, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.kh_str_s, ptr %61, i32 0, i32 4
  %63 = load ptr, ptr %62, align 8, !tbaa !16
  %64 = load i32, ptr %12, align 4, !tbaa !5
  %65 = lshr i32 %64, 4
  %66 = zext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %63, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = load i32, ptr %12, align 4, !tbaa !5
  %70 = and i32 %69, 15
  %71 = shl i32 %70, 1
  %72 = lshr i32 %68, %71
  %73 = and i32 %72, 3
  %74 = icmp ne i32 %73, 0
  br i1 %74, label %132, label %75

75:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %76 = load ptr, ptr %11, align 8, !tbaa !9
  %77 = load ptr, ptr %10, align 8, !tbaa !9
  %78 = getelementptr inbounds %struct.kh_str_s, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !17
  %80 = load i32, ptr %12, align 4, !tbaa !5
  %81 = zext i32 %80 to i64
  %82 = getelementptr inbounds ptr, ptr %79, i64 %81
  %83 = load ptr, ptr %82, align 8, !tbaa !9
  %84 = call i32 @kh_put_str(ptr noundef %76, ptr noundef %83, ptr noundef %9)
  store i32 %84, ptr %14, align 4, !tbaa !5
  %85 = load i32, ptr %9, align 4, !tbaa !5
  %86 = icmp ne i32 %85, 0
  br i1 %86, label %87, label %115

87:                                               ; preds = %75
  %88 = load ptr, ptr %10, align 8, !tbaa !9
  %89 = getelementptr inbounds %struct.kh_str_s, ptr %88, i32 0, i32 5
  %90 = load ptr, ptr %89, align 8, !tbaa !17
  %91 = load i32, ptr %12, align 4, !tbaa !5
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds ptr, ptr %90, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !9
  %95 = call noalias ptr @strdup(ptr noundef %94) #6
  %96 = load ptr, ptr %11, align 8, !tbaa !9
  %97 = getelementptr inbounds %struct.kh_str_s, ptr %96, i32 0, i32 5
  %98 = load ptr, ptr %97, align 8, !tbaa !17
  %99 = load i32, ptr %14, align 4, !tbaa !5
  %100 = zext i32 %99 to i64
  %101 = getelementptr inbounds ptr, ptr %98, i64 %100
  store ptr %95, ptr %101, align 8, !tbaa !9
  %102 = load ptr, ptr %10, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct.kh_str_s, ptr %102, i32 0, i32 6
  %104 = load ptr, ptr %103, align 8, !tbaa !11
  %105 = load i32, ptr %12, align 4, !tbaa !5
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds i32, ptr %104, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load ptr, ptr %11, align 8, !tbaa !9
  %110 = getelementptr inbounds %struct.kh_str_s, ptr %109, i32 0, i32 6
  %111 = load ptr, ptr %110, align 8, !tbaa !11
  %112 = load i32, ptr %14, align 4, !tbaa !5
  %113 = zext i32 %112 to i64
  %114 = getelementptr inbounds i32, ptr %111, i64 %113
  store i32 %108, ptr %114, align 4, !tbaa !5
  br label %131

115:                                              ; preds = %75
  %116 = load ptr, ptr %10, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct.kh_str_s, ptr %116, i32 0, i32 6
  %118 = load ptr, ptr %117, align 8, !tbaa !11
  %119 = load i32, ptr %12, align 4, !tbaa !5
  %120 = zext i32 %119 to i64
  %121 = getelementptr inbounds i32, ptr %118, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = load ptr, ptr %11, align 8, !tbaa !9
  %124 = getelementptr inbounds %struct.kh_str_s, ptr %123, i32 0, i32 6
  %125 = load ptr, ptr %124, align 8, !tbaa !11
  %126 = load i32, ptr %14, align 4, !tbaa !5
  %127 = zext i32 %126 to i64
  %128 = getelementptr inbounds i32, ptr %125, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = add nsw i32 %129, %122
  store i32 %130, ptr %128, align 4, !tbaa !5
  br label %131

131:                                              ; preds = %115, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %132

132:                                              ; preds = %131, %60
  br label %133

133:                                              ; preds = %132
  %134 = load i32, ptr %12, align 4, !tbaa !5
  %135 = add i32 %134, 1
  store i32 %135, ptr %12, align 4, !tbaa !5
  br label %54, !llvm.loop !18

136:                                              ; preds = %54
  br label %137

137:                                              ; preds = %136
  %138 = load i32, ptr %6, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %6, align 4, !tbaa !5
  br label %49, !llvm.loop !19

140:                                              ; preds = %49
  %141 = load ptr, ptr %10, align 8, !tbaa !9
  %142 = call i32 @kh_get_str(ptr noundef %141, ptr noundef @.str.1)
  store i32 %142, ptr %12, align 4, !tbaa !5
  %143 = load ptr, ptr %10, align 8, !tbaa !9
  %144 = getelementptr inbounds %struct.kh_str_s, ptr %143, i32 0, i32 6
  %145 = load ptr, ptr %144, align 8, !tbaa !11
  %146 = load i32, ptr %12, align 4, !tbaa !5
  %147 = zext i32 %146 to i64
  %148 = getelementptr inbounds i32, ptr %145, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %149)
  %151 = load ptr, ptr %10, align 8, !tbaa !9
  %152 = call i32 @kh_get_str(ptr noundef %151, ptr noundef @.str.3)
  store i32 %152, ptr %12, align 4, !tbaa !5
  %153 = load ptr, ptr %10, align 8, !tbaa !9
  %154 = getelementptr inbounds %struct.kh_str_s, ptr %153, i32 0, i32 6
  %155 = load ptr, ptr %154, align 8, !tbaa !11
  %156 = load i32, ptr %12, align 4, !tbaa !5
  %157 = zext i32 %156 to i64
  %158 = getelementptr inbounds i32, ptr %155, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !5
  %160 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %159)
  %161 = load ptr, ptr %11, align 8, !tbaa !9
  %162 = call i32 @kh_get_str(ptr noundef %161, ptr noundef @.str.1)
  store i32 %162, ptr %12, align 4, !tbaa !5
  %163 = load ptr, ptr %11, align 8, !tbaa !9
  %164 = getelementptr inbounds %struct.kh_str_s, ptr %163, i32 0, i32 6
  %165 = load ptr, ptr %164, align 8, !tbaa !11
  %166 = load i32, ptr %12, align 4, !tbaa !5
  %167 = zext i32 %166 to i64
  %168 = getelementptr inbounds i32, ptr %165, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %169)
  %171 = load ptr, ptr %11, align 8, !tbaa !9
  %172 = call i32 @kh_get_str(ptr noundef %171, ptr noundef @.str.3)
  store i32 %172, ptr %12, align 4, !tbaa !5
  %173 = load ptr, ptr %11, align 8, !tbaa !9
  %174 = getelementptr inbounds %struct.kh_str_s, ptr %173, i32 0, i32 6
  %175 = load ptr, ptr %174, align 8, !tbaa !11
  %176 = load i32, ptr %12, align 4, !tbaa !5
  %177 = zext i32 %176 to i64
  %178 = getelementptr inbounds i32, ptr %175, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %179)
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %181

181:                                              ; preds = %211, %140
  %182 = load i32, ptr %12, align 4, !tbaa !5
  %183 = load ptr, ptr %10, align 8, !tbaa !9
  %184 = getelementptr inbounds %struct.kh_str_s, ptr %183, i32 0, i32 0
  %185 = load i32, ptr %184, align 8, !tbaa !15
  %186 = icmp ne i32 %182, %185
  br i1 %186, label %187, label %214

187:                                              ; preds = %181
  %188 = load ptr, ptr %10, align 8, !tbaa !9
  %189 = getelementptr inbounds %struct.kh_str_s, ptr %188, i32 0, i32 4
  %190 = load ptr, ptr %189, align 8, !tbaa !16
  %191 = load i32, ptr %12, align 4, !tbaa !5
  %192 = lshr i32 %191, 4
  %193 = zext i32 %192 to i64
  %194 = getelementptr inbounds i32, ptr %190, i64 %193
  %195 = load i32, ptr %194, align 4, !tbaa !5
  %196 = load i32, ptr %12, align 4, !tbaa !5
  %197 = and i32 %196, 15
  %198 = shl i32 %197, 1
  %199 = lshr i32 %195, %198
  %200 = and i32 %199, 3
  %201 = icmp ne i32 %200, 0
  br i1 %201, label %210, label %202

202:                                              ; preds = %187
  %203 = load ptr, ptr %10, align 8, !tbaa !9
  %204 = getelementptr inbounds %struct.kh_str_s, ptr %203, i32 0, i32 5
  %205 = load ptr, ptr %204, align 8, !tbaa !17
  %206 = load i32, ptr %12, align 4, !tbaa !5
  %207 = zext i32 %206 to i64
  %208 = getelementptr inbounds ptr, ptr %205, i64 %207
  %209 = load ptr, ptr %208, align 8, !tbaa !9
  call void @free(ptr noundef %209) #6
  br label %210

210:                                              ; preds = %202, %187
  br label %211

211:                                              ; preds = %210
  %212 = load i32, ptr %12, align 4, !tbaa !5
  %213 = add i32 %212, 1
  store i32 %213, ptr %12, align 4, !tbaa !5
  br label %181, !llvm.loop !20

214:                                              ; preds = %181
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %215

215:                                              ; preds = %245, %214
  %216 = load i32, ptr %12, align 4, !tbaa !5
  %217 = load ptr, ptr %11, align 8, !tbaa !9
  %218 = getelementptr inbounds %struct.kh_str_s, ptr %217, i32 0, i32 0
  %219 = load i32, ptr %218, align 8, !tbaa !15
  %220 = icmp ne i32 %216, %219
  br i1 %220, label %221, label %248

221:                                              ; preds = %215
  %222 = load ptr, ptr %11, align 8, !tbaa !9
  %223 = getelementptr inbounds %struct.kh_str_s, ptr %222, i32 0, i32 4
  %224 = load ptr, ptr %223, align 8, !tbaa !16
  %225 = load i32, ptr %12, align 4, !tbaa !5
  %226 = lshr i32 %225, 4
  %227 = zext i32 %226 to i64
  %228 = getelementptr inbounds i32, ptr %224, i64 %227
  %229 = load i32, ptr %228, align 4, !tbaa !5
  %230 = load i32, ptr %12, align 4, !tbaa !5
  %231 = and i32 %230, 15
  %232 = shl i32 %231, 1
  %233 = lshr i32 %229, %232
  %234 = and i32 %233, 3
  %235 = icmp ne i32 %234, 0
  br i1 %235, label %244, label %236

236:                                              ; preds = %221
  %237 = load ptr, ptr %11, align 8, !tbaa !9
  %238 = getelementptr inbounds %struct.kh_str_s, ptr %237, i32 0, i32 5
  %239 = load ptr, ptr %238, align 8, !tbaa !17
  %240 = load i32, ptr %12, align 4, !tbaa !5
  %241 = zext i32 %240 to i64
  %242 = getelementptr inbounds ptr, ptr %239, i64 %241
  %243 = load ptr, ptr %242, align 8, !tbaa !9
  call void @free(ptr noundef %243) #6
  br label %244

244:                                              ; preds = %236, %221
  br label %245

245:                                              ; preds = %244
  %246 = load i32, ptr %12, align 4, !tbaa !5
  %247 = add i32 %246, 1
  store i32 %247, ptr %12, align 4, !tbaa !5
  br label %215, !llvm.loop !21

248:                                              ; preds = %215
  %249 = load ptr, ptr %10, align 8, !tbaa !9
  call void @kh_destroy_str(ptr noundef %249)
  %250 = load ptr, ptr %11, align 8, !tbaa !9
  call void @kh_destroy_str(ptr noundef %250)
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  ret i32 0
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @kh_init_str() #2

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kh_put_str(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #4

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kh_get_str(ptr noundef, ptr noundef) #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kh_destroy_str(ptr 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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint nounwind willreturn memory(read) 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 #4 = { 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 = { "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 }
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 = !{!"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 = !{!12, !10, i64 32}
!12 = !{!"kh_str_s", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !10, i64 16}
!17 = !{!12, !10, i64 24}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


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

@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca [32 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %5 = tail call ptr @kh_init_str()
  %6 = tail call ptr @kh_init_str()
  %7 = icmp sgt i32 %0, 1
  br i1 %7, label %8, label %12

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = tail call i32 @atoi(ptr nocapture noundef %10) #9
  br label %12

12:                                               ; preds = %8, %2
  %.064 = phi i32 [ %11, %8 ], [ 1000, %2 ]
  %13 = getelementptr inbounds i8, ptr %4, i64 4
  %14 = getelementptr inbounds i8, ptr %5, i64 32
  br label %22

.preheader72:                                     ; preds = %22
  %15 = icmp sgt i32 %.064, 0
  br i1 %15, label %.preheader71.lr.ph, label %._crit_edge77

.preheader71.lr.ph:                               ; preds = %.preheader72
  %16 = getelementptr inbounds i8, ptr %5, i64 16
  %17 = getelementptr inbounds i8, ptr %5, i64 24
  %18 = getelementptr inbounds i8, ptr %6, i64 24
  %19 = getelementptr inbounds i8, ptr %6, i64 32
  %20 = load i32, ptr %5, align 8, !tbaa !9
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %._crit_edge77, label %.preheader71

22:                                               ; preds = %12, %22
  %.073 = phi i32 [ 0, %12 ], [ %29, %22 ]
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #8
  %23 = call ptr @strcpy(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str) #8
  call void @int2str(i32 noundef %.073, i32 noundef 10, ptr noundef nonnull %13)
  %24 = call noalias ptr @strdup(ptr noundef nonnull %4) #8
  %25 = call i32 @kh_put_str(ptr noundef %5, ptr noundef %24, ptr noundef nonnull %3)
  %26 = load ptr, ptr %14, align 8, !tbaa !12
  %27 = zext i32 %25 to i64
  %28 = getelementptr inbounds i32, ptr %26, i64 %27
  store i32 %.073, ptr %28, align 4, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  %29 = add nuw nsw i32 %.073, 1
  %exitcond.not = icmp eq i32 %29, 10000
  br i1 %exitcond.not, label %.preheader72, label %22, !llvm.loop !14

.preheader71:                                     ; preds = %.preheader71.lr.ph, %._crit_edge
  %30 = phi i32 [ %72, %._crit_edge ], [ 1, %.preheader71.lr.ph ]
  %.176 = phi i32 [ %73, %._crit_edge ], [ 0, %.preheader71.lr.ph ]
  %.not6874 = icmp eq i32 %30, 0
  br i1 %.not6874, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader71, %69
  %.06275 = phi i32 [ %70, %69 ], [ 0, %.preheader71 ]
  %31 = load ptr, ptr %16, align 8, !tbaa !16
  %32 = lshr i32 %.06275, 4
  %33 = zext nneg i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %31, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !13
  %36 = shl i32 %.06275, 1
  %37 = and i32 %36, 30
  %38 = shl nuw i32 3, %37
  %39 = and i32 %35, %38
  %.not69 = icmp eq i32 %39, 0
  br i1 %.not69, label %40, label %69

40:                                               ; preds = %.lr.ph
  %41 = load ptr, ptr %17, align 8, !tbaa !17
  %42 = zext i32 %.06275 to i64
  %43 = getelementptr inbounds ptr, ptr %41, i64 %42
  %44 = load ptr, ptr %43, align 8, !tbaa !5
  %45 = call i32 @kh_put_str(ptr noundef %6, ptr noundef %44, ptr noundef nonnull %3)
  %46 = load i32, ptr %3, align 4, !tbaa !13
  %.not70 = icmp eq i32 %46, 0
  br i1 %.not70, label %60, label %47

47:                                               ; preds = %40
  %48 = load ptr, ptr %17, align 8, !tbaa !17
  %49 = getelementptr inbounds ptr, ptr %48, i64 %42
  %50 = load ptr, ptr %49, align 8, !tbaa !5
  %51 = call noalias ptr @strdup(ptr noundef %50) #8
  %52 = load ptr, ptr %18, align 8, !tbaa !17
  %53 = zext i32 %45 to i64
  %54 = getelementptr inbounds ptr, ptr %52, i64 %53
  store ptr %51, ptr %54, align 8, !tbaa !5
  %55 = load ptr, ptr %14, align 8, !tbaa !12
  %56 = getelementptr inbounds i32, ptr %55, i64 %42
  %57 = load i32, ptr %56, align 4, !tbaa !13
  %58 = load ptr, ptr %19, align 8, !tbaa !12
  %59 = getelementptr inbounds i32, ptr %58, i64 %53
  store i32 %57, ptr %59, align 4, !tbaa !13
  br label %69

60:                                               ; preds = %40
  %61 = load ptr, ptr %14, align 8, !tbaa !12
  %62 = getelementptr inbounds i32, ptr %61, i64 %42
  %63 = load i32, ptr %62, align 4, !tbaa !13
  %64 = load ptr, ptr %19, align 8, !tbaa !12
  %65 = zext i32 %45 to i64
  %66 = getelementptr inbounds i32, ptr %64, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !13
  %68 = add nsw i32 %67, %63
  store i32 %68, ptr %66, align 4, !tbaa !13
  br label %69

69:                                               ; preds = %47, %60, %.lr.ph
  %70 = add i32 %.06275, 1
  %71 = load i32, ptr %5, align 8, !tbaa !9
  %.not68 = icmp eq i32 %70, %71
  br i1 %.not68, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %69, %.preheader71
  %72 = phi i32 [ 0, %.preheader71 ], [ %70, %69 ]
  %73 = add nuw nsw i32 %.176, 1
  %exitcond87.not = icmp eq i32 %73, %.064
  br i1 %exitcond87.not, label %._crit_edge77, label %.preheader71, !llvm.loop !19

._crit_edge77:                                    ; preds = %._crit_edge, %.preheader71.lr.ph, %.preheader72
  %74 = call i32 @kh_get_str(ptr noundef %5, ptr noundef nonnull @.str.1)
  %75 = load ptr, ptr %14, align 8, !tbaa !12
  %76 = zext i32 %74 to i64
  %77 = getelementptr inbounds i32, ptr %75, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !13
  %79 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %78)
  %80 = call i32 @kh_get_str(ptr noundef %5, ptr noundef nonnull @.str.3)
  %81 = load ptr, ptr %14, align 8, !tbaa !12
  %82 = zext i32 %80 to i64
  %83 = getelementptr inbounds i32, ptr %81, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !13
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %84)
  %86 = call i32 @kh_get_str(ptr noundef %6, ptr noundef nonnull @.str.1)
  %87 = getelementptr inbounds i8, ptr %6, i64 32
  %88 = load ptr, ptr %87, align 8, !tbaa !12
  %89 = zext i32 %86 to i64
  %90 = getelementptr inbounds i32, ptr %88, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !13
  %92 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %91)
  %93 = call i32 @kh_get_str(ptr noundef %6, ptr noundef nonnull @.str.3)
  %94 = load ptr, ptr %87, align 8, !tbaa !12
  %95 = zext i32 %93 to i64
  %96 = getelementptr inbounds i32, ptr %94, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !13
  %98 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %97)
  %99 = load i32, ptr %5, align 8, !tbaa !9
  %.not78 = icmp eq i32 %99, 0
  br i1 %.not78, label %.preheader, label %.lr.ph81

.lr.ph81:                                         ; preds = %._crit_edge77
  %100 = getelementptr inbounds i8, ptr %5, i64 16
  %101 = getelementptr inbounds i8, ptr %5, i64 24
  br label %105

.preheader:                                       ; preds = %121, %._crit_edge77
  %102 = load i32, ptr %6, align 8, !tbaa !9
  %.not6582 = icmp eq i32 %102, 0
  br i1 %.not6582, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %.preheader
  %103 = getelementptr inbounds i8, ptr %6, i64 16
  %104 = getelementptr inbounds i8, ptr %6, i64 24
  br label %124

105:                                              ; preds = %.lr.ph81, %121
  %106 = phi i32 [ %99, %.lr.ph81 ], [ %122, %121 ]
  %.16379 = phi i32 [ 0, %.lr.ph81 ], [ %123, %121 ]
  %107 = load ptr, ptr %100, align 8, !tbaa !16
  %108 = lshr i32 %.16379, 4
  %109 = zext nneg i32 %108 to i64
  %110 = getelementptr inbounds i32, ptr %107, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !13
  %112 = shl i32 %.16379, 1
  %113 = and i32 %112, 30
  %114 = shl nuw i32 3, %113
  %115 = and i32 %111, %114
  %.not67 = icmp eq i32 %115, 0
  br i1 %.not67, label %116, label %121

116:                                              ; preds = %105
  %117 = load ptr, ptr %101, align 8, !tbaa !17
  %118 = zext i32 %.16379 to i64
  %119 = getelementptr inbounds ptr, ptr %117, i64 %118
  %120 = load ptr, ptr %119, align 8, !tbaa !5
  call void @free(ptr noundef %120) #8
  %.pre = load i32, ptr %5, align 8, !tbaa !9
  br label %121

121:                                              ; preds = %105, %116
  %122 = phi i32 [ %106, %105 ], [ %.pre, %116 ]
  %123 = add i32 %.16379, 1
  %.not = icmp eq i32 %123, %122
  br i1 %.not, label %.preheader, label %105, !llvm.loop !21

124:                                              ; preds = %.lr.ph84, %140
  %125 = phi i32 [ %102, %.lr.ph84 ], [ %141, %140 ]
  %.283 = phi i32 [ 0, %.lr.ph84 ], [ %142, %140 ]
  %126 = load ptr, ptr %103, align 8, !tbaa !16
  %127 = lshr i32 %.283, 4
  %128 = zext nneg i32 %127 to i64
  %129 = getelementptr inbounds i32, ptr %126, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !13
  %131 = shl i32 %.283, 1
  %132 = and i32 %131, 30
  %133 = shl nuw i32 3, %132
  %134 = and i32 %130, %133
  %.not66 = icmp eq i32 %134, 0
  br i1 %.not66, label %135, label %140

135:                                              ; preds = %124
  %136 = load ptr, ptr %104, align 8, !tbaa !17
  %137 = zext i32 %.283 to i64
  %138 = getelementptr inbounds ptr, ptr %136, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  call void @free(ptr noundef %139) #8
  %.pre88 = load i32, ptr %6, align 8, !tbaa !9
  br label %140

140:                                              ; preds = %124, %135
  %141 = phi i32 [ %125, %124 ], [ %.pre88, %135 ]
  %142 = add i32 %.283, 1
  %.not65 = icmp eq i32 %142, %141
  br i1 %.not65, label %._crit_edge85, label %124, !llvm.loop !22

._crit_edge85:                                    ; preds = %140, %.preheader
  call void @kh_destroy_str(ptr noundef nonnull %5)
  call void @kh_destroy_str(ptr noundef nonnull %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  ret i32 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: inlinehint nounwind uwtable
declare hidden ptr @kh_init_str() local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

; 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 #4

; Function Attrs: inlinehint nounwind uwtable
declare void @int2str(i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kh_put_str(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #5

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @kh_get_str(ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @kh_destroy_str(ptr 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 = { inlinehint nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 #4 = { 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 #5 = { mustprogress nofree nounwind willreturn 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 #6 = { 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { 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, !11, i64 0}
!10 = !{!"kh_str_s", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 32}
!13 = !{!11, !11, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!10, !6, i64 16}
!17 = !{!10, !6, i64 24}
!18 = distinct !{!18, !15}
!19 = distinct !{!19, !15, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}
!21 = distinct !{!21, !15}
!22 = distinct !{!22, !15}


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