; 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_entry = type { ptr, ptr, [2 x i64], [2 x ptr] }
%struct.hashbidimap0_fval = type { ptr, ptr, 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 hidden ptr @hbm0_impl_get_entry_by_key(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hbm0_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
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.hashbidimap0, ptr %12, i32 0, i32 4
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.hashbidimap0, ptr %14, i32 0, i32 4
  store i32 0, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashbidimap0, ptr %16, i32 0, i32 2
  %18 = load i64, ptr %17, align 8, !tbaa !14
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.hashbidimap0, ptr %19, i32 0, i32 2
  %21 = load i64, ptr %20, align 8, !tbaa !14
  %22 = icmp ne i64 %18, %21
  br i1 %22, label %23, label %24

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

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

32:                                               ; preds = %24
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %33, ptr %6, align 8, !tbaa !5
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %34, ptr %7, align 8, !tbaa !5
  br label %38

35:                                               ; preds = %24
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %36, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %37, ptr %7, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %35, %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %39

39:                                               ; preds = %92, %38
  %40 = load i64, ptr %8, align 8, !tbaa !16
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.hashbidimap0, ptr %41, i32 0, i32 1
  %43 = load i64, ptr %42, align 8, !tbaa !15
  %44 = icmp ult i64 %40, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %39
  store i32 2, ptr %9, align 4
  br label %95

46:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.hashbidimap0, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = load i64, ptr %8, align 8, !tbaa !16
  %51 = getelementptr inbounds [2 x ptr], ptr %49, i64 %50
  %52 = getelementptr inbounds [2 x ptr], ptr %51, i64 0, i64 0
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  store ptr %53, ptr %10, align 8, !tbaa !5
  %54 = load ptr, ptr %10, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %88

56:                                               ; preds = %46
  %57 = load ptr, ptr %10, align 8, !tbaa !5
  %58 = icmp ne ptr %57, inttoptr (i64 1 to ptr)
  br i1 %58, label %59, label %88

59:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %61, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8, !tbaa !18
  %64 = call ptr @hbm0_impl_get_entry_by_key(ptr noundef %60, ptr noundef %63)
  store ptr %64, ptr %11, align 8, !tbaa !5
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %68, label %67

67:                                               ; preds = %59
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %85

68:                                               ; preds = %59
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.hashbidimap0, ptr %69, i32 0, i32 6
  %71 = load ptr, ptr %70, align 8, !tbaa !20
  %72 = getelementptr inbounds %struct.hashbidimap0_fval, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !21
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = load ptr, ptr %74, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %75, i32 0, i32 1
  %77 = load ptr, ptr %76, align 8, !tbaa !23
  %78 = load ptr, ptr %10, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %78, i32 0, i32 1
  %80 = load ptr, ptr %79, align 8, !tbaa !23
  %81 = call i32 %73(ptr noundef %77, ptr noundef %80)
  %82 = icmp ne i32 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %68
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %85

84:                                               ; preds = %68
  store i32 0, ptr %9, align 4
  br label %85

85:                                               ; preds = %84, %83, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  %86 = load i32, ptr %9, align 4
  switch i32 %86, label %89 [
    i32 0, label %87
  ]

87:                                               ; preds = %85
  br label %88

88:                                               ; preds = %87, %56, %46
  store i32 0, ptr %9, align 4
  br label %89

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

91:                                               ; preds = %89
  br label %92

92:                                               ; preds = %91
  %93 = load i64, ptr %8, align 8, !tbaa !16
  %94 = add i64 %93, 1
  store i64 %94, ptr %8, align 8, !tbaa !16
  br label %39, !llvm.loop !24

95:                                               ; preds = %89, %45
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %96 = load i32, ptr %9, align 4
  switch i32 %96, label %98 [
    i32 2, label %97
  ]

97:                                               ; preds = %95
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %98

98:                                               ; preds = %97, %95
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %99

99:                                               ; preds = %98, %23
  %100 = load i1, ptr %3, align 1
  ret i1 %100
}

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, !11, i64 16}
!15 = !{!10, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !6, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}
!20 = !{!10, !6, i64 48}
!21 = !{!22, !6, i64 0}
!22 = !{!"hashbidimap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!19, !6, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


; 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
define dso_local noundef zeroext i1 @hbm0_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 %.critedge

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
  %. = select i1 %14, ptr %1, ptr %0
  %.40 = select i1 %14, ptr %0, ptr %1
  %15 = getelementptr inbounds i8, ptr %.40, i64 48
  %16 = getelementptr inbounds i8, ptr %.40, i64 8
  %17 = load i64, ptr %16, align 8, !tbaa !14
  %.not39.not44.not = icmp eq i64 %17, 0
  br i1 %.not39.not44.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %9, %.critedge42
  %18 = phi i64 [ %34, %.critedge42 ], [ %17, %9 ]
  %.03345 = phi i64 [ %35, %.critedge42 ], [ 0, %9 ]
  %19 = load ptr, ptr %.40, align 8, !tbaa !15
  %20 = getelementptr inbounds [2 x ptr], ptr %19, i64 %.03345
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %switch = icmp ult ptr %21, inttoptr (i64 2 to ptr)
  br i1 %switch, label %.critedge42, label %22

22:                                               ; preds = %.lr.ph
  %23 = load ptr, ptr %21, align 8, !tbaa !17
  %24 = tail call ptr @hbm0_impl_get_entry_by_key(ptr noundef %., ptr noundef %23)
  %.not37 = icmp eq ptr %24, null
  br i1 %.not37, label %.critedge, label %25

25:                                               ; preds = %22
  %26 = load ptr, ptr %15, align 8, !tbaa !19
  %27 = load ptr, ptr %26, align 8, !tbaa !20
  %28 = load ptr, ptr %24, align 8, !tbaa !16
  %29 = getelementptr inbounds i8, ptr %28, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !22
  %31 = getelementptr inbounds i8, ptr %21, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = tail call i32 %27(ptr noundef %30, ptr noundef %32) #1
  %.not38 = icmp eq i32 %33, 0
  br i1 %.not38, label %..critedge42_crit_edge, label %.critedge

..critedge42_crit_edge:                           ; preds = %25
  %.pre = load i64, ptr %16, align 8, !tbaa !14
  br label %.critedge42

.critedge42:                                      ; preds = %..critedge42_crit_edge, %.lr.ph
  %34 = phi i64 [ %.pre, %..critedge42_crit_edge ], [ %18, %.lr.ph ]
  %35 = add nuw i64 %.03345, 1
  %.not39.not = icmp ult i64 %35, %34
  br i1 %.not39.not, label %.lr.ph, label %.critedge, !llvm.loop !23

.critedge:                                        ; preds = %25, %22, %.critedge42, %9, %2
  %.6 = phi i1 [ false, %2 ], [ true, %9 ], [ false, %25 ], [ false, %22 ], [ true, %.critedge42 ]
  ret i1 %.6
}

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


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