; LLVM IR from lolosssss/leetcode :: c (65_valid_number)

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

@__const.main.s1 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.main.s2 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.main.s3 = external hidden unnamed_addr constant [4 x i8], align 1
@__const.main.s4 = external hidden unnamed_addr constant [4 x i8], align 1
@__const.main.s5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @isNumber(ptr noundef) #0

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [2 x i8], align 1
  %3 = alloca [5 x i8], align 1
  %4 = alloca [4 x i8], align 1
  %5 = alloca [4 x i8], align 1
  %6 = alloca [5 x i8], align 1
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 2, ptr %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %2, ptr align 1 @__const.main.s1, i64 2, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %3) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %3, ptr align 1 @__const.main.s2, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %4, ptr align 1 @__const.main.s3, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %5, ptr align 1 @__const.main.s4, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 5, ptr %6) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %6, ptr align 1 @__const.main.s5, i64 5, i1 false)
  %7 = getelementptr inbounds [2 x i8], ptr %2, i64 0, i64 0
  %8 = call zeroext i1 @isNumber(ptr noundef %7)
  %9 = zext i1 %8 to i32
  %10 = icmp eq i32 %9, 1
  br i1 %10, label %11, label %14

11:                                               ; preds = %0
  %12 = getelementptr inbounds [2 x i8], ptr %2, i64 0, i64 0
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %12)
  br label %17

14:                                               ; preds = %0
  %15 = getelementptr inbounds [2 x i8], ptr %2, i64 0, i64 0
  %16 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %15)
  br label %17

17:                                               ; preds = %14, %11
  %18 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 0
  %19 = call zeroext i1 @isNumber(ptr noundef %18)
  %20 = zext i1 %19 to i32
  %21 = icmp eq i32 %20, 1
  br i1 %21, label %22, label %25

22:                                               ; preds = %17
  %23 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 0
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %23)
  br label %28

25:                                               ; preds = %17
  %26 = getelementptr inbounds [5 x i8], ptr %3, i64 0, i64 0
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %26)
  br label %28

28:                                               ; preds = %25, %22
  %29 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %30 = call zeroext i1 @isNumber(ptr noundef %29)
  %31 = zext i1 %30 to i32
  %32 = icmp eq i32 %31, 1
  br i1 %32, label %33, label %36

33:                                               ; preds = %28
  %34 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %34)
  br label %39

36:                                               ; preds = %28
  %37 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %37)
  br label %39

39:                                               ; preds = %36, %33
  %40 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 0
  %41 = call zeroext i1 @isNumber(ptr noundef %40)
  %42 = zext i1 %41 to i32
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %44, label %47

44:                                               ; preds = %39
  %45 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 0
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %45)
  br label %50

47:                                               ; preds = %39
  %48 = getelementptr inbounds [4 x i8], ptr %5, i64 0, i64 0
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %48)
  br label %50

50:                                               ; preds = %47, %44
  %51 = getelementptr inbounds [5 x i8], ptr %6, i64 0, i64 0
  %52 = call zeroext i1 @isNumber(ptr noundef %51)
  %53 = zext i1 %52 to i32
  %54 = icmp eq i32 %53, 1
  br i1 %54, label %55, label %58

55:                                               ; preds = %50
  %56 = getelementptr inbounds [5 x i8], ptr %6, i64 0, i64 0
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %56)
  br label %61

58:                                               ; preds = %50
  %59 = getelementptr inbounds [5 x i8], ptr %6, i64 0, i64 0
  %60 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, ptr noundef %59)
  br label %61

61:                                               ; preds = %58, %55
  call void @llvm.lifetime.end.p0(i64 5, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %2) #4
  ret i32 0
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

declare i32 @printf(ptr noundef, ...) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { "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)"}


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

@__const.main.s1 = external hidden unnamed_addr constant [2 x i8], align 1
@__const.main.s2 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.main.s3 = external hidden unnamed_addr constant [4 x i8], align 1
@__const.main.s4 = external hidden unnamed_addr constant [4 x i8], align 1
@__const.main.s5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str = external hidden unnamed_addr constant [12 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @isNumber(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) #1

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca [2 x i8], align 2
  %2 = alloca [5 x i8], align 1
  %3 = alloca [4 x i8], align 4
  %4 = alloca [4 x i8], align 4
  %5 = alloca [5 x i8], align 1
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %1) #4
  %6 = load i16, ptr @__const.main.s1, align 1
  store i16 %6, ptr %1, align 2
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %2) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %2, ptr noundef nonnull align 1 dereferenceable(5) @__const.main.s2, i64 5, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %7 = load i32, ptr @__const.main.s3, align 1
  store i32 %7, ptr %3, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %8 = load i32, ptr @__const.main.s4, align 1
  store i32 %8, ptr %4, align 4
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %5) #4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %5, ptr noundef nonnull align 1 dereferenceable(5) @__const.main.s5, i64 5, i1 false)
  %9 = call zeroext i1 @isNumber(ptr noundef nonnull %1)
  %.str..str.1 = select i1 %9, ptr @.str, ptr @.str.1
  %10 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str..str.1, ptr noundef nonnull %1)
  %11 = call zeroext i1 @isNumber(ptr noundef nonnull %2)
  %.str.1.sink1 = select i1 %11, ptr @.str, ptr @.str.1
  %12 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink1, ptr noundef nonnull %2)
  %13 = call zeroext i1 @isNumber(ptr noundef nonnull %3)
  %.str.1.sink2 = select i1 %13, ptr @.str, ptr @.str.1
  %14 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink2, ptr noundef nonnull %3)
  %15 = call zeroext i1 @isNumber(ptr noundef nonnull %4)
  %.str.1.sink3 = select i1 %15, ptr @.str, ptr @.str.1
  %16 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink3, ptr noundef nonnull %4)
  %17 = call zeroext i1 @isNumber(ptr noundef nonnull %5)
  %.str.1.sink4 = select i1 %17, ptr @.str, ptr @.str.1
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.1.sink4, ptr noundef nonnull %5)
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %1) #4
  ret i32 0
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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)"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass