; LLVM IR from bartobri/data-structures-c :: symbol-table/skip-list (main)

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

@__const.main.keys = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [10 x i8], align 1
  %4 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 10, ptr %3) #6
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %3, ptr align 1 @__const.main.keys, i64 10, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %5 = call i64 @time(ptr noundef null) #6
  %6 = trunc i64 %5 to i32
  call void @srand(i32 noundef %6) #6
  call void @STinit()
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %7

7:                                                ; preds = %23, %0
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = icmp slt i32 %8, 10
  br i1 %9, label %10, label %26

10:                                               ; preds = %7
  %11 = call noalias ptr @malloc(i64 noundef 8) #7
  store ptr %11, ptr %4, align 8, !tbaa !9
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [10 x i8], ptr %3, i64 0, i64 %13
  %15 = load i8, ptr %14, align 1, !tbaa !11
  %16 = load ptr, ptr %4, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.anon, ptr %16, i32 0, i32 0
  store i8 %15, ptr %17, align 4, !tbaa !12
  %18 = call i32 @rand() #6
  %19 = srem i32 %18, 100
  %20 = load ptr, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct.anon, ptr %20, i32 0, i32 1
  store i32 %19, ptr %21, align 4, !tbaa !14
  %22 = load ptr, ptr %4, align 8, !tbaa !9
  call void @STinsert(ptr noundef %22)
  br label %23

23:                                               ; preds = %10
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = add nsw i32 %24, 1
  store i32 %25, ptr %2, align 4, !tbaa !5
  br label %7, !llvm.loop !15

26:                                               ; preds = %7
  call void @STsort(ptr noundef @visit)
  %27 = call ptr @STsearch(i8 noundef signext 89)
  store ptr %27, ptr %4, align 8, !tbaa !9
  %28 = load ptr, ptr %4, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.anon, ptr %28, i32 0, i32 1
  %30 = load i32, ptr %29, align 4, !tbaa !14
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %30)
  call void @STdelete(i8 noundef signext 84)
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  call void @STsort(ptr noundef @visit)
  %33 = call ptr @STselect(i32 noundef 2)
  store ptr %33, ptr %4, align 8, !tbaa !9
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.anon, ptr %34, i32 0, i32 0
  %36 = load i8, ptr %35, align 4, !tbaa !12
  %37 = sext i8 %36 to i32
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %37)
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 10, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  ret i32 0
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #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) #3

; Function Attrs: nounwind
declare void @srand(i32 noundef) #4

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #4

declare void @STinit() #1

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #5

; Function Attrs: nounwind
declare i32 @rand() #4

declare void @STinsert(ptr noundef) #1

declare void @STsort(ptr noundef) #1

declare ptr @STsearch(i8 noundef signext) #1

declare void @STdelete(i8 noundef signext) #1

declare ptr @STselect(i32 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"", !7, i64 0, !6, i64 4}
!14 = !{!13, !6, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@__const.main.keys = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i64 @time(ptr noundef null) #5
  %2 = trunc i64 %1 to i32
  tail call void @srand(i32 noundef %2) #5
  tail call void @STinit() #5
  %3 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %4 = load i8, ptr @__const.main.keys, align 1, !tbaa !5
  store i8 %4, ptr %3, align 4, !tbaa !8
  %5 = tail call i32 @rand() #5
  %6 = srem i32 %5, 100
  %7 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %6, ptr %7, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %3) #5
  %8 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %9 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 1), align 1, !tbaa !5
  store i8 %9, ptr %8, align 4, !tbaa !8
  %10 = tail call i32 @rand() #5
  %11 = srem i32 %10, 100
  %12 = getelementptr inbounds i8, ptr %8, i64 4
  store i32 %11, ptr %12, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %8) #5
  %13 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %14 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 2), align 1, !tbaa !5
  store i8 %14, ptr %13, align 4, !tbaa !8
  %15 = tail call i32 @rand() #5
  %16 = srem i32 %15, 100
  %17 = getelementptr inbounds i8, ptr %13, i64 4
  store i32 %16, ptr %17, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %13) #5
  %18 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %19 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 3), align 1, !tbaa !5
  store i8 %19, ptr %18, align 4, !tbaa !8
  %20 = tail call i32 @rand() #5
  %21 = srem i32 %20, 100
  %22 = getelementptr inbounds i8, ptr %18, i64 4
  store i32 %21, ptr %22, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %18) #5
  %23 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %24 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 4), align 1, !tbaa !5
  store i8 %24, ptr %23, align 4, !tbaa !8
  %25 = tail call i32 @rand() #5
  %26 = srem i32 %25, 100
  %27 = getelementptr inbounds i8, ptr %23, i64 4
  store i32 %26, ptr %27, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %23) #5
  %28 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %29 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 5), align 1, !tbaa !5
  store i8 %29, ptr %28, align 4, !tbaa !8
  %30 = tail call i32 @rand() #5
  %31 = srem i32 %30, 100
  %32 = getelementptr inbounds i8, ptr %28, i64 4
  store i32 %31, ptr %32, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %28) #5
  %33 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %34 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 6), align 1, !tbaa !5
  store i8 %34, ptr %33, align 4, !tbaa !8
  %35 = tail call i32 @rand() #5
  %36 = srem i32 %35, 100
  %37 = getelementptr inbounds i8, ptr %33, i64 4
  store i32 %36, ptr %37, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %33) #5
  %38 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %39 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 7), align 1, !tbaa !5
  store i8 %39, ptr %38, align 4, !tbaa !8
  %40 = tail call i32 @rand() #5
  %41 = srem i32 %40, 100
  %42 = getelementptr inbounds i8, ptr %38, i64 4
  store i32 %41, ptr %42, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %38) #5
  %43 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %44 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 8), align 1, !tbaa !5
  store i8 %44, ptr %43, align 4, !tbaa !8
  %45 = tail call i32 @rand() #5
  %46 = srem i32 %45, 100
  %47 = getelementptr inbounds i8, ptr %43, i64 4
  store i32 %46, ptr %47, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %43) #5
  %48 = tail call noalias dereferenceable_or_null(8) ptr @malloc(i64 noundef 8) #6
  %49 = load i8, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 9), align 1, !tbaa !5
  store i8 %49, ptr %48, align 4, !tbaa !8
  %50 = tail call i32 @rand() #5
  %51 = srem i32 %50, 100
  %52 = getelementptr inbounds i8, ptr %48, i64 4
  store i32 %51, ptr %52, align 4, !tbaa !11
  tail call void @STinsert(ptr noundef nonnull %48) #5
  tail call void @STsort(ptr noundef nonnull @visit) #5
  %53 = tail call ptr @STsearch(i8 noundef signext 89) #5
  %54 = getelementptr inbounds i8, ptr %53, i64 4
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %56 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %55)
  tail call void @STdelete(i8 noundef signext 84) #5
  %57 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @STsort(ptr noundef nonnull @visit) #5
  %58 = tail call ptr @STselect(i32 noundef 2) #5
  %59 = load i8, ptr %58, align 4, !tbaa !8
  %60 = sext i8 %59 to i32
  %61 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %60)
  ret i32 0
}

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #2

declare void @STinit() 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: nounwind
declare i32 @rand() local_unnamed_addr #2

declare void @STinsert(ptr noundef) local_unnamed_addr #3

declare void @STsort(ptr noundef) local_unnamed_addr #3

declare ptr @STsearch(i8 noundef signext) local_unnamed_addr #3

declare void @STdelete(i8 noundef signext) local_unnamed_addr #3

declare ptr @STselect(i32 noundef) local_unnamed_addr #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 = { 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 #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 = { 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 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !6, i64 0}
!9 = !{!"", !6, i64 0, !10, i64 4}
!10 = !{!"int", !6, i64 0}
!11 = !{!9, !10, i64 4}


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