Program: ackermann

x86 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ack                            ## -- Begin function ack
	.p2align	4, 0x90
_ack:                                   ## @ack
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	subq	$16, %rsp
	movl	%edi, -8(%rbp)
	movl	%esi, -12(%rbp)
	movl	_depth(%rip), %eax
	addl	$1, %eax
	movl	%eax, _depth(%rip)
	cmpl	$16777215, _depth(%rip)         ## imm = 0xFFFFFF
	jbe	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rdi
	movl	$16777215, %esi                 ## imm = 0xFFFFFF
	movb	$0, %al
	callq	_libmin_printf
	movl	$1, %edi
	callq	_libmin_fail
LBB0_2:
	cmpl	$65535, -8(%rbp)                ## imm = 0xFFFF
	jb	LBB0_4
## %bb.3:
	leaq	L_.str.1(%rip), %rdi
	movl	$65535, %esi                    ## imm = 0xFFFF
	movb	$0, %al
	callq	_libmin_printf
	movl	$1, %edi
	callq	_libmin_fail
LBB0_4:
	cmpl	$16, -12(%rbp)
	jb	LBB0_6
## %bb.5:
	leaq	L_.str.2(%rip), %rdi
	movl	$16, %esi
	movb	$0, %al
	callq	_libmin_printf
	movl	$1, %edi
	callq	_libmin_fail
LBB0_6:
	movl	-8(%rbp), %eax
	movl	%eax, %ecx
	leaq	_a(%rip), %rax
	shlq	$6, %rcx
	addq	%rcx, %rax
	movl	-12(%rbp), %ecx
                                        ## kill: def $rcx killed $ecx
	cmpl	$0, (%rax,%rcx,4)
	je	LBB0_8
## %bb.7:
	movl	-8(%rbp), %eax
	movl	%eax, %ecx
	leaq	_a(%rip), %rax
	shlq	$6, %rcx
	addq	%rcx, %rax
	movl	-12(%rbp), %ecx
                                        ## kill: def $rcx killed $ecx
	movl	(%rax,%rcx,4), %eax
	movl	%eax, -4(%rbp)
	jmp	LBB0_13
LBB0_8:
	cmpl	$0, -12(%rbp)
	jne	LBB0_10
## %bb.9:
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	-8(%rbp), %ecx
	movl	%ecx, %edx
	leaq	_a(%rip), %rcx
	shlq	$6, %rdx
	addq	%rdx, %rcx
	movl	%eax, (%rcx)
	movl	%eax, -4(%rbp)
	jmp	LBB0_13
LBB0_10:
	cmpl	$0, -8(%rbp)
	jne	LBB0_12
## %bb.11:
	movl	-12(%rbp), %esi
	subl	$1, %esi
	movl	$1, %edi
	callq	_ack
	movl	-12(%rbp), %ecx
	movl	%ecx, %edx
	leaq	_a(%rip), %rcx
	movl	%eax, (%rcx,%rdx,4)
	movl	%eax, -4(%rbp)
	jmp	LBB0_13
LBB0_12:
	movl	-8(%rbp), %edi
	subl	$1, %edi
	movl	-12(%rbp), %esi
	callq	_ack
	movl	%eax, %edi
	movl	-12(%rbp), %esi
	subl	$1, %esi
	callq	_ack
	movl	-8(%rbp), %ecx
	movl	%ecx, %edx
	leaq	_a(%rip), %rcx
	shlq	$6, %rdx
	addq	%rdx, %rcx
	movl	-12(%rbp), %edx
                                        ## kill: def $rdx killed $edx
	movl	%eax, (%rcx,%rdx,4)
	movl	%eax, -4(%rbp)
LBB0_13:
	movl	-4(%rbp), %eax
	addq	$16, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.globl	_main                           ## -- Begin function main
	.p2align	4, 0x90
_main:                                  ## @main
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	subq	$32, %rsp
	movl	$0, -4(%rbp)
	movl	$0, _max_depth(%rip)
	movl	$0, -12(%rbp)
LBB1_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB1_3 Depth 2
	cmpl	$5, -12(%rbp)
	ja	LBB1_10
## %bb.2:                               ##   in Loop: Header=BB1_1 Depth=1
	movl	-12(%rbp), %esi
	leaq	L_.str.3(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movl	$0, -8(%rbp)
LBB1_3:                                 ##   Parent Loop BB1_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	-8(%rbp), %eax
	cmpl	-12(%rbp), %eax
	ja	LBB1_8
## %bb.4:                               ##   in Loop: Header=BB1_3 Depth=2
	movl	$0, _depth(%rip)
	movl	-12(%rbp), %eax
	subl	-8(%rbp), %eax
	movl	%eax, -20(%rbp)                 ## 4-byte Spill
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)                 ## 4-byte Spill
	movl	-12(%rbp), %edi
	subl	-8(%rbp), %edi
	movl	-8(%rbp), %esi
	callq	_ack
	movl	-20(%rbp), %esi                 ## 4-byte Reload
	movl	-16(%rbp), %edx                 ## 4-byte Reload
	movl	%eax, %ecx
	leaq	L_.str.4(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movl	_depth(%rip), %eax
	cmpl	_max_depth(%rip), %eax
	jbe	LBB1_6
## %bb.5:                               ##   in Loop: Header=BB1_3 Depth=2
	movl	_depth(%rip), %eax
	movl	%eax, _max_depth(%rip)
LBB1_6:                                 ##   in Loop: Header=BB1_3 Depth=2
	jmp	LBB1_7
LBB1_7:                                 ##   in Loop: Header=BB1_3 Depth=2
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	LBB1_3
LBB1_8:                                 ##   in Loop: Header=BB1_1 Depth=1
	jmp	LBB1_9
LBB1_9:                                 ##   in Loop: Header=BB1_1 Depth=1
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	LBB1_1
LBB1_10:
	movl	_max_depth(%rip), %esi
	leaq	L_.str.5(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	callq	_libmin_success
	xorl	%eax, %eax
	addq	$32, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_depth,4,2       ## @depth
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Maximum stack depth %d exceeded. Abort.\n"

L_.str.1:                               ## @.str.1
	.asciz	"Maximum x value %d exceeded. Abort. \n"

L_.str.2:                               ## @.str.2
	.asciz	"Maximum y value %d exceeded. Abort. \n"

.zerofill __DATA,__bss,_a,4194240,4     ## @a
.zerofill __DATA,__bss,_max_depth,4,2   ## @max_depth
L_.str.3:                               ## @.str.3
	.asciz	"\nx+y=%d:\n\n"

L_.str.4:                               ## @.str.4
	.asciz	"A(%d,%d) = %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"Max recursive depth = %u\n"

.subsections_via_symbols


ARM64 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ack                            ; -- Begin function ack
	.p2align	2
_ack:                                   ; @ack
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	stur	w0, [x29, #-8]
	stur	w1, [x29, #-12]
	adrp	x8, _depth@PAGE
	ldr	w9, [x8, _depth@PAGEOFF]
	add	w9, w9, #1
	str	w9, [x8, _depth@PAGEOFF]
	ldr	w8, [x8, _depth@PAGEOFF]
	mov	w9, #16777215
	subs	w8, w8, w9
	cset	w8, ls
	tbnz	w8, #0, LBB0_2
	b	LBB0_1
LBB0_1:
	mov	x9, sp
	mov	x8, #16777215
	str	x8, [x9]
	adrp	x0, l_.str@PAGE
	add	x0, x0, l_.str@PAGEOFF
	bl	_libmin_printf
	mov	w0, #1
	bl	_libmin_fail
	b	LBB0_2
LBB0_2:
	ldur	w8, [x29, #-8]
	mov	w9, #65535
	subs	w8, w8, w9
	cset	w8, lo
	tbnz	w8, #0, LBB0_4
	b	LBB0_3
LBB0_3:
	mov	x9, sp
	mov	x8, #65535
	str	x8, [x9]
	adrp	x0, l_.str.1@PAGE
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_libmin_printf
	mov	w0, #1
	bl	_libmin_fail
	b	LBB0_4
LBB0_4:
	ldur	w8, [x29, #-12]
	subs	w8, w8, #16
	cset	w8, lo
	tbnz	w8, #0, LBB0_6
	b	LBB0_5
LBB0_5:
	mov	x9, sp
	mov	x8, #16
	str	x8, [x9]
	adrp	x0, l_.str.2@PAGE
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_libmin_printf
	mov	w0, #1
	bl	_libmin_fail
	b	LBB0_6
LBB0_6:
	ldur	w8, [x29, #-8]
	mov	x9, x8
	adrp	x8, _a@PAGE
	add	x8, x8, _a@PAGEOFF
	add	x8, x8, x9, lsl #6
	ldur	w9, [x29, #-12]
                                        ; kill: def $x9 killed $w9
	ldr	w8, [x8, x9, lsl #2]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB0_8
	b	LBB0_7
LBB0_7:
	ldur	w8, [x29, #-8]
	mov	x9, x8
	adrp	x8, _a@PAGE
	add	x8, x8, _a@PAGEOFF
	add	x8, x8, x9, lsl #6
	ldur	w9, [x29, #-12]
                                        ; kill: def $x9 killed $w9
	ldr	w8, [x8, x9, lsl #2]
	stur	w8, [x29, #-4]
	b	LBB0_13
LBB0_8:
	ldur	w8, [x29, #-12]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB0_10
	b	LBB0_9
LBB0_9:
	ldur	w8, [x29, #-8]
	add	w8, w8, #1
	ldur	w9, [x29, #-8]
                                        ; kill: def $x9 killed $w9
	lsl	x10, x9, #6
	adrp	x9, _a@PAGE
	add	x9, x9, _a@PAGEOFF
	str	w8, [x9, x10]
	stur	w8, [x29, #-4]
	b	LBB0_13
LBB0_10:
	ldur	w8, [x29, #-8]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB0_12
	b	LBB0_11
LBB0_11:
	ldur	w8, [x29, #-12]
	mov	w0, #1
	subs	w1, w8, #1
	bl	_ack
	ldur	w8, [x29, #-12]
	mov	x9, x8
	adrp	x8, _a@PAGE
	add	x8, x8, _a@PAGEOFF
	str	w0, [x8, x9, lsl #2]
	stur	w0, [x29, #-4]
	b	LBB0_13
LBB0_12:
	ldur	w8, [x29, #-8]
	subs	w0, w8, #1
	ldur	w1, [x29, #-12]
	bl	_ack
	ldur	w8, [x29, #-12]
	subs	w1, w8, #1
	bl	_ack
	ldur	w8, [x29, #-8]
	mov	x9, x8
	adrp	x8, _a@PAGE
	add	x8, x8, _a@PAGEOFF
	add	x8, x8, x9, lsl #6
	ldur	w9, [x29, #-12]
                                        ; kill: def $x9 killed $w9
	str	w0, [x8, x9, lsl #2]
	stur	w0, [x29, #-4]
	b	LBB0_13
LBB0_13:
	ldur	w0, [x29, #-4]
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.cfi_endproc
                                        ; -- End function
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	stur	wzr, [x29, #-4]
	adrp	x8, _max_depth@PAGE
	str	wzr, [x8, _max_depth@PAGEOFF]
	stur	wzr, [x29, #-12]
	b	LBB1_1
LBB1_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB1_3 Depth 2
	ldur	w8, [x29, #-12]
	subs	w8, w8, #5
	cset	w8, hi
	tbnz	w8, #0, LBB1_10
	b	LBB1_2
LBB1_2:                                 ;   in Loop: Header=BB1_1 Depth=1
	ldur	w9, [x29, #-12]
                                        ; implicit-def: $x8
	mov	x8, x9
	mov	x9, sp
	str	x8, [x9]
	adrp	x0, l_.str.3@PAGE
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_libmin_printf
	stur	wzr, [x29, #-8]
	b	LBB1_3
LBB1_3:                                 ;   Parent Loop BB1_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldur	w8, [x29, #-8]
	ldur	w9, [x29, #-12]
	subs	w8, w8, w9
	cset	w8, hi
	tbnz	w8, #0, LBB1_8
	b	LBB1_4
LBB1_4:                                 ;   in Loop: Header=BB1_3 Depth=2
	adrp	x8, _depth@PAGE
	stur	x8, [x29, #-24]                 ; 8-byte Folded Spill
	str	wzr, [x8, _depth@PAGEOFF]
	ldur	w8, [x29, #-12]
	ldur	w9, [x29, #-8]
	subs	w8, w8, w9
	str	w8, [sp, #28]                   ; 4-byte Folded Spill
	ldur	w9, [x29, #-8]
                                        ; implicit-def: $x8
	mov	x8, x9
	str	x8, [sp, #32]                   ; 8-byte Folded Spill
	ldur	w8, [x29, #-12]
	ldur	w9, [x29, #-8]
	subs	w0, w8, w9
	ldur	w1, [x29, #-8]
	bl	_ack
	ldr	w11, [sp, #28]                  ; 4-byte Folded Reload
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	mov	x9, sp
                                        ; implicit-def: $x10
	mov	x10, x11
	str	x10, [x9]
	str	x8, [x9, #8]
                                        ; implicit-def: $x8
	mov	x8, x0
	str	x8, [x9, #16]
	adrp	x0, l_.str.4@PAGE
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_libmin_printf
	ldur	x8, [x29, #-24]                 ; 8-byte Folded Reload
	ldr	w8, [x8, _depth@PAGEOFF]
	adrp	x9, _max_depth@PAGE
	ldr	w9, [x9, _max_depth@PAGEOFF]
	subs	w8, w8, w9
	cset	w8, ls
	tbnz	w8, #0, LBB1_6
	b	LBB1_5
LBB1_5:                                 ;   in Loop: Header=BB1_3 Depth=2
	adrp	x8, _depth@PAGE
	ldr	w8, [x8, _depth@PAGEOFF]
	adrp	x9, _max_depth@PAGE
	str	w8, [x9, _max_depth@PAGEOFF]
	b	LBB1_6
LBB1_6:                                 ;   in Loop: Header=BB1_3 Depth=2
	b	LBB1_7
LBB1_7:                                 ;   in Loop: Header=BB1_3 Depth=2
	ldur	w8, [x29, #-8]
	add	w8, w8, #1
	stur	w8, [x29, #-8]
	b	LBB1_3
LBB1_8:                                 ;   in Loop: Header=BB1_1 Depth=1
	b	LBB1_9
LBB1_9:                                 ;   in Loop: Header=BB1_1 Depth=1
	ldur	w8, [x29, #-12]
	add	w8, w8, #1
	stur	w8, [x29, #-12]
	b	LBB1_1
LBB1_10:
	adrp	x8, _max_depth@PAGE
	ldr	w9, [x8, _max_depth@PAGEOFF]
                                        ; implicit-def: $x8
	mov	x8, x9
	mov	x9, sp
	str	x8, [x9]
	adrp	x0, l_.str.5@PAGE
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_libmin_printf
	bl	_libmin_success
	mov	w0, #0
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_depth,4,2       ; @depth
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Maximum stack depth %d exceeded. Abort.\n"

l_.str.1:                               ; @.str.1
	.asciz	"Maximum x value %d exceeded. Abort. \n"

l_.str.2:                               ; @.str.2
	.asciz	"Maximum y value %d exceeded. Abort. \n"

.zerofill __DATA,__bss,_a,4194240,2     ; @a
.zerofill __DATA,__bss,_max_depth,4,2   ; @max_depth
l_.str.3:                               ; @.str.3
	.asciz	"\nx+y=%d:\n\n"

l_.str.4:                               ; @.str.4
	.asciz	"A(%d,%d) = %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"Max recursive depth = %u\n"

.subsections_via_symbols