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

@stderr = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@optarg = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__.input_params = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() #0

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

; Function Attrs: nounwind uwtable
define dso_local void @input_params(ptr dead_on_unwind noalias writable sret(%struct.Params) align 8 %0, i32 noundef %1, ptr noundef %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  store i32 %1, ptr %4, align 4, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 0
  store ptr @.str.2, ptr %7, align 8, !tbaa !11
  %8 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 1
  store i32 1, ptr %8, align 8, !tbaa !13
  %9 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 2
  store i32 512, ptr %9, align 4, !tbaa !14
  %10 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 3
  store i32 512, ptr %10, align 8, !tbaa !15
  %11 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 4
  store i32 2, ptr %11, align 4, !tbaa !16
  %12 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 5
  store i32 3, ptr %12, align 8, !tbaa !17
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  br label %13

13:                                               ; preds = %39, %3
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = load ptr, ptr %5, align 8, !tbaa !9
  %16 = call i32 @getopt(i32 noundef %14, ptr noundef %15, ptr noundef @.str.3) #5
  store i32 %16, ptr %6, align 4, !tbaa !5
  %17 = icmp sge i32 %16, 0
  br i1 %17, label %18, label %40

18:                                               ; preds = %13
  %19 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %19, label %36 [
    i32 104, label %20
    i32 100, label %21
    i32 114, label %24
    i32 110, label %28
    i32 109, label %32
  ]

20:                                               ; preds = %18
  call void @usage()
  call void @exit(i32 noundef 0) #6
  unreachable

21:                                               ; preds = %18
  %22 = load ptr, ptr @optarg, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 0
  store ptr %22, ptr %23, align 8, !tbaa !11
  br label %39

24:                                               ; preds = %18
  %25 = load ptr, ptr @optarg, align 8, !tbaa !9
  %26 = call i32 @atoi(ptr noundef %25) #7
  %27 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 1
  store i32 %26, ptr %27, align 8, !tbaa !13
  br label %39

28:                                               ; preds = %18
  %29 = load ptr, ptr @optarg, align 8, !tbaa !9
  %30 = call i32 @atoi(ptr noundef %29) #7
  %31 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 2
  store i32 %30, ptr %31, align 4, !tbaa !14
  br label %39

32:                                               ; preds = %18
  %33 = load ptr, ptr @optarg, align 8, !tbaa !9
  %34 = call i32 @atoi(ptr noundef %33) #7
  %35 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 3
  store i32 %34, ptr %35, align 8, !tbaa !15
  br label %39

36:                                               ; preds = %18
  %37 = load ptr, ptr @stderr, align 8, !tbaa !9
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str.4) #5
  call void @usage()
  call void @exit(i32 noundef 0) #6
  unreachable

39:                                               ; preds = %32, %28, %24, %21
  br label %13, !llvm.loop !18

40:                                               ; preds = %13
  %41 = getelementptr inbounds %struct.Params, ptr %0, i32 0, i32 1
  %42 = load i32, ptr %41, align 8, !tbaa !13
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %44, label %46

44:                                               ; preds = %40
  br i1 true, label %45, label %46

45:                                               ; preds = %44
  br label %47

46:                                               ; preds = %44, %40
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.7, i32 noundef 118, ptr noundef @__PRETTY_FUNCTION__.input_params) #6
  unreachable

