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

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

; Function Attrs: nounwind uwtable
define dso_local void @test_hash_list_init() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %6 = call ptr (i32, ...) @hash_list_init(i32 noundef 100000)
  store ptr %6, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = call ptr @hash_list_get(ptr noundef %7, i32 noundef 1)
  store ptr %8, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = ptrtoint ptr %9 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %10, ptr noundef null, i64 noundef 23, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store i64 2, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = call i32 @hash_list_add(ptr noundef %11, i32 noundef 1, ptr noundef %3, i32 noundef 8)
  store i32 %12, ptr %4, align 4, !tbaa !11
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = call ptr @hash_list_get(ptr noundef %13, i32 noundef 1)
  store ptr %14, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = load i64, ptr %15, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %16, ptr noundef null, i64 noundef 28, i32 noundef 148)
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = call ptr @hash_list_get(ptr noundef %17, i32 noundef 100)
  store ptr %18, ptr %2, align 8, !tbaa !5
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = ptrtoint ptr %19 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %20, ptr noundef null, i64 noundef 31, i32 noundef 148)
  store i64 4, ptr %3, align 8, !tbaa !9
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = call i32 @hash_list_add(ptr noundef %21, i32 noundef 100, ptr noundef %3, i32 noundef 8)
  store i32 %22, ptr %4, align 4, !tbaa !11
  %23 = load ptr, ptr %1, align 8, !tbaa !5
  %24 = call ptr @hash_list_get(ptr noundef %23, i32 noundef 100)
  store ptr %24, ptr %2, align 8, !tbaa !5
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = load i64, ptr %25, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 4, i64 noundef %26, ptr noundef null, i64 noundef 35, i32 noundef 148)
  %27 = load ptr, ptr %1, align 8, !tbaa !5
  %28 = call ptr @hash_list_get(ptr noundef %27, i32 noundef 1000)
  store ptr %28, ptr %2, align 8, !tbaa !5
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = ptrtoint ptr %29 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %30, ptr noundef null, i64 noundef 38, i32 noundef 148)
  store i64 6, ptr %3, align 8, !tbaa !9
  %31 = load ptr, ptr %1, align 8, !tbaa !5
  %32 = call i32 @hash_list_add(ptr noundef %31, i32 noundef 1000, ptr noundef %3, i32 noundef 8)
  store i32 %32, ptr %4, align 4, !tbaa !11
  %33 = load ptr, ptr %1, align 8, !tbaa !5
  %34 = call ptr @hash_list_get(ptr noundef %33, i32 noundef 1000)
  store ptr %34, ptr %2, align 8, !tbaa !5
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = load i64, ptr %35, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 6, i64 noundef %36, ptr noundef null, i64 noundef 42, i32 noundef 148)
  %37 = load ptr, ptr %1, align 8, !tbaa !5
  %38 = call ptr @hash_list_remove(ptr noundef %37, i32 noundef 1)
  store ptr %38, ptr %2, align 8, !tbaa !5
  %39 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %39) #4
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = call ptr @hash_list_remove(ptr noundef %40, i32 noundef 100)
  store ptr %41, ptr %2, align 8, !tbaa !5
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %42) #4
  %43 = load ptr, ptr %1, align 8, !tbaa !5
  %44 = call ptr @hash_list_remove(ptr noundef %43, i32 noundef 1000)
  store ptr %44, ptr %2, align 8, !tbaa !5
  %45 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %45) #4
  %46 = load ptr, ptr %1, align 8, !tbaa !5
  %47 = call ptr @hash_list_get(ptr noundef %46, i32 noundef 1)
  store ptr %47, ptr %2, align 8, !tbaa !5
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = ptrtoint ptr %48 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %49, ptr noundef null, i64 noundef 52, i32 noundef 148)
  %50 = load ptr, ptr %1, align 8, !tbaa !5
  %51 = call ptr @hash_list_get(ptr noundef %50, i32 noundef 100)
  store ptr %51, ptr %2, align 8, !tbaa !5
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  %53 = ptrtoint ptr %52 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %53, ptr noundef null, i64 noundef 54, i32 noundef 148)
  %54 = load ptr, ptr %1, align 8, !tbaa !5
  %55 = call ptr @hash_list_get(ptr noundef %54, i32 noundef 1000)
  store ptr %55, ptr %2, align 8, !tbaa !5
  %56 = load ptr, ptr %2, align 8, !tbaa !5
  %57 = ptrtoint ptr %56 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %57, ptr noundef null, i64 noundef 56, i32 noundef 148)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1001, ptr %5, align 4, !tbaa !11
  br label %58

58:                                               ; preds = %68, %0
  %59 = load i32, ptr %5, align 4, !tbaa !11
  %60 = icmp ult i32 %59, 100000
  br i1 %60, label %61, label %71

