; LLVM IR from zeux/meshoptimizer :: tools (codecfuzz)

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef, i64 noundef, i64 noundef, ptr 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13fuzzRoundtripPKhmmi(ptr noundef, i64 noundef, i64 noundef, i32 noundef) #0

declare i32 @meshopt_decodeVertexBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i8, align 1
  %6 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i64 %1, ptr %4, align 8, !tbaa !9
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %7, i64 noundef %8, i64 noundef 2, ptr noundef @meshopt_decodeIndexBuffer)
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %9, i64 noundef %10, i64 noundef 4, ptr noundef @meshopt_decodeIndexBuffer)
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %11, i64 noundef %12, i64 noundef 2, ptr noundef @meshopt_decodeIndexSequence)
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %13, i64 noundef %14, i64 noundef 4, ptr noundef @meshopt_decodeIndexSequence)
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %15, i64 noundef %16, i64 noundef 4, ptr noundef @meshopt_decodeVertexBuffer)
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %17, i64 noundef %18, i64 noundef 16, ptr noundef @meshopt_decodeVertexBuffer)
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %19, i64 noundef %20, i64 noundef 24, ptr noundef @meshopt_decodeVertexBuffer)
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = load i64, ptr %4, align 8, !tbaa !9
  call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %21, i64 noundef %22, i64 noundef 32, ptr noundef @meshopt_decodeVertexBuffer)
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  %23 = load i64, ptr %4, align 8, !tbaa !9
  %24 = icmp ugt i64 %23, 0
  br i1 %24, label %25, label %30

25:                                               ; preds = %2
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 0
  %28 = load i8, ptr %27, align 1, !tbaa !11
  %29 = zext i8 %28 to i32
  br label %31

30:                                               ; preds = %2
  br label %31

31:                                               ; preds = %30, %25
  %32 = phi i32 [ %29, %25 ], [ 0, %30 ]
  %33 = trunc i32 %32 to i8
  store i8 %33, ptr %5, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %34 = load i8, ptr %5, align 1, !tbaa !11
  %35 = zext i8 %34 to i32
  %36 = srem i32 %35, 5
  store i32 %36, ptr %6, align 4, !tbaa !12
  %37 = load i32, ptr %6, align 4, !tbaa !12
  %38 = icmp slt i32 %37, 4
  %39 = zext i1 %38 to i64
  %40 = select i1 %38, i32 1, i32 0
  call void @meshopt_encodeVertexVersion(i32 noundef %40)
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = load i64, ptr %4, align 8, !tbaa !9
  %43 = load i32, ptr %6, align 4, !tbaa !12
  call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %41, i64 noundef %42, i64 noundef 4, i32 noundef %43)
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = load i64, ptr %4, align 8, !tbaa !9
  %46 = load i32, ptr %6, align 4, !tbaa !12
  call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %44, i64 noundef %45, i64 noundef 16, i32 noundef %46)
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = load i64, ptr %4, align 8, !tbaa !9
  %49 = load i32, ptr %6, align 4, !tbaa !12
  call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %47, i64 noundef %48, i64 noundef 24, i32 noundef %49)
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = load i64, ptr %4, align 8, !tbaa !9
  %52 = load i32, ptr %6, align 4, !tbaa !12
  call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %50, i64 noundef %51, i64 noundef 32, i32 noundef %52)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret i32 0
}

declare i32 @meshopt_decodeIndexBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #2

declare i32 @meshopt_decodeIndexSequence(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #2

declare void @meshopt_encodeVertexVersion(i32 noundef) #2

attributes #0 = { mustprogress 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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !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"

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef, i64 noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z13fuzzRoundtripPKhmmi(ptr noundef, i64 noundef, i64 noundef, i32 noundef) local_unnamed_addr #0

declare i32 @meshopt_decodeVertexBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @LLVMFuzzerTestOneInput(ptr noundef %0, i64 noundef %1) local_unnamed_addr #0 {
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 2, ptr noundef nonnull @meshopt_decodeIndexBuffer)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 4, ptr noundef nonnull @meshopt_decodeIndexBuffer)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 2, ptr noundef nonnull @meshopt_decodeIndexSequence)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 4, ptr noundef nonnull @meshopt_decodeIndexSequence)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 4, ptr noundef nonnull @meshopt_decodeVertexBuffer)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 16, ptr noundef nonnull @meshopt_decodeVertexBuffer)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 24, ptr noundef nonnull @meshopt_decodeVertexBuffer)
  tail call void @_Z11fuzzDecoderPKhmmPFiPvmmS0_mE(ptr noundef %0, i64 noundef %1, i64 noundef 32, ptr noundef nonnull @meshopt_decodeVertexBuffer)
  %.not = icmp eq i64 %1, 0
  br i1 %.not, label %7, label %3

3:                                                ; preds = %2
  %4 = load i8, ptr %0, align 1, !tbaa !5
  %5 = urem i8 %4, 5
  %6 = zext nneg i8 %5 to i32
  br label %7

7:                                                ; preds = %2, %3
  %8 = phi i32 [ %6, %3 ], [ 0, %2 ]
  %9 = icmp ult i32 %8, 4
  %10 = zext i1 %9 to i32
  tail call void @meshopt_encodeVertexVersion(i32 noundef %10)
  tail call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %0, i64 noundef %1, i64 noundef 4, i32 noundef %8)
  tail call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %0, i64 noundef %1, i64 noundef 16, i32 noundef %8)
  tail call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %0, i64 noundef %1, i64 noundef 24, i32 noundef %8)
  tail call void @_Z13fuzzRoundtripPKhmmi(ptr noundef %0, i64 noundef %1, i64 noundef 32, i32 noundef %8)
  ret i32 0
}

declare i32 @meshopt_decodeIndexBuffer(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #1

declare i32 @meshopt_decodeIndexSequence(ptr noundef, i64 noundef, i64 noundef, ptr noundef, i64 noundef) #1

declare void @meshopt_encodeVertexVersion(i32 noundef) local_unnamed_addr #1

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}


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