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

; 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 [4 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 ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca [16 x i8], align 16
  %16 = alloca i32, align 4
  %17 = alloca [16 x i8], align 16
  %18 = 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 8, ptr %6) #10
  store ptr null, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  store i32 1000000, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #10
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #10
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #10
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  %19 = call ptr @kh_init_str()
  store ptr %19, ptr %14, align 8, !tbaa !9
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 1
  br i1 %21, label %22, label %27

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

27:                                               ; preds = %22, %2
  %28 = call noalias ptr @malloc(i64 noundef 8) #12
  store ptr %28, ptr %6, align 8, !tbaa !9
  %29 = call noalias ptr @malloc(i64 noundef 1048576) #12
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 0
  store ptr %29, ptr %31, align 8, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %12, align 4, !tbaa !5
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %100, %27
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = load i32, ptr %9, align 4, !tbaa !5
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %36, label %103

36:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 16, ptr %15) #10
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  call void @int2str(i32 noundef %37, i32 noundef 16, ptr noundef %38)
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #10
  %39 = load ptr, ptr %14, align 8, !tbaa !9
  %40 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %41 = call i32 @kh_put_str(ptr noundef %39, ptr noundef %40, ptr noundef %10)
  store i32 %41, ptr %16, align 4, !tbaa !5
  %42 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %43 = call i64 @strlen(ptr noundef %42) #11
  %44 = add i64 %43, 1
  %45 = trunc i64 %44 to i32
  store i32 %45, ptr %8, align 4, !tbaa !5
  %46 = load i32, ptr %11, align 4, !tbaa !5
  %47 = load i32, ptr %8, align 4, !tbaa !5
  %48 = add nsw i32 %46, %47
  %49 = icmp sgt i32 %48, 1048576
  br i1 %49, label %50, label %64

50:                                               ; preds = %36
  %51 = load i32, ptr %12, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %12, align 4, !tbaa !5
  store i32 0, ptr %11, align 4, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !9
  %54 = load i32, ptr %12, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = mul i64 %56, 8
  %58 = call ptr @realloc(ptr noundef %53, i64 noundef %57) #13
  store ptr %58, ptr %6, align 8, !tbaa !9
  %59 = call noalias ptr @malloc(i64 noundef 1048576) #12
  %60 = load ptr, ptr %6, align 8, !tbaa !9
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds ptr, ptr %60, i64 %62
  store ptr %59, ptr %63, align 8, !tbaa !9
  br label %64

64:                                               ; preds = %50, %36
  %65 = load ptr, ptr %6, align 8, !tbaa !9
  %66 = load i32, ptr %12, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds ptr, ptr %65, i64 %67
  %69 = load ptr, ptr %68, align 8, !tbaa !9
  %70 = load i32, ptr %11, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i8, ptr %69, i64 %71
  %73 = getelementptr inbounds [16 x i8], ptr %15, i64 0, i64 0
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %72, ptr align 16 %73, i64 %75, i1 false)
  %76 = load ptr, ptr %6, align 8, !tbaa !9
  %77 = load i32, ptr %12, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds ptr, ptr %76, i64 %78
  %80 = load ptr, ptr %79, align 8, !tbaa !9
  %81 = load i32, ptr %11, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i8, ptr %80, i64 %82
  %84 = load ptr, ptr %14, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.kh_str_s, ptr %84, i32 0, i32 5
  %86 = load ptr, ptr %85, align 8, !tbaa !11
  %87 = load i32, ptr %16, align 4, !tbaa !5
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds ptr, ptr %86, i64 %88
  store ptr %83, ptr %89, align 8, !tbaa !9
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = add nsw i32 %91, %90
  store i32 %92, ptr %11, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = load ptr, ptr %14, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.kh_str_s, ptr %94, i32 0, i32 6
  %96 = load ptr, ptr %95, align 8, !tbaa !13
  %97 = load i32, ptr %16, align 4, !tbaa !5
  %98 = zext i32 %97 to i64
  %99 = getelementptr inbounds i32, ptr %96, i64 %98
  store i32 %93, ptr %99, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr %15) #10
  br label %100

100:                                              ; preds = %64
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %7, align 4, !tbaa !5
  br label %32, !llvm.loop !14

103:                                              ; preds = %32
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %123, %103
  %105 = load i32, ptr %7, align 4, !tbaa !5
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = icmp sle i32 %105, %106
  br i1 %107, label %108, label %126

108:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #10
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  call void @int2str(i32 noundef %109, i32 noundef 10, ptr noundef %110)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #10
  %111 = load ptr, ptr %14, align 8, !tbaa !9
  %112 = getelementptr inbounds [16 x i8], ptr %17, i64 0, i64 0
  %113 = call i32 @kh_get_str(ptr noundef %111, ptr noundef %112)
  store i32 %113, ptr %18, align 4, !tbaa !5
  %114 = load i32, ptr %18, align 4, !tbaa !5
  %115 = load ptr, ptr %14, align 8, !tbaa !9
  %116 = getelementptr inbounds %struct.kh_str_s, ptr %115, i32 0, i32 0
  %117 = load i32, ptr %116, align 8, !tbaa !16
  %118 = icmp ne i32 %114, %117
  br i1 %118, label %119, label %122

119:                                              ; preds = %108
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %13, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %119, %108
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #10
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #10
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %7, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %7, align 4, !tbaa !5
  br label %104, !llvm.loop !17

126:                                              ; preds = %104
  %127 = load i32, ptr %13, align 4, !tbaa !5
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %127)
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %139, %126
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = load i32, ptr %12, align 4, !tbaa !5
  %132 = icmp sle i32 %130, %131
  br i1 %132, label %133, label %142

133:                                              ; preds = %129
  %134 = load ptr, ptr %6, align 8, !tbaa !9
  %135 = load i32, ptr %10, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds ptr, ptr %134, i64 %136
  %138 = load ptr, ptr %137, align 8, !tbaa !9
  call void @free(ptr noundef %138) #10
  br label %139

139:                                              ; preds = %133
  %140 = load i32, ptr %10, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %10, align 4, !tbaa !5
  br label %129, !llvm.loop !18

142:                                              ; preds = %129
  %143 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free(ptr noundef %143) #10
  %144 = load ptr, ptr %14, align 8, !tbaa !9
  call void @kh_destroy_str(ptr noundef %144)
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  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 allocsize(0)
declare noalias ptr @malloc(i64 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 willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #6

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

; 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, ...) #8

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

; 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 allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { nounwind allocsize(1) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #9 = { 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 #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { nounwind allocsize(1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 24}
!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 = !{!12, !10, i64 32}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !6, i64 0}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


; 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 [4 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 [16 x i8], align 16
  %5 = alloca [16 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #10
  %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) #11
  br label %12

12:                                               ; preds = %8, %2
  %.043 = phi i32 [ %11, %8 ], [ 1000000, %2 ]
  %13 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #12
  %14 = tail call noalias dereferenceable_or_null(1048576) ptr @malloc(i64 noundef 1048576) #12
  store ptr %14, ptr %13, align 8, !tbaa !5
  %.not54 = icmp slt i32 %.043, 1
  br i1 %.not54, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %12
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef 0)
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %.lr.ph68.preheader

.lr.ph:                                           ; preds = %12
  %16 = getelementptr inbounds i8, ptr %6, i64 24
  %17 = getelementptr inbounds i8, ptr %6, i64 32
  br label %18

.preheader:                                       ; preds = %34
  br i1 %.not54, label %._crit_edge, label %.lr.ph63

18:                                               ; preds = %.lr.ph, %34
  %.058 = phi ptr [ %13, %.lr.ph ], [ %.1, %34 ]
  %.04157 = phi i32 [ 1, %.lr.ph ], [ %48, %34 ]
  %.04656 = phi i32 [ 0, %.lr.ph ], [ %.147, %34 ]
  %.04855 = phi i32 [ 0, %.lr.ph ], [ %45, %34 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #10
  call void @int2str(i32 noundef %.04157, i32 noundef 16, ptr noundef nonnull %4)
  %19 = call i32 @kh_put_str(ptr noundef %6, ptr noundef nonnull %4, ptr noundef nonnull %3)
  %20 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %4) #11
  %21 = trunc i64 %20 to i32
  %22 = add i32 %21, 1
  %23 = add nsw i32 %22, %.04855
  %24 = icmp sgt i32 %23, 1048576
  br i1 %24, label %25, label %._crit_edge71

._crit_edge71:                                    ; preds = %18
  %.phi.trans.insert = sext i32 %.04656 to i64
  %.phi.trans.insert72 = getelementptr inbounds ptr, ptr %.058, i64 %.phi.trans.insert
  %.pre = load ptr, ptr %.phi.trans.insert72, align 8, !tbaa !5
  br label %34

