; 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_fkey = 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: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

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

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

14:                                               ; preds = %3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.hashmap1, ptr %15, i32 0, i32 4
  store i32 2, ptr %16, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  br label %96

17:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 1, ptr %8, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 104, ptr %9) #4
  call void @llvm.memset.p0.i64(ptr align 8 %9, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 104, ptr %10) #4
  call void @llvm.memset.p0.i64(ptr align 8 %10, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  store i64 0, ptr %11, align 8, !tbaa !16
  br label %18

18:                                               ; preds = %80, %17
  %19 = load i64, ptr %11, align 8, !tbaa !16
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.hashmap1, ptr %20, i32 0, i32 1
  %22 = load i64, ptr %21, align 8, !tbaa !17
  %23 = icmp ult i64 %19, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %83

25:                                               ; preds = %18
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.hashmap1, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %29 = load i64, ptr %11, align 8, !tbaa !16
  %30 = getelementptr inbounds %struct.hashmap1_entry, ptr %28, i64 %29
  %31 = getelementptr inbounds %struct.hashmap1_entry, ptr %30, i32 0, i32 3
  %32 = load i32, ptr %31, align 8, !tbaa !19
  %33 = icmp eq i32 %32, 1
  br i1 %33, label %34, label %79

34:                                               ; preds = %25
  %35 = load i8, ptr %8, align 1, !tbaa !14, !range !22, !noundef !23
  %36 = trunc i8 %35 to i1
  br i1 %36, label %37, label %50

37:                                               ; preds = %34
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.hashmap1, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  %41 = load i64, ptr %11, align 8, !tbaa !16
  %42 = getelementptr inbounds %struct.hashmap1_entry, ptr %40, i64 %41
  %43 = getelementptr inbounds %struct.hashmap1_entry, ptr %42, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %43, i64 104, i1 false), !tbaa.struct !24
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.hashmap1, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %45, align 8, !tbaa !18
  %47 = load i64, ptr %11, align 8, !tbaa !16
  %48 = getelementptr inbounds %struct.hashmap1_entry, ptr %46, i64 %47
  %49 = getelementptr inbounds %struct.hashmap1_entry, ptr %48, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %49, i64 104, i1 false), !tbaa.struct !24
  store i8 0, ptr %8, align 1, !tbaa !14
  br label %78

50:                                               ; preds = %34
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.hashmap1, ptr %51, i32 0, i32 5
  %53 = load ptr, ptr %52, align 8, !tbaa !27
  %54 = getelementptr inbounds %struct.hashmap1_fkey, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !28
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.hashmap1, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !18
  %59 = load i64, ptr %11, align 8, !tbaa !16
  %60 = getelementptr inbounds %struct.hashmap1_entry, ptr %58, i64 %59
  %61 = getelementptr inbounds %struct.hashmap1_entry, ptr %60, i32 0, i32 0
  %62 = call i32 %55(ptr noundef byval(%struct.struct_s) align 8 %61, ptr noundef byval(%struct.struct_s) align 8 %9)
  %63 = icmp sgt i32 %62, 0
  br i1 %63, label %64, label %77

64:                                               ; preds = %50
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.hashmap1, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !18
  %68 = load i64, ptr %11, align 8, !tbaa !16
  %69 = getelementptr inbounds %struct.hashmap1_entry, ptr %67, i64 %68
  %70 = getelementptr inbounds %struct.hashmap1_entry, ptr %69, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %70, i64 104, i1 false), !tbaa.struct !24
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.hashmap1, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !18
  %74 = load i64, ptr %11, align 8, !tbaa !16
  %75 = getelementptr inbounds %struct.hashmap1_entry, ptr %73, i64 %74
  %76 = getelementptr inbounds %struct.hashmap1_entry, ptr %75, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %76, i64 104, i1 false), !tbaa.struct !24
  br label %77

77:                                               ; preds = %64, %50
  br label %78

78:                                               ; preds = %77, %37
  br label %79

79:                                               ; preds = %78, %25
  br label %80

80:                                               ; preds = %79
  %81 = load i64, ptr %11, align 8, !tbaa !16
  %82 = add i64 %81, 1
  store i64 %82, ptr %11, align 8, !tbaa !16
  br label %18, !llvm.loop !30

83:                                               ; preds = %24
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = icmp ne ptr %84, null
  br i1 %85, label %86, label %88

86:                                               ; preds = %83
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %87, ptr align 8 %9, i64 104, i1 false), !tbaa.struct !24
  br label %88

88:                                               ; preds = %86, %83
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = icmp ne ptr %89, null
  br i1 %90, label %91, label %93

91:                                               ; preds = %88
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %92, ptr align 8 %10, i64 104, i1 false), !tbaa.struct !24
  br label %93

93:                                               ; preds = %91, %88
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.hashmap1, ptr %94, i32 0, i32 4
  store i32 0, ptr %95, align 8, !tbaa !9
  store i1 true, ptr %4, align 1
  call void @llvm.lifetime.end.p0(i64 104, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 104, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  br label %96

96:                                               ; preds = %93, %14
  %97 = load i1, ptr %4, align 1
  ret i1 %97
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 = !{!15, !15, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!11, !11, i64 0}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !6, i64 0}
!19 = !{!20, !13, i64 216}
!20 = !{!"hashmap1_entry", !21, i64 0, !21, i64 104, !11, i64 208, !13, i64 216}
!21 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!22 = !{i8 0, i8 2}
!23 = !{}
!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 = !{!10, !6, i64 40}
!28 = !{!29, !6, i64 0}
!29 = !{!"hashmap1_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!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] }
%struct.hashmap1_entry = type { %struct.struct_s, %struct.struct_s, i64, i32 }

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; 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) #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hm1_max(ptr noundef %0, ptr noundef writeonly %1, ptr noundef writeonly %2) local_unnamed_addr #3 {
  %4 = alloca %struct.struct_s, align 8
  %5 = alloca %struct.struct_s, align 8
  %6 = tail call zeroext i1 @hm1_empty(ptr noundef %0)
  br i1 %6, label %7, label %9

7:                                                ; preds = %3
  %8 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 2, ptr %8, align 8, !tbaa !5
  br label %38

9:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %4) #4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %4, i8 0, i64 104, i1 false)
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %5)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %5, i8 0, i64 104, i1 false)
  %10 = getelementptr inbounds i8, ptr %0, i64 8
  %11 = load i64, ptr %10, align 8, !tbaa !13
  %.not31 = icmp eq i64 %11, 0
  br i1 %.not31, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %9
  %12 = getelementptr inbounds i8, ptr %0, i64 40
  br label %13

._crit_edge:                                      ; preds = %29, %9
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %34, label %33

13:                                               ; preds = %.lr.ph, %29
  %.030 = phi i64 [ 0, %.lr.ph ], [ %30, %29 ]
  %.02429 = phi i1 [ true, %.lr.ph ], [ %.1, %29 ]
  %14 = load ptr, ptr %0, align 8, !tbaa !14
  %15 = getelementptr inbounds %struct.hashmap1_entry, ptr %14, i64 %.030
  %16 = getelementptr inbounds i8, ptr %15, i64 216
  %17 = load i32, ptr %16, align 8, !tbaa !15
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %29

19:                                               ; preds = %13
  br i1 %.02429, label %.sink.split, label %20

20:                                               ; preds = %19
  %21 = load ptr, ptr %12, align 8, !tbaa !18
  %22 = load ptr, ptr %21, align 8, !tbaa !19
  %23 = tail call i32 %22(ptr noundef nonnull byval(%struct.struct_s) align 8 %15, ptr noundef nonnull byval(%struct.struct_s) align 8 %4) #4
  %24 = icmp sgt i32 %23, 0
  br i1 %24, label %25, label %29

25:                                               ; preds = %20
  %26 = load ptr, ptr %0, align 8, !tbaa !14
  %27 = getelementptr inbounds %struct.hashmap1_entry, ptr %26, i64 %.030
  br label %.sink.split

.sink.split:                                      ; preds = %19, %25
  %.sink = phi ptr [ %27, %25 ], [ %15, %19 ]
  %.sink32 = phi ptr [ %26, %25 ], [ %14, %19 ]
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %4, ptr noundef nonnull align 8 dereferenceable(104) %.sink, i64 104, i1 false)
  %28 = getelementptr inbounds %struct.hashmap1_entry, ptr %.sink32, i64 %.030, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %5, ptr noundef nonnull align 8 dereferenceable(104) %28, i64 104, i1 false)
  br label %29

29:                                               ; preds = %.sink.split, %13, %20
  %.1 = phi i1 [ false, %20 ], [ %.02429, %13 ], [ false, %.sink.split ]
  %30 = add nuw i64 %.030, 1
  %31 = load i64, ptr %10, align 8, !tbaa !13
  %32 = icmp ult i64 %30, %31
  br i1 %32, label %13, label %._crit_edge, !llvm.loop !21

33:                                               ; preds = %._crit_edge
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %1, ptr noundef nonnull align 8 dereferenceable(104) %4, i64 104, i1 false), !tbaa.struct !23
  br label %34

34:                                               ; preds = %33, %._crit_edge
  %.not28 = icmp eq ptr %2, null
  br i1 %.not28, label %36, label %35

35:                                               ; preds = %34
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %2, ptr noundef nonnull align 8 dereferenceable(104) %5, i64 104, i1 false), !tbaa.struct !23
  br label %36

36:                                               ; preds = %35, %34
  %37 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %37, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %5)
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %4) #4
  br label %38

38:                                               ; preds = %36, %7
  %.025 = xor i1 %6, true
  ret i1 %.025
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 8}
!14 = !{!6, !7, i64 0}
!15 = !{!16, !12, i64 216}
!16 = !{!"hashmap1_entry", !17, i64 0, !17, i64 104, !10, i64 208, !12, i64 216}
!17 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!18 = !{!6, !7, i64 40}
!19 = !{!20, !7, i64 0}
!20 = !{!"hashmap1_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = !{i64 0, i64 4, !24, i64 4, i64 4, !24, i64 8, i64 8, !25, i64 16, i64 8, !25, i64 24, i64 80, !26}
!24 = !{!12, !12, i64 0}
!25 = !{!7, !7, i64 0}
!26 = !{!8, !8, i64 0}


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