; 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.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
define dso_local zeroext i1 @hbm0_insert(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %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 i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = call zeroext i1 @hbm0_full(ptr noundef %12)
  br i1 %13, label %14, label %23

14:                                               ; preds = %3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashbidimap0, ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !9
  %19 = add i64 %18, 1
  %20 = call zeroext i1 @hbm0_resize(ptr noundef %15, i64 noundef %19)
  br i1 %20, label %22, label %21

21:                                               ; preds = %14
  store i1 false, ptr %4, align 1
  br label %79

22:                                               ; preds = %14
  br label %23

23:                                               ; preds = %22, %3
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call ptr @hbm0_impl_get_entry_by_key(ptr noundef %24, ptr noundef %25)
  %27 = icmp ne ptr %26, null
  br i1 %27, label %33, label %28

28:                                               ; preds = %23
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = call ptr @hbm0_impl_get_entry_by_val(ptr noundef %29, ptr noundef %30)
  %32 = icmp ne ptr %31, null
  br i1 %32, label %33, label %36

33:                                               ; preds = %28, %23
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.hashbidimap0, ptr %34, i32 0, i32 4
  store i32 6, ptr %35, align 8, !tbaa !14
  store i1 false, ptr %4, align 1
  br label %79

36:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call ptr @hbm0_impl_new_entry(ptr noundef %37, ptr noundef %38, ptr noundef %39)
  store ptr %40, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = call ptr @hbm0_impl_add_entry_to_key(ptr noundef %41, ptr noundef %42)
  store ptr %43, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = call ptr @hbm0_impl_add_entry_to_val(ptr noundef %44, ptr noundef %45)
  store ptr %46, ptr %10, align 8, !tbaa !5
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %52

49:                                               ; preds = %36
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = icmp ne ptr %50, null
  br i1 %51, label %71, label %52

52:                                               ; preds = %49, %36
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %57

55:                                               ; preds = %52
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %56, align 8, !tbaa !5
  br label %57

57:                                               ; preds = %55, %52
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %62

60:                                               ; preds = %57
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %61, align 8, !tbaa !5
  br label %62

62:                                               ; preds = %60, %57
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.hashbidimap0, ptr %63, i32 0, i32 7
  %65 = load ptr, ptr %64, align 8, !tbaa !15
  %66 = getelementptr inbounds %struct.cmc_alloc_node, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !16
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  call void %67(ptr noundef %68)
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.hashbidimap0, ptr %69, i32 0, i32 4
  store i32 7, ptr %70, align 8, !tbaa !14
  store i1 false, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %78

71:                                               ; preds = %49
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.hashbidimap0, ptr %72, i32 0, i32 2
  %74 = load i64, ptr %73, align 8, !tbaa !18
  %75 = add i64 %74, 1
  store i64 %75, ptr %73, align 8, !tbaa !18
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.hashbidimap0, ptr %76, i32 0, i32 4
  store i32 0, ptr %77, align 8, !tbaa !14
  store i1 true, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %78

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

79:                                               ; preds = %78, %33, %21
  %80 = load i1, ptr %4, align 1
  ret i1 %80
}

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_get_entry_by_key(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_get_entry_by_val(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_new_entry(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_key(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_val(ptr noundef, ptr noundef) #1

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, !11, i64 8}
!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 = !{!10, !13, i64 32}
!15 = !{!10, !6, i64 56}
!16 = !{!17, !6, i64 24}
!17 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!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
define dso_local noundef zeroext i1 @hbm0_insert(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @hbm0_full(ptr noundef %0)
  br i1 %4, label %5, label %10

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = add i64 %7, 1
  %9 = tail call zeroext i1 @hbm0_resize(ptr noundef %0, i64 noundef %8)
  br i1 %9, label %10, label %34

10:                                               ; preds = %5, %3
  %11 = tail call ptr @hbm0_impl_get_entry_by_key(ptr noundef %0, ptr noundef %1)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %.sink.split

12:                                               ; preds = %10
  %13 = tail call ptr @hbm0_impl_get_entry_by_val(ptr noundef %0, ptr noundef %2)
  %.not30 = icmp eq ptr %13, null
  br i1 %.not30, label %14, label %.sink.split

14:                                               ; preds = %12
  %15 = tail call ptr @hbm0_impl_new_entry(ptr noundef %0, ptr noundef %1, ptr noundef %2)
  %16 = tail call ptr @hbm0_impl_add_entry_to_key(ptr noundef %0, ptr noundef %15)
  %17 = tail call ptr @hbm0_impl_add_entry_to_val(ptr noundef %0, ptr noundef %15)
  %18 = icmp ne ptr %16, null
  %19 = icmp ne ptr %17, null
  %or.cond = select i1 %18, i1 %19, i1 false
  br i1 %or.cond, label %29, label %20

20:                                               ; preds = %14
  br i1 %18, label %21, label %22

21:                                               ; preds = %20
  store ptr inttoptr (i64 1 to ptr), ptr %16, align 8, !tbaa !13
  br label %22

22:                                               ; preds = %21, %20
  br i1 %19, label %23, label %24

23:                                               ; preds = %22
  store ptr inttoptr (i64 1 to ptr), ptr %17, align 8, !tbaa !13
  br label %24

24:                                               ; preds = %23, %22
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  %26 = load ptr, ptr %25, align 8, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %26, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !15
  tail call void %28(ptr noundef %15) #1
  br label %.sink.split

29:                                               ; preds = %14
  %30 = getelementptr inbounds i8, ptr %0, i64 16
  %31 = load i64, ptr %30, align 8, !tbaa !17
  %32 = add i64 %31, 1
  store i64 %32, ptr %30, align 8, !tbaa !17
  br label %.sink.split

.sink.split:                                      ; preds = %10, %12, %29, %24
  %.sink = phi i32 [ 7, %24 ], [ 0, %29 ], [ 6, %12 ], [ 6, %10 ]
  %.1.ph = phi i1 [ false, %24 ], [ true, %29 ], [ false, %12 ], [ false, %10 ]
  %33 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %33, align 8, !tbaa !18
  br label %34

34:                                               ; preds = %.sink.split, %5
  %.1 = phi i1 [ false, %5 ], [ %.1.ph, %.sink.split ]
  ret i1 %.1
}

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

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_new_entry(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_key(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_val(ptr noundef, ptr noundef) local_unnamed_addr #0

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, !10, i64 8}
!6 = !{!"hashbidimap0", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"double", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!6, !7, i64 56}
!15 = !{!16, !7, i64 24}
!16 = !{!"cmc_alloc_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!17 = !{!6, !10, i64 16}
!18 = !{!6, !12, i64 32}


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