25:                                               ; preds = %18
  %26 = add nsw i32 %.04656, 1
  %27 = add nsw i32 %.04656, 2
  %28 = sext i32 %27 to i64
  %29 = shl nsw i64 %28, 3
  %30 = call ptr @realloc(ptr noundef %.058, i64 noundef %29) #13
  %31 = call noalias dereferenceable_or_null(1048576) ptr @malloc(i64 noundef 1048576) #12
  %32 = sext i32 %26 to i64
  %33 = getelementptr inbounds ptr, ptr %30, i64 %32
  store ptr %31, ptr %33, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %._crit_edge71, %25
  %.pre-phi = phi i64 [ %.phi.trans.insert, %._crit_edge71 ], [ %32, %25 ]
  %35 = phi ptr [ %.pre, %._crit_edge71 ], [ %31, %25 ]
  %.149 = phi i32 [ %.04855, %._crit_edge71 ], [ 0, %25 ]
  %.147 = phi i32 [ %.04656, %._crit_edge71 ], [ %26, %25 ]
  %.1 = phi ptr [ %.058, %._crit_edge71 ], [ %30, %25 ]
  %36 = getelementptr inbounds ptr, ptr %.1, i64 %.pre-phi
  %37 = sext i32 %.149 to i64
  %38 = getelementptr inbounds i8, ptr %35, i64 %37
  %39 = sext i32 %22 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %38, ptr nonnull align 16 %4, i64 %39, i1 false)
  %40 = load ptr, ptr %36, align 8, !tbaa !5
  %41 = getelementptr inbounds i8, ptr %40, i64 %37
  %42 = load ptr, ptr %16, align 8, !tbaa !11
  %43 = zext i32 %19 to i64
  %44 = getelementptr inbounds ptr, ptr %42, i64 %43
  store ptr %41, ptr %44, align 8, !tbaa !5
  %45 = add nsw i32 %.149, %22
  %46 = load ptr, ptr %17, align 8, !tbaa !13
  %47 = getelementptr inbounds i32, ptr %46, i64 %43
  store i32 %.04157, ptr %47, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #10
  %48 = add nuw i32 %.04157, 1
  %exitcond.not = icmp eq i32 %.04157, %.043
  br i1 %exitcond.not, label %.preheader, label %18, !llvm.loop !14

.lr.ph63:                                         ; preds = %.preheader, %.lr.ph63
  %.14262 = phi i32 [ %52, %.lr.ph63 ], [ 1, %.preheader ]
  %.04461 = phi i32 [ %spec.select, %.lr.ph63 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #10
  call void @int2str(i32 noundef %.14262, i32 noundef 10, ptr noundef nonnull %5)
  %49 = call i32 @kh_get_str(ptr noundef nonnull %6, ptr noundef nonnull %5)
  %50 = load i32, ptr %6, align 8, !tbaa !16
  %.not53 = icmp ne i32 %49, %50
  %51 = zext i1 %.not53 to i32
  %spec.select = add nuw nsw i32 %.04461, %51
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #10
  %52 = add nuw i32 %.14262, 1
  %exitcond70.not = icmp eq i32 %.14262, %.043
  br i1 %exitcond70.not, label %._crit_edge, label %.lr.ph63, !llvm.loop !17

._crit_edge:                                      ; preds = %.lr.ph63, %.preheader
  %.044.lcssa = phi i32 [ 0, %.preheader ], [ %spec.select, %.lr.ph63 ]
  %53 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.044.lcssa)
  store i32 0, ptr %3, align 4, !tbaa !9
  %.not5265 = icmp slt i32 %.147, 0
  br i1 %.not5265, label %._crit_edge69, label %.lr.ph68.preheader

.lr.ph68.preheader:                               ; preds = %._crit_edge.thread, %._crit_edge
  %.046.lcssa7583 = phi i32 [ 0, %._crit_edge.thread ], [ %.147, %._crit_edge ]
  %.0.lcssa7681 = phi ptr [ %13, %._crit_edge.thread ], [ %.1, %._crit_edge ]
  br label %.lr.ph68

.lr.ph68:                                         ; preds = %.lr.ph68.preheader, %.lr.ph68
  %storemerge66 = phi i32 [ %58, %.lr.ph68 ], [ 0, %.lr.ph68.preheader ]
  %54 = sext i32 %storemerge66 to i64
  %55 = getelementptr inbounds ptr, ptr %.0.lcssa7681, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  call void @free(ptr noundef %56) #10
  %57 = load i32, ptr %3, align 4, !tbaa !9
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %3, align 4, !tbaa !9
  %.not52.not = icmp slt i32 %57, %.046.lcssa7583
  br i1 %.not52.not, label %.lr.ph68, label %._crit_edge69, !llvm.loop !18

._crit_edge69:                                    ; preds = %.lr.ph68, %._crit_edge
  %.0.lcssa7682 = phi ptr [ %.1, %._crit_edge ], [ %.0.lcssa7681, %.lr.ph68 ]
  call void @free(ptr noundef %.0.lcssa7682) #10
  call void @kh_destroy_str(ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #10
  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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) 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: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #6

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

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

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

; Function Attrs: 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 allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 #6 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) 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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 #9 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #10 = { nounwind }
attributes #11 = { nounwind willreturn memory(read) }
attributes #12 = { nounwind allocsize(0) }
attributes #13 = { nounwind allocsize(1) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 24}
!12 = !{!"kh_str_s", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!13 = !{!12, !6, i64 32}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!12, !10, i64 0}
!17 = distinct !{!17, !15}
!18 = distinct !{!18, !15}


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