; LLVM IR from jermp/2i_bench :: external/CRoaring/tests/vendor/cmocka/cmocka.ll (expect_check)

; 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.ListNode = type { ptr, i32, ptr, ptr }
%struct.CheckParameterEvent = type { %struct.SourceLocation, ptr, ptr, i64 }
%struct.SourceLocation = type { ptr, i32 }

@global_function_parameter_map_head = external hidden global %struct.ListNode, align 8

; 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

; Function Attrs: nounwind uwtable
declare hidden void @add_symbol_value(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
define dso_local void @_expect_check(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, i32 noundef %7) #2 {
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca [2 x ptr], align 16
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store ptr %2, ptr %11, align 8, !tbaa !5
  store i32 %3, ptr %12, align 4, !tbaa !9
  store ptr %4, ptr %13, align 8, !tbaa !5
  store i64 %5, ptr %14, align 8, !tbaa !11
  store ptr %6, ptr %15, align 8, !tbaa !5
  store i32 %7, ptr %16, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %19 = load ptr, ptr %15, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %21, label %23

21:                                               ; preds = %8
  %22 = load ptr, ptr %15, align 8, !tbaa !5
  br label %25

23:                                               ; preds = %8
  %24 = call noalias ptr @malloc(i64 noundef 40) #4
  br label %25

25:                                               ; preds = %23, %21
  %26 = phi ptr [ %22, %21 ], [ %24, %23 ]
  store ptr %26, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %18) #3
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %27, ptr %18, align 8, !tbaa !5
  %28 = getelementptr inbounds ptr, ptr %18, i64 1
  %29 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %29, ptr %28, align 8, !tbaa !5
  %30 = load ptr, ptr %10, align 8, !tbaa !5
  %31 = load ptr, ptr %17, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.CheckParameterEvent, ptr %31, i32 0, i32 1
  store ptr %30, ptr %32, align 8, !tbaa !13
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = load ptr, ptr %17, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.CheckParameterEvent, ptr %34, i32 0, i32 2
  store ptr %33, ptr %35, align 8, !tbaa !16
  %36 = load i64, ptr %14, align 8, !tbaa !11
  %37 = load ptr, ptr %17, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.CheckParameterEvent, ptr %37, i32 0, i32 3
  store i64 %36, ptr %38, align 8, !tbaa !17
  %39 = load ptr, ptr %17, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.CheckParameterEvent, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = load i32, ptr %12, align 4, !tbaa !9
  call void @set_source_location(ptr noundef %40, ptr noundef %41, i32 noundef %42)
  %43 = getelementptr inbounds [2 x ptr], ptr %18, i64 0, i64 0
  %44 = load ptr, ptr %17, align 8, !tbaa !5
  %45 = load i32, ptr %16, align 4, !tbaa !9
  call void @add_symbol_value(ptr noundef @global_function_parameter_map_head, ptr noundef %43, i64 noundef 2, ptr noundef %44, i32 noundef %45)
  call void @llvm.lifetime.end.p0(i64 16, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 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 }
attributes #4 = { nounwind allocsize(0) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 16}
!14 = !{!"CheckParameterEvent", !15, i64 0, !6, i64 16, !6, i64 24, !12, i64 32}
!15 = !{!"SourceLocation", !6, i64 0, !10, i64 8}
!16 = !{!14, !6, i64 24}
!17 = !{!14, !12, i64 32}


; 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.ListNode = type { ptr, i32, ptr, ptr }

@global_function_parameter_map_head = external hidden global %struct.ListNode, align 8

; 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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @set_source_location(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @add_symbol_value(ptr noundef, ptr noundef, i64 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @_expect_check(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, i64 noundef %5, ptr noundef %6, i32 noundef %7) local_unnamed_addr #2 {
  %9 = alloca [2 x ptr], align 16
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %10, label %12

10:                                               ; preds = %8
  %11 = tail call noalias dereferenceable_or_null(40) ptr @malloc(i64 noundef 40) #3
  br label %12

12:                                               ; preds = %8, %10
  %13 = phi ptr [ %11, %10 ], [ %6, %8 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %9) #4
  store ptr %0, ptr %9, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %9, i64 8
  store ptr %1, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %13, i64 16
  store ptr %1, ptr %15, align 8, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %13, i64 24
  store ptr %4, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %13, i64 32
  store i64 %5, ptr %17, align 8, !tbaa !15
  tail call void @set_source_location(ptr noundef %13, ptr noundef %2, i32 noundef %3)
  call void @add_symbol_value(ptr noundef nonnull @global_function_parameter_map_head, ptr noundef nonnull %9, i64 noundef 2, ptr noundef %13, i32 noundef %7)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %9) #4
  ret void
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 allocsize(0) }
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, !6, i64 16}
!10 = !{!"CheckParameterEvent", !11, i64 0, !6, i64 16, !6, i64 24, !13, i64 32}
!11 = !{!"SourceLocation", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !13, i64 32}


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