; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
; RUN: llc -global-isel %s -o - | FileCheck %s
target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
target triple = "arm64-apple-macosx14.0.0"

define void @test() {
; CHECK-LABEL: test:
; CHECK:       ; %bb.0: ; %entry
; CHECK-NEXT:    sub sp, sp, #32
; CHECK-NEXT:    stp x29, x30, [sp, #16] ; 16-byte Folded Spill
; CHECK-NEXT:    .cfi_def_cfa_offset 32
; CHECK-NEXT:    .cfi_offset w30, -8
; CHECK-NEXT:    .cfi_offset w29, -16
; CHECK-NEXT:    mov x0, xzr
; CHECK-NEXT:    mov x1, xzr
; CHECK-NEXT:    ldr x8, [x0]
; CHECK-NEXT:    ldr w9, [x8], #8
; CHECK-NEXT:    str x8, [x0]
; CHECK-NEXT:    str x9, [sp]
; CHECK-NEXT:    bl _sprintf
; CHECK-NEXT:    ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
; CHECK-NEXT:    add sp, sp, #32
; CHECK-NEXT:    ret
entry:
  %0 = va_arg ptr null, i32
  %sprintf1776 = tail call i32 (ptr, ptr, ...) @sprintf(ptr null, ptr null, i32 %0)
  ret void
}

declare i32 @sprintf(ptr, ptr, ...)
