; 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_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cmc_alloc_node = type { ptr, ptr, ptr, ptr }
%struct.hashmultimap1_entry = type { %struct.struct_s, %struct.struct_s, 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

15:                                               ; preds = %4
  %16 = load ptr, ptr %6, 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 i64 0, ptr %5, align 8
  br label %110

18:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.hashmultimap1, ptr %19, i32 0, i32 5
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %21, i32 0, i32 4
  %23 = load ptr, ptr %22, align 8, !tbaa !15
  %24 = call i64 %23(ptr noundef byval(%struct.struct_s) align 8 %1)
  store i64 %24, ptr %8, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashmultimap1, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !18
  %28 = load i64, ptr %8, align 8, !tbaa !17
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.hashmultimap1, ptr %29, i32 0, i32 1
  %31 = load i64, ptr %30, align 8, !tbaa !19
  %32 = urem i64 %28, %31
  %33 = getelementptr inbounds [2 x ptr], ptr %27, i64 %32
  %34 = getelementptr inbounds [2 x ptr], ptr %33, i64 0, i64 0
  %35 = load ptr, ptr %34, align 8, !tbaa !5
  store ptr %35, ptr %9, align 8, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !5
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %18
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.hashmultimap1, ptr %39, i32 0, i32 4
  store i32 3, ptr %40, align 8, !tbaa !9
  store i64 0, ptr %5, align 8
  store i32 1, ptr %10, align 4
  br label %109

41:                                               ; preds = %18
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %72

44:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call i64 @hmm1_impl_key_count(ptr noundef %45, ptr noundef byval(%struct.struct_s) align 8 %1)
  store i64 %46, ptr %11, align 8, !tbaa !17
  %47 = load i64, ptr %11, align 8, !tbaa !17
  %48 = icmp eq i64 %47, 0
  br i1 %48, label %49, label %52

49:                                               ; preds = %44
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.hashmultimap1, ptr %50, i32 0, i32 4
  store i32 3, ptr %51, align 8, !tbaa !9
  store i64 0, ptr %5, align 8
  store i32 1, ptr %10, align 4
  br label %69

52:                                               ; preds = %44
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.hashmultimap1, ptr %53, i32 0, i32 7
  %55 = load ptr, ptr %54, align 8, !tbaa !20
  %56 = getelementptr inbounds %struct.cmc_alloc_node, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  %58 = load i64, ptr %11, align 8, !tbaa !17
  %59 = mul i64 104, %58
  %60 = call ptr %57(i64 noundef %59)
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %60, ptr %61, align 8, !tbaa !5
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load ptr, ptr %62, align 8, !tbaa !5
  %64 = icmp ne ptr %63, null
  br i1 %64, label %68, label %65

65:                                               ; preds = %52
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.hashmultimap1, ptr %66, i32 0, i32 4
  store i32 1, ptr %67, align 8, !tbaa !9
  store i64 0, ptr %5, align 8
  store i32 1, ptr %10, align 4
  br label %69

68:                                               ; preds = %52
  store i32 0, ptr %10, align 4
  br label %69

69:                                               ; preds = %68, %65, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  %70 = load i32, ptr %10, align 4
  switch i32 %70, label %109 [
    i32 0, label %71
  ]

71:                                               ; preds = %69
  br label %72

72:                                               ; preds = %71, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  store i64 0, ptr %12, align 8, !tbaa !17
  br label %73

73:                                               ; preds = %101, %72
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  %75 = icmp ne ptr %74, null
  br i1 %75, label %76, label %105

76:                                               ; preds = %73
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.hashmultimap1, ptr %77, i32 0, i32 5
  %79 = load ptr, ptr %78, align 8, !tbaa !14
  %80 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !23
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %82, i32 0, i32 0
  %84 = call i32 %81(ptr noundef byval(%struct.struct_s) align 8 %83, ptr noundef byval(%struct.struct_s) align 8 %1)
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %101

86:                                               ; preds = %76
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %89, label %96

89:                                               ; preds = %86
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load ptr, ptr %90, align 8, !tbaa !5
  %92 = load i64, ptr %12, align 8, !tbaa !17
  %93 = getelementptr inbounds %struct.struct_s, ptr %91, i64 %92
  %94 = load ptr, ptr %9, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %94, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %93, ptr align 8 %95, i64 104, i1 false), !tbaa.struct !24
  br label %96

96:                                               ; preds = %89, %86
  %97 = load i64, ptr %12, align 8, !tbaa !17
  %98 = add i64 %97, 1
  store i64 %98, ptr %12, align 8, !tbaa !17
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %99, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %100, ptr align 8 %2, i64 104, i1 false), !tbaa.struct !24
  br label %101

101:                                              ; preds = %96, %76
  %102 = load ptr, ptr %9, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %102, i32 0, i32 2
  %104 = load ptr, ptr %103, align 8, !tbaa !27
  store ptr %104, ptr %9, align 8, !tbaa !5
  br label %73, !llvm.loop !30

105:                                              ; preds = %73
  %106 = load ptr, ptr %6, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.hashmultimap1, ptr %106, i32 0, i32 4
  store i32 0, ptr %107, align 8, !tbaa !9
  %108 = load i64, ptr %12, align 8, !tbaa !17
  store i64 %108, ptr %5, align 8
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %109

109:                                              ; preds = %105, %69, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %110

