; LLVM IR from caryll/otfcc :: lib/libcff (charstring-il)

; 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.cff_CharstringIL = type { i32, i32, ptr }
%struct.cff_CharstringInstruction = type { i32, i32, %union.anon }
%union.anon = type { double }

; Function Attrs: nounwind uwtable
define dso_local void @il_push_operand(ptr noundef %0, double noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  call void @ensureThereIsSpace(ptr noundef %5)
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.cff_CharstringIL, ptr %6, i32 0, i32 2
  %8 = load ptr, ptr %7, align 8, !tbaa !11
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.cff_CharstringIL, ptr %9, i32 0, i32 0
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %8, i64 %12
  %14 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %13, i32 0, i32 0
  store i32 0, ptr %14, align 8, !tbaa !15
  %15 = load double, ptr %4, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.cff_CharstringIL, ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.cff_CharstringIL, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !14
  %22 = zext i32 %21 to i64
  %23 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %18, i64 %22
  %24 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %23, i32 0, i32 2
  store double %15, ptr %24, align 8, !tbaa !17
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.cff_CharstringIL, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.cff_CharstringIL, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 8, !tbaa !14
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %27, i64 %31
  %33 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %32, i32 0, i32 1
  store i32 0, ptr %33, align 4, !tbaa !18
  %34 = load ptr, ptr %3, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.cff_CharstringIL, ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !14
  %37 = add i32 %36, 1
  store i32 %37, ptr %35, align 8, !tbaa !14
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.cff_CharstringIL, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 4, !tbaa !19
  %41 = add i32 %40, -1
  store i32 %41, ptr %39, align 4, !tbaa !19
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @ensureThereIsSpace(ptr noundef) #0

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

!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 = !{!"double", !7, i64 0}
!11 = !{!12, !6, i64 8}
!12 = !{!"", !13, i64 0, !13, i64 4, !6, i64 8}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !13, i64 0}
!15 = !{!16, !13, i64 0}
!16 = !{!"", !13, i64 0, !13, i64 4, !7, i64 8}
!17 = !{!7, !7, i64 0}
!18 = !{!16, !13, i64 4}
!19 = !{!12, !13, i64 4}


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

%struct.cff_CharstringInstruction = type { i32, i32, %union.anon }
%union.anon = type { double }

; Function Attrs: nounwind uwtable
define dso_local void @il_push_operand(ptr noundef %0, double noundef %1) local_unnamed_addr #0 {
  tail call void @ensureThereIsSpace(ptr noundef %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = load i32, ptr %0, align 8, !tbaa !11
  %6 = zext i32 %5 to i64
  %7 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %4, i64 %6
  store i32 0, ptr %7, align 8, !tbaa !12
  %8 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %4, i64 %6, i32 2
  store double %1, ptr %8, align 8, !tbaa !14
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = load <2 x i32>, ptr %0, align 8, !tbaa !15
  %11 = extractelement <2 x i32> %10, i64 0
  %12 = zext i32 %11 to i64
  %13 = getelementptr inbounds %struct.cff_CharstringInstruction, ptr %9, i64 %12, i32 1
  store i32 0, ptr %13, align 4, !tbaa !16
  %14 = add <2 x i32> %10, <i32 1, i32 -1>
  store <2 x i32> %14, ptr %0, align 8, !tbaa !15
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @ensureThereIsSpace(ptr noundef) local_unnamed_addr #0

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

!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, !10, i64 8}
!6 = !{!"", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"", !7, i64 0, !7, i64 4, !8, i64 8}
!14 = !{!8, !8, i64 0}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !7, i64 4}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,SLPVectorizerPass,SROAPass,TailCallElimPass