; LLVM IR from clangen/musikcube :: src/3rdparty/src/sqlean/unicode (extension)

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

@__const.sqlite3_unicode_init_impl.scalars = external hidden unnamed_addr constant [11 x %struct.FuncScalar], align 16
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @sqlite3_unicode_init_impl(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca [11 x %struct.FuncScalar], align 16
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 352, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.sqlite3_unicode_init_impl.scalars, i64 352, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  store i64 0, ptr %4, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %30, %1
  %7 = load i64, ptr %4, align 8, !tbaa !9
  %8 = icmp ult i64 %7, 11
  br i1 %8, label %10, label %9

9:                                                ; preds = %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %33

10:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  %11 = load i64, ptr %4, align 8, !tbaa !9
  %12 = getelementptr inbounds [11 x %struct.FuncScalar], ptr %3, i64 0, i64 %11
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.FuncScalar, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.FuncScalar, ptr %17, i32 0, i32 1
  %19 = load i32, ptr %18, align 8, !tbaa !14
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.FuncScalar, ptr %20, i32 0, i32 2
  %22 = load i32, ptr %21, align 4, !tbaa !15
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.FuncScalar, ptr %23, i32 0, i32 3
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.FuncScalar, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = call i32 @sqlite3_create_function(ptr noundef %13, ptr noundef %16, i32 noundef %19, i32 noundef %22, ptr noundef %25, ptr noundef %28, ptr noundef null, ptr noundef null)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  br label %30

30:                                               ; preds = %10
  %31 = load i64, ptr %4, align 8, !tbaa !9
  %32 = add i64 %31, 1
  store i64 %32, ptr %4, align 8, !tbaa !9
  br label %6, !llvm.loop !18

33:                                               ; preds = %9
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = call i32 @sqlite3_create_collation(ptr noundef %34, ptr noundef @.str.9, i32 noundef 1, ptr noundef inttoptr (i64 1 to ptr), ptr noundef @sqlite3_unicode_collate)
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = call i32 @sqlite3_create_collation(ptr noundef %36, ptr noundef @.str.9, i32 noundef 4, ptr noundef inttoptr (i64 4 to ptr), ptr noundef @sqlite3_unicode_collate)
  call void @llvm.lifetime.end.p0(i64 352, ptr %3) #4
  ret i32 0
}

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

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

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

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

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"FuncScalar", !6, i64 0, !13, i64 8, !13, i64 12, !6, i64 16, !6, i64 24}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = !{!12, !13, i64 12}
!16 = !{!12, !6, i64 16}
!17 = !{!12, !6, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

@__const.sqlite3_unicode_init_impl.scalars = external hidden unnamed_addr constant [11 x %struct.FuncScalar], align 16
@.str.9 = external hidden unnamed_addr constant [7 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @sqlite3_unicode_init_impl(ptr noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @__const.sqlite3_unicode_init_impl.scalars, align 16, !tbaa !5
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 8), align 8, !tbaa !11
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 12), align 4, !tbaa !12
  %5 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 16), align 16, !tbaa !13
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 24), align 8, !tbaa !14
  %7 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %2, i32 noundef %3, i32 noundef %4, ptr noundef %5, ptr noundef %6, ptr noundef null, ptr noundef null) #2
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 32), align 16, !tbaa !5
  %9 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 40), align 8, !tbaa !11
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 44), align 4, !tbaa !12
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 48), align 16, !tbaa !13
  %12 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 56), align 8, !tbaa !14
  %13 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %8, i32 noundef %9, i32 noundef %10, ptr noundef %11, ptr noundef %12, ptr noundef null, ptr noundef null) #2
  %14 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 64), align 16, !tbaa !5
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 72), align 8, !tbaa !11
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 76), align 4, !tbaa !12
  %17 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 80), align 16, !tbaa !13
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 88), align 8, !tbaa !14
  %19 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %14, i32 noundef %15, i32 noundef %16, ptr noundef %17, ptr noundef %18, ptr noundef null, ptr noundef null) #2
  %20 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 96), align 16, !tbaa !5
  %21 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 104), align 8, !tbaa !11
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 108), align 4, !tbaa !12
  %23 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 112), align 16, !tbaa !13
  %24 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 120), align 8, !tbaa !14
  %25 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %20, i32 noundef %21, i32 noundef %22, ptr noundef %23, ptr noundef %24, ptr noundef null, ptr noundef null) #2
  %26 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 128), align 16, !tbaa !5
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 136), align 8, !tbaa !11
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 140), align 4, !tbaa !12
  %29 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 144), align 16, !tbaa !13
  %30 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 152), align 8, !tbaa !14
  %31 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %26, i32 noundef %27, i32 noundef %28, ptr noundef %29, ptr noundef %30, ptr noundef null, ptr noundef null) #2
  %32 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 160), align 16, !tbaa !5
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 168), align 8, !tbaa !11
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 172), align 4, !tbaa !12
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 176), align 16, !tbaa !13
  %36 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 184), align 8, !tbaa !14
  %37 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %32, i32 noundef %33, i32 noundef %34, ptr noundef %35, ptr noundef %36, ptr noundef null, ptr noundef null) #2
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 192), align 16, !tbaa !5
  %39 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 200), align 8, !tbaa !11
  %40 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 204), align 4, !tbaa !12
  %41 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 208), align 16, !tbaa !13
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 216), align 8, !tbaa !14
  %43 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %38, i32 noundef %39, i32 noundef %40, ptr noundef %41, ptr noundef %42, ptr noundef null, ptr noundef null) #2
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 224), align 16, !tbaa !5
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 232), align 8, !tbaa !11
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 236), align 4, !tbaa !12
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 240), align 16, !tbaa !13
  %48 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 248), align 8, !tbaa !14
  %49 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %44, i32 noundef %45, i32 noundef %46, ptr noundef %47, ptr noundef %48, ptr noundef null, ptr noundef null) #2
  %50 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 256), align 16, !tbaa !5
  %51 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 264), align 8, !tbaa !11
  %52 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 268), align 4, !tbaa !12
  %53 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 272), align 16, !tbaa !13
  %54 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 280), align 8, !tbaa !14
  %55 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %50, i32 noundef %51, i32 noundef %52, ptr noundef %53, ptr noundef %54, ptr noundef null, ptr noundef null) #2
  %56 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 288), align 16, !tbaa !5
  %57 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 296), align 8, !tbaa !11
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 300), align 4, !tbaa !12
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 304), align 16, !tbaa !13
  %60 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 312), align 8, !tbaa !14
  %61 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %56, i32 noundef %57, i32 noundef %58, ptr noundef %59, ptr noundef %60, ptr noundef null, ptr noundef null) #2
  %62 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 320), align 16, !tbaa !5
  %63 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 328), align 8, !tbaa !11
  %64 = load i32, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 332), align 4, !tbaa !12
  %65 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 336), align 16, !tbaa !13
  %66 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.sqlite3_unicode_init_impl.scalars, i64 344), align 8, !tbaa !14
  %67 = tail call i32 @sqlite3_create_function(ptr noundef %0, ptr noundef %62, i32 noundef %63, i32 noundef %64, ptr noundef %65, ptr noundef %66, ptr noundef null, ptr noundef null) #2
  %68 = tail call i32 @sqlite3_create_collation(ptr noundef %0, ptr noundef nonnull @.str.9, i32 noundef 1, ptr noundef nonnull inttoptr (i64 1 to ptr), ptr noundef nonnull @sqlite3_unicode_collate) #2
  %69 = tail call i32 @sqlite3_create_collation(ptr noundef %0, ptr noundef nonnull @.str.9, i32 noundef 4, ptr noundef nonnull inttoptr (i64 4 to ptr), ptr noundef nonnull @sqlite3_unicode_collate) #2
  ret i32 0
}

declare i32 @sqlite3_create_function(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare i32 @sqlite3_create_collation(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!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, !7, i64 0}
!6 = !{!"FuncScalar", !7, i64 0, !10, i64 8, !10, i64 12, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!6, !10, i64 12}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !7, i64 24}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass