; LLVM IR from jingweizhanghuai/Morn :: src/deep_learning (morn_learning_net)

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

@morn_network_para_dir = external dso_local global ptr, align 8
@morn_network_parafile = external dso_local global ptr, align 8
@morn_network_save = external dso_local global i32, align 4
@morn_network_time_max = external dso_local global i32, align 4
@morn_network_error_thresh = external dso_local global float, align 4
@.str.12 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@__FUNCTION__.NetworkPara = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [10 x i8], align 1
@morn_network_flag = external dso_local global i32, align 4
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@morn_network_para_filename = external dso_local global [256 x i8], align 16
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @NetworkPara(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %7, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.16 to i64), ptr noundef inttoptr (i64 -1 to ptr), i32 noundef -1)
  store ptr %8, ptr @morn_network_para_dir, align 8, !tbaa !5
  br label %9

9:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %10 = load ptr, ptr @morn_network_para_dir, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  %12 = zext i1 %11 to i32
  store i32 %12, ptr %4, align 4, !tbaa !9
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = icmp ne i32 %13, 0
  br i1 %14, label %15, label %17

15:                                               ; preds = %9
  %16 = load i32, ptr %4, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %16, i32 noundef -1, ptr noundef @.str.12, i32 noundef 81, ptr noundef @__FUNCTION__.NetworkPara, ptr noundef @.str.17)
  br label %17

17:                                               ; preds = %15, %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %20, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.18 to i64), ptr noundef inttoptr (i64 -1 to ptr), i32 noundef -1)
  store ptr %21, ptr %3, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %28

25:                                               ; preds = %22
  %26 = load i32, ptr @morn_network_flag, align 4, !tbaa !9
  %27 = icmp eq i32 %26, 0
  br label %28

28:                                               ; preds = %25, %22
  %29 = phi i1 [ false, %22 ], [ %27, %25 ]
  %30 = zext i1 %29 to i32
  store i32 %30, ptr %5, align 4, !tbaa !9
  %31 = load i32, ptr %5, align 4, !tbaa !9
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %33, label %35

33:                                               ; preds = %28
  %34 = load i32, ptr %5, align 4, !tbaa !9
  call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef %34, i32 noundef -1, ptr noundef @.str.12, i32 noundef 84, ptr noundef @__FUNCTION__.NetworkPara, ptr noundef @.str.19)
  br label %35

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

36:                                               ; preds = %35
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = icmp ne ptr %38, null
  br i1 %39, label %40, label %45

40:                                               ; preds = %37
  %41 = load ptr, ptr @morn_network_para_dir, align 8, !tbaa !5
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef @morn_network_para_filename, ptr noundef @.str.20, ptr noundef %41, ptr noundef %42) #5
  %44 = call ptr (ptr, ...) @mFileCreate(ptr noundef @morn_network_para_filename)
  store ptr %44, ptr @morn_network_parafile, align 8, !tbaa !5
  br label %45

45:                                               ; preds = %40, %37
  %46 = load i32, ptr @morn_network_flag, align 4, !tbaa !9
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  store i32 1, ptr %6, align 4
  br label %75

49:                                               ; preds = %45
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %50, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.21 to i64), ptr noundef inttoptr (i64 -1 to ptr), i32 noundef -1)
  store ptr %51, ptr %3, align 8, !tbaa !5
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = icmp ne ptr %52, null
  br i1 %53, label %54, label %57

54:                                               ; preds = %49
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = call i32 @atoi(ptr noundef %55) #6
  store i32 %56, ptr @morn_network_time_max, align 4, !tbaa !9
  br label %57

57:                                               ; preds = %54, %49
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %58, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.22 to i64), ptr noundef inttoptr (i64 -1 to ptr), i32 noundef -1)
  store ptr %59, ptr %3, align 8, !tbaa !5
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %65

62:                                               ; preds = %57
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = call i32 @atoi(ptr noundef %63) #6
  store i32 %64, ptr @morn_network_save, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %62, %57
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %66, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.23 to i64), ptr noundef inttoptr (i64 -1 to ptr), i32 noundef -1)
  store ptr %67, ptr %3, align 8, !tbaa !5
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %74

70:                                               ; preds = %65
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = call double @atof(ptr noundef %71) #6
  %73 = fptrunc double %72 to float
  store float %73, ptr @morn_network_error_thresh, align 4, !tbaa !11
  br label %74

74:                                               ; preds = %70, %65
  store i32 0, ptr %6, align 4
  br label %75

75:                                               ; preds = %74, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  %76 = load i32, ptr %6, align 4
  switch i32 %76, label %78 [
    i32 0, label %77
    i32 1, label %77
  ]

77:                                               ; preds = %75, %75
  ret void

78:                                               ; preds = %75
  unreachable
}

