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

; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@cm_error_message_enabled = external hidden global i32, align 4
@exception_signals = external hidden constant [5 x i32], align 16
@default_signal_functions = external hidden global [5 x ptr], align 16
@.str.26 = external hidden unnamed_addr constant [17 x i8], align 1
@global_running_test = external hidden global i32, align 4
@global_run_test_env = external hidden global [1 x %struct.__jmp_buf_tag], align 16
@.str.27 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1

; 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 void @print_message(ptr noundef, ...) #1

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

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

19:                                               ; preds = %5
  %20 = load ptr, ptr %10, align 8, !tbaa !5
  br label %23

21:                                               ; preds = %5
  %22 = call ptr @check_point_allocated_blocks()
  br label %23

23:                                               ; preds = %21, %19
  %24 = phi ptr [ %20, %19 ], [ %22, %21 ]
  store volatile ptr %24, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store volatile i32 1, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !9
  store i32 0, ptr @cm_error_message_enabled, align 4, !tbaa !9
  %25 = load i32, ptr %14, align 4, !tbaa !9
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %27, label %45

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #4
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %28

28:                                               ; preds = %41, %27
  %29 = load i32, ptr %15, align 4, !tbaa !9
  %30 = zext i32 %29 to i64
  %31 = icmp ult i64 %30, 5
  br i1 %31, label %32, label %44

32:                                               ; preds = %28
  %33 = load i32, ptr %15, align 4, !tbaa !9
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [5 x i32], ptr @exception_signals, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = call ptr @signal(i32 noundef %36, ptr noundef @exception_handler) #4
  %38 = load i32, ptr %15, align 4, !tbaa !9
  %39 = zext i32 %38 to i64
  %40 = getelementptr inbounds [5 x ptr], ptr @default_signal_functions, i64 0, i64 %39
  store ptr %37, ptr %40, align 8, !tbaa !5
  br label %41

41:                                               ; preds = %32
  %42 = load i32, ptr %15, align 4, !tbaa !9
  %43 = add i32 %42, 1
  store i32 %43, ptr %15, align 4, !tbaa !9
  br label %28, !llvm.loop !11

44:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  br label %45

45:                                               ; preds = %44, %23
  %46 = load i32, ptr %9, align 4, !tbaa !9
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %50

48:                                               ; preds = %45
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ...) @print_message(ptr noundef @.str.26, ptr noundef %49)
  br label %50

50:                                               ; preds = %48, %45
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  call void @initialize_testing(ptr noundef %51)
  store i32 1, ptr @global_running_test, align 4, !tbaa !9
  %52 = call i32 @_setjmp(ptr noundef @global_run_test_env) #5
  %53 = icmp eq i32 %52, 0
  br i1 %53, label %54, label %75

54:                                               ; preds = %50
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load volatile ptr, ptr %8, align 8, !tbaa !5
  %57 = icmp ne ptr %56, null
  br i1 %57, label %58, label %60

58:                                               ; preds = %54
  %59 = load volatile ptr, ptr %8, align 8, !tbaa !5
  br label %61

60:                                               ; preds = %54
  br label %61

61:                                               ; preds = %60, %58
  %62 = phi ptr [ %59, %58 ], [ %12, %60 ]
  call void %55(ptr noundef %62)
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  call void @fail_if_leftover_values(ptr noundef %63)
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 1
  br i1 %65, label %66, label %69

66:                                               ; preds = %61
  %67 = load volatile ptr, ptr %11, align 8, !tbaa !5
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  call void @fail_if_blocks_allocated(ptr noundef %67, ptr noundef %68)
  br label %69

69:                                               ; preds = %66, %61
  store i32 0, ptr @global_running_test, align 4, !tbaa !9
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %69
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ...) @print_message(ptr noundef @.str.27, ptr noundef %73)
  br label %74

74:                                               ; preds = %72, %69
  store volatile i32 0, ptr %13, align 4, !tbaa !9
  br label %77

75:                                               ; preds = %50
  store i32 0, ptr @global_running_test, align 4, !tbaa !9
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ...) @print_message(ptr noundef @.str.28, ptr noundef %76)
  br label %77

77:                                               ; preds = %75, %74
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  call void @teardown_testing(ptr noundef %78)
  %79 = load i32, ptr %14, align 4, !tbaa !9
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %100

81:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #4
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %96, %81
  %83 = load i32, ptr %16, align 4, !tbaa !9
  %84 = zext i32 %83 to i64
  %85 = icmp ult i64 %84, 5
  br i1 %85, label %86, label %99

86:                                               ; preds = %82
  %87 = load i32, ptr %16, align 4, !tbaa !9
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds [5 x i32], ptr @exception_signals, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !9
  %91 = load i32, ptr %16, align 4, !tbaa !9
  %92 = zext i32 %91 to i64
  %93 = getelementptr inbounds [5 x ptr], ptr @default_signal_functions, i64 0, i64 %92
  %94 = load ptr, ptr %93, align 8, !tbaa !5
  %95 = call ptr @signal(i32 noundef %90, ptr noundef %94) #4
  br label %96

96:                                               ; preds = %86
  %97 = load i32, ptr %16, align 4, !tbaa !9
  %98 = add i32 %97, 1
  store i32 %98, ptr %16, align 4, !tbaa !9
  br label %82, !llvm.loop !13

99:                                               ; preds = %82
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %100

100:                                              ; preds = %99, %77
  %101 = load volatile i32, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret i32 %101
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @exception_handler(i32 noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @initialize_testing(ptr noundef) #1

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @fail_if_leftover_values(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @teardown_testing(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @check_point_allocated_blocks() #1

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 "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 returns_twice "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 }
attributes #5 = { nounwind returns_twice }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; 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.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@cm_error_message_enabled = external hidden local_unnamed_addr global i32, align 4
@exception_signals = external hidden local_unnamed_addr constant [5 x i32], align 16
@default_signal_functions = external hidden local_unnamed_addr global [5 x ptr], align 16
@.str.26 = external hidden unnamed_addr constant [17 x i8], align 1
@global_running_test = external hidden local_unnamed_addr global i32, align 4
@global_run_test_env = external hidden global [1 x %struct.__jmp_buf_tag], align 16
@.str.27 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [17 x i8], align 1

; 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: nounwind uwtable
declare dso_local void @print_message(ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @_run_test(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store volatile ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %10, label %12

10:                                               ; preds = %5
  %11 = call ptr @check_point_allocated_blocks()
  br label %12

12:                                               ; preds = %5, %10
  %13 = phi ptr [ %11, %10 ], [ %4, %5 ]
  store volatile ptr %13, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #4
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9)
  store volatile i32 1, ptr %9, align 4, !tbaa !9
  store i32 0, ptr @cm_error_message_enabled, align 4, !tbaa !9
  %14 = load i32, ptr @exception_signals, align 16, !tbaa !9
  %15 = call ptr @signal(i32 noundef %14, ptr noundef nonnull @exception_handler) #4
  store ptr %15, ptr @default_signal_functions, align 16, !tbaa !5
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @exception_signals, i64 4), align 4, !tbaa !9
  %17 = call ptr @signal(i32 noundef %16, ptr noundef nonnull @exception_handler) #4
  store ptr %17, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 8), align 8, !tbaa !5
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @exception_signals, i64 8), align 8, !tbaa !9
  %19 = call ptr @signal(i32 noundef %18, ptr noundef nonnull @exception_handler) #4
  store ptr %19, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 16), align 16, !tbaa !5
  %20 = load i32, ptr getelementptr inbounds (i8, ptr @exception_signals, i64 12), align 4, !tbaa !9
  %21 = call ptr @signal(i32 noundef %20, ptr noundef nonnull @exception_handler) #4
  store ptr %21, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 24), align 8, !tbaa !5
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @exception_signals, i64 16), align 16, !tbaa !9
  %23 = call ptr @signal(i32 noundef %22, ptr noundef nonnull @exception_handler) #4
  store ptr %23, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 32), align 16, !tbaa !5
  %24 = icmp eq i32 %3, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %12
  call void (ptr, ...) @print_message(ptr noundef nonnull @.str.26, ptr noundef %0)
  br label %26

26:                                               ; preds = %25, %12
  call void @initialize_testing(ptr noundef %0)
  store i32 1, ptr @global_running_test, align 4, !tbaa !9
  %27 = call i32 @_setjmp(ptr noundef nonnull @global_run_test_env) #5
  %28 = icmp eq i32 %27, 0
  br i1 %28, label %29, label %36

29:                                               ; preds = %26
  %.0..0..0..0.16 = load volatile ptr, ptr %6, align 8, !tbaa !5
  %.not30 = icmp eq ptr %.0..0..0..0.16, null
  br i1 %.not30, label %31, label %30

30:                                               ; preds = %29
  %.0..0..0..0.17 = load volatile ptr, ptr %6, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %29, %30
  %32 = phi ptr [ %.0..0..0..0.17, %30 ], [ %8, %29 ]
  call void %1(ptr noundef %32) #4
  call void @fail_if_leftover_values(ptr noundef %0)
  %.not31 = icmp eq i32 %3, 1
  br i1 %.not31, label %.thread, label %33

.thread:                                          ; preds = %31
  store i32 0, ptr @global_running_test, align 4, !tbaa !9
  br label %35

33:                                               ; preds = %31
  %.0..0..0..0.10 = load volatile ptr, ptr %7, align 8, !tbaa !5
  call void @fail_if_blocks_allocated(ptr noundef %.0..0..0..0.10, ptr noundef %0)
  store i32 0, ptr @global_running_test, align 4, !tbaa !9
  br i1 %24, label %34, label %35

34:                                               ; preds = %33
  call void (ptr, ...) @print_message(ptr noundef nonnull @.str.27, ptr noundef %0)
  br label %35

35:                                               ; preds = %.thread, %34, %33
  store volatile i32 0, ptr %9, align 4, !tbaa !9
  br label %37

36:                                               ; preds = %26
  store i32 0, ptr @global_running_test, align 4, !tbaa !9
  call void (ptr, ...) @print_message(ptr noundef nonnull @.str.28, ptr noundef %0)
  br label %37

37:                                               ; preds = %36, %35
  call void @teardown_testing(ptr noundef %0)
  %38 = load ptr, ptr @default_signal_functions, align 16, !tbaa !5
  %39 = call ptr @signal(i32 noundef %14, ptr noundef %38) #4
  %40 = load ptr, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 8), align 8, !tbaa !5
  %41 = call ptr @signal(i32 noundef %16, ptr noundef %40) #4
  %42 = load ptr, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 16), align 16, !tbaa !5
  %43 = call ptr @signal(i32 noundef %18, ptr noundef %42) #4
  %44 = load ptr, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 24), align 8, !tbaa !5
  %45 = call ptr @signal(i32 noundef %20, ptr noundef %44) #4
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @default_signal_functions, i64 32), align 16, !tbaa !5
  %47 = call ptr @signal(i32 noundef %22, ptr noundef %46) #4
  %.0..0..0..0. = load volatile i32, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7)
  ret i32 %.0..0..0..0.
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden void @exception_handler(i32 noundef) #1

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

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #3

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @check_point_allocated_blocks() local_unnamed_addr #1

attributes #0 = { mustprogress 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 "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 returns_twice "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 }
attributes #5 = { nounwind returns_twice }

!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}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass