; 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.hashmultimap0 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr }
%struct.hashmultimap0_entry = 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 dso_local i64 @hmm0_impl_key_count(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hmm0_equals(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.hashmultimap0, ptr %11, i32 0, i32 4
  store i32 0, ptr %12, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.hashmultimap0, ptr %13, i32 0, i32 4
  store i32 0, ptr %14, align 8, !tbaa !9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.hashmultimap0, ptr %15, i32 0, i32 2
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.hashmultimap0, ptr %18, i32 0, i32 2
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = icmp ne i64 %17, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %92

23:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.hashmultimap0, ptr %24, i32 0, i32 1
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.hashmultimap0, ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !15
  %30 = icmp ult i64 %26, %29
  br i1 %30, label %31, label %33

31:                                               ; preds = %23
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  br label %35

33:                                               ; preds = %23
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %33, %31
  %36 = phi ptr [ %32, %31 ], [ %34, %33 ]
  store ptr %36, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = icmp eq ptr %37, %38
  br i1 %39, label %40, label %42

40:                                               ; preds = %35
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  br label %44

42:                                               ; preds = %35
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %42, %40
  %45 = phi ptr [ %41, %40 ], [ %43, %42 ]
  store ptr %45, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %46

46:                                               ; preds = %85, %44
  %47 = load i64, ptr %8, align 8, !tbaa !16
  %48 = load ptr, ptr %6, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.hashmultimap0, ptr %48, i32 0, i32 1
  %50 = load i64, ptr %49, align 8, !tbaa !15
  %51 = icmp ult i64 %47, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %46
  store i32 2, ptr %9, align 4
  br label %88

53:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.hashmultimap0, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !17
  %57 = load i64, ptr %8, align 8, !tbaa !16
  %58 = getelementptr inbounds [2 x ptr], ptr %56, i64 %57
  %59 = getelementptr inbounds [2 x ptr], ptr %58, i64 0, i64 0
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  store ptr %60, ptr %10, align 8, !tbaa !5
  br label %61

61:                                               ; preds = %77, %53
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %81

64:                                               ; preds = %61
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !18
  %69 = call i64 @hmm0_impl_key_count(ptr noundef %65, ptr noundef %68)
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !18
  %74 = call i64 @hmm0_impl_key_count(ptr noundef %70, ptr noundef %73)
  %75 = icmp ne i64 %69, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %64
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %82

77:                                               ; preds = %64
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  store ptr %80, ptr %10, align 8, !tbaa !5
  br label %61, !llvm.loop !21

81:                                               ; preds = %61
  store i32 0, ptr %9, align 4
  br label %82

82:                                               ; preds = %81, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  %83 = load i32, ptr %9, align 4
  switch i32 %83, label %88 [
    i32 0, label %84
  ]

84:                                               ; preds = %82
  br label %85

85:                                               ; preds = %84
  %86 = load i64, ptr %8, align 8, !tbaa !16
  %87 = add i64 %86, 1
  store i64 %87, ptr %8, align 8, !tbaa !16
  br label %46, !llvm.loop !23

88:                                               ; preds = %82, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %89 = load i32, ptr %9, align 4
  switch i32 %89, label %91 [
    i32 2, label %90
  ]

90:                                               ; preds = %88
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %91

91:                                               ; preds = %90, %88
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %92

92:                                               ; preds = %91, %22
  %93 = load i1, ptr %3, align 1
  ret i1 %93
}

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 = !{!"hashmultimap0", !6, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!11 = !{!"long", !7, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!10, !11, i64 16}
!15 = !{!10, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !6, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"hashmultimap0_entry", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!20 = !{!19, !6, i64 16}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}


; 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 dso_local i64 @hmm0_impl_key_count(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hmm0_equals(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load i64, ptr %7, align 8, !tbaa !13
  %.not = icmp eq i64 %6, %8
  br i1 %.not, label %9, label %.critedge34

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i64, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !14
  %14 = icmp ult i64 %11, %13
  %15 = select i1 %14, ptr %0, ptr %1
  %16 = icmp eq ptr %15, %0
  %17 = select i1 %16, ptr %1, ptr %0
  %18 = getelementptr inbounds i8, ptr %15, i64 8
  %19 = load i64, ptr %18, align 8, !tbaa !14
  %.not32.not39.not = icmp eq i64 %19, 0
  br i1 %.not32.not39.not, label %.critedge34, label %.lr.ph41

.lr.ph41:                                         ; preds = %9, %.critedge
  %20 = phi i64 [ %29, %.critedge ], [ %19, %9 ]
  %.02740 = phi i64 [ %30, %.critedge ], [ 0, %9 ]
  %21 = load ptr, ptr %15, align 8, !tbaa !15
  %22 = getelementptr inbounds [2 x ptr], ptr %21, i64 %.02740
  %.036 = load ptr, ptr %22, align 8, !tbaa !16
  %.not3037 = icmp eq ptr %.036, null
  br i1 %.not3037, label %.critedge, label %.lr.ph

23:                                               ; preds = %.lr.ph
  %24 = getelementptr inbounds i8, ptr %.038, i64 16
  %.0 = load ptr, ptr %24, align 8, !tbaa !16
  %.not30 = icmp eq ptr %.0, null
  br i1 %.not30, label %.critedge.loopexit, label %.lr.ph, !llvm.loop !17

.lr.ph:                                           ; preds = %.lr.ph41, %23
  %.038 = phi ptr [ %.0, %23 ], [ %.036, %.lr.ph41 ]
  %25 = load ptr, ptr %.038, align 8, !tbaa !19
  %26 = tail call i64 @hmm0_impl_key_count(ptr noundef nonnull %15, ptr noundef %25)
  %27 = load ptr, ptr %.038, align 8, !tbaa !19
  %28 = tail call i64 @hmm0_impl_key_count(ptr noundef %17, ptr noundef %27)
  %.not31 = icmp eq i64 %26, %28
  br i1 %.not31, label %23, label %.critedge34

.critedge.loopexit:                               ; preds = %23
  %.pre = load i64, ptr %18, align 8, !tbaa !14
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.lr.ph41
  %29 = phi i64 [ %.pre, %.critedge.loopexit ], [ %20, %.lr.ph41 ]
  %30 = add nuw i64 %.02740, 1
  %.not32.not = icmp ult i64 %30, %29
  br i1 %.not32.not, label %.lr.ph41, label %.critedge34, !llvm.loop !21

.critedge34:                                      ; preds = %.critedge, %.lr.ph, %9, %2
  %.4 = phi i1 [ false, %2 ], [ true, %9 ], [ false, %.lr.ph ], [ true, %.critedge ]
  ret i1 %.4
}

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

!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, !12, i64 32}
!6 = !{!"hashmultimap0", !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 = !{!"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 = !{!6, !10, i64 16}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!20, !7, i64 0}
!20 = !{!"hashmultimap0_entry", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!21 = distinct !{!21, !18}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass