; 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.hashmultimap0 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr }
%struct.hashmultimap0_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashmultimap0_entry = type { ptr, ptr, ptr, ptr }
%struct.hashmultimap0_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: nounwind uwtable
declare dso_local ptr @hmm0_new_custom(i64 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @hmm0_copy_of(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #2
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.hashmultimap0, ptr %10, i32 0, i32 1
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = uitofp i64 %12 to double
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.hashmultimap0, ptr %14, i32 0, i32 3
  %16 = load double, ptr %15, align 8, !tbaa !14
  %17 = fmul double %13, %16
  %18 = fptoui double %17 to i64
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.hashmultimap0, ptr %19, i32 0, i32 3
  %21 = load double, ptr %20, align 8, !tbaa !14
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.hashmultimap0, ptr %22, i32 0, i32 5
  %24 = load ptr, ptr %23, align 8, !tbaa !15
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashmultimap0, ptr %25, i32 0, i32 6
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashmultimap0, ptr %28, i32 0, i32 7
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = call ptr @hmm0_new_custom(i64 noundef %18, double noundef %21, ptr noundef %24, ptr noundef %27, ptr noundef %30, ptr noundef null)
  store ptr %31, ptr %4, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = icmp ne ptr %32, null
  br i1 %33, label %37, label %34

34:                                               ; preds = %1
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.hashmultimap0, ptr %35, i32 0, i32 4
  store i32 7, ptr %36, align 8, !tbaa !18
  store ptr null, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %114

37:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  store i64 0, ptr %6, align 8, !tbaa !19
  br label %38

38:                                               ; preds = %107, %37
  %39 = load i64, ptr %6, align 8, !tbaa !19
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.hashmultimap0, ptr %40, i32 0, i32 1
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = icmp ult i64 %39, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %38
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %110

45:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.hashmultimap0, ptr %46, i32 0, i32 0
  %48 = load ptr, ptr %47, align 8, !tbaa !20
  %49 = load i64, ptr %6, align 8, !tbaa !19
  %50 = getelementptr inbounds [2 x ptr], ptr %48, i64 %49
  %51 = getelementptr inbounds [2 x ptr], ptr %50, i64 0, i64 0
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  store ptr %52, ptr %7, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %98, %45
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %106

56:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.hashmultimap0, ptr %57, i32 0, i32 5
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  %60 = getelementptr inbounds %struct.hashmultimap0_fkey, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !21
  %62 = icmp ne ptr %61, null
  br i1 %62, label %63, label %73

63:                                               ; preds = %56
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.hashmultimap0, ptr %64, i32 0, i32 5
  %66 = load ptr, ptr %65, align 8, !tbaa !15
  %67 = getelementptr inbounds %struct.hashmultimap0_fkey, ptr %66, i32 0, i32 1
  %68 = load ptr, ptr %67, align 8, !tbaa !21
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  %72 = call ptr %68(ptr noundef %71)
  store ptr %72, ptr %8, align 8, !tbaa !5
  br label %77

73:                                               ; preds = %56
  %74 = load ptr, ptr %7, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !23
  store ptr %76, ptr %8, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %73, %63
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.hashmultimap0, ptr %78, i32 0, i32 6
  %80 = load ptr, ptr %79, align 8, !tbaa !16
  %81 = getelementptr inbounds %struct.hashmultimap0_fval, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !25
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %94

84:                                               ; preds = %77
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.hashmultimap0, ptr %85, i32 0, i32 6
  %87 = load ptr, ptr %86, align 8, !tbaa !16
  %88 = getelementptr inbounds %struct.hashmultimap0_fval, ptr %87, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !25
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !27
  %93 = call ptr %89(ptr noundef %92)
  store ptr %93, ptr %9, align 8, !tbaa !5
  br label %98

94:                                               ; preds = %77
  %95 = load ptr, ptr %7, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %95, i32 0, i32 1
  %97 = load ptr, ptr %96, align 8, !tbaa !27
  store ptr %97, ptr %9, align 8, !tbaa !5
  br label %98

98:                                               ; preds = %94, %84
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = call zeroext i1 @hmm0_insert(ptr noundef %99, ptr noundef %100, ptr noundef %101)
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.hashmultimap0_entry, ptr %103, i32 0, i32 2
  %105 = load ptr, ptr %104, align 8, !tbaa !28
  store ptr %105, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %53, !llvm.loop !29

106:                                              ; preds = %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %107

107:                                              ; preds = %106
  %108 = load i64, ptr %6, align 8, !tbaa !19
  %109 = add i64 %108, 1
  store i64 %109, ptr %6, align 8, !tbaa !19
  br label %38, !llvm.loop !31

110:                                              ; preds = %44
  %111 = load ptr, ptr %3, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.hashmultimap0, ptr %111, i32 0, i32 4
  store i32 0, ptr %112, align 8, !tbaa !18
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %113, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %114

114:                                              ; preds = %110, %34
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %115 = load ptr, ptr %2, align 8
  ret ptr %115
}

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, !11, i64 8}
!10 = !{!"hashmultimap0", !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, !12, i64 24}
!15 = !{!10, !6, i64 40}
!16 = !{!10, !6, i64 48}
!17 = !{!10, !6, i64 56}
!18 = !{!10, !13, i64 32}
!19 = !{!11, !11, i64 0}
!20 = !{!10, !6, i64 0}
!21 = !{!22, !6, i64 8}
!22 = !{!"hashmultimap0_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!23 = !{!24, !6, i64 0}
!24 = !{!"hashmultimap0_entry", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!25 = !{!26, !6, i64 8}
!26 = !{!"hashmultimap0_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!27 = !{!24, !6, i64 8}
!28 = !{!24, !6, i64 16}
!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"

; Function Attrs: nounwind uwtable
declare dso_local ptr @hmm0_new_custom(i64 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @hmm0_insert(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @hmm0_copy_of(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 8
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = uitofp i64 %3 to double
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load double, ptr %5, align 8, !tbaa !13
  %7 = fmul double %6, %4
  %8 = fptoui double %7 to i64
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  %11 = getelementptr inbounds i8, ptr %0, i64 48
  %12 = load ptr, ptr %11, align 8, !tbaa !15
  %13 = getelementptr inbounds i8, ptr %0, i64 56
  %14 = load ptr, ptr %13, align 8, !tbaa !16
  %15 = tail call ptr @hmm0_new_custom(i64 noundef %8, double noundef %6, ptr noundef %10, ptr noundef %12, ptr noundef %14, ptr noundef null)
  %.not = icmp eq ptr %15, null
  br i1 %.not, label %._crit_edge43, label %.preheader

.preheader:                                       ; preds = %1
  %16 = load i64, ptr %2, align 8, !tbaa !5
  %.not44 = icmp eq i64 %16, 0
  br i1 %.not44, label %._crit_edge43, label %.lr.ph42

.lr.ph42:                                         ; preds = %.preheader, %._crit_edge
  %17 = phi i64 [ %37, %._crit_edge ], [ %16, %.preheader ]
  %.03041 = phi i64 [ %38, %._crit_edge ], [ 0, %.preheader ]
  %18 = load ptr, ptr %0, align 8, !tbaa !17
  %19 = getelementptr inbounds [2 x ptr], ptr %18, i64 %.03041
  %.02938 = load ptr, ptr %19, align 8, !tbaa !18
  %.not3539 = icmp eq ptr %.02938, null
  br i1 %.not3539, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph42, %34
  %.02940 = phi ptr [ %.029, %34 ], [ %.02938, %.lr.ph42 ]
  %20 = load ptr, ptr %9, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %20, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %.not36 = icmp eq ptr %22, null
  %23 = load ptr, ptr %.02940, align 8, !tbaa !21
  br i1 %.not36, label %26, label %24

24:                                               ; preds = %.lr.ph
  %25 = tail call ptr %22(ptr noundef %23) #1
  br label %26

26:                                               ; preds = %.lr.ph, %24
  %.028 = phi ptr [ %25, %24 ], [ %23, %.lr.ph ]
  %27 = load ptr, ptr %11, align 8, !tbaa !15
  %28 = getelementptr inbounds i8, ptr %27, i64 8
  %29 = load ptr, ptr %28, align 8, !tbaa !23
  %.not37 = icmp eq ptr %29, null
  %30 = getelementptr inbounds i8, ptr %.02940, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !25
  br i1 %.not37, label %34, label %32

32:                                               ; preds = %26
  %33 = tail call ptr %29(ptr noundef %31) #1
  br label %34

34:                                               ; preds = %26, %32
  %.0 = phi ptr [ %33, %32 ], [ %31, %26 ]
  %35 = tail call zeroext i1 @hmm0_insert(ptr noundef nonnull %15, ptr noundef %.028, ptr noundef %.0)
  %36 = getelementptr inbounds i8, ptr %.02940, i64 16
  %.029 = load ptr, ptr %36, align 8, !tbaa !18
  %.not35 = icmp eq ptr %.029, null
  br i1 %.not35, label %._crit_edge.loopexit, label %.lr.ph, !llvm.loop !26

._crit_edge.loopexit:                             ; preds = %34
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.lr.ph42
  %37 = phi i64 [ %.pre, %._crit_edge.loopexit ], [ %17, %.lr.ph42 ]
  %38 = add nuw i64 %.03041, 1
  %39 = icmp ult i64 %38, %37
  br i1 %39, label %.lr.ph42, label %._crit_edge43, !llvm.loop !28

._crit_edge43:                                    ; preds = %._crit_edge, %.preheader, %1
  %.sink = phi i32 [ 7, %1 ], [ 0, %.preheader ], [ 0, %._crit_edge ]
  %40 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %40, align 8, !tbaa !29
  ret ptr %15
}

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 = !{!"hashmultimap0", !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, !11, i64 24}
!14 = !{!6, !7, i64 40}
!15 = !{!6, !7, i64 48}
!16 = !{!6, !7, i64 56}
!17 = !{!6, !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !7, i64 8}
!20 = !{!"hashmultimap0_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!21 = !{!22, !7, i64 0}
!22 = !{!"hashmultimap0_entry", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!23 = !{!24, !7, i64 8}
!24 = !{!"hashmultimap0_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!25 = !{!22, !7, i64 8}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = distinct !{!28, !27}
!29 = !{!6, !12, i64 32}


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