; 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.hashmap1 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr }
%struct.hashmap1_entry = type { %struct.struct_s, %struct.struct_s, i64, i32 }
%struct.hashmap1_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 hidden ptr @hm1_impl_get_entry(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hm1_equals(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.hashmap1, ptr %12, i32 0, i32 4
  store i32 0, ptr %13, align 8, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.hashmap1, ptr %14, i32 0, i32 4
  store i32 0, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.hashmap1, ptr %16, i32 0, i32 2
  %18 = load i64, ptr %17, align 8, !tbaa !14
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.hashmap1, ptr %19, i32 0, i32 2
  %21 = load i64, ptr %20, align 8, !tbaa !14
  %22 = icmp ne i64 %18, %21
  br i1 %22, label %23, label %24

23:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %101

24:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashmap1, ptr %25, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !15
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.hashmap1, ptr %28, i32 0, i32 1
  %30 = load i64, ptr %29, align 8, !tbaa !15
  %31 = icmp ult i64 %27, %30
  br i1 %31, label %32, label %34

32:                                               ; preds = %24
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  br label %36

34:                                               ; preds = %24
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %34, %32
  %37 = phi ptr [ %33, %32 ], [ %35, %34 ]
  store ptr %37, ptr %6, align 8, !tbaa !5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = icmp eq ptr %38, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %36
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  br label %45

43:                                               ; preds = %36
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %43, %41
  %46 = phi ptr [ %42, %41 ], [ %44, %43 ]
  store ptr %46, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %47

47:                                               ; preds = %94, %45
  %48 = load i64, ptr %8, align 8, !tbaa !16
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.hashmap1, ptr %49, i32 0, i32 1
  %51 = load i64, ptr %50, align 8, !tbaa !15
  %52 = icmp ult i64 %48, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %47
  store i32 2, ptr %9, align 4
  br label %97

54:                                               ; preds = %47
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.hashmap1, ptr %55, i32 0, i32 0
  %57 = load ptr, ptr %56, align 8, !tbaa !17
  %58 = load i64, ptr %8, align 8, !tbaa !16
  %59 = getelementptr inbounds %struct.hashmap1_entry, ptr %57, i64 %58
  %60 = getelementptr inbounds %struct.hashmap1_entry, ptr %59, i32 0, i32 3
  %61 = load i32, ptr %60, align 8, !tbaa !18
  %62 = icmp eq i32 %61, 1
  br i1 %62, label %63, label %93

63:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.hashmap1, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !17
  %67 = load i64, ptr %8, align 8, !tbaa !16
  %68 = getelementptr inbounds %struct.hashmap1_entry, ptr %66, i64 %67
  store ptr %68, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #2
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %10, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hashmap1_entry, ptr %70, i32 0, i32 0
  %72 = call ptr @hm1_impl_get_entry(ptr noundef %69, ptr noundef byval(%struct.struct_s) align 8 %71)
  store ptr %72, ptr %11, align 8, !tbaa !5
  %73 = load ptr, ptr %11, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %76, label %75

75:                                               ; preds = %63
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %90

76:                                               ; preds = %63
  %77 = load ptr, ptr %6, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.hashmap1, ptr %77, i32 0, i32 6
  %79 = load ptr, ptr %78, align 8, !tbaa !21
  %80 = getelementptr inbounds %struct.hashmap1_fval, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !22
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.hashmap1_entry, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %11, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.hashmap1_entry, ptr %84, i32 0, i32 1
  %86 = call i32 %81(ptr noundef byval(%struct.struct_s) align 8 %83, ptr noundef byval(%struct.struct_s) align 8 %85)
  %87 = icmp ne i32 %86, 0
  br i1 %87, label %88, label %89

88:                                               ; preds = %76
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %90

89:                                               ; preds = %76
  store i32 0, ptr %9, align 4
  br label %90

90:                                               ; preds = %89, %88, %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  %91 = load i32, ptr %9, align 4
  switch i32 %91, label %97 [
    i32 0, label %92
  ]

92:                                               ; preds = %90
  br label %93

93:                                               ; preds = %92, %54
  br label %94

94:                                               ; preds = %93
  %95 = load i64, ptr %8, align 8, !tbaa !16
  %96 = add i64 %95, 1
  store i64 %96, ptr %8, align 8, !tbaa !16
  br label %47, !llvm.loop !24

97:                                               ; preds = %90, %53
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  %98 = load i32, ptr %9, align 4
  switch i32 %98, label %100 [
    i32 2, label %99
  ]

99:                                               ; preds = %97
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %100

100:                                              ; preds = %99, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #2
  br label %101

101:                                              ; preds = %100, %23
  %102 = load i1, ptr %3, align 1
  ret i1 %102
}

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, !13, i64 32}
!10 = !{!"hashmap1", !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, !11, i64 16}
!15 = !{!10, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !6, i64 0}
!18 = !{!19, !13, i64 216}
!19 = !{!"hashmap1_entry", !20, i64 0, !20, i64 104, !11, i64 208, !13, i64 216}
!20 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!21 = !{!10, !6, i64 48}
!22 = !{!23, !6, i64 0}
!23 = !{!"hashmap1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!24 = distinct !{!24, !25}
!25 = !{!"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] }
%struct.hashmap1_entry = type { %struct.struct_s, %struct.struct_s, i64, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hm1_equals(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %3, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %1, i64 32
  store i32 0, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %1, i64 16
  %8 = load i64, ptr %7, align 8, !tbaa !13
  %.not = icmp eq i64 %6, %8
  br i1 %.not, label %9, label %.critedge

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i64, ptr %10, align 8, !tbaa !14
  %12 = getelementptr inbounds i8, ptr %1, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !14
  %14 = icmp ult i64 %11, %13
  %15 = select i1 %14, ptr %0, ptr %1
  %16 = icmp eq ptr %15, %0
  %17 = select i1 %16, ptr %1, ptr %0
  %18 = getelementptr inbounds i8, ptr %15, i64 48
  %19 = getelementptr inbounds i8, ptr %15, i64 8
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %.not34.not36.not = icmp eq i64 %20, 0
  br i1 %.not34.not36.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %9, %35
  %21 = phi i64 [ %36, %35 ], [ %20, %9 ]
  %.02837 = phi i64 [ %37, %35 ], [ 0, %9 ]
  %22 = load ptr, ptr %15, align 8, !tbaa !15
  %23 = getelementptr inbounds %struct.hashmap1_entry, ptr %22, i64 %.02837
  %24 = getelementptr inbounds i8, ptr %23, i64 216
  %25 = load i32, ptr %24, align 8, !tbaa !16
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %35

27:                                               ; preds = %.lr.ph
  %28 = tail call ptr @hm1_impl_get_entry(ptr noundef %17, ptr noundef nonnull byval(%struct.struct_s) align 8 %23)
  %.not32 = icmp eq ptr %28, null
  br i1 %.not32, label %.critedge, label %29

29:                                               ; preds = %27
  %30 = load ptr, ptr %18, align 8, !tbaa !19
  %31 = load ptr, ptr %30, align 8, !tbaa !20
  %32 = getelementptr inbounds i8, ptr %23, i64 104
  %33 = getelementptr inbounds i8, ptr %28, i64 104
  %34 = tail call i32 %31(ptr noundef nonnull byval(%struct.struct_s) align 8 %32, ptr noundef nonnull byval(%struct.struct_s) align 8 %33) #1
  %.not33 = icmp eq i32 %34, 0
  br i1 %.not33, label %._crit_edge, label %.critedge

._crit_edge:                                      ; preds = %29
  %.pre = load i64, ptr %19, align 8, !tbaa !14
  br label %35

35:                                               ; preds = %._crit_edge, %.lr.ph
  %36 = phi i64 [ %.pre, %._crit_edge ], [ %21, %.lr.ph ]
  %37 = add nuw i64 %.02837, 1
  %.not34.not = icmp ult i64 %37, %36
  br i1 %.not34.not, label %.lr.ph, label %.critedge, !llvm.loop !22

.critedge:                                        ; preds = %27, %29, %35, %9, %2
  %.5 = phi i1 [ false, %2 ], [ true, %9 ], [ false, %27 ], [ false, %29 ], [ true, %35 ]
  ret i1 %.5
}

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, !12, i64 32}
!6 = !{!"hashmap1", !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 16}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!17, !12, i64 216}
!17 = !{!"hashmap1_entry", !18, i64 0, !18, i64 104, !10, i64 208, !12, i64 216}
!18 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!19 = !{!6, !7, i64 48}
!20 = !{!21, !7, i64 0}
!21 = !{!"hashmap1_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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