; 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.hashmultimap1 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr }
%struct.hashmultimap1_entry = type { %struct.struct_s, %struct.struct_s, ptr, ptr }
%struct.hashmultimap1_fkey = 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 @hmm1_empty(ptr noundef) #3

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

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashmultimap1, ptr %16, i32 0, i32 4
  store i32 2, ptr %17, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  br label %82

18:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 1, ptr %8, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 104, ptr %9) #4
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 104, ptr %10) #4
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !16
  br label %19

19:                                               ; preds = %66, %18
  %20 = load i64, ptr %11, align 8, !tbaa !16
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.hashmultimap1, ptr %21, i32 0, i32 1
  %23 = load i64, ptr %22, align 8, !tbaa !17
  %24 = icmp ult i64 %20, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %69

26:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.hashmultimap1, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %30 = load i64, ptr %11, align 8, !tbaa !16
  %31 = getelementptr inbounds [2 x ptr], ptr %29, i64 %30
  %32 = getelementptr inbounds [2 x ptr], ptr %31, i64 0, i64 0
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  store ptr %33, ptr %12, align 8, !tbaa !5
  br label %34

34:                                               ; preds = %61, %26
  %35 = load ptr, ptr %12, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %65

37:                                               ; preds = %34
  %38 = load i8, ptr %8, align 1, !tbaa !14, !range !19, !noundef !20
  %39 = trunc i8 %38 to i1
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %41, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %42, i64 104, i1 false), !tbaa.struct !21
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %43, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %44, i64 104, i1 false), !tbaa.struct !21
  store i8 0, ptr %8, align 1, !tbaa !14
  br label %61

45:                                               ; preds = %37
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.hashmultimap1, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !24
  %49 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %51 = load ptr, ptr %12, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %51, i32 0, i32 0
  %53 = call i32 %50(ptr noundef byval(%struct.struct_s) align 8 %52, ptr noundef byval(%struct.struct_s) align 8 %9)
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %60

55:                                               ; preds = %45
  %56 = load ptr, ptr %12, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %56, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %57, i64 104, i1 false), !tbaa.struct !21
  %58 = load ptr, ptr %12, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %58, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %59, i64 104, i1 false), !tbaa.struct !21
  br label %60

60:                                               ; preds = %55, %45
  br label %61

61:                                               ; preds = %60, %40
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %62, i32 0, i32 2
  %64 = load ptr, ptr %63, align 8, !tbaa !27
  store ptr %64, ptr %12, align 8, !tbaa !5
  br label %34, !llvm.loop !30

65:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %66

66:                                               ; preds = %65
  %67 = load i64, ptr %11, align 8, !tbaa !16
  %68 = add i64 %67, 1
  store i64 %68, ptr %11, align 8, !tbaa !16
  br label %19, !llvm.loop !32

69:                                               ; preds = %25
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = icmp ne ptr %70, null
  br i1 %71, label %72, label %74

72:                                               ; preds = %69
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %73, ptr align 8 %9, i64 104, i1 false), !tbaa.struct !21
  br label %74

74:                                               ; preds = %72, %69
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = icmp ne ptr %75, null
  br i1 %76, label %77, label %79

77:                                               ; preds = %74
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %78, ptr align 8 %10, i64 104, i1 false), !tbaa.struct !21
  br label %79

79:                                               ; preds = %77, %74
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.hashmultimap1, ptr %80, i32 0, i32 4
  store i32 0, ptr %81, align 8, !tbaa !9
  store i1 true, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 104, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 104, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %82