61:                                               ; preds = %58
  %62 = load i32, ptr %5, align 4, !tbaa !11
  %63 = add i32 %62, 1
  %64 = zext i32 %63 to i64
  store i64 %64, ptr %3, align 8, !tbaa !9
  %65 = load ptr, ptr %1, align 8, !tbaa !5
  %66 = load i32, ptr %5, align 4, !tbaa !11
  %67 = call i32 @hash_list_add(ptr noundef %65, i32 noundef %66, ptr noundef %3, i32 noundef 8)
  store i32 %67, ptr %4, align 4, !tbaa !11
  br label %68

68:                                               ; preds = %61
  %69 = load i32, ptr %5, align 4, !tbaa !11
  %70 = add i32 %69, 1
  store i32 %70, ptr %5, align 4, !tbaa !11
  br label %58, !llvm.loop !13

71:                                               ; preds = %58
  call void @hash_list_destroy(ptr noundef %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

declare ptr @hash_list_init(...) #2

declare ptr @hash_list_get(ptr noundef, i32 noundef) #2

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

declare i32 @hash_list_add(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #2

declare ptr @hash_list_remove(ptr noundef, i32 noundef) #2

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

declare void @hash_list_destroy(ptr noundef) #2

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

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

; Function Attrs: nounwind uwtable
define dso_local void @test_hash_list_init() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %3 = tail call ptr (i32, ...) @hash_list_init(i32 noundef 100000) #4
  store ptr %3, ptr %1, align 8, !tbaa !5
  %4 = tail call ptr @hash_list_get(ptr noundef %3, i32 noundef 1) #4
  %5 = ptrtoint ptr %4 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %5, ptr noundef null, i64 noundef 23, i32 noundef 148) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  store i64 2, ptr %2, align 8, !tbaa !9
  %6 = call i32 @hash_list_add(ptr noundef %3, i32 noundef 1, ptr noundef nonnull %2, i32 noundef 8) #4
  %7 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 1) #4
  %8 = load i64, ptr %7, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %8, ptr noundef null, i64 noundef 28, i32 noundef 148) #4
  %9 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 100) #4
  %10 = ptrtoint ptr %9 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %10, ptr noundef null, i64 noundef 31, i32 noundef 148) #4
  store i64 4, ptr %2, align 8, !tbaa !9
  %11 = call i32 @hash_list_add(ptr noundef %3, i32 noundef 100, ptr noundef nonnull %2, i32 noundef 8) #4
  %12 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 100) #4
  %13 = load i64, ptr %12, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 4, i64 noundef %13, ptr noundef null, i64 noundef 35, i32 noundef 148) #4
  %14 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 1000) #4
  %15 = ptrtoint ptr %14 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %15, ptr noundef null, i64 noundef 38, i32 noundef 148) #4
  store i64 6, ptr %2, align 8, !tbaa !9
  %16 = call i32 @hash_list_add(ptr noundef %3, i32 noundef 1000, ptr noundef nonnull %2, i32 noundef 8) #4
  %17 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 1000) #4
  %18 = load i64, ptr %17, align 8, !tbaa !9
  call void @UnityAssertEqualNumber(i64 noundef 6, i64 noundef %18, ptr noundef null, i64 noundef 42, i32 noundef 148) #4
  %19 = call ptr @hash_list_remove(ptr noundef %3, i32 noundef 1) #4
  call void @free(ptr noundef %19) #4
  %20 = call ptr @hash_list_remove(ptr noundef %3, i32 noundef 100) #4
  call void @free(ptr noundef %20) #4
  %21 = call ptr @hash_list_remove(ptr noundef %3, i32 noundef 1000) #4
  call void @free(ptr noundef %21) #4
  %22 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 1) #4
  %23 = ptrtoint ptr %22 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %23, ptr noundef null, i64 noundef 52, i32 noundef 148) #4
  %24 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 100) #4
  %25 = ptrtoint ptr %24 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %25, ptr noundef null, i64 noundef 54, i32 noundef 148) #4
  %26 = call ptr @hash_list_get(ptr noundef %3, i32 noundef 1000) #4
  %27 = ptrtoint ptr %26 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %27, ptr noundef null, i64 noundef 56, i32 noundef 148) #4
  br label %28

28:                                               ; preds = %0, %28
  %indvars.iv = phi i64 [ 1001, %0 ], [ %indvars.iv.next, %28 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  store i64 %indvars.iv.next, ptr %2, align 8, !tbaa !9
  %29 = trunc nuw nsw i64 %indvars.iv to i32
  %30 = call i32 @hash_list_add(ptr noundef %3, i32 noundef %29, ptr noundef nonnull %2, i32 noundef 8) #4
  %exitcond.not = icmp eq i64 %indvars.iv.next, 100000
  br i1 %exitcond.not, label %31, label %28, !llvm.loop !11

31:                                               ; preds = %28
  call void @hash_list_destroy(ptr noundef nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

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

declare ptr @hash_list_init(...) local_unnamed_addr #2

declare ptr @hash_list_get(ptr noundef, i32 noundef) local_unnamed_addr #2

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

declare i32 @hash_list_add(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare ptr @hash_list_remove(ptr noundef, i32 noundef) local_unnamed_addr #2

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

declare void @hash_list_destroy(ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 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 #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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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