; LLVM IR from jingweizhanghuai/Morn :: example (thread3)

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

@.str = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test1(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %4

4:                                                ; preds = %17, %1
  %5 = load i32, ptr %3, align 4, !tbaa !9
  %6 = icmp slt i32 %5, 26
  br i1 %6, label %8, label %7

7:                                                ; preds = %4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  br label %20

8:                                                ; preds = %4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = load i32, ptr %3, align 4, !tbaa !9
  %11 = sext i32 %10 to i64
  %12 = getelementptr inbounds i8, ptr %9, i64 %11
  %13 = load i8, ptr %12, align 1, !tbaa !11
  %14 = sext i8 %13 to i32
  %15 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %14)
  %16 = call i32 @usleep(i32 noundef 1000)
  br label %17

17:                                               ; preds = %8
  %18 = load i32, ptr %3, align 4, !tbaa !9
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr %3, align 4, !tbaa !9
  br label %4, !llvm.loop !12

20:                                               ; preds = %7
  ret void
}

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

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

declare i32 @usleep(i32 noundef) #2

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

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

!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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

@.str = external hidden unnamed_addr constant [27 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test1(ptr nocapture noundef readonly %0) local_unnamed_addr #0 {
  %2 = load i8, ptr %0, align 1, !tbaa !5
  %3 = sext i8 %2 to i32
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %3)
  %5 = tail call i32 @usleep(i32 noundef 1000) #3
  %6 = getelementptr inbounds i8, ptr %0, i64 1
  %7 = load i8, ptr %6, align 1, !tbaa !5
  %8 = sext i8 %7 to i32
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %8)
  %10 = tail call i32 @usleep(i32 noundef 1000) #3
  %11 = getelementptr inbounds i8, ptr %0, i64 2
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %13 = sext i8 %12 to i32
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %13)
  %15 = tail call i32 @usleep(i32 noundef 1000) #3
  %16 = getelementptr inbounds i8, ptr %0, i64 3
  %17 = load i8, ptr %16, align 1, !tbaa !5
  %18 = sext i8 %17 to i32
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %18)
  %20 = tail call i32 @usleep(i32 noundef 1000) #3
  %21 = getelementptr inbounds i8, ptr %0, i64 4
  %22 = load i8, ptr %21, align 1, !tbaa !5
  %23 = sext i8 %22 to i32
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %23)
  %25 = tail call i32 @usleep(i32 noundef 1000) #3
  %26 = getelementptr inbounds i8, ptr %0, i64 5
  %27 = load i8, ptr %26, align 1, !tbaa !5
  %28 = sext i8 %27 to i32
  %29 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %28)
  %30 = tail call i32 @usleep(i32 noundef 1000) #3
  %31 = getelementptr inbounds i8, ptr %0, i64 6
  %32 = load i8, ptr %31, align 1, !tbaa !5
  %33 = sext i8 %32 to i32
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %33)
  %35 = tail call i32 @usleep(i32 noundef 1000) #3
  %36 = getelementptr inbounds i8, ptr %0, i64 7
  %37 = load i8, ptr %36, align 1, !tbaa !5
  %38 = sext i8 %37 to i32
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %38)
  %40 = tail call i32 @usleep(i32 noundef 1000) #3
  %41 = getelementptr inbounds i8, ptr %0, i64 8
  %42 = load i8, ptr %41, align 1, !tbaa !5
  %43 = sext i8 %42 to i32
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %43)
  %45 = tail call i32 @usleep(i32 noundef 1000) #3
  %46 = getelementptr inbounds i8, ptr %0, i64 9
  %47 = load i8, ptr %46, align 1, !tbaa !5
  %48 = sext i8 %47 to i32
  %49 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %48)
  %50 = tail call i32 @usleep(i32 noundef 1000) #3
  %51 = getelementptr inbounds i8, ptr %0, i64 10
  %52 = load i8, ptr %51, align 1, !tbaa !5
  %53 = sext i8 %52 to i32
  %54 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %53)
  %55 = tail call i32 @usleep(i32 noundef 1000) #3
  %56 = getelementptr inbounds i8, ptr %0, i64 11
  %57 = load i8, ptr %56, align 1, !tbaa !5
  %58 = sext i8 %57 to i32
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %58)
  %60 = tail call i32 @usleep(i32 noundef 1000) #3
  %61 = getelementptr inbounds i8, ptr %0, i64 12
  %62 = load i8, ptr %61, align 1, !tbaa !5
  %63 = sext i8 %62 to i32
  %64 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %63)
  %65 = tail call i32 @usleep(i32 noundef 1000) #3
  %66 = getelementptr inbounds i8, ptr %0, i64 13
  %67 = load i8, ptr %66, align 1, !tbaa !5
  %68 = sext i8 %67 to i32
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %68)
  %70 = tail call i32 @usleep(i32 noundef 1000) #3
  %71 = getelementptr inbounds i8, ptr %0, i64 14
  %72 = load i8, ptr %71, align 1, !tbaa !5
  %73 = sext i8 %72 to i32
  %74 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %73)
  %75 = tail call i32 @usleep(i32 noundef 1000) #3
  %76 = getelementptr inbounds i8, ptr %0, i64 15
  %77 = load i8, ptr %76, align 1, !tbaa !5
  %78 = sext i8 %77 to i32
  %79 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %78)
  %80 = tail call i32 @usleep(i32 noundef 1000) #3
  %81 = getelementptr inbounds i8, ptr %0, i64 16
  %82 = load i8, ptr %81, align 1, !tbaa !5
  %83 = sext i8 %82 to i32
  %84 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %83)
  %85 = tail call i32 @usleep(i32 noundef 1000) #3
  %86 = getelementptr inbounds i8, ptr %0, i64 17
  %87 = load i8, ptr %86, align 1, !tbaa !5
  %88 = sext i8 %87 to i32
  %89 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %88)
  %90 = tail call i32 @usleep(i32 noundef 1000) #3
  %91 = getelementptr inbounds i8, ptr %0, i64 18
  %92 = load i8, ptr %91, align 1, !tbaa !5
  %93 = sext i8 %92 to i32
  %94 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %93)
  %95 = tail call i32 @usleep(i32 noundef 1000) #3
  %96 = getelementptr inbounds i8, ptr %0, i64 19
  %97 = load i8, ptr %96, align 1, !tbaa !5
  %98 = sext i8 %97 to i32
  %99 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %98)
  %100 = tail call i32 @usleep(i32 noundef 1000) #3
  %101 = getelementptr inbounds i8, ptr %0, i64 20
  %102 = load i8, ptr %101, align 1, !tbaa !5
  %103 = sext i8 %102 to i32
  %104 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %103)
  %105 = tail call i32 @usleep(i32 noundef 1000) #3
  %106 = getelementptr inbounds i8, ptr %0, i64 21
  %107 = load i8, ptr %106, align 1, !tbaa !5
  %108 = sext i8 %107 to i32
  %109 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %108)
  %110 = tail call i32 @usleep(i32 noundef 1000) #3
  %111 = getelementptr inbounds i8, ptr %0, i64 22
  %112 = load i8, ptr %111, align 1, !tbaa !5
  %113 = sext i8 %112 to i32
  %114 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %113)
  %115 = tail call i32 @usleep(i32 noundef 1000) #3
  %116 = getelementptr inbounds i8, ptr %0, i64 23
  %117 = load i8, ptr %116, align 1, !tbaa !5
  %118 = sext i8 %117 to i32
  %119 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %118)
  %120 = tail call i32 @usleep(i32 noundef 1000) #3
  %121 = getelementptr inbounds i8, ptr %0, i64 24
  %122 = load i8, ptr %121, align 1, !tbaa !5
  %123 = sext i8 %122 to i32
  %124 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %123)
  %125 = tail call i32 @usleep(i32 noundef 1000) #3
  %126 = getelementptr inbounds i8, ptr %0, i64 25
  %127 = load i8, ptr %126, align 1, !tbaa !5
  %128 = sext i8 %127 to i32
  %129 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %128)
  %130 = tail call i32 @usleep(i32 noundef 1000) #3
  ret void
}

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

declare i32 @usleep(i32 noundef) local_unnamed_addr #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 = { 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 = { "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 }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


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