; 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.hashbidimap0 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap0_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap0_entry = type { ptr, ptr, [2 x i64], [2 x ptr] }
%struct.hashbidimap0_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 @hbm0_new_custom(i64 noundef, double noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_new_entry(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_key(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_val(ptr noundef, ptr noundef) #1

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

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

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

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

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

46:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.hashbidimap0, ptr %47, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8, !tbaa !20
  %50 = load i64, ptr %6, align 8, !tbaa !19
  %51 = getelementptr inbounds [2 x ptr], ptr %49, i64 %50
  %52 = getelementptr inbounds [2 x ptr], ptr %51, i64 0, i64 0
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  store ptr %53, ptr %7, align 8, !tbaa !5
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %116

56:                                               ; preds = %46
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = icmp ne ptr %57, inttoptr (i64 1 to ptr)
  br i1 %58, label %59, label %116

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

66:                                               ; preds = %59
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.hashbidimap0, ptr %67, i32 0, i32 5
  %69 = load ptr, ptr %68, align 8, !tbaa !15
  %70 = getelementptr inbounds %struct.hashbidimap0_fkey, ptr %69, i32 0, i32 1
  %71 = load ptr, ptr %70, align 8, !tbaa !21
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %72, i32 0, i32 0
  %74 = load ptr, ptr %73, align 8, !tbaa !23
  %75 = call ptr %71(ptr noundef %74)
  store ptr %75, ptr %8, align 8, !tbaa !5
  br label %80

76:                                               ; preds = %59
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %77, i32 0, i32 0
  %79 = load ptr, ptr %78, align 8, !tbaa !23
  store ptr %79, ptr %8, align 8, !tbaa !5
  br label %80

80:                                               ; preds = %76, %66
  %81 = load ptr, ptr %3, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.hashbidimap0, ptr %81, i32 0, i32 6
  %83 = load ptr, ptr %82, align 8, !tbaa !16
  %84 = getelementptr inbounds %struct.hashbidimap0_fval, ptr %83, i32 0, i32 1
  %85 = load ptr, ptr %84, align 8, !tbaa !25
  %86 = icmp ne ptr %85, null
  br i1 %86, label %87, label %97

87:                                               ; preds = %80
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.hashbidimap0, ptr %88, i32 0, i32 6
  %90 = load ptr, ptr %89, align 8, !tbaa !16
  %91 = getelementptr inbounds %struct.hashbidimap0_fval, ptr %90, i32 0, i32 1
  %92 = load ptr, ptr %91, align 8, !tbaa !25
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %93, i32 0, i32 1
  %95 = load ptr, ptr %94, align 8, !tbaa !27
  %96 = call ptr %92(ptr noundef %95)
  store ptr %96, ptr %9, align 8, !tbaa !5
  br label %101

97:                                               ; preds = %80
  %98 = load ptr, ptr %7, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.hashbidimap0_entry, ptr %98, i32 0, i32 1
  %100 = load ptr, ptr %99, align 8, !tbaa !27
  store ptr %100, ptr %9, align 8, !tbaa !5
  br label %101

101:                                              ; preds = %97, %87
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %102 = load ptr, ptr %4, align 8, !tbaa !5
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = call ptr @hbm0_impl_new_entry(ptr noundef %102, ptr noundef %103, ptr noundef %104)
  store ptr %105, ptr %10, align 8, !tbaa !5
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = load ptr, ptr %10, align 8, !tbaa !5
  %108 = call ptr @hbm0_impl_add_entry_to_key(ptr noundef %106, ptr noundef %107)
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = load ptr, ptr %10, align 8, !tbaa !5
  %111 = call ptr @hbm0_impl_add_entry_to_val(ptr noundef %109, ptr noundef %110)
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.hashbidimap0, ptr %112, i32 0, i32 2
  %114 = load i64, ptr %113, align 8, !tbaa !28
  %115 = add i64 %114, 1
  store i64 %115, ptr %113, align 8, !tbaa !28
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  br label %116

116:                                              ; preds = %101, %56, %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  br label %117

117:                                              ; preds = %116
  %118 = load i64, ptr %6, align 8, !tbaa !19
  %119 = add i64 %118, 1
  store i64 %119, ptr %6, align 8, !tbaa !19
  br label %39, !llvm.loop !29

120:                                              ; preds = %45
  %121 = load ptr, ptr %3, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.hashbidimap0, ptr %121, i32 0, i32 4
  store i32 0, ptr %122, align 8, !tbaa !18
  %123 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %123, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %124

124:                                              ; preds = %120, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #2
  %125 = load ptr, ptr %2, align 8
  ret ptr %125
}

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 = !{!"hashbidimap0", !6, i64 0, !11, i64 8, !11, i64 16, !12, i64 24, !13, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!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 = !{!"hashbidimap0_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 = !{!"hashbidimap0_entry", !6, i64 0, !6, i64 8, !7, i64 16, !7, i64 32}
!25 = !{!26, !6, i64 8}
!26 = !{!"hashbidimap0_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 = !{!10, !11, i64 16}
!29 = distinct !{!29, !30}
!30 = !{!"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"

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_new_entry(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_key(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm0_impl_add_entry_to_val(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @hbm0_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 @hbm0_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_edge, 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_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %17 = getelementptr inbounds i8, ptr %15, i64 16
  br label %18

18:                                               ; preds = %.lr.ph, %44
  %19 = phi i64 [ %16, %.lr.ph ], [ %45, %44 ]
  %.03643 = phi i64 [ 0, %.lr.ph ], [ %46, %44 ]
  %20 = load ptr, ptr %0, align 8, !tbaa !17
  %21 = getelementptr inbounds [2 x ptr], ptr %20, i64 %.03643
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %switch = icmp ult ptr %22, inttoptr (i64 2 to ptr)
  br i1 %switch, label %44, label %23

23:                                               ; preds = %18
  %24 = load ptr, ptr %9, align 8, !tbaa !14
  %25 = getelementptr inbounds i8, ptr %24, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !19
  %.not41 = icmp eq ptr %26, null
  %27 = load ptr, ptr %22, align 8, !tbaa !21
  br i1 %.not41, label %30, label %28

28:                                               ; preds = %23
  %29 = tail call ptr %26(ptr noundef %27) #1
  br label %30

30:                                               ; preds = %23, %28
  %.035 = phi ptr [ %29, %28 ], [ %27, %23 ]
  %31 = load ptr, ptr %11, align 8, !tbaa !15
  %32 = getelementptr inbounds i8, ptr %31, i64 8
  %33 = load ptr, ptr %32, align 8, !tbaa !23
  %.not42 = icmp eq ptr %33, null
  %34 = getelementptr inbounds i8, ptr %22, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !25
  br i1 %.not42, label %38, label %36

36:                                               ; preds = %30
  %37 = tail call ptr %33(ptr noundef %35) #1
  br label %38

38:                                               ; preds = %30, %36
  %.034 = phi ptr [ %37, %36 ], [ %35, %30 ]
  %39 = tail call ptr @hbm0_impl_new_entry(ptr noundef nonnull %15, ptr noundef %.035, ptr noundef %.034)
  %40 = tail call ptr @hbm0_impl_add_entry_to_key(ptr noundef nonnull %15, ptr noundef %39)
  %41 = tail call ptr @hbm0_impl_add_entry_to_val(ptr noundef nonnull %15, ptr noundef %39)
  %42 = load i64, ptr %17, align 8, !tbaa !26
  %43 = add i64 %42, 1
  store i64 %43, ptr %17, align 8, !tbaa !26
  %.pre = load i64, ptr %2, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %18, %38
  %45 = phi i64 [ %19, %18 ], [ %.pre, %38 ]
  %46 = add nuw i64 %.03643, 1
  %47 = icmp ult i64 %46, %45
  br i1 %47, label %18, label %._crit_edge, !llvm.loop !27

._crit_edge:                                      ; preds = %44, %.preheader, %1
  %.sink = phi i32 [ 7, %1 ], [ 0, %.preheader ], [ 0, %44 ]
  %48 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %48, 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 = !{!"hashbidimap0", !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, i64 64, !7, i64 72}
!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 = !{!"hashbidimap0_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 = !{!"hashbidimap0_entry", !7, i64 0, !7, i64 8, !8, i64 16, !8, i64 32}
!23 = !{!24, !7, i64 8}
!24 = !{!"hashbidimap0_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 = !{!6, !10, i64 16}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!6, !12, i64 32}


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