; 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 }
%struct.hashmultimap0_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashmultimap0_fval = type { ptr, 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local void @hmm0_clear(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %68, %1
  %7 = load i64, ptr %3, align 8, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.hashmultimap0, ptr %8, i32 0, i32 1
  %10 = load i64, ptr %9, align 8, !tbaa !11
  %11 = icmp ult i64 %7, %10
  br i1 %11, label %13, label %12

12:                                               ; preds = %6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %71

13:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.hashmultimap0, ptr %14, i32 0, i32 0
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %17 = load i64, ptr %3, align 8, !tbaa !9
  %18 = getelementptr inbounds [2 x ptr], ptr %16, i64 %17
  %19 = getelementptr inbounds [2 x ptr], ptr %18, i64 0, i64 0
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  store ptr %20, ptr %4, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %59, %13
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %67

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  store ptr %27, ptr %5, align 8, !tbaa !5
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashmultimap0, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %31 = getelementptr inbounds %struct.hashmultimap0_fkey, ptr %30, i32 0, i32 3
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %43

34:                                               ; preds = %24
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.hashmultimap0, ptr %35, i32 0, i32 5
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %38 = getelementptr inbounds %struct.hashmultimap0_fkey, ptr %37, i32 0, i32 3
  %39 = load ptr, ptr %38, align 8, !tbaa !19
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %40, i32 0, i32 0
  %42 = load ptr, ptr %41, align 8, !tbaa !21
  call void %39(ptr noundef %42)
  br label %43

43:                                               ; preds = %34, %24
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.hashmultimap0, ptr %44, i32 0, i32 6
  %46 = load ptr, ptr %45, align 8, !tbaa !22
  %47 = getelementptr inbounds %struct.hashmultimap0_fval, ptr %46, i32 0, i32 3
  %48 = load ptr, ptr %47, align 8, !tbaa !23
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %59

50:                                               ; preds = %43
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.hashmultimap0, ptr %51, i32 0, i32 6
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = getelementptr inbounds %struct.hashmultimap0_fval, ptr %53, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !23
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %56, i32 0, i32 1
  %58 = load ptr, ptr %57, align 8, !tbaa !25
  call void %55(ptr noundef %58)
  br label %59

59:                                               ; preds = %50, %43
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.hashmultimap0, ptr %60, i32 0, i32 7
  %62 = load ptr, ptr %61, align 8, !tbaa !26
  %63 = getelementptr inbounds %struct.cmc_alloc_node, ptr %62, i32 0, i32 3
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  call void %64(ptr noundef %65)
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %66, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  br label %21, !llvm.loop !29

67:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %68

68:                                               ; preds = %67
  %69 = load i64, ptr %3, align 8, !tbaa !9
  %70 = add i64 %69, 1
  store i64 %70, ptr %3, align 8, !tbaa !9
  br label %6, !llvm.loop !31

71:                                               ; preds = %12
  %72 = load ptr, ptr %2, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.hashmultimap0, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !15
  %75 = load ptr, ptr %2, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.hashmultimap0, ptr %75, i32 0, i32 1
  %77 = load i64, ptr %76, align 8, !tbaa !11
  %78 = mul i64 16, %77
  call void @llvm.memset.p0.i64(ptr align 8 %74, i8 0, i64 %78, i1 false)
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.hashmultimap0, ptr %79, i32 0, i32 2
  store i64 0, ptr %80, align 8, !tbaa !32
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.hashmultimap0, ptr %81, i32 0, i32 4
  store i32 0, ptr %82, align 8, !tbaa !33
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { 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 #3 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"hashmultimap0", !6, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !14, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!"double", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !6, i64 16}
!17 = !{!"hashmultimap0_entry", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!18 = !{!12, !6, i64 40}
!19 = !{!20, !6, i64 24}
!20 = !{!"hashmultimap0_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = !{!17, !6, i64 0}
!22 = !{!12, !6, i64 48}
!23 = !{!24, !6, i64 24}
!24 = !{!"hashmultimap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!25 = !{!17, !6, i64 8}
!26 = !{!12, !6, i64 56}
!27 = !{!28, !6, i64 24}
!28 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}
!32 = !{!12, !10, i64 16}
!33 = !{!12, !14, 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: nounwind uwtable
define dso_local void @hmm0_clear(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %.not31 = icmp eq i64 %3, 0
  br i1 %.not31, label %._crit_edge30, label %.lr.ph29

.lr.ph29:                                         ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  br label %11

._crit_edge30.loopexit:                           ; preds = %._crit_edge
  %7 = shl i64 %34, 4
  br label %._crit_edge30

._crit_edge30:                                    ; preds = %._crit_edge30.loopexit, %1
  %.lcssa = phi i64 [ 0, %1 ], [ %7, %._crit_edge30.loopexit ]
  %8 = load ptr, ptr %0, align 8, !tbaa !13
  tail call void @llvm.memset.p0.i64(ptr align 8 %8, i8 0, i64 %.lcssa, i1 false)
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %9, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %10, align 8, !tbaa !15
  ret void

11:                                               ; preds = %.lr.ph29, %._crit_edge
  %12 = phi i64 [ %3, %.lr.ph29 ], [ %34, %._crit_edge ]
  %.027 = phi i64 [ 0, %.lr.ph29 ], [ %35, %._crit_edge ]
  %13 = load ptr, ptr %0, align 8, !tbaa !13
  %14 = getelementptr inbounds [2 x ptr], ptr %13, i64 %.027
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %.not25 = icmp eq ptr %15, null
  br i1 %.not25, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %11, %30
  %.01926 = phi ptr [ %17, %30 ], [ %15, %11 ]
  %16 = getelementptr inbounds i8, ptr %.01926, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = load ptr, ptr %4, align 8, !tbaa !19
  %19 = getelementptr inbounds i8, ptr %18, i64 24
  %20 = load ptr, ptr %19, align 8, !tbaa !20
  %.not23 = icmp eq ptr %20, null
  br i1 %.not23, label %23, label %21

21:                                               ; preds = %.lr.ph
  %22 = load ptr, ptr %.01926, align 8, !tbaa !22
  tail call void %20(ptr noundef %22) #2
  br label %23

23:                                               ; preds = %21, %.lr.ph
  %24 = load ptr, ptr %5, align 8, !tbaa !23
  %25 = getelementptr inbounds i8, ptr %24, i64 24
  %26 = load ptr, ptr %25, align 8, !tbaa !24
  %.not24 = icmp eq ptr %26, null
  br i1 %.not24, label %30, label %27

27:                                               ; preds = %23
  %28 = getelementptr inbounds i8, ptr %.01926, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !26
  tail call void %26(ptr noundef %29) #2
  br label %30

30:                                               ; preds = %27, %23
  %31 = load ptr, ptr %6, align 8, !tbaa !27
  %32 = getelementptr inbounds i8, ptr %31, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !28
  tail call void %33(ptr noundef nonnull %.01926) #2
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !30

._crit_edge.loopexit:                             ; preds = %30
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %11
  %34 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %12, %11 ]
  %35 = add nuw i64 %.027, 1
  %36 = icmp ult i64 %35, %34
  br i1 %36, label %11, label %._crit_edge30.loopexit, !llvm.loop !32
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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, !10, i64 8}
!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, !7, i64 0}
!14 = !{!6, !10, i64 16}
!15 = !{!6, !12, i64 32}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !7, i64 16}
!18 = !{!"hashmultimap0_entry", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!19 = !{!6, !7, i64 40}
!20 = !{!21, !7, i64 24}
!21 = !{!"hashmultimap0_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!22 = !{!18, !7, i64 0}
!23 = !{!6, !7, i64 48}
!24 = !{!25, !7, i64 24}
!25 = !{!"hashmultimap0_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!26 = !{!18, !7, i64 8}
!27 = !{!6, !7, i64 56}
!28 = !{!29, !7, i64 24}
!29 = !{!"cmc_alloc_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass