; 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.hashmultimap1 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr }
%struct.hashmultimap1_entry = type { %struct.struct_s, %struct.struct_s, ptr, ptr }
%struct.struct_s = type { i32, i32, ptr, ptr, [10 x double] }
%struct.hashmultimap1_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashmultimap1_fval = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.cmc_alloc_node = type { 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
define dso_local void @hmm1_free(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #2
  store i64 0, ptr %3, align 8, !tbaa !9
  br label %6

6:                                                ; preds = %116, %1
  %7 = load i64, ptr %3, align 8, !tbaa !9
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.hashmultimap1, ptr %8, i32 0, i32 1
  %10 = load i64, ptr %9, align 8, !tbaa !11
  %11 = icmp ult i64 %7, %10
  br i1 %11, label %12, label %119

12:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.hashmultimap1, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = load i64, ptr %3, align 8, !tbaa !9
  %17 = getelementptr inbounds [2 x ptr], ptr %15, i64 %16
  %18 = getelementptr inbounds [2 x ptr], ptr %17, i64 0, i64 0
  %19 = load ptr, ptr %18, align 8, !tbaa !5
  store ptr %19, ptr %4, align 8, !tbaa !5
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = icmp ne ptr %20, null
  br i1 %21, label %22, label %116

22:                                               ; preds = %12
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %23, i32 0, i32 2
  %25 = load ptr, ptr %24, align 8, !tbaa !16
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %69

27:                                               ; preds = %22
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %29, align 8, !tbaa !19
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %69

32:                                               ; preds = %27
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.hashmultimap1, ptr %33, i32 0, i32 5
  %35 = load ptr, ptr %34, align 8, !tbaa !20
  %36 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !21
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %47

39:                                               ; preds = %32
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.hashmultimap1, ptr %40, i32 0, i32 5
  %42 = load ptr, ptr %41, align 8, !tbaa !20
  %43 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %42, i32 0, i32 3
  %44 = load ptr, ptr %43, align 8, !tbaa !21
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %45, i32 0, i32 0
  call void %44(ptr noundef byval(%struct.struct_s) align 8 %46)
  br label %47

47:                                               ; preds = %39, %32
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.hashmultimap1, ptr %48, i32 0, i32 6
  %50 = load ptr, ptr %49, align 8, !tbaa !23
  %51 = getelementptr inbounds %struct.hashmultimap1_fval, ptr %50, i32 0, i32 3
  %52 = load ptr, ptr %51, align 8, !tbaa !24
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %62

54:                                               ; preds = %47
  %55 = load ptr, ptr %2, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.hashmultimap1, ptr %55, i32 0, i32 6
  %57 = load ptr, ptr %56, align 8, !tbaa !23
  %58 = getelementptr inbounds %struct.hashmultimap1_fval, ptr %57, i32 0, i32 3
  %59 = load ptr, ptr %58, align 8, !tbaa !24
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %60, i32 0, i32 1
  call void %59(ptr noundef byval(%struct.struct_s) align 8 %61)
  br label %62

62:                                               ; preds = %54, %47
  %63 = load ptr, ptr %2, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.hashmultimap1, ptr %63, i32 0, i32 7
  %65 = load ptr, ptr %64, align 8, !tbaa !26
  %66 = getelementptr inbounds %struct.cmc_alloc_node, ptr %65, i32 0, i32 3
  %67 = load ptr, ptr %66, align 8, !tbaa !27
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  call void %67(ptr noundef %68)
  br label %115

69:                                               ; preds = %27, %22
  br label %70

70:                                               ; preds = %107, %69
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %114

73:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %74 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %74, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %75, i32 0, i32 2
  %77 = load ptr, ptr %76, align 8, !tbaa !16
  store ptr %77, ptr %4, align 8, !tbaa !5
  %78 = load ptr, ptr %2, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.hashmultimap1, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !20
  %81 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %80, i32 0, i32 3
  %82 = load ptr, ptr %81, align 8, !tbaa !21
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %92

84:                                               ; preds = %73
  %85 = load ptr, ptr %2, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.hashmultimap1, ptr %85, i32 0, i32 5
  %87 = load ptr, ptr %86, align 8, !tbaa !20
  %88 = getelementptr inbounds %struct.hashmultimap1_fkey, ptr %87, i32 0, i32 3
  %89 = load ptr, ptr %88, align 8, !tbaa !21
  %90 = load ptr, ptr %5, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %90, i32 0, i32 0
  call void %89(ptr noundef byval(%struct.struct_s) align 8 %91)
  br label %92

92:                                               ; preds = %84, %73
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.hashmultimap1, ptr %93, i32 0, i32 6
  %95 = load ptr, ptr %94, align 8, !tbaa !23
  %96 = getelementptr inbounds %struct.hashmultimap1_fval, ptr %95, i32 0, i32 3
  %97 = load ptr, ptr %96, align 8, !tbaa !24
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %107

99:                                               ; preds = %92
  %100 = load ptr, ptr %2, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.hashmultimap1, ptr %100, i32 0, i32 6
  %102 = load ptr, ptr %101, align 8, !tbaa !23
  %103 = getelementptr inbounds %struct.hashmultimap1_fval, ptr %102, i32 0, i32 3
  %104 = load ptr, ptr %103, align 8, !tbaa !24
  %105 = load ptr, ptr %5, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %105, i32 0, i32 1
  call void %104(ptr noundef byval(%struct.struct_s) align 8 %106)
  br label %107

107:                                              ; preds = %99, %92
  %108 = load ptr, ptr %2, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.hashmultimap1, ptr %108, i32 0, i32 7
  %110 = load ptr, ptr %109, align 8, !tbaa !26
  %111 = getelementptr inbounds %struct.cmc_alloc_node, ptr %110, i32 0, i32 3
  %112 = load ptr, ptr %111, align 8, !tbaa !27
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  call void %112(ptr noundef %113)
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  br label %70, !llvm.loop !29

114:                                              ; preds = %70
  br label %115

115:                                              ; preds = %114, %62
  br label %116

116:                                              ; preds = %115, %12
  %117 = load i64, ptr %3, align 8, !tbaa !9
  %118 = add i64 %117, 1
  store i64 %118, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  br label %6, !llvm.loop !31

119:                                              ; preds = %6
  %120 = load ptr, ptr %2, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.hashmultimap1, ptr %120, i32 0, i32 7
  %122 = load ptr, ptr %121, align 8, !tbaa !26
  %123 = getelementptr inbounds %struct.cmc_alloc_node, ptr %122, i32 0, i32 3
  %124 = load ptr, ptr %123, align 8, !tbaa !27
  %125 = load ptr, ptr %2, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.hashmultimap1, ptr %125, i32 0, i32 0
  %127 = load ptr, ptr %126, align 8, !tbaa !15
  call void %124(ptr noundef %127)
  %128 = load ptr, ptr %2, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.hashmultimap1, ptr %128, i32 0, i32 7
  %130 = load ptr, ptr %129, align 8, !tbaa !26
  %131 = getelementptr inbounds %struct.cmc_alloc_node, ptr %130, i32 0, i32 3
  %132 = load ptr, ptr %131, align 8, !tbaa !27
  %133 = load ptr, ptr %2, align 8, !tbaa !5
  call void %132(ptr noundef %133)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #2
  ret void
}

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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"hashmultimap1", !6, i64 0, !10, i64 8, !10, i64 16, !13, i64 24, !14, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!"double", !7, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !6, i64 0}
!16 = !{!17, !6, i64 208}
!17 = !{!"hashmultimap1_entry", !18, i64 0, !18, i64 104, !6, i64 208, !6, i64 216}
!18 = !{!"struct_s", !14, i64 0, !14, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!19 = !{!17, !6, i64 216}
!20 = !{!12, !6, i64 40}
!21 = !{!22, !6, i64 24}
!22 = !{!"hashmultimap1_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!12, !6, i64 48}
!24 = !{!25, !6, i64 24}
!25 = !{!"hashmultimap1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!26 = !{!12, !6, i64 56}
!27 = !{!28, !6, i64 24}
!28 = !{!"cmc_alloc_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


; 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
define dso_local void @hmm1_free(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %.not43 = icmp eq i64 %3, 0
  br i1 %.not43, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %4 = getelementptr inbounds i8, ptr %0, i64 40
  %5 = getelementptr inbounds i8, ptr %0, i64 48
  %6 = getelementptr inbounds i8, ptr %0, i64 56
  br label %7

7:                                                ; preds = %.lr.ph, %.loopexit
  %.042 = phi i64 [ 0, %.lr.ph ], [ %51, %.loopexit ]
  %8 = load ptr, ptr %0, align 8, !tbaa !13
  %9 = getelementptr inbounds [2 x ptr], ptr %8, i64 %.042
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %.not = icmp eq ptr %10, null
  br i1 %.not, label %.loopexit, label %11

11:                                               ; preds = %7
  %12 = getelementptr inbounds i8, ptr %10, i64 208
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %.preheader

.preheader:                                       ; preds = %15, %11
  br label %34

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %10, i64 216
  %17 = load ptr, ptr %16, align 8, !tbaa !18
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %.preheader

19:                                               ; preds = %15
  %20 = load ptr, ptr %4, align 8, !tbaa !19
  %21 = getelementptr inbounds i8, ptr %20, i64 24
  %22 = load ptr, ptr %21, align 8, !tbaa !20
  %.not39 = icmp eq ptr %22, null
  br i1 %.not39, label %24, label %23

23:                                               ; preds = %19
  tail call void %22(ptr noundef nonnull byval(%struct.struct_s) align 8 %10) #1
  br label %24

24:                                               ; preds = %23, %19
  %25 = load ptr, ptr %5, align 8, !tbaa !22
  %26 = getelementptr inbounds i8, ptr %25, i64 24
  %27 = load ptr, ptr %26, align 8, !tbaa !23
  %.not40 = icmp eq ptr %27, null
  br i1 %.not40, label %30, label %28

28:                                               ; preds = %24
  %29 = getelementptr inbounds i8, ptr %10, i64 104
  tail call void %27(ptr noundef nonnull byval(%struct.struct_s) align 8 %29) #1
  br label %30

30:                                               ; preds = %28, %24
  %31 = load ptr, ptr %6, align 8, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %31, i64 24
  %33 = load ptr, ptr %32, align 8, !tbaa !26
  tail call void %33(ptr noundef nonnull %10) #1
  br label %.loopexit

34:                                               ; preds = %.preheader, %47
  %.03041 = phi ptr [ %36, %47 ], [ %10, %.preheader ]
  %35 = getelementptr inbounds i8, ptr %.03041, i64 208
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = load ptr, ptr %4, align 8, !tbaa !19
  %38 = getelementptr inbounds i8, ptr %37, i64 24
  %39 = load ptr, ptr %38, align 8, !tbaa !20
  %.not37 = icmp eq ptr %39, null
  br i1 %.not37, label %41, label %40

40:                                               ; preds = %34
  tail call void %39(ptr noundef nonnull byval(%struct.struct_s) align 8 %.03041) #1
  br label %41

41:                                               ; preds = %40, %34
  %42 = load ptr, ptr %5, align 8, !tbaa !22
  %43 = getelementptr inbounds i8, ptr %42, i64 24
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  %.not38 = icmp eq ptr %44, null
  br i1 %.not38, label %47, label %45

45:                                               ; preds = %41
  %46 = getelementptr inbounds i8, ptr %.03041, i64 104
  tail call void %44(ptr noundef nonnull byval(%struct.struct_s) align 8 %46) #1
  br label %47

47:                                               ; preds = %45, %41
  %48 = load ptr, ptr %6, align 8, !tbaa !25
  %49 = getelementptr inbounds i8, ptr %48, i64 24
  %50 = load ptr, ptr %49, align 8, !tbaa !26
  tail call void %50(ptr noundef nonnull %.03041) #1
  %.not36 = icmp eq ptr %36, null
  br i1 %.not36, label %.loopexit, label %34, !llvm.loop !28

.loopexit:                                        ; preds = %47, %30, %7
  %51 = add nuw i64 %.042, 1
  %52 = load i64, ptr %2, align 8, !tbaa !5
  %53 = icmp ult i64 %51, %52
  br i1 %53, label %7, label %._crit_edge, !llvm.loop !30

._crit_edge:                                      ; preds = %.loopexit, %1
  %54 = getelementptr inbounds i8, ptr %0, i64 56
  %55 = load ptr, ptr %54, align 8, !tbaa !25
  %56 = getelementptr inbounds i8, ptr %55, i64 24
  %57 = load ptr, ptr %56, align 8, !tbaa !26
  %58 = load ptr, ptr %0, align 8, !tbaa !13
  tail call void %57(ptr noundef %58) #1
  %59 = load ptr, ptr %54, align 8, !tbaa !25
  %60 = getelementptr inbounds i8, ptr %59, i64 24
  %61 = load ptr, ptr %60, align 8, !tbaa !26
  tail call void %61(ptr noundef nonnull %0) #1
  ret void
}

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


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