Program: pi-calc

x86 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.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	$16, %rsp
	movl	$0, -4(%rbp)
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movl	_c(%rip), %eax
	subl	$14, %eax
	movl	%eax, _c(%rip)
	movq	_b@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	cmpl	$0, %eax
	je	LBB0_11
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	_f(%rip), %ecx
	movq	_d@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cltd
	idivl	%ecx
	movq	_d@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
	movq	_e@GOTPCREL(%rip), %rax
	movl	%edx, (%rax)
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	_b@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	addl	$-1, %eax
	movq	_b@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	shll	$1, %eax
	movq	_g@GOTPCREL(%rip), %rcx
	movl	%eax, (%rcx)
	cmpl	$0, %eax
	je	LBB0_9
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	_d@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_b@GOTPCREL(%rip), %rcx
	imull	(%rcx), %eax
	movl	%eax, -12(%rbp)                 ## 4-byte Spill
	movl	_f(%rip), %eax
	movl	%eax, -8(%rbp)                  ## 4-byte Spill
	movq	_h@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	je	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	_b@GOTPCREL(%rip), %rax
	movslq	(%rax), %rcx
	movq	_a@GOTPCREL(%rip), %rax
	movl	(%rax,%rcx,4), %eax
	movl	%eax, -16(%rbp)                 ## 4-byte Spill
	jmp	LBB0_7
LBB0_6:                                 ##   in Loop: Header=BB0_3 Depth=2
	movl	_f(%rip), %eax
	movl	$5, %ecx
	cltd
	idivl	%ecx
	movl	%eax, -16(%rbp)                 ## 4-byte Spill
LBB0_7:                                 ##   in Loop: Header=BB0_3 Depth=2
	movl	-12(%rbp), %ecx                 ## 4-byte Reload
	movl	-8(%rbp), %eax                  ## 4-byte Reload
	movl	-16(%rbp), %edx                 ## 4-byte Reload
	imull	%edx, %eax
	addl	%eax, %ecx
	movq	_d@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	movq	_d@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_g@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	$-1, %ecx
	movq	_g@GOTPCREL(%rip), %rdx
	movl	%ecx, (%rdx)
	cltd
	idivl	%ecx
	movq	_b@GOTPCREL(%rip), %rax
	movslq	(%rax), %rcx
	movq	_a@GOTPCREL(%rip), %rax
	movl	%edx, (%rax,%rcx,4)
## %bb.8:                               ##   in Loop: Header=BB0_3 Depth=2
	movq	_g@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_d@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cltd
	idivl	%ecx
	movl	%eax, %ecx
	movq	_d@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	jmp	LBB0_3
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	jmp	LBB0_10
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	movq	_e@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_d@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cltd
	idivl	_f(%rip)
	addl	%eax, %esi
	leaq	L_.str(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movl	%eax, %ecx
	movq	_h@GOTPCREL(%rip), %rax
	movl	%ecx, (%rax)
	jmp	LBB0_1
LBB0_11:
	callq	_libmin_success
	movl	-4(%rbp), %eax
	addq	$16, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__DATA,__data
	.globl	_c                              ## @c
	.p2align	2
_c:
	.long	52514                           ## 0xcd22

	.globl	_f                              ## @f
	.p2align	2
_f:
	.long	10000                           ## 0x2710

	.comm	_b,4,2                          ## @b
	.comm	_d,4,2                          ## @d
	.comm	_e,4,2                          ## @e
	.comm	_g,4,2                          ## @g
	.comm	_h,4,2                          ## @h
	.comm	_a,210056,4                     ## @a
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%04d"

.subsections_via_symbols


ARM64 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.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
	adrp	x8, _b@GOTPAGE
	ldr	x8, [x8, _b@GOTPAGEOFF]
	str	x8, [sp, #32]                   ; 8-byte Folded Spill
	adrp	x8, _d@GOTPAGE
	ldr	x8, [x8, _d@GOTPAGEOFF]
	stur	x8, [x29, #-24]                 ; 8-byte Folded Spill
	adrp	x8, _g@GOTPAGE
	ldr	x8, [x8, _g@GOTPAGEOFF]
	stur	x8, [x29, #-16]                 ; 8-byte Folded Spill
	stur	wzr, [x29, #-4]
	b	LBB0_1
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	adrp	x10, _c@PAGE
	ldr	w8, [x10, _c@PAGEOFF]
	subs	w8, w8, #14
	str	w8, [x10, _c@PAGEOFF]
	str	w8, [x9]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB0_11
	b	LBB0_2
LBB0_2:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldur	x9, [x29, #-24]                 ; 8-byte Folded Reload
	adrp	x8, _f@PAGE
	ldr	w11, [x8, _f@PAGEOFF]
	ldr	w8, [x9]
	sdiv	w10, w8, w11
	mul	w10, w10, w11
	subs	w8, w8, w10
	str	w8, [x9]
	adrp	x9, _e@GOTPAGE
	ldr	x9, [x9, _e@GOTPAGEOFF]
	str	w8, [x9]
	b	LBB0_3
LBB0_3:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldur	x9, [x29, #-16]                 ; 8-byte Folded Reload
	ldr	x10, [sp, #32]                  ; 8-byte Folded Reload
	ldr	w8, [x10]
	subs	w8, w8, #1
	str	w8, [x10]
	lsl	w8, w8, #1
	str	w8, [x9]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB0_9
	b	LBB0_4
LBB0_4:                                 ;   in Loop: Header=BB0_3 Depth=2
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	ldur	x8, [x29, #-24]                 ; 8-byte Folded Reload
	ldr	w8, [x8]
	ldr	w9, [x9]
	mul	w8, w8, w9
	str	w8, [sp, #24]                   ; 4-byte Folded Spill
	adrp	x8, _f@PAGE
	ldr	w8, [x8, _f@PAGEOFF]
	str	w8, [sp, #28]                   ; 4-byte Folded Spill
	adrp	x8, _h@GOTPAGE
	ldr	x8, [x8, _h@GOTPAGEOFF]
	ldr	w8, [x8]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB0_6
	b	LBB0_5
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=2
	ldr	x8, [sp, #32]                   ; 8-byte Folded Reload
	ldrsw	x9, [x8]
	adrp	x8, _a@GOTPAGE
	ldr	x8, [x8, _a@GOTPAGEOFF]
	ldr	w8, [x8, x9, lsl #2]
	str	w8, [sp, #20]                   ; 4-byte Folded Spill
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_3 Depth=2
	adrp	x8, _f@PAGE
	ldr	w8, [x8, _f@PAGEOFF]
	mov	w9, #5
	sdiv	w8, w8, w9
	str	w8, [sp, #20]                   ; 4-byte Folded Spill
	b	LBB0_7
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=2
	ldr	x9, [sp, #32]                   ; 8-byte Folded Reload
	ldur	x10, [x29, #-16]                ; 8-byte Folded Reload
	ldur	x8, [x29, #-24]                 ; 8-byte Folded Reload
	ldr	w11, [sp, #24]                  ; 4-byte Folded Reload
	ldr	w12, [sp, #28]                  ; 4-byte Folded Reload
	ldr	w13, [sp, #20]                  ; 4-byte Folded Reload
	mul	w12, w12, w13
	add	w11, w11, w12
	str	w11, [x8]
	ldr	w8, [x8]
	ldr	w11, [x10]
	subs	w11, w11, #1
	str	w11, [x10]
	sdiv	w10, w8, w11
	mul	w10, w10, w11
	subs	w8, w8, w10
	ldrsw	x10, [x9]
	adrp	x9, _a@GOTPAGE
	ldr	x9, [x9, _a@GOTPAGEOFF]
	str	w8, [x9, x10, lsl #2]
	b	LBB0_8
LBB0_8:                                 ;   in Loop: Header=BB0_3 Depth=2
	ldur	x9, [x29, #-24]                 ; 8-byte Folded Reload
	ldur	x8, [x29, #-16]                 ; 8-byte Folded Reload
	ldr	w10, [x8]
	ldr	w8, [x9]
	sdiv	w8, w8, w10
	str	w8, [x9]
	b	LBB0_3
LBB0_9:                                 ;   in Loop: Header=BB0_1 Depth=1
	b	LBB0_10
LBB0_10:                                ;   in Loop: Header=BB0_1 Depth=1
	ldur	x9, [x29, #-24]                 ; 8-byte Folded Reload
	adrp	x8, _e@GOTPAGE
	ldr	x8, [x8, _e@GOTPAGEOFF]
	ldr	w8, [x8]
	ldr	w9, [x9]
	adrp	x10, _f@PAGE
	ldr	w10, [x10, _f@PAGEOFF]
	sdiv	w9, w9, w10
	add	w10, w8, w9
	mov	x9, sp
                                        ; implicit-def: $x8
	mov	x8, x10
	str	x8, [x9]
	adrp	x0, l_.str@PAGE
	add	x0, x0, l_.str@PAGEOFF
	bl	_libmin_printf
	adrp	x8, _h@GOTPAGE
	ldr	x8, [x8, _h@GOTPAGEOFF]
	str	w0, [x8]
	b	LBB0_1
LBB0_11:
	bl	_libmin_success
	ldur	w0, [x29, #-4]
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.cfi_endproc
                                        ; -- End function
	.section	__DATA,__data
	.globl	_c                              ; @c
	.p2align	2
_c:
	.long	52514                           ; 0xcd22

	.globl	_f                              ; @f
	.p2align	2
_f:
	.long	10000                           ; 0x2710

	.comm	_b,4,2                          ; @b
	.comm	_d,4,2                          ; @d
	.comm	_e,4,2                          ; @e
	.comm	_g,4,2                          ; @g
	.comm	_h,4,2                          ; @h
	.comm	_a,210056,2                     ; @a
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%04d"

.subsections_via_symbols