; 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.hashset1 = type { ptr, i64, i64, double, i32, ptr, ptr }
%struct.hashset1_fval = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashset1_entry = type { %struct.struct_s, i64, i32 }

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @hs1_new_custom(i64 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local ptr @hs1_copy_of(ptr noundef %0) #2 {
  %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 %struct.struct_s, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.hashset1, 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.hashset1, 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.hashset1, 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.hashset1, 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.hashset1, ptr %25, i32 0, i32 6
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = call ptr @hs1_new_custom(i64 noundef %18, double noundef %21, ptr noundef %24, ptr noundef %27, ptr noundef null)
  store ptr %28, ptr %4, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = icmp ne ptr %29, null
  br i1 %30, label %34, label %31

31:                                               ; preds = %1
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.hashset1, ptr %32, i32 0, i32 4
  store i32 7, ptr %33, align 8, !tbaa !17
  store ptr null, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %118

34:                                               ; preds = %1
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.hashset1, ptr %35, i32 0, i32 5
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = getelementptr inbounds %struct.hashset1_fval, ptr %37, i32 0, i32 1
  %39 = load ptr, ptr %38, align 8, !tbaa !18
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %98

41:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !20
  br label %42

42:                                               ; preds = %94, %41
  %43 = load i64, ptr %6, align 8, !tbaa !20
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.hashset1, ptr %44, i32 0, i32 1
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = icmp ult i64 %43, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.hashset1, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !21
  %53 = load i64, ptr %6, align 8, !tbaa !20
  %54 = getelementptr inbounds %struct.hashset1_entry, ptr %52, i64 %53
  store ptr %54, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.hashset1_entry, ptr %55, i32 0, i32 2
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %93

59:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.hashset1, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !21
  %63 = load i64, ptr %6, align 8, !tbaa !20
  %64 = getelementptr inbounds %struct.hashset1_entry, ptr %62, i64 %63
  store ptr %64, ptr %8, align 8, !tbaa !5
  %65 = load ptr, ptr %7, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.hashset1_entry, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8, !tbaa !22
  %68 = icmp eq i32 %67, -1
  br i1 %68, label %69, label %72

69:                                               ; preds = %59
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.hashset1_entry, ptr %70, i32 0, i32 2
  store i32 -1, ptr %71, align 8, !tbaa !22
  br label %92

72:                                               ; preds = %59
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.hashset1_entry, ptr %73, i32 0, i32 2
  %75 = load i32, ptr %74, align 8, !tbaa !22
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.hashset1_entry, ptr %76, i32 0, i32 2
  store i32 %75, ptr %77, align 8, !tbaa !22
  %78 = load ptr, ptr %7, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.hashset1_entry, ptr %78, i32 0, i32 1
  %80 = load i64, ptr %79, align 8, !tbaa !25
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.hashset1_entry, ptr %81, i32 0, i32 1
  store i64 %80, ptr %82, align 8, !tbaa !25
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.hashset1_entry, ptr %83, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 104, ptr %9) #3
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.hashset1, ptr %85, i32 0, i32 5
  %87 = load ptr, ptr %86, align 8, !tbaa !15
  %88 = getelementptr inbounds %struct.hashset1_fval, ptr %87, i32 0, i32 1
  %89 = load ptr, ptr %88, align 8, !tbaa !18
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.hashset1_entry, ptr %90, i32 0, i32 0
  call void %89(ptr dead_on_unwind writable sret(%struct.struct_s) align 8 %9, ptr noundef byval(%struct.struct_s) align 8 %91)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %84, ptr align 8 %9, i64 104, i1 false), !tbaa.struct !26
  call void @llvm.lifetime.end.p0(i64 104, ptr %9) #3
  br label %92

92:                                               ; preds = %72, %69
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %93

93:                                               ; preds = %92, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %94

94:                                               ; preds = %93
  %95 = load i64, ptr %6, align 8, !tbaa !20
  %96 = add i64 %95, 1
  store i64 %96, ptr %6, align 8, !tbaa !20
  br label %42, !llvm.loop !29

97:                                               ; preds = %48
  br label %109

98:                                               ; preds = %34
  %99 = load ptr, ptr %4, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.hashset1, ptr %99, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8, !tbaa !21
  %102 = load ptr, ptr %3, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.hashset1, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !21
  %105 = load ptr, ptr %3, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.hashset1, ptr %105, i32 0, i32 1
  %107 = load i64, ptr %106, align 8, !tbaa !9
  %108 = mul i64 120, %107
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %101, ptr align 8 %104, i64 %108, i1 false)
  br label %109

109:                                              ; preds = %98, %97
  %110 = load ptr, ptr %3, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.hashset1, ptr %110, i32 0, i32 2
  %112 = load i64, ptr %111, align 8, !tbaa !31
  %113 = load ptr, ptr %4, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.hashset1, ptr %113, i32 0, i32 2
  store i64 %112, ptr %114, align 8, !tbaa !31
  %115 = load ptr, ptr %3, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.hashset1, ptr %115, i32 0, i32 4
  store i32 0, ptr %116, align 8, !tbaa !17
  %117 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %117, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %118

118:                                              ; preds = %109, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %119 = load ptr, ptr %2, align 8
  ret ptr %119
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"hashset1", !6, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32, !6, i64 40, !6, i64 48}
!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, !13, i64 32}
!18 = !{!19, !6, i64 8}
!19 = !{!"hashset1_fval", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!20 = !{!11, !11, i64 0}
!21 = !{!10, !6, i64 0}
!22 = !{!23, !13, i64 112}
!23 = !{!"hashset1_entry", !24, i64 0, !11, i64 104, !13, i64 112}
!24 = !{!"struct_s", !13, i64 0, !13, i64 4, !6, i64 8, !6, i64 16, !7, i64 24}
!25 = !{!23, !11, i64 104}
!26 = !{i64 0, i64 4, !27, i64 4, i64 4, !27, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 80, !28}
!27 = !{!13, !13, i64 0}
!28 = !{!7, !7, i64 0}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = !{!10, !11, i64 16}


; 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.hashset1_entry = type { %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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

.preheader:                                       ; preds = %15
  %19 = load i64, ptr %3, align 8, !tbaa !5
  %.not38 = icmp eq i64 %19, 0
  br i1 %.not38, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %38
  %20 = phi i64 [ %39, %38 ], [ %19, %.preheader ]
  %.03237 = phi i64 [ %40, %38 ], [ 0, %.preheader ]
  %21 = load ptr, ptr %0, align 8, !tbaa !18
  %22 = getelementptr inbounds %struct.hashset1_entry, ptr %21, i64 %.03237
  %23 = getelementptr inbounds i8, ptr %22, i64 112
  %24 = load i32, ptr %23, align 8, !tbaa !19
  %.not36 = icmp eq i32 %24, 0
  br i1 %.not36, label %38, label %25

25:                                               ; preds = %.lr.ph
  %26 = load ptr, ptr %14, align 8, !tbaa !18
  %27 = getelementptr inbounds %struct.hashset1_entry, ptr %26, i64 %.03237
  %28 = icmp eq i32 %24, -1
  %29 = getelementptr inbounds i8, ptr %27, i64 112
  br i1 %28, label %30, label %31

30:                                               ; preds = %25
  store i32 -1, ptr %29, align 8, !tbaa !19
  br label %38

31:                                               ; preds = %25
  store i32 %24, ptr %29, align 8, !tbaa !19
  %32 = getelementptr inbounds i8, ptr %22, i64 104
  %33 = load i64, ptr %32, align 8, !tbaa !22
  %34 = getelementptr inbounds i8, ptr %27, i64 104
  store i64 %33, ptr %34, align 8, !tbaa !22
  call void @llvm.lifetime.start.p0(i64 104, ptr nonnull %2) #3
  %35 = load ptr, ptr %10, align 8, !tbaa !14
  %36 = getelementptr inbounds i8, ptr %35, i64 8
  %37 = load ptr, ptr %36, align 8, !tbaa !16
  call void %37(ptr dead_on_unwind nonnull writable sret(%struct.struct_s) align 8 %2, ptr noundef nonnull byval(%struct.struct_s) align 8 %22) #3
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %27, ptr noundef nonnull align 8 dereferenceable(104) %2, i64 104, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 104, ptr nonnull %2) #3
  %.pre = load i64, ptr %3, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %30, %31, %.lr.ph
  %39 = phi i64 [ %20, %30 ], [ %.pre, %31 ], [ %20, %.lr.ph ]
  %40 = add nuw i64 %.03237, 1
  %41 = icmp ult i64 %40, %39
  br i1 %41, label %.lr.ph, label %.loopexit, !llvm.loop !27

42:                                               ; preds = %15
  %43 = load ptr, ptr %14, align 8, !tbaa !18
  %44 = load ptr, ptr %0, align 8, !tbaa !18
  %45 = load i64, ptr %3, align 8, !tbaa !5
  %46 = mul i64 %45, 120
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 8 %43, ptr align 8 %44, i64 %46, i1 false)
  br label %.loopexit

.loopexit:                                        ; preds = %38, %.preheader, %42
  %47 = getelementptr inbounds i8, ptr %0, i64 16
  %48 = load i64, ptr %47, align 8, !tbaa !29
  %49 = getelementptr inbounds i8, ptr %14, i64 16
  store i64 %48, ptr %49, align 8, !tbaa !29
  br label %50

50:                                               ; preds = %1, %.loopexit
  %.sink = phi i32 [ 0, %.loopexit ], [ 7, %1 ]
  %51 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %51, align 8, !tbaa !30
  ret ptr %14
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"hashset1", !7, i64 0, !10, i64 8, !10, i64 16, !11, i64 24, !12, i64 32, !7, i64 40, !7, i64 48}
!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 = !{!17, !7, i64 8}
!17 = !{!"hashset1_fval", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!18 = !{!6, !7, i64 0}
!19 = !{!20, !12, i64 112}
!20 = !{!"hashset1_entry", !21, i64 0, !10, i64 104, !12, i64 112}
!21 = !{!"struct_s", !12, i64 0, !12, i64 4, !7, i64 8, !7, i64 16, !8, i64 24}
!22 = !{!20, !10, i64 104}
!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}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!6, !10, i64 16}
!30 = !{!6, !12, i64 32}


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