; 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.struct_s = type { i32, i32, ptr, ptr, [10 x double] }
%struct.hashbidimap1 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap1_entry = type { %struct.struct_s, %struct.struct_s, [2 x i64], [2 x ptr] }
%struct.hashbidimap1_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 @hbm1_impl_get_entry_by_key(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hbm1_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.hashbidimap1, 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.hashbidimap1, 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.hashbidimap1, 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.hashbidimap1, 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 %96

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.hashbidimap1, 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.hashbidimap1, 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 = %89, %38
  %40 = load i64, ptr %8, align 8, !tbaa !16
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.hashbidimap1, 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 %92

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.hashbidimap1, 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 %85

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 %85

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.hashbidimap1_entry, ptr %61, i32 0, i32 0
  %63 = call ptr @hbm1_impl_get_entry_by_key(ptr noundef %60, ptr noundef byval(%struct.struct_s) align 8 %62)
  store ptr %63, ptr %11, align 8, !tbaa !5
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = icmp ne ptr %64, null
  br i1 %65, label %67, label %66

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

67:                                               ; preds = %59
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.hashbidimap1, ptr %68, i32 0, i32 6
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  %71 = getelementptr inbounds %struct.hashbidimap1_fval, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !19
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %74, i32 0, i32 1
  %76 = load ptr, ptr %10, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %76, i32 0, i32 1
  %78 = call i32 %72(ptr noundef byval(%struct.struct_s) align 8 %75, ptr noundef byval(%struct.struct_s) align 8 %77)
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %81

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

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

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

84:                                               ; preds = %82
  br label %85

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

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

88:                                               ; preds = %86
  br label %89

89:                                               ; preds = %88
  %90 = load i64, ptr %8, align 8, !tbaa !16
  %91 = add i64 %90, 1
  store i64 %91, ptr %8, align 8, !tbaa !16
  br label %39, !llvm.loop !21

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

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

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

96:                                               ; preds = %95, %23
  %97 = load i1, ptr %3, align 1
  ret i1 %97
}

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 = !{!"hashbidimap1", !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 = !{!10, !6, i64 48}
!19 = !{!20, !6, i64 0}
!20 = !{!"hashbidimap1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"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"

%struct.struct_s = type { i32, i32, ptr, ptr, [10 x double] }

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_get_entry_by_key(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hbm1_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 [ %31, %.critedge42 ], [ %17, %9 ]
  %.03345 = phi i64 [ %32, %.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 = tail call ptr @hbm1_impl_get_entry_by_key(ptr noundef %., ptr noundef nonnull byval(%struct.struct_s) align 8 %21)
  %.not37 = icmp eq ptr %23, null
  br i1 %.not37, label %.critedge, label %24

24:                                               ; preds = %22
  %25 = load ptr, ptr %15, align 8, !tbaa !17
  %26 = load ptr, ptr %25, align 8, !tbaa !18
  %27 = load ptr, ptr %23, align 8, !tbaa !16
  %28 = getelementptr inbounds i8, ptr %27, i64 104
  %29 = getelementptr inbounds i8, ptr %21, i64 104
  %30 = tail call i32 %26(ptr noundef nonnull byval(%struct.struct_s) align 8 %28, ptr noundef nonnull byval(%struct.struct_s) align 8 %29) #1
  %.not38 = icmp eq i32 %30, 0
  br i1 %.not38, label %..critedge42_crit_edge, label %.critedge

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

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

.critedge:                                        ; preds = %24, %22, %.critedge42, %9, %2
  %.6 = phi i1 [ false, %2 ], [ true, %9 ], [ false, %24 ], [ 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 = !{!"hashbidimap1", !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 = !{!6, !7, i64 48}
!18 = !{!19, !7, i64 0}
!19 = !{!"hashbidimap1_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


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