; LLVM IR from STMicroelectronics/STMems_Machine_Learning_Core :: tools/mlc_tilt_angle_tool (DecisionTree_for_AngleDetection)

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

@fp_session = external hidden global ptr, align 8
@fname_dectree = external hidden global ptr, align 8
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@fp_dectree = external hidden global ptr, align 8
@.str.34 = external hidden unnamed_addr constant [36 x i8], align 1
@fname_session = external hidden global ptr, align 8

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

; Function Attrs: nounwind uwtable
declare hidden void @params_set_default() #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @dectree_design_init() #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
  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 @params_set_default()
  %6 = load i32, ptr %4, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 1
  br i1 %7, label %8, label %15

8:                                                ; preds = %2
  %9 = load i32, ptr %4, align 4, !tbaa !5
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  %11 = call i32 @params_parse(i32 noundef %9, ptr noundef %10)
  %12 = icmp ne i32 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %8
  store i32 1, ptr %3, align 4
  br label %52

14:                                               ; preds = %8
  br label %23

15:                                               ; preds = %2
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  call void @params_help_print(ptr noundef %18)
  %19 = call i32 @params_interactive()
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store i32 1, ptr %3, align 4
  br label %52

22:                                               ; preds = %15
  br label %23

23:                                               ; preds = %22, %14
  %24 = load ptr, ptr @fname_dectree, align 8, !tbaa !9
  %25 = call noalias ptr @fopen(ptr noundef %24, ptr noundef @.str.33)
  store ptr %25, ptr @fp_dectree, align 8, !tbaa !9
  %26 = load ptr, ptr @fp_dectree, align 8, !tbaa !9
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %31

28:                                               ; preds = %23
  %29 = load ptr, ptr @fname_dectree, align 8, !tbaa !9
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.34, ptr noundef %29)
  store i32 1, ptr %3, align 4
  br label %52

31:                                               ; preds = %23
  %32 = load ptr, ptr @fname_session, align 8, !tbaa !9
  %33 = call noalias ptr @fopen(ptr noundef %32, ptr noundef @.str.33)
  store ptr %33, ptr @fp_session, align 8, !tbaa !9
  %34 = load ptr, ptr @fp_session, align 8, !tbaa !9
  %35 = icmp eq ptr %34, null
  br i1 %35, label %36, label %39

36:                                               ; preds = %31
  %37 = load ptr, ptr @fname_session, align 8, !tbaa !9
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.34, ptr noundef %37)
  store i32 1, ptr %3, align 4
  br label %52

39:                                               ; preds = %31
  call void @params_print()
  %40 = call i32 @params_check()
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %47

42:                                               ; preds = %39
  %43 = load ptr, ptr @fp_dectree, align 8, !tbaa !9
  %44 = call i32 @fclose(ptr noundef %43)
  %45 = load ptr, ptr @fp_session, align 8, !tbaa !9
  %46 = call i32 @fclose(ptr noundef %45)
  store i32 1, ptr %3, align 4
  br label %52

47:                                               ; preds = %39
  call void @dectree_design_init()
  call void @dectree_design_root()
  call void @dectree_design_finish()
  %48 = load ptr, ptr @fp_dectree, align 8, !tbaa !9
  %49 = call i32 @fclose(ptr noundef %48)
  %50 = load ptr, ptr @fp_session, align 8, !tbaa !9
  %51 = call i32 @fclose(ptr noundef %50)
  store i32 0, ptr %3, align 4
  br label %52

52:                                               ; preds = %47, %42, %36, %28, %21, %13
  %53 = load i32, ptr %3, align 4
  ret i32 %53
}

; Function Attrs: nounwind uwtable
declare hidden i32 @params_parse(i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @params_interactive() #0

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @params_print() #0

; Function Attrs: nounwind uwtable
declare hidden i32 @params_check() #0

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @dectree_design_root() #0

; Function Attrs: nounwind uwtable
declare hidden void @dectree_design_finish() #0

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

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

@fp_session = external hidden local_unnamed_addr global ptr, align 8
@fname_dectree = external hidden local_unnamed_addr global ptr, align 8
@.str.33 = external hidden unnamed_addr constant [2 x i8], align 1
@fp_dectree = external hidden local_unnamed_addr global ptr, align 8
@.str.34 = external hidden unnamed_addr constant [36 x i8], align 1
@fname_session = external hidden local_unnamed_addr global ptr, align 8

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

; Function Attrs: nounwind uwtable
declare hidden void @params_set_default() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @dectree_design_init() local_unnamed_addr #0

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

4:                                                ; preds = %2
  %5 = tail call i32 @params_parse(i32 noundef %0, ptr noundef %1)
  %.not5 = icmp eq i32 %5, 0
  br i1 %.not5, label %9, label %35

6:                                                ; preds = %2
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  tail call void @params_help_print(ptr noundef %7)
  %8 = tail call i32 @params_interactive()
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %9, label %35

9:                                                ; preds = %6, %4
  %10 = load ptr, ptr @fname_dectree, align 8, !tbaa !5
  %11 = tail call noalias ptr @fopen(ptr noundef %10, ptr noundef nonnull @.str.33)
  store ptr %11, ptr @fp_dectree, align 8, !tbaa !5
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %16

13:                                               ; preds = %9
  %14 = load ptr, ptr @fname_dectree, align 8, !tbaa !5
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, ptr noundef %14)
  br label %35

16:                                               ; preds = %9
  %17 = load ptr, ptr @fname_session, align 8, !tbaa !5
  %18 = tail call noalias ptr @fopen(ptr noundef %17, ptr noundef nonnull @.str.33)
  store ptr %18, ptr @fp_session, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %23

20:                                               ; preds = %16
  %21 = load ptr, ptr @fname_session, align 8, !tbaa !5
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.34, ptr noundef %21)
  br label %35

23:                                               ; preds = %16
  tail call void @params_print()
  %24 = tail call i32 @params_check()
  %.not6 = icmp eq i32 %24, 0
  br i1 %.not6, label %30, label %25

25:                                               ; preds = %23
  %26 = load ptr, ptr @fp_dectree, align 8, !tbaa !5
  %27 = tail call i32 @fclose(ptr noundef %26)
  %28 = load ptr, ptr @fp_session, align 8, !tbaa !5
  %29 = tail call i32 @fclose(ptr noundef %28)
  br label %35

30:                                               ; preds = %23
  tail call void @dectree_design_init()
  tail call void @dectree_design_root()
  tail call void @dectree_design_finish()
  %31 = load ptr, ptr @fp_dectree, align 8, !tbaa !5
  %32 = tail call i32 @fclose(ptr noundef %31)
  %33 = load ptr, ptr @fp_session, align 8, !tbaa !5
  %34 = tail call i32 @fclose(ptr noundef %33)
  br label %35

35:                                               ; preds = %6, %4, %30, %25, %20, %13
  %.0 = phi i32 [ 1, %13 ], [ 1, %20 ], [ 1, %25 ], [ 0, %30 ], [ 1, %4 ], [ 1, %6 ]
  ret i32 %.0
}

; Function Attrs: nounwind uwtable
declare hidden i32 @params_parse(i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @params_interactive() local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @params_print() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @params_check() local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @dectree_design_root() local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @dectree_design_finish() local_unnamed_addr #0

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

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


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