; LLVM IR from huawei-noah/bolt :: inference/engine/src (bolt_c_simplify)

; 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 i32 @MallocTensorDesc(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr 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 i32 @FreeTensorDesc(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

declare i32 @GetNumInputsFromModel(ptr noundef) #2

declare void @GetInputDataInfoFromModel(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

26:                                               ; preds = %6
  %27 = load ptr, ptr %13, align 8, !tbaa !9
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %31

29:                                               ; preds = %26, %6
  store i32 1, ptr %14, align 4, !tbaa !5
  %30 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %30, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %104

31:                                               ; preds = %26
  %32 = load i32, ptr %8, align 4, !tbaa !5
  %33 = icmp ne i32 %32, 0
  br i1 %33, label %34, label %40

34:                                               ; preds = %31
  %35 = load ptr, ptr %9, align 8, !tbaa !9
  %36 = load i32, ptr %11, align 4, !tbaa !11
  %37 = load ptr, ptr %10, align 8, !tbaa !9
  %38 = call ptr @CreateModelWithFileStream(ptr noundef %35, i32 noundef %36, ptr noundef %37)
  %39 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %38, ptr %39, align 8, !tbaa !9
  br label %46

40:                                               ; preds = %31
  %41 = load ptr, ptr %9, align 8, !tbaa !9
  %42 = load i32, ptr %11, align 4, !tbaa !11
  %43 = load ptr, ptr %10, align 8, !tbaa !9
  %44 = call ptr @CreateModel(ptr noundef %41, i32 noundef %42, ptr noundef %43)
  %45 = load ptr, ptr %12, align 8, !tbaa !9
  store ptr %44, ptr %45, align 8, !tbaa !9
  br label %46

46:                                               ; preds = %40, %34
  %47 = load ptr, ptr %12, align 8, !tbaa !9
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %52

50:                                               ; preds = %46
  store i32 1, ptr %14, align 4, !tbaa !5
  %51 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %51, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %104

52:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = call i32 @GetNumInputsFromModel(ptr noundef %54)
  store i32 %55, ptr %23, align 4, !tbaa !5
  %56 = load i32, ptr %23, align 4, !tbaa !5
  %57 = call i32 @MallocTensorDesc(i32 noundef %56, ptr noundef %16, ptr noundef %17, ptr noundef %18, ptr noundef %19, ptr noundef %20, ptr noundef %21, ptr noundef %22)
  store i32 %57, ptr %14, align 4, !tbaa !5
  %58 = load i32, ptr %14, align 4, !tbaa !5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %62

60:                                               ; preds = %52
  %61 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %61, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %103

62:                                               ; preds = %52
  %63 = load ptr, ptr %12, align 8, !tbaa !9
  %64 = load ptr, ptr %63, align 8, !tbaa !9
  %65 = load i32, ptr %23, align 4, !tbaa !5
  %66 = load ptr, ptr %16, align 8, !tbaa !9
  %67 = load ptr, ptr %17, align 8, !tbaa !9
  %68 = load ptr, ptr %18, align 8, !tbaa !9
  %69 = load ptr, ptr %19, align 8, !tbaa !9
  %70 = load ptr, ptr %20, align 8, !tbaa !9
  %71 = load ptr, ptr %21, align 8, !tbaa !9
  %72 = load ptr, ptr %22, align 8, !tbaa !9
  call void @GetInputDataInfoFromModel(ptr noundef %64, i32 noundef %65, ptr noundef %66, ptr noundef %67, ptr noundef %68, ptr noundef %69, ptr noundef %70, ptr noundef %71, ptr noundef %72)
  %73 = load ptr, ptr %12, align 8, !tbaa !9
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = load i32, ptr %23, align 4, !tbaa !5
  %76 = load ptr, ptr %16, align 8, !tbaa !9
  %77 = load ptr, ptr %17, align 8, !tbaa !9
  %78 = load ptr, ptr %18, align 8, !tbaa !9
  %79 = load ptr, ptr %19, align 8, !tbaa !9
  %80 = load ptr, ptr %20, align 8, !tbaa !9
  %81 = load ptr, ptr %21, align 8, !tbaa !9
  %82 = load ptr, ptr %22, align 8, !tbaa !9
  call void @PrepareModel(ptr noundef %74, i32 noundef %75, ptr noundef %76, ptr noundef %77, ptr noundef %78, ptr noundef %79, ptr noundef %80, ptr noundef %81, ptr noundef %82)
  %83 = load ptr, ptr %12, align 8, !tbaa !9
  %84 = load ptr, ptr %83, align 8, !tbaa !9
  %85 = call ptr @AllocAllResultHandle(ptr noundef %84)
  %86 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %85, ptr %86, align 8, !tbaa !9
  %87 = load ptr, ptr %13, align 8, !tbaa !9
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = icmp eq ptr %88, null
  br i1 %89, label %90, label %92

90:                                               ; preds = %62
  store i32 1, ptr %14, align 4, !tbaa !5
  %91 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %91, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %103

92:                                               ; preds = %62
  %93 = load i32, ptr %23, align 4, !tbaa !5
  %94 = load ptr, ptr %16, align 8, !tbaa !9
  %95 = load ptr, ptr %17, align 8, !tbaa !9
  %96 = load ptr, ptr %18, align 8, !tbaa !9
  %97 = load ptr, ptr %19, align 8, !tbaa !9
  %98 = load ptr, ptr %20, align 8, !tbaa !9
  %99 = load ptr, ptr %21, align 8, !tbaa !9
  %100 = load ptr, ptr %22, align 8, !tbaa !9
  %101 = call i32 @FreeTensorDesc(i32 noundef %93, ptr noundef %94, ptr noundef %95, ptr noundef %96, ptr noundef %97, ptr noundef %98, ptr noundef %99, ptr noundef %100)
  store i32 %101, ptr %14, align 4, !tbaa !5
  %102 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %102, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %103

103:                                              ; preds = %92, %90, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  br label %104

104:                                              ; preds = %103, %50, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %105 = load i32, ptr %7, align 4
  ret i32 %105
}

declare ptr @CreateModelWithFileStream(ptr noundef, i32 noundef, ptr noundef) #2

declare ptr @CreateModel(ptr noundef, i32 noundef, ptr noundef) #2

declare void @PrepareModel(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @AllocAllResultHandle(ptr 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS13AFFINITY_TYPE", !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 i32 @MallocTensorDesc(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress 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 i32 @FreeTensorDesc(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @GetNumInputsFromModel(ptr noundef) local_unnamed_addr #2

declare void @GetInputDataInfoFromModel(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local i32 @CreateInference(i32 noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef writeonly %5) local_unnamed_addr #0 {
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = icmp eq ptr %4, null
  %15 = icmp eq ptr %5, null
  %or.cond = or i1 %14, %15
  br i1 %or.cond, label %56, label %16

16:                                               ; preds = %6
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %19, label %17

17:                                               ; preds = %16
  %18 = tail call ptr @CreateModelWithFileStream(ptr noundef %1, i32 noundef %3, ptr noundef %2)
  br label %21

19:                                               ; preds = %16
  %20 = tail call ptr @CreateModel(ptr noundef %1, i32 noundef %3, ptr noundef %2)
  br label %21

21:                                               ; preds = %19, %17
  %storemerge = phi ptr [ %20, %19 ], [ %18, %17 ]
  store ptr %storemerge, ptr %4, align 8, !tbaa !5
  %22 = icmp eq ptr %storemerge, null
  br i1 %22, label %56, label %23

23:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #3
  %24 = tail call i32 @GetNumInputsFromModel(ptr noundef nonnull %storemerge)
  %25 = call i32 @MallocTensorDesc(i32 noundef %24, ptr noundef nonnull %7, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %13)
  %.not32 = icmp eq i32 %25, 0
  br i1 %.not32, label %26, label %55

26:                                               ; preds = %23
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = load ptr, ptr %9, align 8, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = load ptr, ptr %11, align 8, !tbaa !5
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = load ptr, ptr %13, align 8, !tbaa !5
  call void @GetInputDataInfoFromModel(ptr noundef %27, i32 noundef %24, ptr noundef %28, ptr noundef %29, ptr noundef %30, ptr noundef %31, ptr noundef %32, ptr noundef %33, ptr noundef %34)
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = load ptr, ptr %10, align 8, !tbaa !5
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = load ptr, ptr %13, align 8, !tbaa !5
  call void @PrepareModel(ptr noundef %35, i32 noundef %24, ptr noundef %36, ptr noundef %37, ptr noundef %38, ptr noundef %39, ptr noundef %40, ptr noundef %41, ptr noundef %42)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = call ptr @AllocAllResultHandle(ptr noundef %43)
  store ptr %44, ptr %5, align 8, !tbaa !5
  %45 = icmp eq ptr %44, null
  br i1 %45, label %55, label %46

46:                                               ; preds = %26
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %10, align 8, !tbaa !5
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = load ptr, ptr %13, align 8, !tbaa !5
  %54 = call i32 @FreeTensorDesc(i32 noundef %24, ptr noundef %47, ptr noundef %48, ptr noundef %49, ptr noundef %50, ptr noundef %51, ptr noundef %52, ptr noundef %53)
  br label %55

55:                                               ; preds = %26, %23, %46
  %.0 = phi i32 [ %54, %46 ], [ %25, %23 ], [ 1, %26 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  br label %56

56:                                               ; preds = %21, %6, %55
  %.1 = phi i32 [ %.0, %55 ], [ 1, %6 ], [ 1, %21 ]
  ret i32 %.1
}

declare ptr @CreateModelWithFileStream(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare ptr @CreateModel(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare void @PrepareModel(ptr noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @AllocAllResultHandle(ptr noundef) local_unnamed_addr #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 = { mustprogress 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"}


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