declare ptr @m_INIRead(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #3

declare ptr @mFileCreate(ptr noundef, ...) #1

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 "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 = { 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 = !{!"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, !12, i64 0}
!12 = !{!"float", !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"

@morn_network_para_dir = external dso_local local_unnamed_addr global ptr, align 8
@morn_network_parafile = external dso_local local_unnamed_addr global ptr, align 8
@morn_network_save = external dso_local local_unnamed_addr global i32, align 4
@morn_network_time_max = external dso_local local_unnamed_addr global i32, align 4
@morn_network_error_thresh = external dso_local local_unnamed_addr global float, align 4
@.str.12 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [9 x i8], align 1
@__FUNCTION__.NetworkPara = external hidden unnamed_addr constant [12 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [10 x i8], align 1
@morn_network_flag = external dso_local local_unnamed_addr global i32, align 4
@.str.19 = external hidden unnamed_addr constant [18 x i8], align 1
@morn_network_para_filename = external dso_local global [256 x i8], align 16
@.str.20 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [13 x i8], align 1

declare void @m_Exception(i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @NetworkPara(ptr noundef %0) local_unnamed_addr #1 {
  %2 = tail call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %0, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.16 to i64), ptr noundef nonnull inttoptr (i64 -1 to ptr), i32 noundef -1) #4
  store ptr %2, ptr @morn_network_para_dir, align 8, !tbaa !5
  %3 = icmp eq ptr %2, null
  br i1 %3, label %4, label %5

4:                                                ; preds = %1
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.12, i32 noundef 81, ptr noundef nonnull @__FUNCTION__.NetworkPara, ptr noundef nonnull @.str.17) #4
  br label %5

5:                                                ; preds = %4, %1
  %6 = tail call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %0, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.18 to i64), ptr noundef nonnull inttoptr (i64 -1 to ptr), i32 noundef -1) #4
  %7 = icmp eq ptr %6, null
  %8 = load i32, ptr @morn_network_flag, align 4
  %9 = icmp eq i32 %8, 0
  %10 = select i1 %7, i1 %9, i1 false
  br i1 %10, label %.thread, label %11

.thread:                                          ; preds = %5
  tail call void (i32, i32, ptr, i32, ptr, ptr, ...) @m_Exception(i32 noundef 1, i32 noundef -1, ptr noundef nonnull @.str.12, i32 noundef 84, ptr noundef nonnull @__FUNCTION__.NetworkPara, ptr noundef nonnull @.str.19) #4
  br label %thread-pre-split

11:                                               ; preds = %5
  br i1 %7, label %16, label %12

12:                                               ; preds = %11
  %13 = load ptr, ptr @morn_network_para_dir, align 8, !tbaa !5
  %14 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) @morn_network_para_filename, ptr noundef nonnull dereferenceable(1) @.str.20, ptr noundef %13, ptr noundef nonnull %6) #4
  %15 = tail call ptr (ptr, ...) @mFileCreate(ptr noundef nonnull @morn_network_para_filename) #4
  store ptr %15, ptr @morn_network_parafile, align 8, !tbaa !5
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %12, %.thread
  %.pr = load i32, ptr @morn_network_flag, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %thread-pre-split, %11
  %17 = phi i32 [ %.pr, %thread-pre-split ], [ %8, %11 ]
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %32, label %19

19:                                               ; preds = %16
  %20 = tail call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %0, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.21 to i64), ptr noundef nonnull inttoptr (i64 -1 to ptr), i32 noundef -1) #4
  %.not20 = icmp eq ptr %20, null
  br i1 %.not20, label %23, label %21

21:                                               ; preds = %19
  %22 = tail call i32 @atoi(ptr nocapture noundef %20) #5
  store i32 %22, ptr @morn_network_time_max, align 4, !tbaa !9
  br label %23

23:                                               ; preds = %21, %19
  %24 = tail call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %0, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.22 to i64), ptr noundef nonnull inttoptr (i64 -1 to ptr), i32 noundef -1) #4
  %.not21 = icmp eq ptr %24, null
  br i1 %.not21, label %27, label %25

25:                                               ; preds = %23
  %26 = tail call i32 @atoi(ptr nocapture noundef %24) #5
  store i32 %26, ptr @morn_network_save, align 4, !tbaa !9
  br label %27

27:                                               ; preds = %25, %23
  %28 = tail call ptr (ptr, i64, i64, ptr, ...) @m_INIRead(ptr noundef %0, i64 noundef ptrtoint (ptr @.str.15 to i64), i64 noundef ptrtoint (ptr @.str.23 to i64), ptr noundef nonnull inttoptr (i64 -1 to ptr), i32 noundef -1) #4
  %.not22 = icmp eq ptr %28, null
  br i1 %.not22, label %32, label %29

29:                                               ; preds = %27
  %30 = tail call double @atof(ptr noundef %28) #5
  %31 = fptrunc double %30 to float
  store float %31, ptr @morn_network_error_thresh, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %27, %29, %16
  ret void
}

declare ptr @m_INIRead(ptr noundef, i64 noundef, i64 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare ptr @mFileCreate(ptr noundef, ...) local_unnamed_addr #0

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

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare double @atof(ptr nocapture noundef nonnull) local_unnamed_addr #3

attributes #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 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 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { 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 = !{!"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, !12, i64 0}
!12 = !{!"float", !7, i64 0}


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