; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/ply.ll (Z11check_typesv)

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

@ply_type_size = external dso_local global [9 x i32], align 16
@_ZL13types_checked = external hidden global i32, align 4
@stderr = external global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z11check_typesv() #0 {
  %1 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 1), align 4, !tbaa !5
  %2 = sext i32 %1 to i64
  %3 = icmp ne i64 %2, 1
  br i1 %3, label %32, label %4

4:                                                ; preds = %0
  %5 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 2), align 8, !tbaa !5
  %6 = sext i32 %5 to i64
  %7 = icmp ne i64 %6, 2
  br i1 %7, label %32, label %8

8:                                                ; preds = %4
  %9 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 3), align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = icmp ne i64 %10, 4
  br i1 %11, label %32, label %12

12:                                               ; preds = %8
  %13 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 4), align 16, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp ne i64 %14, 1
  br i1 %15, label %32, label %16

16:                                               ; preds = %12
  %17 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 5), align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = icmp ne i64 %18, 2
  br i1 %19, label %32, label %20

20:                                               ; preds = %16
  %21 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 6), align 8, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp ne i64 %22, 4
  br i1 %23, label %32, label %24

24:                                               ; preds = %20
  %25 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 7), align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp ne i64 %26, 4
  br i1 %27, label %32, label %28

28:                                               ; preds = %24
  %29 = load i32, ptr getelementptr inbounds ([9 x i32], ptr @ply_type_size, i64 0, i64 8), align 16, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp ne i64 %30, 8
  br i1 %31, label %32, label %37

32:                                               ; preds = %28, %24, %20, %16, %12, %8, %4, %0
  %33 = load ptr, ptr @stderr, align 8, !tbaa !9
  %34 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.53) #3
  %35 = load ptr, ptr @stderr, align 8, !tbaa !9
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.52) #3
  call void @exit(i32 noundef 1) #4
  unreachable

37:                                               ; preds = %28
  store i32 1, ptr @_ZL13types_checked, align 4, !tbaa !5
  ret void
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

attributes #0 = { 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 #1 = { 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 #2 = { noreturn 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 = { nounwind }
attributes #4 = { noreturn 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}


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

@ply_type_size = external dso_local local_unnamed_addr global [9 x i32], align 16
@_ZL13types_checked = external hidden local_unnamed_addr global i32, align 4
@stderr = external local_unnamed_addr global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_Z11check_typesv() local_unnamed_addr #0 {
  %1 = load <8 x i32>, ptr getelementptr inbounds (i8, ptr @ply_type_size, i64 4), align 4
  %.fr = freeze <8 x i32> %1
  %2 = icmp ne <8 x i32> %.fr, <i32 1, i32 2, i32 4, i32 1, i32 2, i32 4, i32 4, i32 8>
  %3 = bitcast <8 x i1> %2 to i8
  %.not = icmp eq i8 %3, 0
  br i1 %.not, label %9, label %4

4:                                                ; preds = %0
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.53) #3
  %7 = load ptr, ptr @stderr, align 8, !tbaa !5
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.52) #3
  tail call void @exit(i32 noundef 1) #4
  unreachable

9:                                                ; preds = %0
  store i32 1, ptr @_ZL13types_checked, align 4, !tbaa !9
  ret void
}

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

attributes #0 = { 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 #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" }
attributes #2 = { noreturn 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 = { cold nounwind }
attributes #4 = { noreturn 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 = !{!"int", !7, i64 0}


; Effective O3 passes: GlobalDCEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SimplifyCFGPass,TailCallElimPass