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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hms1_empty(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hms1_max(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca %struct.struct_s, align 8
  %8 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = call zeroext i1 @hms1_empty(ptr noundef %9)
  br i1 %10, label %11, label %14

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.hashmultiset1, ptr %12, i32 0, i32 5
  store i32 2, ptr %13, align 8, !tbaa !9
  store i1 false, ptr %3, align 1
  br label %76

14:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 1, ptr %6, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 104, ptr %7) #4
  call void @llvm.memset.p0.i64(ptr align 8 %7, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %15

15:                                               ; preds = %65, %14
  %16 = load i64, ptr %8, align 8, !tbaa !16
  %17 = load ptr, ptr %4, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.hashmultiset1, ptr %17, i32 0, i32 1
  %19 = load i64, ptr %18, align 8, !tbaa !17
  %20 = icmp ult i64 %16, %19
  br i1 %20, label %22, label %21

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

22:                                               ; preds = %15
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.hashmultiset1, ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = load i64, ptr %8, align 8, !tbaa !16
  %27 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %25, i64 %26
  %28 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %27, i32 0, i32 3
  %29 = load i32, ptr %28, align 8, !tbaa !19
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %64

31:                                               ; preds = %22
  %32 = load i8, ptr %6, align 1, !tbaa !14, !range !22, !noundef !23
  %33 = trunc i8 %32 to i1
  br i1 %33, label %34, label %41

34:                                               ; preds = %31
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.hashmultiset1, ptr %35, i32 0, i32 0
  %37 = load ptr, ptr %36, align 8, !tbaa !18
  %38 = load i64, ptr %8, align 8, !tbaa !16
  %39 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %37, i64 %38
  %40 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %39, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %40, i64 104, i1 false), !tbaa.struct !24
  store i8 0, ptr %6, align 1, !tbaa !14
  br label %63

41:                                               ; preds = %31
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.hashmultiset1, ptr %42, i32 0, i32 6
  %44 = load ptr, ptr %43, align 8, !tbaa !27
  %45 = getelementptr inbounds %struct.hashmultiset1_fval, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !28
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.hashmultiset1, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = load i64, ptr %8, align 8, !tbaa !16
  %51 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %49, i64 %50
  %52 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %51, i32 0, i32 0
  %53 = call i32 %46(ptr noundef byval(%struct.struct_s) align 8 %52, ptr noundef byval(%struct.struct_s) align 8 %7)
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %62

55:                                               ; preds = %41
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.hashmultiset1, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !18
  %59 = load i64, ptr %8, align 8, !tbaa !16
  %60 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %58, i64 %59
  %61 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %60, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %61, i64 104, i1 false), !tbaa.struct !24
  br label %62

62:                                               ; preds = %55, %41
  br label %63

63:                                               ; preds = %62, %34
  br label %64

64:                                               ; preds = %63, %22
  br label %65

65:                                               ; preds = %64
  %66 = load i64, ptr %8, align 8, !tbaa !16
  %67 = add i64 %66, 1
  store i64 %67, ptr %8, align 8, !tbaa !16
  br label %15, !llvm.loop !30

68:                                               ; preds = %21
  %69 = load ptr, ptr %5, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %73

71:                                               ; preds = %68
  %72 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %72, ptr align 8 %7, i64 104, i1 false), !tbaa.struct !24
  br label %73

73:                                               ; preds = %71, %68
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.hashmultiset1, ptr %74, i32 0, i32 5
  store i32 0, ptr %75, align 8, !tbaa !9
  store i1 true, ptr %3, align 1
  call void @llvm.lifetime.end.p0(i64 104, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %76

76:                                               ; preds = %73, %11
  %77 = load i1, ptr %3, align 1
  ret i1 %77
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 8}
!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 = !{i8 0, i8 2}
!23 = !{}
!24 = !{i64 0, i64 4, !25, i64 4, i64 4, !25, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 80, !26}
!25 = !{!13, !13, i64 0}
!26 = !{!7, !7, i64 0}
!27 = !{!10, !6, i64 48}
!28 = !{!29, !6, i64 0}
!29 = !{!"hashmultiset1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!30 = distinct !{!30, !31}
!31 = !{!"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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hms1_empty(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hms1_max(ptr noundef %0, ptr noundef writeonly %1) local_unnamed_addr #3 {
  %3 = alloca %struct.struct_s, align 8
  %4 = tail call zeroext i1 @hms1_empty(ptr noundef %0)
  br i1 %4, label %5, label %7

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 2, ptr %6, align 8, !tbaa !5
  br label %33

7:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %3) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %3, i8 0, i64 104, i1 false)
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i64, ptr %8, align 8, !tbaa !13
  %.not23 = icmp eq i64 %9, 0
  br i1 %.not23, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 48
  br label %11

._crit_edge:                                      ; preds = %26, %7
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %31, label %30

11:                                               ; preds = %.lr.ph, %26
  %.022 = phi i64 [ 0, %.lr.ph ], [ %27, %26 ]
  %.01821 = phi i1 [ true, %.lr.ph ], [ %.1, %26 ]
  %12 = load ptr, ptr %0, align 8, !tbaa !14
  %13 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %12, i64 %.022
  %14 = getelementptr inbounds i8, ptr %13, i64 120
  %15 = load i32, ptr %14, align 8, !tbaa !15
  %16 = icmp eq i32 %15, 1
  br i1 %16, label %17, label %26

17:                                               ; preds = %11
  br i1 %.01821, label %.sink.split, label %18

18:                                               ; preds = %17
  %19 = load ptr, ptr %10, align 8, !tbaa !18
  %20 = load ptr, ptr %19, align 8, !tbaa !19
  %21 = tail call i32 %20(ptr noundef nonnull byval(%struct.struct_s) align 8 %13, ptr noundef nonnull byval(%struct.struct_s) align 8 %3) #4
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %18
  %24 = load ptr, ptr %0, align 8, !tbaa !14
  %25 = getelementptr inbounds %struct.hashmultiset1_entry, ptr %24, i64 %.022
  br label %.sink.split

.sink.split:                                      ; preds = %17, %23
  %.sink = phi ptr [ %25, %23 ], [ %13, %17 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %3, ptr noundef nonnull align 8 dereferenceable(104) %.sink, i64 104, i1 false)
  br label %26

26:                                               ; preds = %.sink.split, %11, %18
  %.1 = phi i1 [ false, %18 ], [ %.01821, %11 ], [ false, %.sink.split ]
  %27 = add nuw i64 %.022, 1
  %28 = load i64, ptr %8, align 8, !tbaa !13
  %29 = icmp ult i64 %27, %28
  br i1 %29, label %11, label %._crit_edge, !llvm.loop !21

30:                                               ; preds = %._crit_edge
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %1, ptr noundef nonnull align 8 dereferenceable(104) %3, i64 104, i1 false), !tbaa.struct !23
  br label %31

31:                                               ; preds = %30, %._crit_edge
  %32 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 0, ptr %32, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %3) #4
  br label %33

33:                                               ; preds = %31, %5
  %.019 = xor i1 %4, true
  ret i1 %.019
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 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 8}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !12, i64 120}
!16 = !{!"hashmultiset1_entry", !17, i64 0, !10, i64 104, !10, i64 112, !12, i64 120}
!17 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!18 = !{!6, !7, i64 48}
!19 = !{!20, !7, i64 0}
!20 = !{!"hashmultiset1_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 8, !25, i64 16, i64 8, !25, i64 24, i64 80, !26}
!24 = !{!12, !12, i64 0}
!25 = !{!7, !7, i64 0}
!26 = !{!8, !8, i64 0}


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