; LLVM IR from reworks-org/galaxy :: deps/sfml_deps/freetype-src/tests/issue-1063 (main)

; 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 [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [4096 x i8], align 16
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  store ptr null, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %10 = call ptr @getenv(ptr noundef @.str) #4
  store ptr %10, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4096, ptr %5) #4
  %11 = getelementptr inbounds [4096 x i8], ptr %5, i64 0, i64 0
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %16

14:                                               ; preds = %0
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  br label %17

16:                                               ; preds = %0
  br label %17

17:                                               ; preds = %16, %14
  %18 = phi ptr [ %15, %14 ], [ @.str.2, %16 ]
  %19 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef %11, i64 noundef 4096, ptr noundef @.str.1, ptr noundef %18, ptr noundef @.str.3) #4
  %20 = call i32 @FT_Init_FreeType(ptr noundef %2)
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = getelementptr inbounds [4096 x i8], ptr %5, i64 0, i64 0
  %23 = call i32 @FT_New_Face(ptr noundef %21, ptr noundef %22, i64 noundef 0, ptr noundef %3)
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %29

25:                                               ; preds = %17
  %26 = load ptr, ptr @stderr, align 8, !tbaa !5
  %27 = getelementptr inbounds [4096 x i8], ptr %5, i64 0, i64 0
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.4, ptr noundef %27) #4
  store i32 1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %53

29:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 59, ptr %7, align 8, !tbaa !9
  br label %30

30:                                               ; preds = %49, %29
  %31 = load i64, ptr %7, align 8, !tbaa !9
  %32 = icmp ult i64 %31, 171
  br i1 %32, label %34, label %33

33:                                               ; preds = %30
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %52

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = load i64, ptr %7, align 8, !tbaa !9
  %37 = call i32 @FT_Get_Char_Index(ptr noundef %35, i64 noundef %36)
  store i32 %37, ptr %8, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = load i32, ptr %8, align 4, !tbaa !11
  %40 = call i32 @FT_Load_Glyph(ptr noundef %38, i32 noundef %39, i32 noundef 0)
  store i32 %40, ptr %9, align 4, !tbaa !11
  %41 = load i32, ptr %9, align 4, !tbaa !11
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %43, label %48

43:                                               ; preds = %34
  %44 = load i32, ptr %9, align 4, !tbaa !11
  %45 = load i64, ptr %7, align 8, !tbaa !9
  %46 = load i32, ptr %8, align 4, !tbaa !11
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %44, i64 noundef %45, i32 noundef %46)
  br label %48

48:                                               ; preds = %43, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  br label %49

49:                                               ; preds = %48
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = add i64 %50, 1
  store i64 %51, ptr %7, align 8, !tbaa !9
  br label %30, !llvm.loop !13

52:                                               ; preds = %33
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %53

53:                                               ; preds = %52, %25
  call void @llvm.lifetime.end.p0(i64 4096, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  %54 = load i32, ptr %1, align 4
  ret i32 %54
}

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

; Function Attrs: nounwind
declare ptr @getenv(ptr noundef) #2

; Function Attrs: nounwind
declare i32 @snprintf(ptr noundef, i64 noundef, ptr noundef, ...) #2

declare i32 @FT_Init_FreeType(ptr noundef) #3

declare i32 @FT_New_Face(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #3

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

declare i32 @FT_Get_Char_Index(ptr noundef, i64 noundef) #3

declare i32 @FT_Load_Glyph(ptr noundef, i32 noundef, i32 noundef) #3

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

; 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 = { 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 = { "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"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 [24 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [19 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [33 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main() local_unnamed_addr #0 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca [4096 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store ptr null, ptr %2, align 8, !tbaa !5
  %4 = tail call ptr @getenv(ptr noundef nonnull @.str) #5
  call void @llvm.lifetime.start.p0(i64 4096, ptr nonnull %3) #5
  %.not = icmp eq ptr %4, null
  %5 = select i1 %.not, ptr @.str.2, ptr %4
  %6 = call i32 (ptr, i64, ptr, ...) @snprintf(ptr noundef nonnull dereferenceable(1) %3, i64 noundef 4096, ptr noundef nonnull @.str.1, ptr noundef nonnull %5, ptr noundef nonnull @.str.3) #5
  %7 = call i32 @FT_Init_FreeType(ptr noundef nonnull %1) #5
  %8 = load ptr, ptr %1, align 8, !tbaa !5
  %9 = call i32 @FT_New_Face(ptr noundef %8, ptr noundef nonnull %3, i64 noundef 0, ptr noundef nonnull %2) #5
  %.not12 = icmp eq i32 %9, 0
  br i1 %.not12, label %.preheader, label %10

10:                                               ; preds = %0
  %11 = load ptr, ptr @stderr, align 8, !tbaa !5
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.4, ptr noundef nonnull %3) #6
  br label %.loopexit

.preheader:                                       ; preds = %0, %19
  %.01014 = phi i64 [ %20, %19 ], [ 59, %0 ]
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = call i32 @FT_Get_Char_Index(ptr noundef %13, i64 noundef %.01014) #5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = call i32 @FT_Load_Glyph(ptr noundef %15, i32 noundef %14, i32 noundef 0) #5
  %.not13 = icmp eq i32 %16, 0
  br i1 %.not13, label %19, label %17

17:                                               ; preds = %.preheader
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %16, i64 noundef %.01014, i32 noundef %14)
  br label %19

19:                                               ; preds = %17, %.preheader
  %20 = add nuw nsw i64 %.01014, 1
  %exitcond.not = icmp eq i64 %20, 171
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !9

.loopexit:                                        ; preds = %19, %10
  %.0 = phi i32 [ 1, %10 ], [ 0, %19 ]
  call void @llvm.lifetime.end.p0(i64 4096, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  ret i32 %.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: nofree nounwind memory(read)
declare noundef ptr @getenv(ptr nocapture noundef) local_unnamed_addr #2

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

declare i32 @FT_Init_FreeType(ptr noundef) local_unnamed_addr #4

declare i32 @FT_New_Face(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #4

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

declare i32 @FT_Get_Char_Index(ptr noundef, i64 noundef) local_unnamed_addr #4

declare i32 @FT_Load_Glyph(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nofree nounwind memory(read) "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 = { 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 = { "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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass