; LLVM IR from QiaoLiuHit/LSOTB-TIR :: vlfeat-0.9.19/vl (generic)

; 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._VlState = type { i32, %union.pthread_mutex_t, i64, %union.pthread_cond_t, i64, ptr, ptr, ptr, ptr, ptr, %struct._VlX86CpuInfo, i64, i32, i64 }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct._VlX86CpuInfo = type { %union.anon, i32, i32, i32, i32, i32, i32, i32 }
%union.anon = type { [8 x i32] }

@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_get_version_string() #0

; Function Attrs: nounwind uwtable
define dso_local ptr @vl_configuration_to_string_copy() #0 {
  %1 = alloca ptr, align 8
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  store ptr null, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %6 = call ptr (...) @vl_static_configuration_to_string_copy()
  store ptr %6, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %7 = call ptr @vl_get_state()
  %8 = getelementptr inbounds %struct._VlState, ptr %7, i32 0, i32 10
  %9 = call ptr @_vl_x86cpu_info_to_string_copy(ptr noundef %8)
  store ptr %9, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %10

10:                                               ; preds = %25, %0
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %36

13:                                               ; preds = %10
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %16, label %25

16:                                               ; preds = %13
  %17 = load i32, ptr %2, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = mul i64 1, %18
  %20 = call ptr @vl_malloc(i64 noundef %19)
  store ptr %20, ptr %1, align 8, !tbaa !5
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %24

23:                                               ; preds = %16
  br label %36

24:                                               ; preds = %16
  br label %25

25:                                               ; preds = %24, %13
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = load i32, ptr %2, align 4, !tbaa !9
  %28 = sext i32 %27 to i64
  %29 = call ptr @vl_get_version_string()
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = call i64 @vl_get_num_cpus()
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %26, i64 noundef %28, ptr noundef @.str.1, ptr noundef %29, ptr noundef %30, i64 noundef %31, ptr noundef %32, ptr noundef @.str.2) #5
  store i32 %33, ptr %2, align 4, !tbaa !9
  %34 = load i32, ptr %2, align 4, !tbaa !9
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !9
  br label %10, !llvm.loop !11

36:                                               ; preds = %23, %10
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %41

39:                                               ; preds = %36
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  call void @vl_free(ptr noundef %40)
  br label %41

41:                                               ; preds = %39, %36
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %46

44:                                               ; preds = %41
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  call void @vl_free(ptr noundef %45)
  br label %46

46:                                               ; preds = %44, %41
  %47 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret ptr %47
}

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

declare ptr @vl_static_configuration_to_string_copy(...) #2

declare ptr @_vl_x86cpu_info_to_string_copy(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_malloc(i64 noundef) #0

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #3

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_get_num_cpus() #0

; Function Attrs: nounwind uwtable
declare dso_local void @vl_free(ptr noundef) #0

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @vl_get_state() #4

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 = { "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 "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 = { inlinehint 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 #5 = { 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"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.1 = external hidden unnamed_addr constant [75 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_get_version_string() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local ptr @vl_configuration_to_string_copy() local_unnamed_addr #0 {
  %1 = tail call ptr (...) @vl_static_configuration_to_string_copy() #4
  %2 = tail call ptr @vl_get_state()
  %3 = getelementptr inbounds i8, ptr %2, i64 152
  %4 = tail call ptr @_vl_x86cpu_info_to_string_copy(ptr noundef nonnull %3) #4
  br label %5

5:                                                ; preds = %0, %11
  %.01319 = phi i32 [ 0, %0 ], [ %16, %11 ]
  %6 = icmp sgt i32 %.01319, 0
  br i1 %6, label %7, label %11

7:                                                ; preds = %5
  %8 = zext nneg i32 %.01319 to i64
  %9 = tail call ptr @vl_malloc(i64 noundef %8)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %18, label %11

11:                                               ; preds = %7, %5
  %.1 = phi ptr [ %9, %7 ], [ null, %5 ]
  %12 = sext i32 %.01319 to i64
  %13 = tail call ptr @vl_get_version_string()
  %14 = tail call i64 @vl_get_num_cpus()
  %15 = tail call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %.1, i64 noundef %12, ptr noundef nonnull @.str.1, ptr noundef %13, ptr noundef %1, i64 noundef %14, ptr noundef %4, ptr noundef nonnull @.str.2) #4
  %16 = add nsw i32 %15, 1
  %17 = icmp eq ptr %.1, null
  br i1 %17, label %5, label %18, !llvm.loop !5

18:                                               ; preds = %7, %11
  %.0.lcssa = phi ptr [ null, %7 ], [ %.1, %11 ]
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %20, label %19

19:                                               ; preds = %18
  tail call void @vl_free(ptr noundef nonnull %1)
  br label %20

20:                                               ; preds = %19, %18
  %.not18 = icmp eq ptr %4, null
  br i1 %.not18, label %22, label %21

21:                                               ; preds = %20
  tail call void @vl_free(ptr noundef nonnull %4)
  br label %22

22:                                               ; preds = %21, %20
  ret ptr %.0.lcssa
}

declare ptr @vl_static_configuration_to_string_copy(...) local_unnamed_addr #1

declare ptr @_vl_x86cpu_info_to_string_copy(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @vl_malloc(i64 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @vl_get_num_cpus() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @vl_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @vl_get_state() 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 = { "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 = { inlinehint 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass