; LLVM IR from LeoVen/C-Macro-Collections :: tests (types)

; 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.hashbidimap0 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap0_entry = type { ptr, ptr, [2 x i64], [2 x ptr] }
%struct.cmc_alloc_node = type { ptr, ptr, ptr, ptr }

; 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 hidden ptr @hbm0_impl_get_entry_by_key(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hbm0_empty(ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hbm0_remove_by_key(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #1 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call zeroext i1 @hbm0_empty(ptr noundef %13)
  br i1 %14, label %15, label %18

15:                                               ; preds = %4
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashbidimap0, ptr %16, i32 0, i32 4
  store i32 2, ptr %17, align 8, !tbaa !9
  store i1 false, ptr %5, align 1
  br label %79

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = call ptr @hbm0_impl_get_entry_by_key(ptr noundef %19, ptr noundef %20)
  store ptr %21, ptr %10, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %27, label %24

24:                                               ; preds = %18
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashbidimap0, ptr %25, i32 0, i32 4
  store i32 3, ptr %26, align 8, !tbaa !9
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %78

27:                                               ; preds = %18
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %29, i32 0, i32 3
  %31 = getelementptr inbounds [2 x ptr], ptr %30, i64 0, i64 1
  %32 = load ptr, ptr %31, align 8, !tbaa !5
  store ptr %32, ptr %11, align 8, !tbaa !5
  %33 = load ptr, ptr %11, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %41

35:                                               ; preds = %27
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = load ptr, ptr %38, align 8, !tbaa !5
  %40 = icmp ne ptr %37, %39
  br i1 %40, label %41, label %44

41:                                               ; preds = %35, %27
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.hashbidimap0, ptr %42, i32 0, i32 4
  store i32 7, ptr %43, align 8, !tbaa !9
  store i1 false, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %78

44:                                               ; preds = %35
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %53

47:                                               ; preds = %44
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  %49 = load ptr, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %49, i32 0, i32 0
  %51 = load ptr, ptr %50, align 8, !tbaa !14
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %51, ptr %52, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %47, %44
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %62

56:                                               ; preds = %53
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = load ptr, ptr %57, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %58, i32 0, i32 1
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %60, ptr %61, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %56, %53
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.hashbidimap0, ptr %63, i32 0, i32 7
  %65 = load ptr, ptr %64, align 8, !tbaa !17
  %66 = getelementptr inbounds %struct.cmc_alloc_node, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = load ptr, ptr %10, align 8, !tbaa !5
  %69 = load ptr, ptr %68, align 8, !tbaa !5
  call void %67(ptr noundef %69)
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %70, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %71, align 8, !tbaa !5
  %72 = load ptr, ptr %6, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.hashbidimap0, ptr %72, i32 0, i32 2
  %74 = load i64, ptr %73, align 8, !tbaa !20
  %75 = add i64 %74, -1
  store i64 %75, ptr %73, align 8, !tbaa !20
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.hashbidimap0, ptr %76, i32 0, i32 4
  store i32 0, ptr %77, align 8, !tbaa !9
  store i1 true, ptr %5, align 1
  store i32 1, ptr %12, align 4
  br label %78

78:                                               ; preds = %62, %41, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  br label %79

79:                                               ; preds = %78, %15
  %80 = load i1, ptr %5, align 1
  ret i1 %80
}

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 = { 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, !13, i64 32}
!10 = !{!"hashbidimap0", !6, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !6, i64 0}
!15 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}
!16 = !{!15, !6, i64 8}
!17 = !{!10, !6, i64 56}
!18 = !{!19, !6, i64 24}
!19 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!10, !11, i64 16}


; 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
declare hidden ptr @hbm0_impl_get_entry_by_key(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hbm0_empty(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hbm0_remove_by_key(ptr noundef %0, ptr noundef %1, ptr noundef writeonly %2, ptr noundef writeonly %3) local_unnamed_addr #0 {
  %5 = tail call zeroext i1 @hbm0_empty(ptr noundef %0)
  br i1 %5, label %30, label %6

6:                                                ; preds = %4
  %7 = tail call ptr @hbm0_impl_get_entry_by_key(ptr noundef %0, ptr noundef %1)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %30, label %8

8:                                                ; preds = %6
  %9 = load ptr, ptr %7, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 40
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not29 = icmp eq ptr %11, null
  br i1 %.not29, label %30, label %12

12:                                               ; preds = %8
  %13 = load ptr, ptr %11, align 8, !tbaa !5
  %.not30 = icmp eq ptr %13, %9
  br i1 %.not30, label %14, label %30

14:                                               ; preds = %12
  %.not31 = icmp eq ptr %2, null
  br i1 %.not31, label %17, label %15

15:                                               ; preds = %14
  %16 = load ptr, ptr %9, align 8, !tbaa !9
  store ptr %16, ptr %2, align 8, !tbaa !5
  %.pre33.pre = load ptr, ptr %7, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %15, %14
  %.pre33 = phi ptr [ %.pre33.pre, %15 ], [ %9, %14 ]
  %.not32 = icmp eq ptr %3, null
  br i1 %.not32, label %21, label %18

18:                                               ; preds = %17
  %19 = getelementptr inbounds i8, ptr %.pre33, i64 8
  %20 = load ptr, ptr %19, align 8, !tbaa !11
  store ptr %20, ptr %3, align 8, !tbaa !5
  %.pre = load ptr, ptr %7, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %18, %17
  %22 = phi ptr [ %.pre, %18 ], [ %.pre33, %17 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %24, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  tail call void %26(ptr noundef %22) #1
  store ptr inttoptr (i64 1 to ptr), ptr %7, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %11, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %0, i64 16
  %28 = load i64, ptr %27, align 8, !tbaa !19
  %29 = add i64 %28, -1
  store i64 %29, ptr %27, align 8, !tbaa !19
  br label %30

30:                                               ; preds = %8, %12, %6, %4, %21
  %.sink = phi i32 [ 0, %21 ], [ 2, %4 ], [ 3, %6 ], [ 7, %12 ], [ 7, %8 ]
  %.1 = phi i1 [ true, %21 ], [ false, %4 ], [ false, %6 ], [ false, %12 ], [ false, %8 ]
  %31 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %31, align 8, !tbaa !20
  ret i1 %.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 = { 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, !6, i64 0}
!10 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !6, i64 56}
!13 = !{!"hashbidimap0", !6, i64 0, !14, i64 8, !14, i64 16, !15, i64 24, !16, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!14 = !{!"long", !7, i64 0}
!15 = !{!"double", !7, i64 0}
!16 = !{!"int", !7, i64 0}
!17 = !{!18, !6, i64 24}
!18 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!19 = !{!13, !14, i64 16}
!20 = !{!13, !16, i64 32}


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