47:                                               ; preds = %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  ret void
}

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

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #4

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

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

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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint nounwind willreturn memory(read) 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 = { nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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, !10, i64 0}
!12 = !{!"Params", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24}
!13 = !{!12, !6, i64 8}
!14 = !{!12, !6, i64 12}
!15 = !{!12, !6, i64 16}
!16 = !{!12, !6, i64 20}
!17 = !{!12, !6, i64 24}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [8 x i8], align 1
@optarg = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [91 x i8], align 1
@__PRETTY_FUNCTION__.input_params = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @usage() 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: nounwind uwtable
define dso_local void @input_params(ptr dead_on_unwind noalias nocapture writable writeonly sret(%struct.Params) align 8 %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = getelementptr inbounds i8, ptr %0, i64 12
  %6 = getelementptr inbounds i8, ptr %0, i64 16
  %7 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 2, ptr %7, align 4, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 3, ptr %8, align 8, !tbaa !11
  %9 = tail call i32 @getopt(i32 noundef %1, ptr noundef %2, ptr noundef nonnull @.str.3) #5
  %10 = icmp sgt i32 %9, -1
  br i1 %10, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %3
  store i32 512, ptr %6, align 8, !tbaa !12
  store i32 512, ptr %5, align 4, !tbaa !13
  store i32 1, ptr %4, align 8, !tbaa !14
  store ptr @.str.2, ptr %0, align 8, !tbaa !15
  br label %40

.lr.ph:                                           ; preds = %3, %31
  %11 = phi i32 [ %36, %31 ], [ %9, %3 ]
  %12 = phi i32 [ %35, %31 ], [ 512, %3 ]
  %13 = phi i32 [ %34, %31 ], [ 512, %3 ]
  %14 = phi i32 [ %33, %31 ], [ 1, %3 ]
  %15 = phi ptr [ %32, %31 ], [ @.str.2, %3 ]
  switch i32 %11, label %28 [
    i32 104, label %16
    i32 100, label %17
    i32 114, label %19
    i32 110, label %22
    i32 109, label %25
  ]

16:                                               ; preds = %.lr.ph
  store i32 %12, ptr %6, align 8, !tbaa !12
  store i32 %13, ptr %5, align 4, !tbaa !13
  store i32 %14, ptr %4, align 8, !tbaa !14
  store ptr %15, ptr %0, align 8, !tbaa !15
  tail call void @usage()
  tail call void @exit(i32 noundef 0) #6
  unreachable

17:                                               ; preds = %.lr.ph
  %18 = load ptr, ptr @optarg, align 8, !tbaa !16
  br label %31

19:                                               ; preds = %.lr.ph
  %20 = load ptr, ptr @optarg, align 8, !tbaa !16
  %21 = tail call i32 @atoi(ptr nocapture noundef %20) #7
  br label %31

22:                                               ; preds = %.lr.ph
  %23 = load ptr, ptr @optarg, align 8, !tbaa !16
  %24 = tail call i32 @atoi(ptr nocapture noundef %23) #7
  br label %31

25:                                               ; preds = %.lr.ph
  %26 = load ptr, ptr @optarg, align 8, !tbaa !16
  %27 = tail call i32 @atoi(ptr nocapture noundef %26) #7
  br label %31

28:                                               ; preds = %.lr.ph
  store i32 %12, ptr %6, align 8, !tbaa !12
  store i32 %13, ptr %5, align 4, !tbaa !13
  store i32 %14, ptr %4, align 8, !tbaa !14
  store ptr %15, ptr %0, align 8, !tbaa !15
  %29 = load ptr, ptr @stderr, align 8, !tbaa !16
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.4) #8
  tail call void @usage()
  tail call void @exit(i32 noundef 0) #6
  unreachable

31:                                               ; preds = %25, %22, %19, %17
  %32 = phi ptr [ %15, %25 ], [ %15, %22 ], [ %15, %19 ], [ %18, %17 ]
  %33 = phi i32 [ %14, %25 ], [ %14, %22 ], [ %21, %19 ], [ %14, %17 ]
  %34 = phi i32 [ %13, %25 ], [ %24, %22 ], [ %13, %19 ], [ %13, %17 ]
  %35 = phi i32 [ %27, %25 ], [ %12, %22 ], [ %12, %19 ], [ %12, %17 ]
  %36 = tail call i32 @getopt(i32 noundef %1, ptr noundef %2, ptr noundef nonnull @.str.3) #5
  %37 = icmp sgt i32 %36, -1
  br i1 %37, label %.lr.ph, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %31
  store i32 %35, ptr %6, align 8, !tbaa !12
  store i32 %34, ptr %5, align 4, !tbaa !13
  store i32 %33, ptr %4, align 8, !tbaa !14
  store ptr %32, ptr %0, align 8, !tbaa !15
  %38 = icmp sgt i32 %33, 0
  br i1 %38, label %40, label %39

39:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, i32 noundef 118, ptr noundef nonnull @__PRETTY_FUNCTION__.input_params) #6
  unreachable

40:                                               ; preds = %._crit_edge.thread, %._crit_edge
  ret void
}

; Function Attrs: nounwind
declare i32 @getopt(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #4

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

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 = { 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 = { 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 = { inlinehint mustprogress nofree nounwind willreturn memory(read) 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 = { nounwind }
attributes #6 = { noreturn nounwind }
attributes #7 = { nounwind willreturn memory(read) }
attributes #8 = { cold 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, !10, i64 20}
!6 = !{!"Params", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24}
!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 24}
!12 = !{!6, !10, i64 16}
!13 = !{!6, !10, i64 12}
!14 = !{!6, !10, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass