; 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

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

; Function Attrs: mustprogress uwtable
define dso_local i32 @TransformDataTypeAndFormat(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, ptr noundef %14) #1 {
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca i32, align 4
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca ptr, align 8
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i64, align 8
  store ptr %0, ptr %17, align 8, !tbaa !5
  store i32 %1, ptr %18, align 4, !tbaa !9
  store i32 %2, ptr %19, align 4, !tbaa !11
  store i32 %3, ptr %20, align 4, !tbaa !13
  store i32 %4, ptr %21, align 4, !tbaa !13
  store i32 %5, ptr %22, align 4, !tbaa !13
  store i32 %6, ptr %23, align 4, !tbaa !13
  store ptr %7, ptr %24, align 8, !tbaa !5
  store i32 %8, ptr %25, align 4, !tbaa !9
  store i32 %9, ptr %26, align 4, !tbaa !11
  store i32 %10, ptr %27, align 4, !tbaa !13
  store i32 %11, ptr %28, align 4, !tbaa !13
  store i32 %12, ptr %29, align 4, !tbaa !13
  store i32 %13, ptr %30, align 4, !tbaa !13
  store ptr %14, ptr %31, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #4
  store i32 0, ptr %32, align 4, !tbaa !13
  %35 = load i32, ptr %26, align 4, !tbaa !11
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %39

37:                                               ; preds = %15
  store i32 1, ptr %32, align 4, !tbaa !13
  %38 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %38, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %105

39:                                               ; preds = %15
  %40 = load i32, ptr %25, align 4, !tbaa !9
  %41 = icmp ne i32 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %39
  store i32 1, ptr %32, align 4, !tbaa !13
  %43 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %43, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %105

44:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #4
  %45 = load i32, ptr %27, align 4, !tbaa !13
  %46 = load i32, ptr %28, align 4, !tbaa !13
  %47 = mul nsw i32 %45, %46
  %48 = load i32, ptr %29, align 4, !tbaa !13
  %49 = mul nsw i32 %47, %48
  %50 = load i32, ptr %30, align 4, !tbaa !13
  %51 = mul nsw i32 %49, %50
  %52 = sext i32 %51 to i64
  store i64 %52, ptr %34, align 8, !tbaa !15
  %53 = load i32, ptr %19, align 4, !tbaa !11
  %54 = icmp ne i32 %53, 2
  br i1 %54, label %55, label %68

55:                                               ; preds = %44
  %56 = load i32, ptr %19, align 4, !tbaa !11
  %57 = icmp ne i32 %56, 5
  br i1 %57, label %58, label %68

58:                                               ; preds = %55
  %59 = load ptr, ptr %17, align 8, !tbaa !5
  %60 = load i32, ptr %18, align 4, !tbaa !9
  %61 = load ptr, ptr %24, align 8, !tbaa !5
  %62 = load i32, ptr %25, align 4, !tbaa !9
  %63 = load ptr, ptr %31, align 8, !tbaa !5
  %64 = load i64, ptr %34, align 8, !tbaa !15
  %65 = trunc i64 %64 to i32
  %66 = call i32 @TransformDataType(ptr noundef %59, i32 noundef %60, ptr noundef %61, ptr noundef null, i32 noundef %62, ptr noundef %63, ptr noundef null, i32 noundef %65)
  store i32 %66, ptr %32, align 4, !tbaa !13
  %67 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %67, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %104

68:                                               ; preds = %55, %44
  %69 = load i32, ptr %18, align 4, !tbaa !9
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %85

71:                                               ; preds = %68
  %72 = load i32, ptr %19, align 4, !tbaa !11
  %73 = load i32, ptr %20, align 4, !tbaa !13
  %74 = load i32, ptr %21, align 4, !tbaa !13
  %75 = load i32, ptr %22, align 4, !tbaa !13
  %76 = load i32, ptr %23, align 4, !tbaa !13
  %77 = load ptr, ptr %24, align 8, !tbaa !5
  %78 = load i32, ptr %26, align 4, !tbaa !11
  %79 = load i32, ptr %27, align 4, !tbaa !13
  %80 = load i32, ptr %28, align 4, !tbaa !13
  %81 = load i32, ptr %29, align 4, !tbaa !13
  %82 = load i32, ptr %30, align 4, !tbaa !13
  %83 = load ptr, ptr %31, align 8, !tbaa !5
  call void @_Z21TransformNCHWCxToNCHWIffEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef %72, i32 noundef %73, i32 noundef %74, i32 noundef %75, i32 noundef %76, ptr noundef %77, i32 noundef %78, i32 noundef %79, i32 noundef %80, i32 noundef %81, i32 noundef %82, ptr noundef %83)
  %84 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %84, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %104

85:                                               ; preds = %68
  %86 = load i32, ptr %18, align 4, !tbaa !9
  %87 = icmp eq i32 %86, 1
  br i1 %87, label %88, label %102

88:                                               ; preds = %85
  %89 = load i32, ptr %19, align 4, !tbaa !11
  %90 = load i32, ptr %20, align 4, !tbaa !13
  %91 = load i32, ptr %21, align 4, !tbaa !13
  %92 = load i32, ptr %22, align 4, !tbaa !13
  %93 = load i32, ptr %23, align 4, !tbaa !13
  %94 = load ptr, ptr %24, align 8, !tbaa !5
  %95 = load i32, ptr %26, align 4, !tbaa !11
  %96 = load i32, ptr %27, align 4, !tbaa !13
  %97 = load i32, ptr %28, align 4, !tbaa !13
  %98 = load i32, ptr %29, align 4, !tbaa !13
  %99 = load i32, ptr %30, align 4, !tbaa !13
  %100 = load ptr, ptr %31, align 8, !tbaa !5
  call void @_Z21TransformNCHWCxToNCHWItfEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef %89, i32 noundef %90, i32 noundef %91, i32 noundef %92, i32 noundef %93, ptr noundef %94, i32 noundef %95, i32 noundef %96, i32 noundef %97, i32 noundef %98, i32 noundef %99, ptr noundef %100)
  %101 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %101, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %104

102:                                              ; preds = %85
  %103 = load i32, ptr %32, align 4, !tbaa !13
  store i32 %103, ptr %16, align 4
  store i32 1, ptr %33, align 4
  br label %104

104:                                              ; preds = %102, %88, %71, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #4
  br label %105

105:                                              ; preds = %104, %42, %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #4
  %106 = load i32, ptr %16, align 4
  ret i32 %106
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21TransformNCHWCxToNCHWIffEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21TransformNCHWCxToNCHWItfEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { mustprogress 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 = !{!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 = !{!"_ZTS9DATA_TYPE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS11DATA_FORMAT", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !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
define dso_local i32 @TransformDataTypeAndFormat(ptr noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7, i32 noundef %8, i32 noundef %9, i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, ptr noundef %14) local_unnamed_addr #0 {
  %16 = or i32 %9, %8
  %or.cond = icmp eq i32 %16, 0
  br i1 %or.cond, label %17, label %26

17:                                               ; preds = %15
  switch i32 %2, label %18 [
    i32 5, label %23
    i32 2, label %23
  ]

18:                                               ; preds = %17
  %19 = mul nsw i32 %11, %10
  %20 = mul nsw i32 %19, %12
  %21 = mul nsw i32 %20, %13
  %22 = tail call i32 @TransformDataType(ptr noundef %0, i32 noundef %1, ptr noundef %7, ptr noundef null, i32 noundef 0, ptr noundef %14, ptr noundef null, i32 noundef %21)
  br label %26

23:                                               ; preds = %17, %17
  switch i32 %1, label %26 [
    i32 0, label %24
    i32 1, label %25
  ]

24:                                               ; preds = %23
  tail call void @_Z21TransformNCHWCxToNCHWIffEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7, i32 noundef 0, i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, ptr noundef %14)
  br label %26

25:                                               ; preds = %23
  tail call void @_Z21TransformNCHWCxToNCHWItfEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, i32 noundef %6, ptr noundef %7, i32 noundef 0, i32 noundef %10, i32 noundef %11, i32 noundef %12, i32 noundef %13, ptr noundef %14)
  br label %26

26:                                               ; preds = %18, %24, %25, %23, %15
  %.1 = phi i32 [ 1, %15 ], [ %22, %18 ], [ 0, %24 ], [ 0, %25 ], [ 0, %23 ]
  ret i32 %.1
}

declare i32 @TransformDataType(ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21TransformNCHWCxToNCHWIffEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z21TransformNCHWCxToNCHWItfEv11DATA_FORMATiiiiPKT_S0_iiiiPT0_(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, 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 = { "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 = { mustprogress 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" }

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


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