; LLVM IR from openssl/openssl :: test (asynctest)

; 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"

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [59 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  %6 = call i32 @ASYNC_is_capable()
  %7 = icmp ne i32 %6, 0
  br i1 %7, label %11, label %8

8:                                                ; preds = %2
  %9 = load ptr, ptr @stderr, align 8, !tbaa !9
  %10 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef @.str) #3
  br label %37

11:                                               ; preds = %2
  %12 = call i32 @test_ASYNC_init_thread()
  %13 = icmp ne i32 %12, 0
  br i1 %13, label %14, label %35

14:                                               ; preds = %11
  %15 = call i32 @test_ASYNC_callback_status()
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %35

17:                                               ; preds = %14
  %18 = call i32 @test_ASYNC_start_job()
  %19 = icmp ne i32 %18, 0
  br i1 %19, label %20, label %35

20:                                               ; preds = %17
  %21 = call i32 @test_ASYNC_get_current_job()
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %35

23:                                               ; preds = %20
  %24 = call i32 @test_ASYNC_WAIT_CTX_get_all_fds()
  %25 = icmp ne i32 %24, 0
  br i1 %25, label %26, label %35

26:                                               ; preds = %23
  %27 = call i32 @test_ASYNC_block_pause()
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %35

29:                                               ; preds = %26
  %30 = call i32 @test_ASYNC_start_job_ex()
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %35

32:                                               ; preds = %29
  %33 = call i32 @test_ASYNC_set_mem_functions()
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %36, label %35

35:                                               ; preds = %32, %29, %26, %23, %20, %17, %14, %11
  store i32 1, ptr %3, align 4
  br label %39

36:                                               ; preds = %32
  br label %37

37:                                               ; preds = %36, %8
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %3, align 4
  br label %39

39:                                               ; preds = %37, %35
  %40 = load i32, ptr %3, align 4
  ret i32 %40
}

declare i32 @ASYNC_is_capable() #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_init_thread() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_callback_status() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_start_job() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_get_current_job() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_WAIT_CTX_get_all_fds() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_block_pause() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_start_job_ex() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_set_mem_functions() #0

declare i32 @printf(ptr noundef, ...) #1

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 = { "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 }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [59 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call i32 @ASYNC_is_capable() #3
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %4, label %7

4:                                                ; preds = %2
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str) #4
  br label %23

7:                                                ; preds = %2
  %8 = tail call i32 @test_ASYNC_init_thread()
  %.not1 = icmp eq i32 %8, 0
  br i1 %.not1, label %25, label %9

9:                                                ; preds = %7
  %10 = tail call i32 @test_ASYNC_callback_status()
  %.not2 = icmp eq i32 %10, 0
  br i1 %.not2, label %25, label %11

11:                                               ; preds = %9
  %12 = tail call i32 @test_ASYNC_start_job()
  %.not3 = icmp eq i32 %12, 0
  br i1 %.not3, label %25, label %13

13:                                               ; preds = %11
  %14 = tail call i32 @test_ASYNC_get_current_job()
  %.not4 = icmp eq i32 %14, 0
  br i1 %.not4, label %25, label %15

15:                                               ; preds = %13
  %16 = tail call i32 @test_ASYNC_WAIT_CTX_get_all_fds()
  %.not5 = icmp eq i32 %16, 0
  br i1 %.not5, label %25, label %17

17:                                               ; preds = %15
  %18 = tail call i32 @test_ASYNC_block_pause()
  %.not6 = icmp eq i32 %18, 0
  br i1 %.not6, label %25, label %19

19:                                               ; preds = %17
  %20 = tail call i32 @test_ASYNC_start_job_ex()
  %.not7 = icmp eq i32 %20, 0
  br i1 %.not7, label %25, label %21

21:                                               ; preds = %19
  %22 = tail call i32 @test_ASYNC_set_mem_functions()
  %.not8 = icmp eq i32 %22, 0
  br i1 %.not8, label %25, label %23

23:                                               ; preds = %21, %4
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %25

25:                                               ; preds = %7, %9, %11, %13, %15, %17, %19, %21, %23
  %.0 = phi i32 [ 0, %23 ], [ 1, %21 ], [ 1, %19 ], [ 1, %17 ], [ 1, %15 ], [ 1, %13 ], [ 1, %11 ], [ 1, %9 ], [ 1, %7 ]
  ret i32 %.0
}

declare i32 @ASYNC_is_capable() local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_init_thread() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_callback_status() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_start_job() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_get_current_job() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_WAIT_CTX_get_all_fds() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_block_pause() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_start_job_ex() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @test_ASYNC_set_mem_functions() local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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 = { "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 = { nofree 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 }
attributes #4 = { cold 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"}


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