; LLVM IR from oservo/aiFi :: mlp (mlpNew)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [53 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__.mlpNew = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #2

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mlpNew() #4 {
  %1 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #6
  %2 = call noalias ptr @malloc(i64 noundef 128) #7
  store ptr %2, ptr %1, align 8, !tbaa !5
  %3 = load ptr, ptr %1, align 8, !tbaa !5
  %4 = icmp ne ptr %3, null
  br i1 %4, label %23, label %5

5:                                                ; preds = %0
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = call ptr @__errno_location() #8
  %8 = load i32, ptr %7, align 4, !tbaa !9
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %11

10:                                               ; preds = %5
  br label %15

11:                                               ; preds = %5
  %12 = call ptr @__errno_location() #8
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %14 = call ptr @strerror(i32 noundef %13) #6
  br label %15

15:                                               ; preds = %11, %10
  %16 = phi ptr [ @.str.2, %10 ], [ %14, %11 ]
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 42, ptr noundef %16) #6
  %18 = load ptr, ptr %1, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %15
  br label %22

21:                                               ; preds = %15
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 42, ptr noundef @__PRETTY_FUNCTION__.mlpNew) #9
  unreachable

22:                                               ; preds = %20
  br label %23

23:                                               ; preds = %22, %0
  %24 = load ptr, ptr %1, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mlp, ptr %24, i32 0, i32 0
  store i32 6, ptr %25, align 8, !tbaa !11
  %26 = load ptr, ptr %1, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mlp, ptr %26, i32 0, i32 7
  store ptr null, ptr %27, align 8, !tbaa !14
  %28 = load ptr, ptr %1, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mlp, ptr %28, i32 0, i32 2
  store i32 0, ptr %29, align 8, !tbaa !15
  %30 = load ptr, ptr %1, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mlp, ptr %30, i32 0, i32 3
  store i32 0, ptr %31, align 4, !tbaa !16
  %32 = load ptr, ptr %1, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.mlp, ptr %32, i32 0, i32 4
  store i32 0, ptr %33, align 8, !tbaa !17
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.mlp, ptr %34, i32 0, i32 1
  store i32 0, ptr %35, align 4, !tbaa !18
  %36 = load ptr, ptr %1, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mlp, ptr %36, i32 0, i32 17
  store ptr null, ptr %37, align 8, !tbaa !19
  %38 = load ptr, ptr %1, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mlp, ptr %38, i32 0, i32 18
  store ptr null, ptr %39, align 8, !tbaa !20
  %40 = load ptr, ptr %1, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mlp, ptr %40, i32 0, i32 19
  store ptr null, ptr %41, align 8, !tbaa !21
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.mlp, ptr %42, i32 0, i32 20
  store ptr null, ptr %43, align 8, !tbaa !22
  %44 = load ptr, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #6
  ret ptr %44
}

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

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

attributes #0 = { 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 #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 = { nounwind willreturn memory(none) "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 = { 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 #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"mlp", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 40}
!15 = !{!12, !10, i64 8}
!16 = !{!12, !10, i64 12}
!17 = !{!12, !10, i64 16}
!18 = !{!12, !10, i64 4}
!19 = !{!12, !6, i64 96}
!20 = !{!12, !6, i64 104}
!21 = !{!12, !6, i64 112}
!22 = !{!12, !6, i64 120}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [53 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__.mlpNew = external hidden unnamed_addr constant [14 x i8], align 1

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

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @mlpNew() local_unnamed_addr #5 {
  %1 = tail call noalias dereferenceable_or_null(128) ptr @malloc(i64 noundef 128) #7
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %2, label %12

2:                                                ; preds = %0
  %3 = load ptr, ptr @stderr, align 8, !tbaa !5
  %4 = tail call ptr @__errno_location() #8
  %5 = load i32, ptr %4, align 4, !tbaa !9
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %9, label %7

7:                                                ; preds = %2
  %8 = tail call ptr @strerror(i32 noundef %5) #9
  br label %9

9:                                                ; preds = %2, %7
  %10 = phi ptr [ %8, %7 ], [ @.str.2, %2 ]
  %11 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %3, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 42, ptr noundef %10) #10
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 42, ptr noundef nonnull @__PRETTY_FUNCTION__.mlpNew) #11
  unreachable

12:                                               ; preds = %0
  store i32 6, ptr %1, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  store ptr null, ptr %13, align 8, !tbaa !14
  %14 = getelementptr inbounds i8, ptr %1, i64 4
  %15 = getelementptr inbounds i8, ptr %1, i64 96
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(16) %14, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %15, i8 0, i64 32, i1 false)
  ret ptr %1
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

attributes #0 = { 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 #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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 "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 "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 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 #6 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind allocsize(0) }
attributes #8 = { nounwind willreturn memory(none) }
attributes #9 = { nounwind }
attributes #10 = { cold nounwind }
attributes #11 = { 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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"mlp", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !13, i64 24, !13, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !6, i64 40}


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