; 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.hashbidimap1 = type { ptr, i64, i64, double, i32, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap1_fkey = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.hashbidimap1_entry = type { %struct.struct_s, %struct.struct_s, [2 x i64], [2 x 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: 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 hidden ptr @hbm1_impl_get_entry_by_key(ptr noundef, ptr noundef byval(%struct.struct_s) align 8) #2

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

; Function Attrs: nounwind uwtable
declare hidden ptr @hbm1_impl_add_entry_to_key(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @hbm1_update_key(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2) #2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.struct_s, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call zeroext i1 @hbm1_empty(ptr noundef %11)
  br i1 %12, label %13, label %16

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

16:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call ptr @hbm1_impl_get_entry_by_val(ptr noundef %17, ptr noundef byval(%struct.struct_s) align 8 %1)
  store ptr %18, ptr %7, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %24, label %21

21:                                               ; preds = %16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.hashbidimap1, ptr %22, i32 0, i32 4
  store i32 3, ptr %23, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %8, align 4
  br label %83

24:                                               ; preds = %16
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.hashbidimap1, ptr %25, i32 0, i32 5
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  %28 = getelementptr inbounds %struct.hashbidimap1_fkey, ptr %27, i32 0, i32 0
  %29 = load ptr, ptr %28, align 8, !tbaa !15
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %31, i32 0, i32 0
  %33 = call i32 %29(ptr noundef byval(%struct.struct_s) align 8 %2, ptr noundef byval(%struct.struct_s) align 8 %32)
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %24
  br label %80

36:                                               ; preds = %24
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = call ptr @hbm1_impl_get_entry_by_key(ptr noundef %37, ptr noundef byval(%struct.struct_s) align 8 %2)
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %43

40:                                               ; preds = %36
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.hashbidimap1, ptr %41, i32 0, i32 4
  store i32 6, ptr %42, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %8, align 4
  br label %83

43:                                               ; preds = %36
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %45, i32 0, i32 3
  %47 = getelementptr inbounds [2 x ptr], ptr %46, i64 0, i64 0
  %48 = load ptr, ptr %47, align 8, !tbaa !5
  store ptr %48, ptr %6, align 8, !tbaa !5
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %51, label %57

51:                                               ; preds = %43
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = icmp ne ptr %53, %55
  br i1 %56, label %57, label %60

57:                                               ; preds = %51, %43
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.hashbidimap1, ptr %58, i32 0, i32 4
  store i32 7, ptr %59, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %8, align 4
  br label %83

60:                                               ; preds = %51
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = load ptr, ptr %61, align 8, !tbaa !5
  store ptr %62, ptr %9, align 8, !tbaa !5
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %63, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 %64, i64 104, i1 false), !tbaa.struct !17
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %65, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %66, ptr align 8 %2, i64 104, i1 false), !tbaa.struct !17
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr inttoptr (i64 1 to ptr), ptr %67, align 8, !tbaa !5
  %68 = load ptr, ptr %5, align 8, !tbaa !5
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = call ptr @hbm1_impl_add_entry_to_key(ptr noundef %68, ptr noundef %69)
  %71 = icmp ne ptr %70, null
  br i1 %71, label %79, label %72

72:                                               ; preds = %60
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.hashbidimap1_entry, ptr %73, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %74, ptr align 8 %10, i64 104, i1 false), !tbaa.struct !17
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %75, ptr %76, align 8, !tbaa !5
  %77 = load ptr, ptr %5, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.hashbidimap1, ptr %77, i32 0, i32 4
  store i32 7, ptr %78, align 8, !tbaa !9
  store i1 false, ptr %4, align 1
  store i32 1, ptr %8, align 4
  br label %83

79:                                               ; preds = %60
  br label %80

80:                                               ; preds = %79, %35
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.hashbidimap1, ptr %81, i32 0, i32 4
  store i32 0, ptr %82, align 8, !tbaa !9
  store i1 true, ptr %4, align 1
  store i32 1, ptr %8, align 4
  br label %83

83:                                               ; preds = %80, %72, %57, %40, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %84

84:                                               ; preds = %83, %13
  %85 = load i1, ptr %4, align 1
  ret i1 %85
}

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

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, !13, i64 32}
!10 = !{!"hashbidimap1", !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, !6, i64 40}
!15 = !{!16, !6, i64 0}
!16 = !{!"hashbidimap1_fkey", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 80, !19}
!18 = !{!13, !13, i64 0}
!19 = !{!7, !7, i64 0}