82:                                               ; preds = %79, %15
  %83 = load i1, ptr %4, align 1
  ret i1 %83
}

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 32}
!10 = !{!"hashmultimap1", !6, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32, !6, 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 = !{i8 0, i8 2}
!20 = !{}
!21 = !{i64 0, i64 4, !22, i64 4, i64 4, !22, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 80, !23}
!22 = !{!13, !13, i64 0}
!23 = !{!7, !7, i64 0}
!24 = !{!10, !6, i64 40}
!25 = !{!26, !6, i64 0}
!26 = !{!"hashmultimap1_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!27 = !{!28, !6, i64 208}
!28 = !{!"hashmultimap1_entry", !29, i64 0, !29, i64 104, !6, i64 208, !6, i64 216}
!29 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = distinct !{!32, !31}


; 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: 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 @hmm1_empty(ptr noundef) local_unnamed_addr #3

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

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

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

.lr.ph35:                                         ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  br label %13

._crit_edge36:                                    ; preds = %._crit_edge, %9
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %36, label %35

13:                                               ; preds = %.lr.ph35, %._crit_edge
  %14 = phi i64 [ %11, %.lr.ph35 ], [ %32, %._crit_edge ]
  %.02133 = phi i64 [ 0, %.lr.ph35 ], [ %33, %._crit_edge ]
  %.02232 = phi i1 [ true, %.lr.ph35 ], [ %.1.lcssa, %._crit_edge ]
  %15 = load ptr, ptr %0, align 8, !tbaa !14
  %16 = getelementptr inbounds [2 x ptr], ptr %15, i64 %.02133
  %.028 = load ptr, ptr %16, align 8, !tbaa !15
  %.not2729 = icmp eq ptr %.028, null
  br i1 %.not2729, label %._crit_edge, label %.lr.ph.peel

.lr.ph.peel:                                      ; preds = %13
  br i1 %.02232, label %.sink.split.peel, label %17

17:                                               ; preds = %.lr.ph.peel
  %18 = load ptr, ptr %12, align 8, !tbaa !16
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = tail call i32 %19(ptr noundef nonnull byval(%struct.struct_s) align 8 %.028, ptr noundef nonnull byval(%struct.struct_s) align 8 %4) #4
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.sink.split.peel, label %23

.sink.split.peel:                                 ; preds = %17, %.lr.ph.peel
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %4, ptr noundef nonnull align 8 dereferenceable(104) %.028, i64 104, i1 false)
  %22 = getelementptr inbounds i8, ptr %.028, i64 104
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %5, ptr noundef nonnull align 8 dereferenceable(104) %22, i64 104, i1 false)
  br label %23

23:                                               ; preds = %.sink.split.peel, %17
  %24 = getelementptr inbounds i8, ptr %.028, i64 208
  %.0.peel = load ptr, ptr %24, align 8, !tbaa !15
  %.not27.peel = icmp eq ptr %.0.peel, null
  br i1 %.not27.peel, label %._crit_edge.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %23, %30
  %.031 = phi ptr [ %.0, %30 ], [ %.0.peel, %23 ]
  %25 = load ptr, ptr %12, align 8, !tbaa !16
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = tail call i32 %26(ptr noundef nonnull byval(%struct.struct_s) align 8 %.031, ptr noundef nonnull byval(%struct.struct_s) align 8 %4) #4
  %28 = icmp sgt i32 %27, 0
  br i1 %28, label %.sink.split, label %30

.sink.split:                                      ; preds = %.lr.ph
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %4, ptr noundef nonnull align 8 dereferenceable(104) %.031, i64 104, i1 false)
  %29 = getelementptr inbounds i8, ptr %.031, i64 104
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %5, ptr noundef nonnull align 8 dereferenceable(104) %29, i64 104, i1 false)
  br label %30

30:                                               ; preds = %.sink.split, %.lr.ph
  %31 = getelementptr inbounds i8, ptr %.031, i64 208
  %.0 = load ptr, ptr %31, align 8, !tbaa !15
  %.not27 = icmp eq ptr %.0, null
  br i1 %.not27, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !19

._crit_edge.loopexit:                             ; preds = %30, %23
  %.pre = load i64, ptr %10, align 8, !tbaa !13
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %13
  %32 = phi i64 [ %14, %13 ], [ %.pre, %._crit_edge.loopexit ]
  %.1.lcssa = phi i1 [ %.02232, %13 ], [ false, %._crit_edge.loopexit ]
  %33 = add nuw i64 %.02133, 1
  %34 = icmp ult i64 %33, %32
  br i1 %34, label %13, label %._crit_edge36, !llvm.loop !22

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

36:                                               ; preds = %35, %._crit_edge36
  %.not26 = icmp eq ptr %2, null
  br i1 %.not26, label %38, label %37

37:                                               ; preds = %36
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %2, ptr noundef nonnull align 8 dereferenceable(104) %5, i64 104, i1 false), !tbaa.struct !23
  br label %38

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

40:                                               ; preds = %38, %7
  %.023 = xor i1 %6, true
  ret i1 %.023
}

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 32}
!6 = !{!"hashmultimap1", !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 = !{!"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 = !{!7, !7, i64 0}
!16 = !{!6, !7, i64 40}
!17 = !{!18, !7, i64 0}
!18 = !{!"hashmultimap1_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!19 = distinct !{!19, !20, !21}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!"llvm.loop.peeled.count", i32 1}
!22 = distinct !{!22, !20}
!23 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 8, !15, i64 16, i64 8, !15, i64 24, i64 80, !25}
!24 = !{!12, !12, i64 0}
!25 = !{!8, !8, i64 0}


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