; LLVM IR from theck01/offbrand_lib :: apps/minlog/src/classes (NCube)

; 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.NCube_struct = type { ptr, ptr, i32, i8, i8, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [86 x i8], align 1
@createNCubeWithOrder.classname = external hidden constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.createNCubeWithOrder = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @createNCubeWithOrder(i8 noundef zeroext %0) #2 {
  %2 = alloca i8, align 1
  %3 = alloca ptr, align 8
  store i8 %0, ptr %2, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %4 = load i8, ptr %2, align 1, !tbaa !5
  %5 = zext i8 %4 to i32
  %6 = icmp sle i32 %5, 27
  br i1 %6, label %7, label %8

7:                                                ; preds = %1
  br label %9

8:                                                ; preds = %1
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 193, ptr noundef @__PRETTY_FUNCTION__.createNCubeWithOrder) #6
  unreachable

9:                                                ; preds = %7
  %10 = call noalias ptr @malloc(i64 noundef 24) #7
  store ptr %10, ptr %3, align 8, !tbaa !8
  %11 = load ptr, ptr %3, align 8, !tbaa !8
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %14

13:                                               ; preds = %9
  br label %15

14:                                               ; preds = %9
  call void @__assert_fail(ptr noundef @.str.9, ptr noundef @.str.1, i32 noundef 196, ptr noundef @__PRETTY_FUNCTION__.createNCubeWithOrder) #6
  unreachable

15:                                               ; preds = %13
  %16 = load ptr, ptr %3, align 8, !tbaa !8
  call void @ob_init_base(ptr noundef %16, ptr noundef @deallocNCube, ptr noundef null, ptr noundef @compareNCubes, ptr noundef null, ptr noundef @createNCubeWithOrder.classname)
  %17 = load i8, ptr %2, align 1, !tbaa !5
  %18 = zext i8 %17 to i32
  %19 = shl i32 1, %18
  %20 = sext i32 %19 to i64
  %21 = mul i64 4, %20
  %22 = call noalias ptr @malloc(i64 noundef %21) #7
  %23 = load ptr, ptr %3, align 8, !tbaa !8
  %24 = getelementptr inbounds %struct.NCube_struct, ptr %23, i32 0, i32 1
  store ptr %22, ptr %24, align 8, !tbaa !10
  %25 = load ptr, ptr %3, align 8, !tbaa !8
  %26 = getelementptr inbounds %struct.NCube_struct, ptr %25, i32 0, i32 1
  %27 = load ptr, ptr %26, align 8, !tbaa !10
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %15
  br label %31

30:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.10, ptr noundef @.str.1, i32 noundef 203, ptr noundef @__PRETTY_FUNCTION__.createNCubeWithOrder) #6
  unreachable

31:                                               ; preds = %29
  %32 = load ptr, ptr %3, align 8, !tbaa !8
  %33 = getelementptr inbounds %struct.NCube_struct, ptr %32, i32 0, i32 2
  store i32 0, ptr %33, align 8, !tbaa !13
  %34 = load i8, ptr %2, align 1, !tbaa !5
  %35 = load ptr, ptr %3, align 8, !tbaa !8
  %36 = getelementptr inbounds %struct.NCube_struct, ptr %35, i32 0, i32 3
  store i8 %34, ptr %36, align 4, !tbaa !14
  %37 = load ptr, ptr %3, align 8, !tbaa !8
  %38 = getelementptr inbounds %struct.NCube_struct, ptr %37, i32 0, i32 4
  store i8 1, ptr %38, align 1, !tbaa !15
  %39 = load ptr, ptr %3, align 8, !tbaa !8
  %40 = getelementptr inbounds %struct.NCube_struct, ptr %39, i32 0, i32 5
  store i8 0, ptr %40, align 2, !tbaa !16
  %41 = load ptr, ptr %3, align 8, !tbaa !8
  %42 = getelementptr inbounds %struct.NCube_struct, ptr %41, i32 0, i32 6
  store i8 0, ptr %42, align 1, !tbaa !17
  %43 = load ptr, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret ptr %43
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

declare void @ob_init_base(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @deallocNCube(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @compareNCubes(ptr noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { nounwind allocsize(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 = { "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 }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind allocsize(0) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!11, !9, i64 8}
!11 = !{!"NCube_struct", !9, i64 0, !9, i64 8, !12, i64 16, !6, i64 20, !6, i64 21, !6, i64 22, !6, i64 23}
!12 = !{!"int", !6, i64 0}
!13 = !{!11, !12, i64 16}
!14 = !{!11, !6, i64 20}
!15 = !{!11, !6, i64 21}
!16 = !{!11, !6, i64 22}
!17 = !{!11, !6, i64 23}


; 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 [86 x i8], align 1
@createNCubeWithOrder.classname = external hidden constant [6 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [12 x i8], align 1
@__PRETTY_FUNCTION__.createNCubeWithOrder = external hidden unnamed_addr constant [37 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef ptr @createNCubeWithOrder(i8 noundef zeroext %0) local_unnamed_addr #1 {
  %2 = zext nneg i8 %0 to i32
  %3 = icmp ult i8 %0, 28
  br i1 %3, label %5, label %4

4:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 193, ptr noundef nonnull @__PRETTY_FUNCTION__.createNCubeWithOrder) #4
  unreachable

5:                                                ; preds = %1
  %6 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #5
  %.not = icmp eq ptr %6, null
  br i1 %.not, label %7, label %8

7:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.1, i32 noundef 196, ptr noundef nonnull @__PRETTY_FUNCTION__.createNCubeWithOrder) #4
  unreachable

8:                                                ; preds = %5
  tail call void @ob_init_base(ptr noundef nonnull %6, ptr noundef nonnull @deallocNCube, ptr noundef null, ptr noundef nonnull @compareNCubes, ptr noundef null, ptr noundef nonnull @createNCubeWithOrder.classname) #6
  %9 = shl nuw nsw i32 1, %2
  %10 = zext nneg i32 %9 to i64
  %11 = shl nuw nsw i64 %10, 2
  %12 = tail call noalias ptr @malloc(i64 noundef %11) #5
  %13 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %12, ptr %13, align 8, !tbaa !5
  %.not13 = icmp eq ptr %12, null
  br i1 %.not13, label %14, label %15

14:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.10, ptr noundef nonnull @.str.1, i32 noundef 203, ptr noundef nonnull @__PRETTY_FUNCTION__.createNCubeWithOrder) #4
  unreachable

15:                                               ; preds = %8
  %16 = getelementptr inbounds i8, ptr %6, i64 16
  store i32 0, ptr %16, align 8, !tbaa !11
  %17 = getelementptr inbounds i8, ptr %6, i64 20
  store i8 %0, ptr %17, align 4, !tbaa !12
  %18 = getelementptr inbounds i8, ptr %6, i64 21
  store i8 1, ptr %18, align 1, !tbaa !13
  %19 = getelementptr inbounds i8, ptr %6, i64 22
  store i8 0, ptr %19, align 2, !tbaa !14
  %20 = getelementptr inbounds i8, ptr %6, i64 23
  store i8 0, ptr %20, align 1, !tbaa !15
  ret ptr %6
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

declare void @ob_init_base(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare dso_local void @deallocNCube(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local signext i8 @compareNCubes(ptr noundef, ptr noundef) #1

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { noreturn nounwind }
attributes #5 = { nounwind allocsize(0) }
attributes #6 = { 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, !7, i64 8}
!6 = !{!"NCube_struct", !7, i64 0, !7, i64 8, !10, i64 16, !8, i64 20, !8, i64 21, !8, i64 22, !8, i64 23}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !8, i64 20}
!13 = !{!6, !8, i64 21}
!14 = !{!6, !8, i64 22}
!15 = !{!6, !8, i64 23}


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