; LLVM IR from vertver/Fresponze-old :: modules/opus/tests (test_opus_api)

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

@.str.2 = external hidden unnamed_addr constant [90 x i8], align 1
@stderr = external global ptr, align 8
@.str.108 = external hidden unnamed_addr constant [11 x i8], align 1
@iseed = external hidden global i32, align 4
@.str.109 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_dec_api() #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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: inlinehint noreturn nounwind uwtable
declare hidden void @_test_failed(ptr noundef, i32 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 dso_local i32 @test_msdec_api() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_parse() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_enc_api() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_repacketizer_api() #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_malloc_fail() #0

; 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
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %11, label %17

11:                                               ; preds = %2
  %12 = load ptr, ptr @stderr, align 8, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds ptr, ptr %13, i64 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef @.str.108, ptr noundef %15) #6
  store i32 1, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %60

17:                                               ; preds = %2
  store i32 0, ptr @iseed, align 4, !tbaa !5
  %18 = call ptr @opus_get_version_string()
  store ptr %18, ptr %7, align 8, !tbaa !9
  %19 = load ptr, ptr %7, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %17
  call void @_test_failed(ptr noundef @.str.2, i32 noundef 1887) #7
  unreachable

22:                                               ; preds = %17
  %23 = load ptr, ptr @stderr, align 8, !tbaa !9
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef @.str.109, ptr noundef %24) #6
  %26 = call ptr @opus_strerror(i32 noundef -32768)
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  call void @_test_failed(ptr noundef @.str.2, i32 noundef 1889) #7
  unreachable

29:                                               ; preds = %22
  %30 = call ptr @opus_strerror(i32 noundef 32767)
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %33

32:                                               ; preds = %29
  call void @_test_failed(ptr noundef @.str.2, i32 noundef 1890) #7
  unreachable

33:                                               ; preds = %29
  %34 = call ptr @opus_strerror(i32 noundef 0)
  %35 = call i64 @strlen(ptr noundef %34) #8
  %36 = icmp ult i64 %35, 1
  br i1 %36, label %37, label %38

37:                                               ; preds = %33
  call void @_test_failed(ptr noundef @.str.2, i32 noundef 1891) #7
  unreachable

38:                                               ; preds = %33
  store i32 4, ptr %6, align 4, !tbaa !5
  %39 = call i32 @test_dec_api()
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = add nsw i32 %40, %39
  store i32 %41, ptr %6, align 4, !tbaa !5
  %42 = call i32 @test_msdec_api()
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = add nsw i32 %43, %42
  store i32 %44, ptr %6, align 4, !tbaa !5
  %45 = call i32 @test_parse()
  %46 = load i32, ptr %6, align 4, !tbaa !5
  %47 = add nsw i32 %46, %45
  store i32 %47, ptr %6, align 4, !tbaa !5
  %48 = call i32 @test_enc_api()
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = add nsw i32 %49, %48
  store i32 %50, ptr %6, align 4, !tbaa !5
  %51 = call i32 @test_repacketizer_api()
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = add nsw i32 %52, %51
  store i32 %53, ptr %6, align 4, !tbaa !5
  %54 = call i32 @test_malloc_fail()
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = add nsw i32 %55, %54
  store i32 %56, ptr %6, align 4, !tbaa !5
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %57, ptr noundef @.str.110, i32 noundef %58) #6
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %60

60:                                               ; preds = %38, %11
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %61 = load i32, ptr %3, align 4
  ret i32 %61
}

declare ptr @opus_get_version_string() #4

declare ptr @opus_strerror(i32 noundef) #4

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

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 = { 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 = { inlinehint noreturn 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 #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 willreturn memory(read) "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 = { noreturn }
attributes #8 = { nounwind willreturn memory(read) }

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

@.str.2 = external hidden unnamed_addr constant [90 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.108 = external hidden unnamed_addr constant [11 x i8], align 1
@iseed = external hidden local_unnamed_addr global i32, align 4
@.str.109 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.110 = external hidden unnamed_addr constant [62 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_dec_api() local_unnamed_addr #0

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

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_msdec_api() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_parse() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_enc_api() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_repacketizer_api() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i32 @test_malloc_fail() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = icmp sgt i32 %0, 1
  br i1 %3, label %4, label %8

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

8:                                                ; preds = %2
  store i32 0, ptr @iseed, align 4, !tbaa !9
  %9 = tail call ptr @opus_get_version_string() #5
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %10, label %11

10:                                               ; preds = %8
  tail call void @_test_failed(ptr noundef nonnull @.str.2, i32 noundef 1887) #6
  unreachable

11:                                               ; preds = %8
  %12 = load ptr, ptr @stderr, align 8, !tbaa !5
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef nonnull @.str.109, ptr noundef nonnull %9) #4
  %14 = tail call ptr @opus_strerror(i32 noundef -32768) #5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %11
  tail call void @_test_failed(ptr noundef nonnull @.str.2, i32 noundef 1889) #6
  unreachable

17:                                               ; preds = %11
  %18 = tail call ptr @opus_strerror(i32 noundef 32767) #5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  tail call void @_test_failed(ptr noundef nonnull @.str.2, i32 noundef 1890) #6
  unreachable

21:                                               ; preds = %17
  %22 = tail call ptr @opus_strerror(i32 noundef 0) #5
  %char0 = load i8, ptr %22, align 1
  %23 = icmp eq i8 %char0, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  tail call void @_test_failed(ptr noundef nonnull @.str.2, i32 noundef 1891) #6
  unreachable

25:                                               ; preds = %21
  %26 = tail call i32 @test_dec_api()
  %27 = add nsw i32 %26, 4
  %28 = tail call i32 @test_msdec_api()
  %29 = add nsw i32 %27, %28
  %30 = tail call i32 @test_parse()
  %31 = add nsw i32 %29, %30
  %32 = tail call i32 @test_enc_api()
  %33 = add nsw i32 %31, %32
  %34 = tail call i32 @test_repacketizer_api()
  %35 = add nsw i32 %33, %34
  %36 = tail call i32 @test_malloc_fail()
  %37 = add nsw i32 %35, %36
  %38 = load ptr, ptr @stderr, align 8, !tbaa !5
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.110, i32 noundef %37) #4
  br label %40

40:                                               ; preds = %25, %4
  %.0 = phi i32 [ 1, %4 ], [ 0, %25 ]
  ret i32 %.0
}

declare ptr @opus_get_version_string() local_unnamed_addr #3

declare ptr @opus_strerror(i32 noundef) local_unnamed_addr #3

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 = { 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 #2 = { inlinehint noreturn 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 = { "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 = { cold nounwind }
attributes #5 = { nounwind }
attributes #6 = { noreturn }

!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: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass