; 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.struct_s = type { i32, i32, ptr, ptr, [10 x double] }
%struct.hashbidimap1 = 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 @hbm1_insert(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %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 i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = call zeroext i1 @hbm1_full(ptr noundef %10)
  br i1 %11, label %12, label %21

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

19:                                               ; preds = %12
  store i1 false, ptr %4, align 1
  br label %73

20:                                               ; preds = %12
  br label %21

21:                                               ; preds = %20, %3
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call ptr @hbm1_impl_get_entry_by_key(ptr noundef %22, ptr noundef byval(%struct.struct_s) align 8 %1)
  %24 = icmp ne ptr %23, null
  br i1 %24, label %29, label %25

25:                                               ; preds = %21
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call ptr @hbm1_impl_get_entry_by_val(ptr noundef %26, ptr noundef byval(%struct.struct_s) align 8 %2)
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %32

29:                                               ; preds = %25, %21
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.hashbidimap1, ptr %30, i32 0, i32 4
  store i32 6, ptr %31, align 8, !tbaa !14
  store i1 false, ptr %4, align 1
  br label %73

32:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call ptr @hbm1_impl_new_entry(ptr noundef %33, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2)
  store ptr %34, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = call ptr @hbm1_impl_add_entry_to_key(ptr noundef %35, ptr noundef %36)
  store ptr %37, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = call ptr @hbm1_impl_add_entry_to_val(ptr noundef %38, ptr noundef %39)
  store ptr %40, ptr %8, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = icmp ne ptr %41, null
  br i1 %42, label %43, label %46

43:                                               ; preds = %32
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = icmp ne ptr %44, null
  br i1 %45, label %65, label %46

46:                                               ; preds = %43, %32
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = icmp ne ptr %47, null
  br i1 %48, label %49, label %51

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %50, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %49, %46
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %56

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

56:                                               ; preds = %54, %51
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.hashbidimap1, ptr %57, i32 0, i32 7
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  %60 = getelementptr inbounds %struct.cmc_alloc_node, ptr %59, i32 0, i32 3
  %61 = load ptr, ptr %60, align 8, !tbaa !16
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  call void %61(ptr noundef %62)
  %63 = load ptr, ptr %5, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.hashbidimap1, ptr %63, i32 0, i32 4
  store i32 7, ptr %64, align 8, !tbaa !14
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %72

65:                                               ; preds = %43
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.hashbidimap1, ptr %66, i32 0, i32 2
  %68 = load i64, ptr %67, align 8, !tbaa !18
  %69 = add i64 %68, 1
  store i64 %69, ptr %67, align 8, !tbaa !18
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hashbidimap1, ptr %70, i32 0, i32 4
  store i32 0, ptr %71, align 8, !tbaa !14
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %72

72:                                               ; preds = %65, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %73

73:                                               ; preds = %72, %29, %19
  %74 = load i1, ptr %4, align 1
  ret i1 %74
}

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_get_entry_by_key(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_get_entry_by_val(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_new_entry(ptr noundef, ptr noundef byval(%struct.struct_s) align 8, ptr noundef byval(%struct.struct_s) align 8) #1

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_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 = !{!"hashbidimap1", !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"

%struct.struct_s = type { i32, i32, ptr, ptr, [10 x double] }

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hbm1_insert(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @hbm1_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 @hbm1_resize(ptr noundef %0, i64 noundef %8)
  br i1 %9, label %10, label %34

10:                                               ; preds = %5, %3
  %11 = tail call ptr @hbm1_impl_get_entry_by_key(ptr noundef %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %1)
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %12, label %.sink.split

12:                                               ; preds = %10
  %13 = tail call ptr @hbm1_impl_get_entry_by_val(ptr noundef %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %2)
  %.not26 = icmp eq ptr %13, null
  br i1 %.not26, label %14, label %.sink.split

14:                                               ; preds = %12
  %15 = tail call ptr @hbm1_impl_new_entry(ptr noundef %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %1, ptr noundef nonnull byval(%struct.struct_s) align 8 %2)
  %16 = tail call ptr @hbm1_impl_add_entry_to_key(ptr noundef %0, ptr noundef %15)
  %17 = tail call ptr @hbm1_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 @hbm1_full(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_get_entry_by_key(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_get_entry_by_val(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_new_entry(ptr noundef, ptr noundef byval(%struct.struct_s) align 8, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_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 = !{!"hashbidimap1", !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