; 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] }
%struct.hashbidimap0_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: nounwind uwtable
define dso_local void @hbm0_clear(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %5

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

11:                                               ; preds = %5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  br label %80

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

22:                                               ; preds = %12
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = icmp ne ptr %23, inttoptr (i64 1 to ptr)
  br i1 %24, label %25, label %64

25:                                               ; preds = %22
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.hashbidimap0, ptr %26, i32 0, i32 5
  %28 = load ptr, ptr %27, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.hashbidimap0_fkey, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %41

32:                                               ; preds = %25
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.hashbidimap0, ptr %33, i32 0, i32 5
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  %36 = getelementptr inbounds %struct.hashbidimap0_fkey, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !17
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  call void %37(ptr noundef %40)
  br label %41

41:                                               ; preds = %32, %25
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.hashbidimap0, ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = getelementptr inbounds %struct.hashbidimap0_fval, ptr %44, i32 0, i32 3
  %46 = load ptr, ptr %45, align 8, !tbaa !22
  %47 = icmp ne ptr %46, null
  br i1 %47, label %48, label %57

48:                                               ; preds = %41
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.hashbidimap0, ptr %49, i32 0, i32 6
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = getelementptr inbounds %struct.hashbidimap0_fval, ptr %51, i32 0, i32 3
  %53 = load ptr, ptr %52, align 8, !tbaa !22
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !24
  call void %53(ptr noundef %56)
  br label %57

57:                                               ; preds = %48, %41
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hashbidimap0, ptr %58, i32 0, i32 7
  %60 = load ptr, ptr %59, align 8, !tbaa !25
  %61 = getelementptr inbounds %struct.cmc_alloc_node, ptr %60, i32 0, i32 3
  %62 = load ptr, ptr %61, align 8, !tbaa !26
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  call void %62(ptr noundef %63)
  br label %64

64:                                               ; preds = %57, %22, %12
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.hashbidimap0, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !15
  %68 = load i64, ptr %3, align 8, !tbaa !9
  %69 = getelementptr inbounds [2 x ptr], ptr %67, i64 %68
  %70 = getelementptr inbounds [2 x ptr], ptr %69, i64 0, i64 0
  store ptr null, ptr %70, align 8, !tbaa !5
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.hashbidimap0, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  %74 = load i64, ptr %3, align 8, !tbaa !9
  %75 = getelementptr inbounds [2 x ptr], ptr %73, i64 %74
  %76 = getelementptr inbounds [2 x ptr], ptr %75, i64 0, i64 1
  store ptr null, ptr %76, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  br label %77

77:                                               ; preds = %64
  %78 = load i64, ptr %3, align 8, !tbaa !9
  %79 = add i64 %78, 1
  store i64 %79, ptr %3, align 8, !tbaa !9
  br label %5, !llvm.loop !28

80:                                               ; preds = %11
  %81 = load ptr, ptr %2, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.hashbidimap0, ptr %81, i32 0, i32 2
  store i64 0, ptr %82, align 8, !tbaa !30
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.hashbidimap0, ptr %83, i32 0, i32 4
  store i32 0, ptr %84, align 8, !tbaa !31
  ret void
}

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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"hashbidimap0", !6, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !14, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!13 = !{!"double", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!12, !6, i64 40}
!17 = !{!18, !6, i64 24}
!18 = !{!"hashbidimap0_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!19 = !{!20, !6, i64 0}
!20 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}
!21 = !{!12, !6, i64 48}
!22 = !{!23, !6, i64 24}
!23 = !{!"hashbidimap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!24 = !{!20, !6, i64 8}
!25 = !{!12, !6, i64 56}
!26 = !{!27, !6, i64 24}
!27 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!12, !10, i64 16}
!31 = !{!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: nounwind uwtable
define dso_local void @hbm0_clear(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %.not26 = icmp eq i64 %3, 0
  br i1 %.not26, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; 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 %9

._crit_edge:                                      ; preds = %31, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  store i64 0, ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %8, align 8, !tbaa !14
  ret void

9:                                                ; preds = %.lr.ph, %31
  %10 = phi i64 [ %3, %.lr.ph ], [ %32, %31 ]
  %.025 = phi i64 [ 0, %.lr.ph ], [ %37, %31 ]
  %11 = load ptr, ptr %0, align 8, !tbaa !15
  %12 = getelementptr inbounds [2 x ptr], ptr %11, i64 %.025
  %13 = load ptr, ptr %12, align 8, !tbaa !16
  %switch = icmp ult ptr %13, inttoptr (i64 2 to ptr)
  br i1 %switch, label %31, label %14

14:                                               ; preds = %9
  %15 = load ptr, ptr %4, align 8, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %15, i64 24
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %20, label %18

18:                                               ; preds = %14
  %19 = load ptr, ptr %13, align 8, !tbaa !20
  tail call void %17(ptr noundef %19) #1
  br label %20

20:                                               ; preds = %18, %14
  %21 = load ptr, ptr %5, align 8, !tbaa !22
  %22 = getelementptr inbounds i8, ptr %21, i64 24
  %23 = load ptr, ptr %22, align 8, !tbaa !23
  %.not24 = icmp eq ptr %23, null
  br i1 %.not24, label %27, label %24

24:                                               ; preds = %20
  %25 = getelementptr inbounds i8, ptr %13, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !25
  tail call void %23(ptr noundef %26) #1
  br label %27

27:                                               ; preds = %24, %20
  %28 = load ptr, ptr %6, align 8, !tbaa !26
  %29 = getelementptr inbounds i8, ptr %28, i64 24
  %30 = load ptr, ptr %29, align 8, !tbaa !27
  tail call void %30(ptr noundef nonnull %13) #1
  %.pre = load ptr, ptr %0, align 8, !tbaa !15
  %.pre27 = load i64, ptr %2, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %9, %27
  %32 = phi i64 [ %10, %9 ], [ %.pre27, %27 ]
  %33 = phi ptr [ %11, %9 ], [ %.pre, %27 ]
  %34 = getelementptr inbounds [2 x ptr], ptr %33, i64 %.025
  store ptr null, ptr %34, align 8, !tbaa !16
  %35 = load ptr, ptr %0, align 8, !tbaa !15
  %36 = getelementptr inbounds [2 x ptr], ptr %35, i64 %.025, i64 1
  store ptr null, ptr %36, align 8, !tbaa !16
  %37 = add nuw i64 %.025, 1
  %38 = icmp ult i64 %37, %32
  br i1 %38, label %9, label %._crit_edge, !llvm.loop !29
}

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 = !{!6, !10, i64 16}
!14 = !{!6, !12, i64 32}
!15 = !{!6, !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!6, !7, i64 40}
!18 = !{!19, !7, i64 24}
!19 = !{!"hashbidimap0_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!20 = !{!21, !7, i64 0}
!21 = !{!"hashbidimap0_entry", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 32}
!22 = !{!6, !7, i64 48}
!23 = !{!24, !7, i64 24}
!24 = !{!"hashbidimap0_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!25 = !{!21, !7, i64 8}
!26 = !{!6, !7, i64 56}
!27 = !{!28, !7, i64 24}
!28 = !{!"cmc_alloc_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}


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