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

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

@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 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 uwtable
define dso_local void @test_giggle_get_chrm_id() #2 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #4
  %2 = call ptr @giggle_init_index(i32 noundef 3, ptr noundef @.str.1)
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %4 = call i32 @giggle_get_chrm_id(ptr noundef %3, ptr noundef @.str.2)
  %5 = zext i32 %4 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %5, ptr noundef null, i64 noundef 888, i32 noundef 148)
  %6 = load ptr, ptr %1, align 8, !tbaa !5
  %7 = call i32 @giggle_get_chrm_id(ptr noundef %6, ptr noundef @.str.3)
  %8 = zext i32 %7 to i64
  call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %8, ptr noundef null, i64 noundef 889, i32 noundef 148)
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = call i32 @giggle_get_chrm_id(ptr noundef %9, ptr noundef @.str.4)
  %11 = zext i32 %10 to i64
  call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %11, ptr noundef null, i64 noundef 890, i32 noundef 148)
  %12 = load ptr, ptr %1, align 8, !tbaa !5
  %13 = call i32 @giggle_get_chrm_id(ptr noundef %12, ptr noundef @.str.2)
  %14 = zext i32 %13 to i64
  call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %14, ptr noundef null, i64 noundef 891, i32 noundef 148)
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = call i32 @giggle_get_chrm_id(ptr noundef %15, ptr noundef @.str.5)
  %17 = zext i32 %16 to i64
  call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %17, ptr noundef null, i64 noundef 893, i32 noundef 148)
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = call i32 @giggle_get_chrm_id(ptr noundef %18, ptr noundef @.str.6)
  %20 = zext i32 %19 to i64
  call void @UnityAssertEqualNumber(i64 noundef 4, i64 noundef %20, ptr noundef null, i64 noundef 894, i32 noundef 148)
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = call i32 @giggle_get_chrm_id(ptr noundef %21, ptr noundef @.str.7)
  %23 = zext i32 %22 to i64
  call void @UnityAssertEqualNumber(i64 noundef 5, i64 noundef %23, ptr noundef null, i64 noundef 895, i32 noundef 148)
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = call i32 @giggle_get_chrm_id(ptr noundef %24, ptr noundef @.str.5)
  %26 = zext i32 %25 to i64
  call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %26, ptr noundef null, i64 noundef 896, i32 noundef 148)
  call void @giggle_index_destroy(ptr noundef %1)
  %27 = call i32 @remove(ptr noundef @.str.1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #4
  ret void
}

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

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

declare void @giggle_index_destroy(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @remove(ptr noundef) #3

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 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 = { 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"}


; 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.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 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: nounwind uwtable
define dso_local void @test_giggle_get_chrm_id() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %2 = tail call ptr @giggle_init_index(i32 noundef 3, ptr noundef nonnull @.str.1) #4
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.2) #4
  %4 = zext i32 %3 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %4, ptr noundef null, i64 noundef 888, i32 noundef 148) #4
  %5 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.3) #4
  %6 = zext i32 %5 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 1, i64 noundef %6, ptr noundef null, i64 noundef 889, i32 noundef 148) #4
  %7 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.4) #4
  %8 = zext i32 %7 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 2, i64 noundef %8, ptr noundef null, i64 noundef 890, i32 noundef 148) #4
  %9 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.2) #4
  %10 = zext i32 %9 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 0, i64 noundef %10, ptr noundef null, i64 noundef 891, i32 noundef 148) #4
  %11 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.5) #4
  %12 = zext i32 %11 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %12, ptr noundef null, i64 noundef 893, i32 noundef 148) #4
  %13 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.6) #4
  %14 = zext i32 %13 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 4, i64 noundef %14, ptr noundef null, i64 noundef 894, i32 noundef 148) #4
  %15 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.7) #4
  %16 = zext i32 %15 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 5, i64 noundef %16, ptr noundef null, i64 noundef 895, i32 noundef 148) #4
  %17 = tail call i32 @giggle_get_chrm_id(ptr noundef %2, ptr noundef nonnull @.str.5) #4
  %18 = zext i32 %17 to i64
  tail call void @UnityAssertEqualNumber(i64 noundef 3, i64 noundef %18, ptr noundef null, i64 noundef 896, i32 noundef 148) #4
  call void @giggle_index_destroy(ptr noundef nonnull %1) #4
  %19 = call i32 @remove(ptr noundef nonnull @.str.1) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret void
}

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

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

declare void @giggle_index_destroy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @remove(ptr nocapture noundef readonly) local_unnamed_addr #3

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 = { 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 = { 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 #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"}


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