110:                                              ; preds = %109, %15
  %111 = load i64, ptr %5, align 8
  ret i64 %111
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @hmm1_impl_key_count(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!10, !6, i64 40}
!15 = !{!16, !6, i64 32}
!16 = !{!"hashmultimap1_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!11, !11, i64 0}
!18 = !{!10, !6, i64 0}
!19 = !{!10, !11, i64 8}
!20 = !{!10, !6, i64 56}
!21 = !{!22, !6, i64 0}
!22 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!23 = !{!16, !6, i64 0}
!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 = !{!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"}


; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local i64 @hmm1_update_all(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr nocapture noundef readonly byval(%struct.struct_s) align 8 %2, ptr noundef %3) local_unnamed_addr #1 {
  %5 = tail call zeroext i1 @hmm1_empty(ptr noundef %0)
  br i1 %5, label %.critedge, label %6

6:                                                ; preds = %4
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 32
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %11 = tail call i64 %10(ptr noundef nonnull byval(%struct.struct_s) align 8 %1) #2
  %12 = load ptr, ptr %0, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  %14 = load i64, ptr %13, align 8, !tbaa !16
  %15 = urem i64 %11, %14
  %16 = getelementptr inbounds [2 x ptr], ptr %12, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !17
  %18 = icmp eq ptr %17, null
  br i1 %18, label %.critedge, label %19

19:                                               ; preds = %6
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %.split.us, label %20

20:                                               ; preds = %19
  %21 = tail call i64 @hmm1_impl_key_count(ptr noundef nonnull %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %1)
  %22 = icmp eq i64 %21, 0
  br i1 %22, label %.critedge, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %0, i64 56
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %27 = mul i64 %21, 104
  %28 = tail call ptr %26(i64 noundef %27) #2
  store ptr %28, ptr %3, align 8, !tbaa !17
  %.not38 = icmp eq ptr %28, null
  br i1 %.not38, label %.critedge, label %.split

.split.us:                                        ; preds = %19, %36
  %.041.us = phi i64 [ %.1.us, %36 ], [ 0, %19 ]
  %.03340.us = phi ptr [ %38, %36 ], [ %17, %19 ]
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  %31 = tail call i32 %30(ptr noundef nonnull byval(%struct.struct_s) align 8 %.03340.us, ptr noundef nonnull byval(%struct.struct_s) align 8 %1) #2
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %36

33:                                               ; preds = %.split.us
  %34 = add i64 %.041.us, 1
  %35 = getelementptr inbounds i8, ptr %.03340.us, i64 104
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %35, ptr noundef nonnull align 8 dereferenceable(104) %2, i64 104, i1 false), !tbaa.struct !22
  br label %36

36:                                               ; preds = %33, %.split.us
  %.1.us = phi i64 [ %34, %33 ], [ %.041.us, %.split.us ]
  %37 = getelementptr inbounds i8, ptr %.03340.us, i64 208
  %38 = load ptr, ptr %37, align 8, !tbaa !25
  %.not39.us = icmp eq ptr %38, null
  br i1 %.not39.us, label %.critedge, label %.split.us, !llvm.loop !28

.split:                                           ; preds = %23, %48
  %.041 = phi i64 [ %.1, %48 ], [ 0, %23 ]
  %.03340 = phi ptr [ %50, %48 ], [ %17, %23 ]
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  %41 = tail call i32 %40(ptr noundef nonnull byval(%struct.struct_s) align 8 %.03340, ptr noundef nonnull byval(%struct.struct_s) align 8 %1) #2
  %42 = icmp eq i32 %41, 0
  br i1 %42, label %43, label %48

43:                                               ; preds = %.split
  %44 = load ptr, ptr %3, align 8, !tbaa !17
  %45 = getelementptr inbounds %struct.struct_s, ptr %44, i64 %.041
  %46 = getelementptr inbounds i8, ptr %.03340, i64 104
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %45, ptr noundef nonnull align 8 dereferenceable(104) %46, i64 104, i1 false), !tbaa.struct !22
  %47 = add i64 %.041, 1
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %46, ptr noundef nonnull align 8 dereferenceable(104) %2, i64 104, i1 false), !tbaa.struct !22
  br label %48

48:                                               ; preds = %43, %.split
  %.1 = phi i64 [ %47, %43 ], [ %.041, %.split ]
  %49 = getelementptr inbounds i8, ptr %.03340, i64 208
  %50 = load ptr, ptr %49, align 8, !tbaa !25
  %.not39 = icmp eq ptr %50, null
  br i1 %.not39, label %.critedge, label %.split, !llvm.loop !28

.critedge:                                        ; preds = %48, %36, %23, %20, %6, %4
  %.sink = phi i32 [ 2, %4 ], [ 3, %6 ], [ 3, %20 ], [ 1, %23 ], [ 0, %36 ], [ 0, %48 ]
  %.2 = phi i64 [ 0, %4 ], [ 0, %6 ], [ 0, %20 ], [ 0, %23 ], [ %.1.us, %36 ], [ %.1, %48 ]
  %51 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %51, align 8, !tbaa !30
  ret i64 %.2
}

; Function Attrs: nounwind uwtable
declare dso_local i64 @hmm1_impl_key_count(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree 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, !7, i64 40}
!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 = !{!14, !7, i64 32}
!14 = !{!"hashmultimap1_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!15 = !{!6, !7, i64 0}
!16 = !{!6, !10, i64 8}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 56}
!19 = !{!20, !7, i64 0}
!20 = !{!"cmc_alloc_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!21 = !{!14, !7, i64 0}
!22 = !{i64 0, i64 4, !23, i64 4, i64 4, !23, i64 8, i64 8, !17, i64 16, i64 8, !17, i64 24, i64 80, !24}
!23 = !{!12, !12, i64 0}
!24 = !{!8, !8, i64 0}
!25 = !{!26, !7, i64 208}
!26 = !{!"hashmultimap1_entry", !27, i64 0, !27, i64 104, !7, i64 208, !7, i64 216}
!27 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!6, !12, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass