; LLVM IR from ryanlayer/giggle :: test/unit (test_lists)

; 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.ordered_set = type { ptr, i32, i32, ptr, ptr, ptr }
%struct.str_uint_pair = type { ptr, i32 }

@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 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

declare void @UnityAssertEqualNumber(i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) #1

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

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

declare ptr @ordered_set_init(i32 noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare i32 @str_uint_pair_sort_element_cmp(ptr noundef, ptr noundef) #1

declare i32 @str_uint_pair_search_element_cmp(ptr noundef, ptr noundef) #1

declare i32 @str_uint_pair_search_key_cmp(ptr noundef, ptr noundef) #1

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

declare ptr @ordered_set_add(ptr noundef, ptr noundef) #1

declare void @str_uint_pair_free(ptr noundef) #1

declare void @ordered_set_destroy(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @test_ordered_set_get() #4 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %8 = call ptr @ordered_set_init(i32 noundef 3, ptr noundef @str_uint_pair_sort_element_cmp, ptr noundef @str_uint_pair_search_element_cmp, ptr noundef @str_uint_pair_search_key_cmp)
  store ptr %8, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  %9 = call noalias ptr @malloc(i64 noundef 16) #6
  store ptr %9, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.ordered_set, ptr %10, i32 0, i32 1
  %12 = load i32, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.str_uint_pair, ptr %13, i32 0, i32 1
  store i32 %12, ptr %14, align 8, !tbaa !12
  %15 = call noalias ptr @strdup(ptr noundef @.str.4) #5
  %16 = load ptr, ptr %2, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.str_uint_pair, ptr %16, i32 0, i32 0
  store ptr %15, ptr %17, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = call ptr @ordered_set_add(ptr noundef %18, ptr noundef %19)
  store ptr %20, ptr %3, align 8, !tbaa !5
  %21 = call noalias ptr @malloc(i64 noundef 16) #6
  store ptr %21, ptr %2, align 8, !tbaa !5
  %22 = load ptr, ptr %1, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.ordered_set, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.str_uint_pair, ptr %25, i32 0, i32 1
  store i32 %24, ptr %26, align 8, !tbaa !12
  %27 = call noalias ptr @strdup(ptr noundef @.str.6) #5
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.str_uint_pair, ptr %28, i32 0, i32 0
  store ptr %27, ptr %29, align 8, !tbaa !14
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = call ptr @ordered_set_add(ptr noundef %30, ptr noundef %31)
  store ptr %32, ptr %3, align 8, !tbaa !5
  %33 = call noalias ptr @malloc(i64 noundef 16) #6
  store ptr %33, ptr %2, align 8, !tbaa !5
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.ordered_set, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.str_uint_pair, ptr %37, i32 0, i32 1
  store i32 %36, ptr %38, align 8, !tbaa !12
  %39 = call noalias ptr @strdup(ptr noundef @.str.7) #5
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.str_uint_pair, ptr %40, i32 0, i32 0
  store ptr %39, ptr %41, align 8, !tbaa !14
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = call ptr @ordered_set_add(ptr noundef %42, ptr noundef %43)
  store ptr %44, ptr %3, align 8, !tbaa !5
  %45 = call noalias ptr @malloc(i64 noundef 16) #6
  store ptr %45, ptr %2, align 8, !tbaa !5
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ordered_set, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !9
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.str_uint_pair, ptr %49, i32 0, i32 1
  store i32 %48, ptr %50, align 8, !tbaa !12
  %51 = call noalias ptr @strdup(ptr noundef @.str.5) #5
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.str_uint_pair, ptr %52, i32 0, i32 0
  store ptr %51, ptr %53, align 8, !tbaa !14
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = call ptr @ordered_set_add(ptr noundef %54, ptr noundef %55)
  store ptr %56, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  store ptr @.str.4, ptr %4, align 8, !tbaa !5
  %57 = load ptr, ptr %1, align 8, !tbaa !5
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = call ptr @ordered_set_get(ptr noundef %57, ptr noundef %58)
  store ptr %59, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.str_uint_pair, ptr %60, i32 0, i32 1
  %62 = load i32, ptr %61, align 8, !tbaa !12
  %63 = zext i32 %62 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %63, ptr noundef null, i64 noundef 272, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr @.str.5, ptr %5, align 8, !tbaa !5
  %64 = load ptr, ptr %1, align 8, !tbaa !5
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = call ptr @ordered_set_get(ptr noundef %64, ptr noundef %65)
  store ptr %66, ptr %3, align 8, !tbaa !5
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.str_uint_pair, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !12
  %70 = zext i32 %69 to i64
  call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %70, ptr noundef null, i64 noundef 276, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr @.str.6, ptr %6, align 8, !tbaa !5
  %71 = load ptr, ptr %1, align 8, !tbaa !5
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = call ptr @ordered_set_get(ptr noundef %71, ptr noundef %72)
  store ptr %73, ptr %3, align 8, !tbaa !5
  %74 = load ptr, ptr %3, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.str_uint_pair, ptr %74, i32 0, i32 1
  %76 = load i32, ptr %75, align 8, !tbaa !12
  %77 = zext i32 %76 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %77, ptr noundef null, i64 noundef 280, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store ptr @.str.7, ptr %7, align 8, !tbaa !5
  %78 = load ptr, ptr %1, align 8, !tbaa !5
  %79 = load ptr, ptr %7, align 8, !tbaa !5
  %80 = call ptr @ordered_set_get(ptr noundef %78, ptr noundef %79)
  store ptr %80, ptr %3, align 8, !tbaa !5
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.str_uint_pair, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !12
  %84 = zext i32 %83 to i64
  call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %84, ptr noundef null, i64 noundef 284, i32 noundef 148)
  call void @ordered_set_destroy(ptr noundef %1, ptr noundef @str_uint_pair_free)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

declare ptr @ordered_set_get(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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 #3 = { 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 #4 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"ordered_set", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"str_uint_pair", !6, i64 0, !11, i64 8}
!14 = !{!13, !6, i64 0}


; 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.4 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1

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

declare void @UnityAssertEqualNumber(i64 noundef, i64 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

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

declare i32 @str_uint_pair_sort_element_cmp(ptr noundef, ptr noundef) #1

declare i32 @str_uint_pair_search_element_cmp(ptr noundef, ptr noundef) #1

declare i32 @str_uint_pair_search_key_cmp(ptr noundef, ptr noundef) #1

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

declare ptr @ordered_set_add(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @str_uint_pair_free(ptr noundef) #1

declare void @ordered_set_destroy(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @test_ordered_set_get() local_unnamed_addr #4 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  %2 = tail call ptr @ordered_set_init(i32 noundef 3, ptr noundef nonnull @str_uint_pair_sort_element_cmp, ptr noundef nonnull @str_uint_pair_search_element_cmp, ptr noundef nonnull @str_uint_pair_search_key_cmp) #5
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  %5 = load i32, ptr %4, align 8, !tbaa !9
  %6 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %5, ptr %6, align 8, !tbaa !12
  %7 = tail call noalias ptr @strdup(ptr noundef nonnull @.str.4) #5
  store ptr %7, ptr %3, align 8, !tbaa !14
  %8 = tail call ptr @ordered_set_add(ptr noundef %2, ptr noundef nonnull %3) #5
  %9 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %10 = load i32, ptr %4, align 8, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  store i32 %10, ptr %11, align 8, !tbaa !12
  %12 = tail call noalias ptr @strdup(ptr noundef nonnull @.str.6) #5
  store ptr %12, ptr %9, align 8, !tbaa !14
  %13 = tail call ptr @ordered_set_add(ptr noundef %2, ptr noundef nonnull %9) #5
  %14 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %15 = load i32, ptr %4, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %14, i64 8
  store i32 %15, ptr %16, align 8, !tbaa !12
  %17 = tail call noalias ptr @strdup(ptr noundef nonnull @.str.7) #5
  store ptr %17, ptr %14, align 8, !tbaa !14
  %18 = tail call ptr @ordered_set_add(ptr noundef %2, ptr noundef nonnull %14) #5
  %19 = tail call noalias dereferenceable_or_null(16) ptr @malloc(i64 noundef 16) #6
  %20 = load i32, ptr %4, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %19, i64 8
  store i32 %20, ptr %21, align 8, !tbaa !12
  %22 = tail call noalias ptr @strdup(ptr noundef nonnull @.str.5) #5
  store ptr %22, ptr %19, align 8, !tbaa !14
  %23 = tail call ptr @ordered_set_add(ptr noundef %2, ptr noundef nonnull %19) #5
  %24 = tail call ptr @ordered_set_get(ptr noundef %2, ptr noundef nonnull @.str.4) #5
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = zext i32 %26 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %27, ptr noundef null, i64 noundef 272, i32 noundef 148) #5
  %28 = tail call ptr @ordered_set_get(ptr noundef %2, ptr noundef nonnull @.str.5) #5
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load i32, ptr %29, align 8, !tbaa !12
  %31 = zext i32 %30 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %31, ptr noundef null, i64 noundef 276, i32 noundef 148) #5
  %32 = tail call ptr @ordered_set_get(ptr noundef %2, ptr noundef nonnull @.str.6) #5
  %33 = getelementptr inbounds i8, ptr %32, i64 8
  %34 = load i32, ptr %33, align 8, !tbaa !12
  %35 = zext i32 %34 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %35, ptr noundef null, i64 noundef 280, i32 noundef 148) #5
  %36 = tail call ptr @ordered_set_get(ptr noundef %2, ptr noundef nonnull @.str.7) #5
  %37 = getelementptr inbounds i8, ptr %36, i64 8
  %38 = load i32, ptr %37, align 8, !tbaa !12
  %39 = zext i32 %38 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %39, ptr noundef null, i64 noundef 284, i32 noundef 148) #5
  call void @ordered_set_destroy(ptr noundef nonnull %1, ptr noundef nonnull @str_uint_pair_free) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret void
}

declare ptr @ordered_set_get(ptr noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #3 = { 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 #4 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"ordered_set", !6, i64 0, !11, i64 8, !11, i64 12, !6, i64 16, !6, i64 24, !6, i64 32}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"str_uint_pair", !6, i64 0, !11, i64 8}
!14 = !{!13, !6, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass