; 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.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: nounwind uwtable
define dso_local zeroext i1 @hmm1_insert(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2) #1 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = call zeroext i1 @hmm1_full(ptr noundef %9)
  br i1 %10, label %11, label %20

11:                                               ; preds = %3
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.hashmultimap1, ptr %13, i32 0, i32 1
  %15 = load i64, ptr %14, align 8, !tbaa !9
  %16 = add i64 %15, 1
  %17 = call zeroext i1 @hmm1_resize(ptr noundef %12, i64 noundef %16)
  br i1 %17, label %19, label %18

18:                                               ; preds = %11
  store i1 false, ptr %4, align 1
  br label %90

19:                                               ; preds = %11
  br label %20

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

42:                                               ; preds = %20
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.hashmultimap1, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = load i64, ptr %7, align 8, !tbaa !17
  %48 = getelementptr inbounds [2 x ptr], ptr %46, i64 %47
  %49 = getelementptr inbounds [2 x ptr], ptr %48, i64 0, i64 0
  store ptr %43, ptr %49, align 8, !tbaa !5
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.hashmultimap1, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !18
  %54 = load i64, ptr %7, align 8, !tbaa !17
  %55 = getelementptr inbounds [2 x ptr], ptr %53, i64 %54
  %56 = getelementptr inbounds [2 x ptr], ptr %55, i64 0, i64 1
  store ptr %50, ptr %56, align 8, !tbaa !5
  br label %83

57:                                               ; preds = %20
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hashmultimap1, ptr %58, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8, !tbaa !18
  %61 = load i64, ptr %7, align 8, !tbaa !17
  %62 = getelementptr inbounds [2 x ptr], ptr %60, i64 %61
  %63 = getelementptr inbounds [2 x ptr], ptr %62, i64 0, i64 1
  %64 = load ptr, ptr %63, align 8, !tbaa !5
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %65, i32 0, i32 3
  store ptr %64, ptr %66, align 8, !tbaa !19
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.hashmultimap1, ptr %68, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  %71 = load i64, ptr %7, align 8, !tbaa !17
  %72 = getelementptr inbounds [2 x ptr], ptr %70, i64 %71
  %73 = getelementptr inbounds [2 x ptr], ptr %72, i64 0, i64 1
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.hashmultimap1_entry, ptr %74, i32 0, i32 2
  store ptr %67, ptr %75, align 8, !tbaa !22
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.hashmultimap1, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !18
  %80 = load i64, ptr %7, align 8, !tbaa !17
  %81 = getelementptr inbounds [2 x ptr], ptr %79, i64 %80
  %82 = getelementptr inbounds [2 x ptr], ptr %81, i64 0, i64 1
  store ptr %76, ptr %82, align 8, !tbaa !5
  br label %83

83:                                               ; preds = %57, %42
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.hashmultimap1, ptr %84, i32 0, i32 2
  %86 = load i64, ptr %85, align 8, !tbaa !23
  %87 = add i64 %86, 1
  store i64 %87, ptr %85, align 8, !tbaa !23
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.hashmultimap1, ptr %88, i32 0, i32 4
  store i32 0, ptr %89, align 8, !tbaa !24
  store i1 true, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %90

90:                                               ; preds = %83, %18
  %91 = load i1, ptr %4, align 1
  ret i1 %91
}

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

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

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

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 = !{!"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 = !{!20, !6, i64 216}
!20 = !{!"hashmultimap1_entry", !21, i64 0, !21, i64 104, !6, i64 208, !6, i64 216}
!21 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!22 = !{!20, !6, i64 208}
!23 = !{!10, !11, i64 16}
!24 = !{!10, !13, i64 32}


; 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 noundef zeroext i1 @hmm1_insert(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2) local_unnamed_addr #0 {
  %4 = tail call zeroext i1 @hmm1_full(ptr noundef %0)
  br i1 %4, label %5, label %10

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load i64, ptr %6, align 8, !tbaa !5
  %8 = add i64 %7, 1
  %9 = tail call zeroext i1 @hmm1_resize(ptr noundef %0, i64 noundef %8)
  br i1 %9, label %10, label %36

10:                                               ; preds = %5, %3
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %12, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = tail call i64 %14(ptr noundef nonnull byval(%struct.struct_s) align 8 %1) #1
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load i64, ptr %16, align 8, !tbaa !5
  %18 = urem i64 %15, %17
  %19 = tail call ptr @hmm1_impl_new_entry(ptr noundef %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %1, ptr noundef nonnull byval(%struct.struct_s) align 8 %2)
  %20 = load ptr, ptr %0, align 8, !tbaa !16
  %21 = getelementptr inbounds [2 x ptr], ptr %20, i64 %18
  %22 = load ptr, ptr %21, align 8, !tbaa !17
  %23 = icmp eq ptr %22, null
  br i1 %23, label %24, label %26

24:                                               ; preds = %10
  store ptr %19, ptr %21, align 8, !tbaa !17
  %25 = load ptr, ptr %0, align 8, !tbaa !16
  br label %31

26:                                               ; preds = %10
  %27 = getelementptr inbounds i8, ptr %21, i64 8
  %28 = load ptr, ptr %27, align 8, !tbaa !17
  %29 = getelementptr inbounds i8, ptr %19, i64 216
  store ptr %28, ptr %29, align 8, !tbaa !18
  %30 = getelementptr inbounds i8, ptr %28, i64 208
  store ptr %19, ptr %30, align 8, !tbaa !21
  br label %31

31:                                               ; preds = %26, %24
  %.pn = phi ptr [ %20, %26 ], [ %25, %24 ]
  %.sink = getelementptr inbounds [2 x ptr], ptr %.pn, i64 %18, i64 1
  store ptr %19, ptr %.sink, align 8, !tbaa !17
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  %33 = load i64, ptr %32, align 8, !tbaa !22
  %34 = add i64 %33, 1
  store i64 %34, ptr %32, align 8, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %35, align 8, !tbaa !23
  br label %36

36:                                               ; preds = %5, %31
  %.0 = phi i1 [ true, %31 ], [ false, %5 ]
  ret i1 %.0
}

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

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

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

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 40}
!14 = !{!15, !7, i64 32}
!15 = !{!"hashmultimap1_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!16 = !{!6, !7, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!19, !7, i64 216}
!19 = !{!"hashmultimap1_entry", !20, i64 0, !20, i64 104, !7, i64 208, !7, i64 216}
!20 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!21 = !{!19, !7, i64 208}
!22 = !{!6, !10, i64 16}
!23 = !{!6, !12, i64 32}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass