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

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

@global_function_parameter_map_head = external hidden global %struct.ListNode, align 8
@global_last_parameter_location = external hidden global %struct.SourceLocation, align 8
@.str.6 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @cm_print_error(ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
declare hidden void @exit_test(i32 noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_symbol_value(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #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) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @source_location_is_set(ptr noundef) #0

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

23:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %24 = load ptr, ptr %11, align 8, !tbaa !5
  store ptr %24, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  %25 = load ptr, ptr %14, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.CheckParameterEvent, ptr %25, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @global_last_parameter_location, ptr align 8 %26, i64 16, i1 false), !tbaa.struct !13
  %27 = load ptr, ptr %14, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.CheckParameterEvent, ptr %27, i32 0, i32 2
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = load i64, ptr %10, align 8, !tbaa !11
  %31 = load ptr, ptr %14, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.CheckParameterEvent, ptr %31, i32 0, i32 3
  %33 = load i64, ptr %32, align 8, !tbaa !17
  %34 = call i32 %29(i64 noundef %30, i64 noundef %33)
  store i32 %34, ptr %15, align 4, !tbaa !9
  %35 = load i32, ptr %13, align 4, !tbaa !9
  %36 = icmp eq i32 %35, 1
  br i1 %36, label %37, label %39

37:                                               ; preds = %23
  %38 = load ptr, ptr %14, align 8, !tbaa !5
  call void @free(ptr noundef %38) #4
  br label %39

39:                                               ; preds = %37, %23
  %40 = load i32, ptr %15, align 4, !tbaa !9
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %51, label %42

42:                                               ; preds = %39
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = load ptr, ptr @global_last_parameter_location, align 8, !tbaa !18
  %48 = load i32, ptr getelementptr inbounds (%struct.SourceLocation, ptr @global_last_parameter_location, i32 0, i32 1), align 8, !tbaa !19
  call void (ptr, ...) @cm_print_error(ptr noundef @.str.6, ptr noundef %43, i32 noundef %44, ptr noundef %45, ptr noundef %46, ptr noundef %47, i32 noundef %48)
  %49 = load ptr, ptr %8, align 8, !tbaa !5
  %50 = load i32, ptr %9, align 4, !tbaa !9
  call void @_fail(ptr noundef %49, i32 noundef %50)
  br label %51

51:                                               ; preds = %42, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %64

52:                                               ; preds = %5
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !9
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ...) @cm_print_error(ptr noundef @.str.7, ptr noundef %53, i32 noundef %54, ptr noundef %55, ptr noundef %56)
  %57 = call i32 @source_location_is_set(ptr noundef @global_last_parameter_location)
  %58 = icmp ne i32 %57, 0
  br i1 %58, label %59, label %62

59:                                               ; preds = %52
  %60 = load ptr, ptr @global_last_parameter_location, align 8, !tbaa !18
  %61 = load i32, ptr getelementptr inbounds (%struct.SourceLocation, ptr @global_last_parameter_location, i32 0, i32 1), align 8, !tbaa !19
  call void (ptr, ...) @cm_print_error(ptr noundef @.str.8, ptr noundef %60, i32 noundef %61)
  br label %63

62:                                               ; preds = %52
  call void (ptr, ...) @cm_print_error(ptr noundef @.str.9)
  br label %63

63:                                               ; preds = %62, %59
  call void @exit_test(i32 noundef 1)
  br label %64

64:                                               ; preds = %63, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @_fail(ptr noundef, i32 noundef) #0

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind "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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{i64 0, i64 8, !5, i64 8, i64 4, !9}
!14 = !{!15, !6, i64 24}
!15 = !{!"CheckParameterEvent", !16, i64 0, !6, i64 16, !6, i64 24, !12, i64 32}
!16 = !{!"SourceLocation", !6, i64 0, !10, i64 8}
!17 = !{!15, !12, i64 32}
!18 = !{!16, !6, i64 0}
!19 = !{!16, !10, i64 8}


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

@global_function_parameter_map_head = external hidden global %struct.ListNode, align 8
@global_last_parameter_location = external hidden global %struct.SourceLocation, align 8
@.str.6 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [67 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @cm_print_error(ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @exit_test(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden i32 @get_symbol_value(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #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) #2

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
define dso_local void @_check_expected(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, i64 noundef %4) local_unnamed_addr #0 {
  %6 = alloca ptr, align 8
  %7 = alloca [2 x ptr], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #4
  store ptr %0, ptr %7, align 16, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  store ptr %1, ptr %8, align 8, !tbaa !5
  %9 = call i32 @get_symbol_value(ptr noundef nonnull @global_function_parameter_map_head, ptr noundef nonnull %7, i64 noundef 2, ptr noundef nonnull %6)
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %23, label %10

10:                                               ; preds = %5
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) @global_last_parameter_location, ptr noundef nonnull align 8 dereferenceable(16) %11, i64 16, i1 false), !tbaa.struct !9
  %12 = getelementptr inbounds i8, ptr %11, i64 24
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  %14 = getelementptr inbounds i8, ptr %11, i64 32
  %15 = load i64, ptr %14, align 8, !tbaa !16
  %16 = call i32 %13(i64 noundef %4, i64 noundef %15) #4
  %17 = icmp eq i32 %9, 1
  br i1 %17, label %18, label %19

18:                                               ; preds = %10
  call void @free(ptr noundef nonnull %11) #4
  br label %19

19:                                               ; preds = %18, %10
  %.not20 = icmp eq i32 %16, 0
  br i1 %.not20, label %20, label %30

20:                                               ; preds = %19
  %21 = load ptr, ptr @global_last_parameter_location, align 8, !tbaa !17
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @global_last_parameter_location, i64 8), align 8, !tbaa !18
  call void (ptr, ...) @cm_print_error(ptr noundef nonnull @.str.6, ptr noundef %2, i32 noundef %3, ptr noundef %1, ptr noundef %0, ptr noundef %21, i32 noundef %22)
  call void @_fail(ptr noundef %2, i32 noundef %3)
  br label %30

23:                                               ; preds = %5
  call void (ptr, ...) @cm_print_error(ptr noundef nonnull @.str.7, ptr noundef %2, i32 noundef %3, ptr noundef %1, ptr noundef %0)
  %24 = call i32 @source_location_is_set(ptr noundef nonnull @global_last_parameter_location)
  %.not19 = icmp eq i32 %24, 0
  br i1 %.not19, label %28, label %25

25:                                               ; preds = %23
  %26 = load ptr, ptr @global_last_parameter_location, align 8, !tbaa !17
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @global_last_parameter_location, i64 8), align 8, !tbaa !18
  call void (ptr, ...) @cm_print_error(ptr noundef nonnull @.str.8, ptr noundef %26, i32 noundef %27)
  br label %29

28:                                               ; preds = %23
  call void (ptr, ...) @cm_print_error(ptr noundef nonnull @.str.9)
  br label %29

29:                                               ; preds = %28, %25
  call void @exit_test(i32 noundef 1)
  br label %30

30:                                               ; preds = %19, %20, %29
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #4
  ret void
}

; Function Attrs: nounwind uwtable
declare dso_local void @_fail(ptr noundef, i32 noundef) local_unnamed_addr #0

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #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 = !{i64 0, i64 8, !5, i64 8, i64 4, !10}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 24}
!13 = !{!"CheckParameterEvent", !14, i64 0, !6, i64 16, !6, i64 24, !15, i64 32}
!14 = !{!"SourceLocation", !6, i64 0, !11, i64 8}
!15 = !{!"long", !7, i64 0}
!16 = !{!13, !15, i64 32}
!17 = !{!14, !6, i64 0}
!18 = !{!14, !11, i64 8}


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