; LLVM IR from ggml-org/ggml :: src (ggml)

; 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.ggml_threadpool_params = type { [512 x i8], i32, i32, i32, i8, i8 }

; Function Attrs: nounwind willreturn memory(read)
declare i32 @memcmp(ptr noundef, ptr noundef, i64 noundef) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @ggml_threadpool_params_match(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %6, i32 0, i32 1
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %9, i32 0, i32 1
  %11 = load i32, ptr %10, align 4, !tbaa !9
  %12 = icmp ne i32 %8, %11
  br i1 %12, label %13, label %14

13:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %54

14:                                               ; preds = %2
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %15, i32 0, i32 2
  %17 = load i32, ptr %16, align 4, !tbaa !13
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %18, i32 0, i32 2
  %20 = load i32, ptr %19, align 4, !tbaa !13
  %21 = icmp ne i32 %17, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %14
  store i1 false, ptr %3, align 1
  br label %54

23:                                               ; preds = %14
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %24, i32 0, i32 3
  %26 = load i32, ptr %25, align 4, !tbaa !14
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %27, i32 0, i32 3
  %29 = load i32, ptr %28, align 4, !tbaa !14
  %30 = icmp ne i32 %26, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %23
  store i1 false, ptr %3, align 1
  br label %54

32:                                               ; preds = %23
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %33, i32 0, i32 4
  %35 = load i8, ptr %34, align 4, !tbaa !15, !range !16, !noundef !17
  %36 = trunc i8 %35 to i1
  %37 = zext i1 %36 to i32
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %38, i32 0, i32 4
  %40 = load i8, ptr %39, align 4, !tbaa !15, !range !16, !noundef !17
  %41 = trunc i8 %40 to i1
  %42 = zext i1 %41 to i32
  %43 = icmp ne i32 %37, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %32
  store i1 false, ptr %3, align 1
  br label %54

45:                                               ; preds = %32
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds [512 x i8], ptr %47, i64 0, i64 0
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.ggml_threadpool_params, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds [512 x i8], ptr %50, i64 0, i64 0
  %52 = call i32 @memcmp(ptr noundef %48, ptr noundef %51, i64 noundef 512) #2
  %53 = icmp eq i32 %52, 0
  store i1 %53, ptr %3, align 1
  br label %54

54:                                               ; preds = %45, %44, %31, %22, %13
  %55 = load i1, ptr %3, align 1
  ret i1 %55
}

attributes #0 = { 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 #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 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 512}
!10 = !{!"ggml_threadpool_params", !7, i64 0, !11, i64 512, !11, i64 516, !11, i64 520, !12, i64 524, !12, i64 525}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !11, i64 516}
!14 = !{!10, !11, i64 520}
!15 = !{!10, !12, i64 524}
!16 = !{i8 0, i8 2}
!17 = !{}


; 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 nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local zeroext i1 @ggml_threadpool_params_match(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 512
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 512
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %.not = icmp eq i32 %4, %6
  br i1 %.not, label %7, label %24

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 516
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %1, i64 516
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %.not11 = icmp eq i32 %9, %11
  br i1 %.not11, label %12, label %24

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %0, i64 520
  %14 = load i32, ptr %13, align 4, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %1, i64 520
  %16 = load i32, ptr %15, align 4, !tbaa !12
  %.not12 = icmp eq i32 %14, %16
  br i1 %.not12, label %17, label %24

17:                                               ; preds = %12
  %18 = getelementptr inbounds i8, ptr %0, i64 524
  %19 = load i8, ptr %18, align 4, !tbaa !13, !range !14, !noundef !15
  %20 = getelementptr inbounds i8, ptr %1, i64 524
  %21 = load i8, ptr %20, align 4, !tbaa !13, !range !14, !noundef !15
  %.not13 = icmp eq i8 %19, %21
  br i1 %.not13, label %22, label %24

22:                                               ; preds = %17
  %bcmp = tail call i32 @bcmp(ptr noundef nonnull dereferenceable(512) %0, ptr noundef nonnull dereferenceable(512) %1, i64 512)
  %23 = icmp eq i32 %bcmp, 0
  br label %24

24:                                               ; preds = %17, %12, %7, %2, %22
  %.0 = phi i1 [ %23, %22 ], [ false, %2 ], [ false, %7 ], [ false, %12 ], [ false, %17 ]
  ret i1 %.0
}

; Function Attrs: nofree nounwind willreturn memory(argmem: read)
declare i32 @bcmp(ptr nocapture, ptr nocapture, i64) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(argmem: read) 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 willreturn memory(argmem: 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, !9, i64 512}
!6 = !{!"ggml_threadpool_params", !7, i64 0, !9, i64 512, !9, i64 516, !9, i64 520, !10, i64 524, !10, i64 525}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!6, !9, i64 516}
!12 = !{!6, !9, i64 520}
!13 = !{!6, !10, i64 524}
!14 = !{i8 0, i8 2}
!15 = !{}


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