; LLVM IR from ClementineAccount/Albuquerque :: src/HelloSDL (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"

%struct.stbtt_pack_context = type { ptr, ptr, i32, i32, i32, i32, i32, i32, i32, ptr, ptr }

; 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @stbrp_init_target(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13nk_stbtt_freePvS_(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef, ptr noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local i32 @stbtt_PackBegin(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6) #3 {
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  store ptr %0, ptr %9, align 8, !tbaa !5
  store ptr %1, ptr %10, align 8, !tbaa !5
  store i32 %2, ptr %11, align 4, !tbaa !9
  store i32 %3, ptr %12, align 4, !tbaa !9
  store i32 %4, ptr %13, align 4, !tbaa !9
  store i32 %5, ptr %14, align 4, !tbaa !9
  store ptr %6, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %20 = load ptr, ptr %15, align 8, !tbaa !5
  %21 = call noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef 72, ptr noundef %20)
  store ptr %21, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %22 = load i32, ptr %11, align 4, !tbaa !9
  %23 = load i32, ptr %14, align 4, !tbaa !9
  %24 = sub nsw i32 %22, %23
  store i32 %24, ptr %17, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #4
  %25 = load i32, ptr %17, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = mul i64 16, %26
  %28 = load ptr, ptr %15, align 8, !tbaa !5
  %29 = call noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef %27, ptr noundef %28)
  store ptr %29, ptr %18, align 8, !tbaa !5
  %30 = load ptr, ptr %16, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  br i1 %31, label %35, label %32

32:                                               ; preds = %7
  %33 = load ptr, ptr %18, align 8, !tbaa !5
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %48

35:                                               ; preds = %32, %7
  %36 = load ptr, ptr %16, align 8, !tbaa !5
  %37 = icmp ne ptr %36, null
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load ptr, ptr %16, align 8, !tbaa !5
  %40 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZL13nk_stbtt_freePvS_(ptr noundef %39, ptr noundef %40)
  br label %41

41:                                               ; preds = %38, %35
  %42 = load ptr, ptr %18, align 8, !tbaa !5
  %43 = icmp ne ptr %42, null
  br i1 %43, label %44, label %47

44:                                               ; preds = %41
  %45 = load ptr, ptr %18, align 8, !tbaa !5
  %46 = load ptr, ptr %15, align 8, !tbaa !5
  call void @_ZL13nk_stbtt_freePvS_(ptr noundef %45, ptr noundef %46)
  br label %47

47:                                               ; preds = %44, %41
  store i32 0, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %104

48:                                               ; preds = %32
  %49 = load ptr, ptr %15, align 8, !tbaa !5
  %50 = load ptr, ptr %9, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.stbtt_pack_context, ptr %50, i32 0, i32 0
  store ptr %49, ptr %51, align 8, !tbaa !11
  %52 = load i32, ptr %11, align 4, !tbaa !9
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.stbtt_pack_context, ptr %53, i32 0, i32 2
  store i32 %52, ptr %54, align 8, !tbaa !13
  %55 = load i32, ptr %12, align 4, !tbaa !9
  %56 = load ptr, ptr %9, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.stbtt_pack_context, ptr %56, i32 0, i32 3
  store i32 %55, ptr %57, align 4, !tbaa !14
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.stbtt_pack_context, ptr %59, i32 0, i32 9
  store ptr %58, ptr %60, align 8, !tbaa !15
  %61 = load ptr, ptr %16, align 8, !tbaa !5
  %62 = load ptr, ptr %9, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.stbtt_pack_context, ptr %62, i32 0, i32 1
  store ptr %61, ptr %63, align 8, !tbaa !16
  %64 = load ptr, ptr %18, align 8, !tbaa !5
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.stbtt_pack_context, ptr %65, i32 0, i32 10
  store ptr %64, ptr %66, align 8, !tbaa !17
  %67 = load i32, ptr %14, align 4, !tbaa !9
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.stbtt_pack_context, ptr %68, i32 0, i32 5
  store i32 %67, ptr %69, align 4, !tbaa !18
  %70 = load i32, ptr %13, align 4, !tbaa !9
  %71 = icmp ne i32 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %48
  %73 = load i32, ptr %13, align 4, !tbaa !9
  br label %76

74:                                               ; preds = %48
  %75 = load i32, ptr %11, align 4, !tbaa !9
  br label %76

76:                                               ; preds = %74, %72
  %77 = phi i32 [ %73, %72 ], [ %75, %74 ]
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.stbtt_pack_context, ptr %78, i32 0, i32 4
  store i32 %77, ptr %79, align 8, !tbaa !19
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.stbtt_pack_context, ptr %80, i32 0, i32 7
  store i32 1, ptr %81, align 4, !tbaa !20
  %82 = load ptr, ptr %9, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.stbtt_pack_context, ptr %82, i32 0, i32 8
  store i32 1, ptr %83, align 8, !tbaa !21
  %84 = load ptr, ptr %9, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.stbtt_pack_context, ptr %84, i32 0, i32 6
  store i32 0, ptr %85, align 8, !tbaa !22
  %86 = load ptr, ptr %16, align 8, !tbaa !5
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = load i32, ptr %14, align 4, !tbaa !9
  %89 = sub nsw i32 %87, %88
  %90 = load i32, ptr %12, align 4, !tbaa !9
  %91 = load i32, ptr %14, align 4, !tbaa !9
  %92 = sub nsw i32 %90, %91
  %93 = load ptr, ptr %18, align 8, !tbaa !5
  %94 = load i32, ptr %17, align 4, !tbaa !9
  call void @stbrp_init_target(ptr noundef %86, i32 noundef %89, i32 noundef %92, ptr noundef %93, i32 noundef %94)
  %95 = load ptr, ptr %10, align 8, !tbaa !5
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %103

97:                                               ; preds = %76
  %98 = load ptr, ptr %10, align 8, !tbaa !5
  %99 = load i32, ptr %11, align 4, !tbaa !9
  %100 = load i32, ptr %12, align 4, !tbaa !9
  %101 = mul nsw i32 %99, %100
  %102 = sext i32 %101 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %98, i8 0, i64 %102, i1 false)
  br label %103

103:                                              ; preds = %97, %76
  store i32 1, ptr %8, align 4
  store i32 1, ptr %19, align 4
  br label %104

104:                                              ; preds = %103, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %105 = load i32, ptr %8, align 4
  ret i32 %105
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress 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 = { mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"_ZTS18stbtt_pack_context", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !6, i64 48, !6, i64 56}
!13 = !{!12, !10, i64 16}
!14 = !{!12, !10, i64 20}
!15 = !{!12, !6, i64 48}
!16 = !{!12, !6, i64 8}
!17 = !{!12, !6, i64 56}
!18 = !{!12, !10, i64 28}
!19 = !{!12, !10, i64 24}
!20 = !{!12, !10, i64 36}
!21 = !{!12, !10, i64 40}
!22 = !{!12, !10, i64 32}


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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @stbrp_init_target(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare hidden void @_ZL13nk_stbtt_freePvS_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local range(i32 0, 2) i32 @stbtt_PackBegin(ptr nocapture noundef writeonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, i32 noundef %4, i32 noundef %5, ptr noundef %6) local_unnamed_addr #2 {
  %8 = tail call noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef 72, ptr noundef %6)
  %9 = sub nsw i32 %2, %5
  %10 = sext i32 %9 to i64
  %11 = shl nsw i64 %10, 4
  %12 = tail call noundef ptr @_ZL15nk_stbtt_mallocmPv(i64 noundef %11, ptr noundef %6)
  %13 = icmp eq ptr %8, null
  %14 = icmp eq ptr %12, null
  %or.cond = or i1 %13, %14
  br i1 %or.cond, label %15, label %19

15:                                               ; preds = %7
  br i1 %13, label %17, label %16

16:                                               ; preds = %15
  tail call void @_ZL13nk_stbtt_freePvS_(ptr noundef nonnull %8, ptr noundef %6)
  br label %17

17:                                               ; preds = %16, %15
  br i1 %14, label %35, label %18

18:                                               ; preds = %17
  tail call void @_ZL13nk_stbtt_freePvS_(ptr noundef nonnull %12, ptr noundef %6)
  br label %35

19:                                               ; preds = %7
  store ptr %6, ptr %0, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 %2, ptr %20, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %3, ptr %21, align 4, !tbaa !12
  %22 = getelementptr inbounds i8, ptr %0, i64 48
  store ptr %1, ptr %22, align 8, !tbaa !13
  %23 = getelementptr inbounds i8, ptr %0, i64 8
  store ptr %8, ptr %23, align 8, !tbaa !14
  %24 = getelementptr inbounds i8, ptr %0, i64 56
  store ptr %12, ptr %24, align 8, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %0, i64 28
  store i32 %5, ptr %25, align 4, !tbaa !16
  %.not = icmp eq i32 %4, 0
  %26 = select i1 %.not, i32 %2, i32 %4
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  store i32 %26, ptr %27, align 8, !tbaa !17
  %28 = getelementptr inbounds i8, ptr %0, i64 36
  store i32 1, ptr %28, align 4, !tbaa !18
  %29 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 1, ptr %29, align 8, !tbaa !19
  %30 = getelementptr inbounds i8, ptr %0, i64 32
  store i32 0, ptr %30, align 8, !tbaa !20
  %31 = sub nsw i32 %3, %5
  tail call void @stbrp_init_target(ptr noundef nonnull %8, i32 noundef %9, i32 noundef %31, ptr noundef nonnull %12, i32 noundef %9)
  %.not50 = icmp eq ptr %1, null
  br i1 %.not50, label %35, label %32

32:                                               ; preds = %19
  %33 = mul nsw i32 %3, %2
  %34 = sext i32 %33 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 %1, i8 0, i64 %34, i1 false)
  br label %35

35:                                               ; preds = %19, %32, %17, %18
  %.0 = phi i32 [ 0, %18 ], [ 0, %17 ], [ 1, %32 ], [ 1, %19 ]
  ret i32 %.0
}

attributes #0 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { mustprogress 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 = { mustprogress 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" }

!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, !7, i64 0}
!6 = !{!"_ZTS18stbtt_pack_context", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !7, i64 48, !7, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 16}
!12 = !{!6, !10, i64 20}
!13 = !{!6, !7, i64 48}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 56}
!16 = !{!6, !10, i64 28}
!17 = !{!6, !10, i64 24}
!18 = !{!6, !10, i64 36}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !10, i64 32}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass