; LLVM IR from aws/s2n-tls :: tests/fuzz (s2n_cert_req_recv_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"

@s2n_use_color_in_output = external dso_local global i8, align 1
@s2n_errno = external thread_local global i32, align 4
@stderr = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [101 x i8], align 1
@test_count = external dso_local global i32, align 4
@.str.9 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_fuzz_test(ptr noundef, i64 noundef) #1

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

declare i32 @s2n_print_stacktrace(ptr noundef) #4

; Function Attrs: nounwind
declare i32 @isatty(i32 noundef) #5

; Function Attrs: nounwind
declare i32 @fileno(ptr noundef) #5

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

declare ptr @s2n_strerror(i32 noundef, ptr noundef) #4

declare ptr @s2n_strerror_debug(i32 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #5

; Function Attrs: nounwind uwtable
define dso_local i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = load i64, ptr %4, align 8, !tbaa !9
  %9 = call i32 @s2n_fuzz_test(ptr noundef %7, i64 noundef %8)
  store i32 %9, ptr %5, align 4, !tbaa !11
  %10 = load i32, ptr %5, align 4, !tbaa !11
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %62

12:                                               ; preds = %2
  br label %13

13:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %14 = call ptr @__errno_location() #7
  %15 = load i32, ptr %14, align 4, !tbaa !11
  store i32 %15, ptr %6, align 4, !tbaa !11
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = call i32 @s2n_print_stacktrace(ptr noundef %16)
  %18 = load i8, ptr @s2n_use_color_in_output, align 1, !tbaa !13, !range !15, !noundef !16
  %19 = trunc i8 %18 to i1
  br i1 %19, label %20, label %42

20:                                               ; preds = %13
  %21 = load ptr, ptr @stderr, align 8, !tbaa !5
  %22 = call i32 @fileno(ptr noundef %21) #6
  %23 = call i32 @isatty(i32 noundef %22) #6
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %42

25:                                               ; preds = %20
  %26 = load i32, ptr %6, align 4, !tbaa !11
  %27 = call ptr @__errno_location() #7
  store i32 %26, ptr %27, align 4, !tbaa !11
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = load i32, ptr @test_count, align 4, !tbaa !11
  %30 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  %31 = load i32, ptr %30, align 4, !tbaa !11
  %32 = call ptr @s2n_strerror(i32 noundef %31, ptr noundef @.str.10)
  %33 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = call ptr @s2n_strerror_debug(i32 noundef %34, ptr noundef @.str.10)
  %36 = call ptr @__errno_location() #7
  %37 = load i32, ptr %36, align 4, !tbaa !11
  %38 = call ptr @strerror(i32 noundef %37) #6
  %39 = call ptr @__errno_location() #7
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef @.str.7, i32 noundef %29, ptr noundef @.str.14, ptr noundef @.str.9, i32 noundef 100, ptr noundef %32, ptr noundef %35, ptr noundef %38, i32 noundef %40) #6
  br label %59

42:                                               ; preds = %20, %13
  %43 = load i32, ptr %6, align 4, !tbaa !11
  %44 = call ptr @__errno_location() #7
  store i32 %43, ptr %44, align 4, !tbaa !11
  %45 = load ptr, ptr @stderr, align 8, !tbaa !5
  %46 = load i32, ptr @test_count, align 4, !tbaa !11
  %47 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  %48 = load i32, ptr %47, align 4, !tbaa !11
  %49 = call ptr @s2n_strerror(i32 noundef %48, ptr noundef @.str.10)
  %50 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = call ptr @s2n_strerror_debug(i32 noundef %51, ptr noundef @.str.10)
  %53 = call ptr @__errno_location() #7
  %54 = load i32, ptr %53, align 4, !tbaa !11
  %55 = call ptr @strerror(i32 noundef %54) #6
  %56 = call ptr @__errno_location() #7
  %57 = load i32, ptr %56, align 4, !tbaa !11
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %45, ptr noundef @.str.11, i32 noundef %46, ptr noundef @.str.14, ptr noundef @.str.9, i32 noundef 100, ptr noundef %49, ptr noundef %52, ptr noundef %55, i32 noundef %57) #6
  br label %59

59:                                               ; preds = %42, %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61, %2
  %63 = load i32, ptr %5, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  ret i32 %63
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(none) "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 = { "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 #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }

!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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}


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

@s2n_use_color_in_output = external dso_local local_unnamed_addr global i8, align 1
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [101 x i8], align 1
@test_count = external dso_local local_unnamed_addr global i32, align 4
@.str.9 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [90 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @s2n_fuzz_test(ptr noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

declare i32 @s2n_print_stacktrace(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i32 @isatty(i32 noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fileno(ptr nocapture noundef) local_unnamed_addr #5

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

declare ptr @s2n_strerror(i32 noundef, ptr noundef) local_unnamed_addr #3

declare ptr @s2n_strerror_debug(i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) local_unnamed_addr #1 {
  %3 = tail call i32 @s2n_fuzz_test(ptr noundef %0, i64 noundef %1)
  %.not = icmp eq i32 %3, 0
  br i1 %.not, label %27, label %4

4:                                                ; preds = %2
  %5 = tail call ptr @__errno_location() #6
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = load ptr, ptr @stderr, align 8, !tbaa !9
  %8 = tail call i32 @s2n_print_stacktrace(ptr noundef %7) #7
  %9 = load i8, ptr @s2n_use_color_in_output, align 1, !tbaa !11, !range !13, !noundef !14
  %10 = trunc nuw i8 %9 to i1
  br i1 %10, label %11, label %15

11:                                               ; preds = %4
  %12 = load ptr, ptr @stderr, align 8, !tbaa !9
  %13 = tail call i32 @fileno(ptr noundef %12) #7
  %14 = tail call i32 @isatty(i32 noundef %13) #7
  %.not5 = icmp eq i32 %14, 0
  br i1 %.not5, label %15, label %.sink.split

15:                                               ; preds = %11, %4
  br label %.sink.split

.sink.split:                                      ; preds = %11, %15
  %.str.7.sink = phi ptr [ @.str.11, %15 ], [ @.str.7, %11 ]
  store i32 %6, ptr %5, align 4, !tbaa !5
  %16 = load ptr, ptr @stderr, align 8, !tbaa !9
  %17 = load i32, ptr @test_count, align 4, !tbaa !5
  %18 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = tail call ptr @s2n_strerror(i32 noundef %19, ptr noundef nonnull @.str.10) #7
  %21 = load i32, ptr %18, align 4, !tbaa !5
  %22 = tail call ptr @s2n_strerror_debug(i32 noundef %21, ptr noundef nonnull @.str.10) #7
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = tail call ptr @strerror(i32 noundef %23) #7
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull %.str.7.sink, i32 noundef %17, ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.9, i32 noundef 100, ptr noundef %20, ptr noundef %22, ptr noundef %24, i32 noundef %25) #8
  br label %27

27:                                               ; preds = %.sink.split, %2
  ret i32 %3
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { "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 "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 #5 = { 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 #6 = { nounwind willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { 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 = !{!"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}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


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