; 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: 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) #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @hbm1_update_key(ptr noundef %0, ptr noundef byval(%struct.struct_s) align 8 %1, ptr noundef byval(%struct.struct_s) align 8 %2) local_unnamed_addr #1 {
  %4 = alloca %struct.struct_s, align 8
  %5 = tail call zeroext i1 @hbm1_empty(ptr noundef %0)
  br i1 %5, label %26, label %6

6:                                                ; preds = %3
  %7 = tail call ptr @hbm1_impl_get_entry_by_val(ptr noundef %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %1)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %26, label %8

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = load ptr, ptr %7, align 8, !tbaa !15
  %13 = tail call i32 %11(ptr noundef nonnull byval(%struct.struct_s) align 8 %2, ptr noundef byval(%struct.struct_s) align 8 %12) #2
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %26, label %15

15:                                               ; preds = %8
  %16 = tail call ptr @hbm1_impl_get_entry_by_key(ptr noundef nonnull %0, ptr noundef nonnull byval(%struct.struct_s) align 8 %2)
  %.not29 = icmp eq ptr %16, null
  br i1 %.not29, label %17, label %26

17:                                               ; preds = %15
  %18 = load ptr, ptr %7, align 8, !tbaa !15
  %19 = getelementptr inbounds i8, ptr %18, i64 224
  %20 = load ptr, ptr %19, align 8, !tbaa !15
  %.not30 = icmp eq ptr %20, null
  br i1 %.not30, label %26, label %21

21:                                               ; preds = %17
  %22 = load ptr, ptr %20, align 8, !tbaa !15
  %.not31 = icmp eq ptr %22, %18
  br i1 %.not31, label %23, label %26

23:                                               ; preds = %21
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %4, ptr noundef nonnull align 8 dereferenceable(104) %22, i64 104, i1 false), !tbaa.struct !16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %22, ptr noundef nonnull align 8 dereferenceable(104) %2, i64 104, i1 false), !tbaa.struct !16
  store ptr inttoptr (i64 1 to ptr), ptr %20, align 8, !tbaa !15
  %24 = tail call ptr @hbm1_impl_add_entry_to_key(ptr noundef nonnull %0, ptr noundef %22)
  %.not32 = icmp eq ptr %24, null
  br i1 %.not32, label %25, label %26

25:                                               ; preds = %23
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(104) %22, ptr noundef nonnull align 8 dereferenceable(104) %4, i64 104, i1 false), !tbaa.struct !16
  store ptr %22, ptr %20, align 8, !tbaa !15
  br label %26

26:                                               ; preds = %8, %23, %17, %21, %15, %6, %3, %25
  %.sink = phi i32 [ 7, %25 ], [ 2, %3 ], [ 3, %6 ], [ 6, %15 ], [ 7, %21 ], [ 7, %17 ], [ 0, %23 ], [ 0, %8 ]
  %.1 = phi i1 [ false, %25 ], [ false, %3 ], [ false, %6 ], [ false, %15 ], [ false, %21 ], [ false, %17 ], [ true, %23 ], [ true, %8 ]
  %27 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 %.sink, ptr %27, align 8, !tbaa !19
  ret i1 %.1
}

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

attributes #0 = { mustprogress nocallback nofree 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, !7, i64 40}
!6 = !{!"hashbidimap1", !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 = !{!14, !7, i64 0}
!14 = !{!"hashbidimap1_fkey", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!15 = !{!7, !7, i64 0}
!16 = !{i64 0, i64 4, !17, i64 4, i64 4, !17, i64 8, i64 8, !15, i64 16, i64 8, !15, i64 24, i64 80, !18}
!17 = !{!12, !12, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!6, !12, i64 32}


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