; 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.hashmultiset1 = type { ptr, i64, i64, i64, double, i32, ptr, ptr }
%struct.hashmultiset1_entry = type { %struct.struct_s, i64, i64, i32 }

; 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 @hms1_impl_get_entry(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hms1_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.hashmultiset1, ptr %12, i32 0, i32 5
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.hashmultiset1, ptr %14, i32 0, i32 5
  store i32 0, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashmultiset1, 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.hashmultiset1, 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 %112

24:                                               ; preds = %2
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashmultiset1, ptr %25, i32 0, i32 3
  %27 = load i64, ptr %26, align 8, !tbaa !15
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashmultiset1, ptr %28, i32 0, i32 3
  %30 = load i64, ptr %29, align 8, !tbaa !15
  %31 = icmp ne i64 %27, %30
  br i1 %31, label %32, label %33

32:                                               ; preds = %24
  store i1 false, ptr %3, align 1
  br label %112

33:                                               ; preds = %24
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.hashmultiset1, ptr %34, i32 0, i32 2
  %36 = load i64, ptr %35, align 8, !tbaa !14
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  store i1 true, ptr %3, align 1
  br label %112

39:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.hashmultiset1, ptr %40, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !16
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.hashmultiset1, ptr %43, i32 0, i32 1
  %45 = load i64, ptr %44, align 8, !tbaa !16
  %46 = icmp ult i64 %42, %45
  br i1 %46, label %47, label %49

47:                                               ; preds = %39
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  br label %51

49:                                               ; preds = %39
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %49, %47
  %52 = phi ptr [ %48, %47 ], [ %50, %49 ]
  store ptr %52, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = icmp eq ptr %53, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %51
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  br label %60

58:                                               ; preds = %51
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %58, %56
  %61 = phi ptr [ %57, %56 ], [ %59, %58 ]
  store ptr %61, 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 !17
  br label %62

62:                                               ; preds = %105, %60
  %63 = load i64, ptr %8, align 8, !tbaa !17
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.hashmultiset1, ptr %64, i32 0, i32 1
  %66 = load i64, ptr %65, align 8, !tbaa !16
  %67 = icmp ult i64 %63, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %62
  store i32 2, ptr %9, align 4
  br label %108

69:                                               ; preds = %62
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hashmultiset1, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !18
  %73 = load i64, ptr %8, align 8, !tbaa !17
  %74 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %72, i64 %73
  %75 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %74, i32 0, i32 3
  %76 = load i32, ptr %75, align 8, !tbaa !19
  %77 = icmp eq i32 %76, 1
  br i1 %77, label %78, label %104

78:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %79 = load ptr, ptr %6, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.hashmultiset1, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !18
  %82 = load i64, ptr %8, align 8, !tbaa !17
  %83 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %81, i64 %82
  store ptr %83, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = load ptr, ptr %10, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %85, i32 0, i32 0
  %87 = call ptr @hms1_impl_get_entry(ptr noundef %84, ptr noundef byval(%struct.struct_s) align 8 %86)
  store ptr %87, ptr %11, align 8, !tbaa !5
  %88 = load ptr, ptr %11, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %91, label %90

90:                                               ; preds = %78
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %101

91:                                               ; preds = %78
  %92 = load ptr, ptr %10, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %92, i32 0, i32 1
  %94 = load i64, ptr %93, align 8, !tbaa !22
  %95 = load ptr, ptr %11, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %95, i32 0, i32 1
  %97 = load i64, ptr %96, align 8, !tbaa !22
  %98 = icmp ne i64 %94, %97
  br i1 %98, label %99, label %100

99:                                               ; preds = %91
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %101

100:                                              ; preds = %91
  store i32 0, ptr %9, align 4
  br label %101

101:                                              ; preds = %100, %99, %90
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  %102 = load i32, ptr %9, align 4
  switch i32 %102, label %108 [
    i32 0, label %103
  ]

103:                                              ; preds = %101
  br label %104

104:                                              ; preds = %103, %69
  br label %105

105:                                              ; preds = %104
  %106 = load i64, ptr %8, align 8, !tbaa !17
  %107 = add i64 %106, 1
  store i64 %107, ptr %8, align 8, !tbaa !17
  br label %62, !llvm.loop !23

108:                                              ; preds = %101, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %109 = load i32, ptr %9, align 4
  switch i32 %109, label %111 [
    i32 2, label %110
  ]

110:                                              ; preds = %108
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %111

111:                                              ; preds = %110, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %112

112:                                              ; preds = %111, %38, %32, %23
  %113 = load i1, ptr %3, align 1
  ret i1 %113
}

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 40}
!10 = !{!"hashmultiset1", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !13, 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 24}
!16 = !{!10, !11, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !6, i64 0}
!19 = !{!20, !13, i64 120}
!20 = !{!"hashmultiset1_entry", !21, i64 0, !11, i64 104, !11, i64 112, !13, i64 120}
!21 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!22 = !{!20, !11, i64 104}
!23 = distinct !{!23, !24}
!24 = !{!"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] }
%struct.hashmultiset1_entry = type { %struct.struct_s, i64, i64, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hms1_equals(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 40
  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 24
  %11 = load i64, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %1, i64 24
  %13 = load i64, ptr %12, align 8, !tbaa !14
  %.not35 = icmp eq i64 %11, %13
  br i1 %.not35, label %14, label %.critedge

14:                                               ; preds = %9
  %15 = icmp eq i64 %6, 0
  br i1 %15, label %.critedge, label %16

16:                                               ; preds = %14
  %17 = getelementptr inbounds i8, ptr %0, i64 8
  %18 = load i64, ptr %17, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %1, i64 8
  %20 = load i64, ptr %19, align 8, !tbaa !15
  %21 = icmp ult i64 %18, %20
  %22 = select i1 %21, ptr %0, ptr %1
  %23 = icmp eq ptr %22, %0
  %24 = select i1 %23, ptr %1, ptr %0
  %25 = getelementptr inbounds i8, ptr %22, i64 8
  %26 = load i64, ptr %25, align 8, !tbaa !15
  %.not38.not40.not = icmp eq i64 %26, 0
  br i1 %.not38.not40.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %16, %40
  %27 = phi i64 [ %41, %40 ], [ %26, %16 ]
  %.03041 = phi i64 [ %42, %40 ], [ 0, %16 ]
  %28 = load ptr, ptr %22, align 8, !tbaa !16
  %29 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %28, i64 %.03041
  %30 = getelementptr inbounds i8, ptr %29, i64 120
  %31 = load i32, ptr %30, align 8, !tbaa !17
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %40

33:                                               ; preds = %.lr.ph
  %34 = tail call ptr @hms1_impl_get_entry(ptr noundef %24, ptr noundef nonnull byval(%struct.struct_s) align 8 %29)
  %.not36 = icmp eq ptr %34, null
  br i1 %.not36, label %.critedge, label %35

35:                                               ; preds = %33
  %36 = getelementptr inbounds i8, ptr %29, i64 104
  %37 = load i64, ptr %36, align 8, !tbaa !20
  %38 = getelementptr inbounds i8, ptr %34, i64 104
  %39 = load i64, ptr %38, align 8, !tbaa !20
  %.not37 = icmp eq i64 %37, %39
  br i1 %.not37, label %._crit_edge, label %.critedge

._crit_edge:                                      ; preds = %35
  %.pre = load i64, ptr %25, align 8, !tbaa !15
  br label %40

40:                                               ; preds = %._crit_edge, %.lr.ph
  %41 = phi i64 [ %.pre, %._crit_edge ], [ %27, %.lr.ph ]
  %42 = add nuw i64 %.03041, 1
  %.not38.not = icmp ult i64 %42, %41
  br i1 %.not38.not, label %.lr.ph, label %.critedge, !llvm.loop !21

.critedge:                                        ; preds = %33, %35, %40, %16, %14, %9, %2
  %.5 = phi i1 [ false, %2 ], [ false, %9 ], [ true, %14 ], [ true, %16 ], [ false, %33 ], [ false, %35 ], [ true, %40 ]
  ret i1 %.5
}

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 40}
!6 = !{!"hashmultiset1", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !12, 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 24}
!15 = !{!6, !10, i64 8}
!16 = !{!6, !7, i64 0}
!17 = !{!18, !12, i64 120}
!18 = !{!"hashmultiset1_entry", !19, i64 0, !10, i64 104, !10, i64 112, !12, i64 120}
!19 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!20 = !{!18, !10, i64 104}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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