; 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_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap0_entry = type { ptr, ptr, [2 x i64], [2 x 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 hidden ptr @hbm0_impl_get_entry_by_val(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
define dso_local zeroext i1 @hbm0_update_key(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 i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  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
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call zeroext i1 @hbm0_empty(ptr noundef %13)
  br i1 %14, label %15, label %18

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, 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 %4, align 1
  br label %93

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

24:                                               ; preds = %18
  %25 = load ptr, ptr %5, 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 %4, align 1
  store i32 1, ptr %10, align 4
  br label %92

27:                                               ; preds = %18
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashbidimap0, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !14
  %31 = getelementptr inbounds %struct.hashbidimap0_fkey, ptr %30, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = call i32 %32(ptr noundef %33, ptr noundef %37)
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %27
  br label %89

41:                                               ; preds = %27
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = call ptr @hbm0_impl_get_entry_by_key(ptr noundef %42, ptr noundef %43)
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %49

46:                                               ; preds = %41
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.hashbidimap0, ptr %47, i32 0, i32 4
  store i32 6, ptr %48, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %92

49:                                               ; preds = %41
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = load ptr, ptr %50, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %51, i32 0, i32 3
  %53 = getelementptr inbounds [2 x ptr], ptr %52, i64 0, i64 0
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  store ptr %54, ptr %8, align 8, !tbaa !5
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %63

57:                                               ; preds = %49
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = load ptr, ptr %9, align 8, !tbaa !5
  %61 = load ptr, ptr %60, align 8, !tbaa !5
  %62 = icmp ne ptr %59, %61
  br i1 %62, label %63, label %66

63:                                               ; preds = %57, %49
  %64 = load ptr, ptr %5, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.hashbidimap0, ptr %64, i32 0, i32 4
  store i32 7, ptr %65, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %92

66:                                               ; preds = %57
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %67, align 8, !tbaa !5
  store ptr %68, ptr %11, align 8, !tbaa !5
  %69 = load ptr, ptr %11, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !17
  store ptr %71, ptr %12, align 8, !tbaa !5
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %73, i32 0, i32 0
  store ptr %72, ptr %74, align 8, !tbaa !17
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %75, align 8, !tbaa !5
  %76 = load ptr, ptr %5, align 8, !tbaa !5
  %77 = load ptr, ptr %11, align 8, !tbaa !5
  %78 = call ptr @hbm0_impl_add_entry_to_key(ptr noundef %76, ptr noundef %77)
  %79 = icmp ne ptr %78, null
  br i1 %79, label %88, label %80

80:                                               ; preds = %66
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = load ptr, ptr %11, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %82, i32 0, i32 0
  store ptr %81, ptr %83, align 8, !tbaa !17
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %84, ptr %85, align 8, !tbaa !5
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.hashbidimap0, ptr %86, i32 0, i32 4
  store i32 7, ptr %87, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %92

88:                                               ; preds = %66
  br label %89

89:                                               ; preds = %88, %40
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.hashbidimap0, ptr %90, i32 0, i32 4
  store i32 0, ptr %91, align 8, !tbaa !9
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %92

92:                                               ; preds = %89, %80, %63, %46, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %93

93:                                               ; preds = %92, %15
  %94 = load i1, ptr %4, align 1
  ret i1 %94
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hbm0_empty(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, !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 = !{!10, !6, i64 40}
!15 = !{!16, !6, i64 0}
!16 = !{!"hashbidimap0_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}


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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hbm0_update_key(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @hbm0_empty(ptr noundef %0)
  br i1 %4, label %27, label %5

5:                                                ; preds = %3
  %6 = tail call ptr @hbm0_impl_get_entry_by_val(ptr noundef %0, ptr noundef %1)
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %27, label %7

7:                                                ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 40
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = load ptr, ptr %6, align 8, !tbaa !15
  %12 = load ptr, ptr %11, align 8, !tbaa !16
  %13 = tail call i32 %10(ptr noundef %2, ptr noundef %12) #1
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %27, label %15

15:                                               ; preds = %7
  %16 = tail call ptr @hbm0_impl_get_entry_by_key(ptr noundef nonnull %0, ptr noundef %2)
  %.not34 = icmp eq ptr %16, null
  br i1 %.not34, label %17, label %27

17:                                               ; preds = %15
  %18 = load ptr, ptr %6, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %18, i64 32
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %.not35 = icmp eq ptr %20, null
  br i1 %.not35, label %27, label %21

21:                                               ; preds = %17
  %22 = load ptr, ptr %20, align 8, !tbaa !15
  %.not36 = icmp eq ptr %22, %18
  br i1 %.not36, label %23, label %27

23:                                               ; preds = %21
  %24 = load ptr, ptr %22, align 8, !tbaa !16
  store ptr %2, ptr %22, align 8, !tbaa !16
  store ptr inttoptr (i64 1 to ptr), ptr %20, align 8, !tbaa !15
  %25 = tail call ptr @hbm0_impl_add_entry_to_key(ptr noundef nonnull %0, ptr noundef nonnull %22)
  %.not37 = icmp eq ptr %25, null
  br i1 %.not37, label %26, label %27

26:                                               ; preds = %23
  store ptr %24, ptr %22, align 8, !tbaa !16
  store ptr %22, ptr %20, align 8, !tbaa !15
  br label %27

27:                                               ; preds = %7, %23, %17, %21, %15, %5, %3, %26
  %.sink = phi i32 [ 7, %26 ], [ 2, %3 ], [ 3, %5 ], [ 6, %15 ], [ 7, %21 ], [ 7, %17 ], [ 0, %23 ], [ 0, %7 ]
  %.1 = phi i1 [ false, %26 ], [ false, %3 ], [ false, %5 ], [ false, %15 ], [ false, %21 ], [ false, %17 ], [ true, %23 ], [ true, %7 ]
  %28 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %28, align 8, !tbaa !18
  ret i1 %.1
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hbm0_empty(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, !7, i64 40}
!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 = !{!14, !7, i64 0}
!14 = !{!"hashbidimap0_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !7, i64 0}
!17 = !{!"hashbidimap0_entry", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 32}
!18 = !{!6, !12, i64 32}


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