; LLVM IR from CMU-SAFARI/prim-benchmarks :: MLP/baselines/cpu (mlp_openmp)

; 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.Params = type { ptr, i32, i32, i32, i32, i32 }
%struct.Timer = type { [5 x %struct.timeval], [5 x %struct.timeval], [5 x double] }
%struct.timeval = type { i64, i64 }

@A = external dso_local global ptr, align 8
@B = external dso_local global ptr, align 8
@C = external dso_local global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @start(ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @stop(ptr noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @print(ptr noundef, i32 noundef, i32 noundef) #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @input_params(ptr dead_on_unwind noalias writable sret(%struct.Params) align 8, i32 noundef, ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca %struct.Params, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %struct.Timer, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #5
  %13 = load i32, ptr %4, align 4, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !9
  call void @input_params(ptr dead_on_unwind writable sret(%struct.Params) align 8 %6, i32 noundef %13, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 8192, ptr %7, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  store i64 20480, ptr %8, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 200, ptr %9) #5
  %15 = call noalias ptr @malloc(i64 noundef 24) #6
  store ptr %15, ptr @A, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %30, %2
  %17 = load i32, ptr %10, align 4, !tbaa !5
  %18 = icmp slt i32 %17, 3
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %33

20:                                               ; preds = %16
  %21 = load i64, ptr %7, align 8, !tbaa !11
  %22 = load i64, ptr %8, align 8, !tbaa !11
  %23 = mul i64 %21, %22
  %24 = mul i64 %23, 4
  %25 = call noalias ptr @malloc(i64 noundef %24) #6
  %26 = load ptr, ptr @A, align 8, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds ptr, ptr %26, i64 %28
  store ptr %25, ptr %29, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %20
  %31 = load i32, ptr %10, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %10, align 4, !tbaa !5
  br label %16, !llvm.loop !13

33:                                               ; preds = %19
  %34 = load i64, ptr %8, align 8, !tbaa !11
  %35 = mul i64 %34, 4
  %36 = call noalias ptr @malloc(i64 noundef %35) #6
  store ptr %36, ptr @B, align 8, !tbaa !9
  %37 = load i64, ptr %8, align 8, !tbaa !11
  %38 = mul i64 %37, 4
  %39 = call noalias ptr @malloc(i64 noundef %38) #6
  store ptr %39, ptr @C, align 8, !tbaa !9
  %40 = load ptr, ptr @A, align 8, !tbaa !9
  %41 = load ptr, ptr @B, align 8, !tbaa !9
  %42 = load i64, ptr %8, align 8, !tbaa !11
  %43 = trunc i64 %42 to i32
  %44 = load i64, ptr %7, align 8, !tbaa !11
  %45 = trunc i64 %44 to i32
  call void @init_data(ptr noundef %40, ptr noundef %41, i32 noundef %43, i32 noundef %45)
  call void @start(ptr noundef %9, i32 noundef 0, i32 noundef 1)
  %46 = load ptr, ptr @C, align 8, !tbaa !9
  %47 = load ptr, ptr @A, align 8, !tbaa !9
  %48 = load ptr, ptr @B, align 8, !tbaa !9
  %49 = load i64, ptr %7, align 8, !tbaa !11
  %50 = trunc i64 %49 to i32
  %51 = load i64, ptr %8, align 8, !tbaa !11
  %52 = trunc i64 %51 to i32
  call void @mlp_host(ptr noundef %46, ptr noundef %47, ptr noundef %48, i32 noundef %50, i32 noundef %52)
  call void @stop(ptr noundef %9, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %53 = load i64, ptr %7, align 8, !tbaa !11
  %54 = load i64, ptr %8, align 8, !tbaa !11
  %55 = call i64 @mlp_host_sum(i64 noundef %53, i64 noundef %54)
  %56 = trunc i64 %55 to i32
  store i32 %56, ptr %11, align 4, !tbaa !5
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  call void @print(ptr noundef %9, i32 noundef 0, i32 noundef 1)
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  %59 = load i32, ptr %11, align 4, !tbaa !5
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i32 noundef %59)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %71, %33
  %62 = load i32, ptr %12, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 3
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %74

65:                                               ; preds = %61
  %66 = load ptr, ptr @A, align 8, !tbaa !9
  %67 = load i32, ptr %12, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !9
  call void @free(ptr noundef %70) #5
  br label %71

71:                                               ; preds = %65
  %72 = load i32, ptr %12, align 4, !tbaa !5
  %73 = add nsw i32 %72, 1
  store i32 %73, ptr %12, align 4, !tbaa !5
  br label %61, !llvm.loop !15

74:                                               ; preds = %64
  %75 = load ptr, ptr @A, align 8, !tbaa !9
  call void @free(ptr noundef %75) #5
  %76 = load ptr, ptr @B, align 8, !tbaa !9
  call void @free(ptr noundef %76) #5
  %77 = load ptr, ptr @C, align 8, !tbaa !9
  call void @free(ptr noundef %77) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #5
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare hidden void @init_data(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @mlp_host(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @mlp_host_sum(i64 noundef, i64 noundef) #0

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

attributes #0 = { 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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


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

%struct.Params = type { ptr, i32, i32, i32, i32, i32 }
%struct.Timer = type { [5 x %struct.timeval], [5 x %struct.timeval], [5 x double] }
%struct.timeval = type { i64, i64 }

@A = external dso_local local_unnamed_addr global ptr, align 8
@B = external dso_local local_unnamed_addr global ptr, align 8
@C = external dso_local local_unnamed_addr global ptr, align 8
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @start(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @stop(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @print(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @input_params(ptr dead_on_unwind noalias writable sret(%struct.Params) align 8, i32 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) #2

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.Params, align 8
  %4 = alloca %struct.Timer, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @input_params(ptr dead_on_unwind nonnull writable sret(%struct.Params) align 8 %3, i32 noundef %0, ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 200, ptr nonnull %4) #5
  %5 = call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #6
  store ptr %5, ptr @A, align 8, !tbaa !5
  %6 = call noalias dereferenceable_or_null(671088640) ptr @malloc(i64 noundef 671088640) #6
  store ptr %6, ptr %5, align 8, !tbaa !5
  %7 = call noalias dereferenceable_or_null(671088640) ptr @malloc(i64 noundef 671088640) #6
  %8 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %7, ptr %8, align 8, !tbaa !5
  %9 = call noalias dereferenceable_or_null(671088640) ptr @malloc(i64 noundef 671088640) #6
  %10 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %9, ptr %10, align 8, !tbaa !5
  %11 = call noalias dereferenceable_or_null(81920) ptr @malloc(i64 noundef 81920) #6
  store ptr %11, ptr @B, align 8, !tbaa !5
  %12 = call noalias dereferenceable_or_null(81920) ptr @malloc(i64 noundef 81920) #6
  store ptr %12, ptr @C, align 8, !tbaa !5
  call void @init_data(ptr noundef nonnull %5, ptr noundef %11, i32 noundef 20480, i32 noundef 8192)
  call void @start(ptr noundef nonnull %4, i32 noundef 0, i32 noundef 1)
  %13 = load ptr, ptr @C, align 8, !tbaa !5
  %14 = load ptr, ptr @A, align 8, !tbaa !5
  %15 = load ptr, ptr @B, align 8, !tbaa !5
  call void @mlp_host(ptr noundef %13, ptr noundef %14, ptr noundef %15, i32 noundef 8192, i32 noundef 20480)
  call void @stop(ptr noundef nonnull %4, i32 noundef 0)
  %16 = call i64 @mlp_host_sum(i64 noundef 8192, i64 noundef 20480)
  %17 = trunc i64 %16 to i32
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  call void @print(ptr noundef nonnull %4, i32 noundef 0, i32 noundef 1)
  %19 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %17)
  %21 = load ptr, ptr @A, align 8, !tbaa !5
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  call void @free(ptr noundef %22) #5
  %23 = load ptr, ptr @A, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  call void @free(ptr noundef %25) #5
  %26 = load ptr, ptr @A, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  %28 = load ptr, ptr %27, align 8, !tbaa !5
  call void @free(ptr noundef %28) #5
  %29 = load ptr, ptr @A, align 8, !tbaa !5
  call void @free(ptr noundef %29) #5
  %30 = load ptr, ptr @B, align 8, !tbaa !5
  call void @free(ptr noundef %30) #5
  %31 = load ptr, ptr @C, align 8, !tbaa !5
  call void @free(ptr noundef %31) #5
  call void @llvm.lifetime.end.p0(i64 200, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare hidden void @init_data(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @mlp_host(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i64 @mlp_host_sum(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

attributes #0 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass