; LLVM IR from jingweizhanghuai/Morn :: test (test_log)

; 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_log_levelset = external global i32, align 4
@morn_log_level = external thread_local global i32, align 4
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

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

declare ptr @m_PropertyWrite(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare ptr @mMornObject(ptr noundef, i32 noundef) #1

; 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 void @test4() #3 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 32, ptr %1, align 4, !tbaa !5
  %2 = call ptr @mMornObject(ptr noundef @.str.11, i32 noundef -1)
  %3 = call ptr @m_PropertyWrite(ptr noundef %2, ptr noundef @.str.23, ptr noundef %1, i32 noundef 4)
  br label %4

4:                                                ; preds = %0
  %5 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %6 = icmp sge i32 16, %5
  br i1 %6, label %7, label %9

7:                                                ; preds = %4
  %8 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 16, ptr %8, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 16, ptr noundef @.str.24)
  br label %9

9:                                                ; preds = %7, %4
  br label %10

10:                                               ; preds = %9
  br label %11

11:                                               ; preds = %10
  br label %12

12:                                               ; preds = %11
  %13 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %14 = icmp sge i32 32, %13
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %16 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %16, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef @.str.25)
  br label %17

17:                                               ; preds = %15, %12
  br label %18

18:                                               ; preds = %17
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %22 = icmp sge i32 48, %21
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 48, ptr %24, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 48, ptr noundef @.str.26)
  br label %25

25:                                               ; preds = %23, %20
  br label %26

26:                                               ; preds = %25
  br label %27

27:                                               ; preds = %26
  br label %28

28:                                               ; preds = %27
  %29 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %30 = icmp sge i32 64, %29
  br i1 %30, label %31, label %33

31:                                               ; preds = %28
  %32 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %32, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef @.str.27)
  br label %33

33:                                               ; preds = %31, %28
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34
  store i32 33, ptr %1, align 4, !tbaa !5
  %36 = call ptr @mMornObject(ptr noundef @.str.11, i32 noundef -1)
  %37 = call ptr @m_PropertyWrite(ptr noundef %36, ptr noundef @.str.23, ptr noundef %1, i32 noundef 4)
  br label %38

38:                                               ; preds = %35
  %39 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %40 = icmp sge i32 16, %39
  br i1 %40, label %41, label %43

41:                                               ; preds = %38
  %42 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 16, ptr %42, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 16, ptr noundef @.str.24)
  br label %43

43:                                               ; preds = %41, %38
  br label %44

44:                                               ; preds = %43
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %48 = icmp sge i32 32, %47
  br i1 %48, label %49, label %51

49:                                               ; preds = %46
  %50 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %50, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef @.str.25)
  br label %51

51:                                               ; preds = %49, %46
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  br label %54

54:                                               ; preds = %53
  %55 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %56 = icmp sge i32 33, %55
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 33, ptr %58, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 33, ptr noundef @.str.28)
  br label %59

59:                                               ; preds = %57, %54
  br label %60

60:                                               ; preds = %59
  br label %61

61:                                               ; preds = %60
  br label %62

62:                                               ; preds = %61
  %63 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %64 = icmp sge i32 48, %63
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 48, ptr %66, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 48, ptr noundef @.str.26)
  br label %67

67:                                               ; preds = %65, %62
  br label %68

68:                                               ; preds = %67
  br label %69

69:                                               ; preds = %68
  br label %70

70:                                               ; preds = %69
  %71 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %72 = icmp sge i32 64, %71
  br i1 %72, label %73, label %75

73:                                               ; preds = %70
  %74 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %74, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef @.str.27)
  br label %75

75:                                               ; preds = %73, %70
  br label %76

76:                                               ; preds = %75
  br label %77

77:                                               ; preds = %76
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 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 }

!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"}


; 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_log_levelset = external local_unnamed_addr global i32, align 4
@morn_log_level = external thread_local local_unnamed_addr global i32, align 4
@.str.11 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.28 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

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

declare ptr @m_PropertyWrite(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @mMornObject(ptr noundef, i32 noundef) local_unnamed_addr #1

; 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 void @test4() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  store i32 32, ptr %1, align 4, !tbaa !5
  %2 = tail call ptr @mMornObject(ptr noundef nonnull @.str.11, i32 noundef -1) #4
  %3 = call ptr @m_PropertyWrite(ptr noundef %2, ptr noundef nonnull @.str.23, ptr noundef nonnull %1, i32 noundef 4) #4
  %4 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %5 = icmp slt i32 %4, 17
  br i1 %5, label %6, label %8

6:                                                ; preds = %0
  %7 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 16, ptr %7, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 16, ptr noundef nonnull @.str.24) #4
  %.pr = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %8

8:                                                ; preds = %0, %6
  %9 = phi i32 [ %4, %0 ], [ %.pr, %6 ]
  %10 = icmp slt i32 %9, 33
  br i1 %10, label %11, label %13

11:                                               ; preds = %8
  %12 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %12, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef nonnull @.str.25) #4
  %.pre = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %8, %11
  %14 = phi i32 [ %9, %8 ], [ %.pre, %11 ]
  %15 = icmp slt i32 %14, 49
  br i1 %15, label %16, label %18

16:                                               ; preds = %13
  %17 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 48, ptr %17, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 48, ptr noundef nonnull @.str.26) #4
  %.pr1 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %13, %16
  %19 = phi i32 [ %14, %13 ], [ %.pr1, %16 ]
  %20 = icmp slt i32 %19, 65
  br i1 %20, label %21, label %23

21:                                               ; preds = %18
  %22 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %22, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef nonnull @.str.27) #4
  br label %23

23:                                               ; preds = %21, %18
  store i32 33, ptr %1, align 4, !tbaa !5
  %24 = call ptr @mMornObject(ptr noundef nonnull @.str.11, i32 noundef -1) #4
  %25 = call ptr @m_PropertyWrite(ptr noundef %24, ptr noundef nonnull @.str.23, ptr noundef nonnull %1, i32 noundef 4) #4
  %26 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  %27 = icmp slt i32 %26, 17
  br i1 %27, label %28, label %30

28:                                               ; preds = %23
  %29 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 16, ptr %29, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 16, ptr noundef nonnull @.str.24) #4
  %.pr2 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %30

30:                                               ; preds = %23, %28
  %31 = phi i32 [ %26, %23 ], [ %.pr2, %28 ]
  %32 = icmp slt i32 %31, 33
  br i1 %32, label %33, label %35

33:                                               ; preds = %30
  %34 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 32, ptr %34, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 32, ptr noundef nonnull @.str.25) #4
  %.pre4 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %30, %33
  %36 = phi i32 [ %31, %30 ], [ %.pre4, %33 ]
  %37 = icmp slt i32 %36, 34
  br i1 %37, label %38, label %40

38:                                               ; preds = %35
  %39 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 33, ptr %39, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 33, ptr noundef nonnull @.str.28) #4
  %.pr3 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %40

40:                                               ; preds = %35, %38
  %41 = phi i32 [ %36, %35 ], [ %.pr3, %38 ]
  %42 = icmp slt i32 %41, 49
  br i1 %42, label %43, label %45

43:                                               ; preds = %40
  %44 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 48, ptr %44, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 48, ptr noundef nonnull @.str.26) #4
  %.pre5 = load i32, ptr @morn_log_levelset, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %40, %43
  %46 = phi i32 [ %41, %40 ], [ %.pre5, %43 ]
  %47 = icmp slt i32 %46, 65
  br i1 %47, label %48, label %50

48:                                               ; preds = %45
  %49 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @morn_log_level)
  store i32 64, ptr %49, align 4, !tbaa !5
  call void (i32, ptr, ...) @m_Log(i32 noundef 64, ptr noundef nonnull @.str.27) #4
  br label %50

50:                                               ; preds = %48, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void
}

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


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