Program: rle-compress

x86 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_run_length_encode              ## -- Begin function run_length_encode
	.p2align	4, 0x90
_run_length_encode:                     ## @run_length_encode
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	subq	$112, %rsp
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -8(%rbp)
	movq	%rdi, -40(%rbp)
	movq	-40(%rbp), %rdi
	callq	_libmin_strlen
                                        ## kill: def $eax killed $eax killed $rax
	movl	%eax, -44(%rbp)
	movl	$0, -48(%rbp)
	movq	-40(%rbp), %rdi
	callq	_libmin_strlen
	movq	%rax, %rdi
	shlq	$1, %rdi
	addq	$1, %rdi
	callq	_libmin_malloc
	movq	%rax, -56(%rbp)
	movl	$0, -60(%rbp)
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_3 Depth 2
	movl	-60(%rbp), %eax
	cmpl	-44(%rbp), %eax
	jge	LBB0_7
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$0, -64(%rbp)
	movq	-40(%rbp), %rax
	movslq	-60(%rbp), %rcx
	movb	(%rax,%rcx), %al
	movb	%al, -65(%rbp)
LBB0_3:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movsbl	-65(%rbp), %eax
	movq	-40(%rbp), %rcx
	movl	-60(%rbp), %edx
	addl	-64(%rbp), %edx
	movslq	%edx, %rdx
	movsbl	(%rcx,%rdx), %ecx
	cmpl	%ecx, %eax
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=2
	movl	-64(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -64(%rbp)
	jmp	LBB0_3
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	-64(%rbp), %eax
	subl	$1, %eax
	addl	-60(%rbp), %eax
	movl	%eax, -60(%rbp)
	leaq	-32(%rbp), %rdi
	movl	-64(%rbp), %ecx
	movl	$20, %esi
	leaq	L_.str(%rip), %rdx
	movb	$0, %al
	callq	_libmin_snprintf
	movq	-56(%rbp), %rax
	movslq	-48(%rbp), %rcx
	addq	%rcx, %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	leaq	-32(%rbp), %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	leaq	-32(%rbp), %rdi
	callq	_libmin_strlen
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	movq	-88(%rbp), %rsi                 ## 8-byte Reload
	movq	%rax, %rdx
	callq	_libmin_strncpy
	leaq	-32(%rbp), %rdi
	callq	_libmin_strlen
	movq	%rax, %rcx
	movslq	-48(%rbp), %rax
	addq	%rcx, %rax
                                        ## kill: def $eax killed $eax killed $rax
	movl	%eax, -48(%rbp)
	movb	-65(%rbp), %dl
	movq	-56(%rbp), %rax
	movslq	-48(%rbp), %rcx
	movb	%dl, (%rax,%rcx)
	movl	-48(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -48(%rbp)
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	-60(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -60(%rbp)
	jmp	LBB0_1
LBB0_7:
	movq	-56(%rbp), %rax
	movslq	-48(%rbp), %rcx
	movb	$0, (%rax,%rcx)
	movq	-56(%rbp), %rdi
	callq	_libmin_strlen
	movq	%rax, %rdi
	addq	$1, %rdi
	callq	_libmin_malloc
	movq	%rax, -80(%rbp)
	movq	-80(%rbp), %rdi
	movq	-56(%rbp), %rsi
	callq	_libmin_strcpy
	movq	-56(%rbp), %rdi
	callq	_libmin_free
	movq	-80(%rbp), %rax
	movq	%rax, -104(%rbp)                ## 8-byte Spill
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	-8(%rbp), %rcx
	cmpq	%rcx, %rax
	jne	LBB0_9
## %bb.8:
	movq	-104(%rbp), %rax                ## 8-byte Reload
	addq	$112, %rsp
	popq	%rbp
	retq
LBB0_9:
	callq	___stack_chk_fail
	ud2
	.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	$16, %rsp
	movl	$0, -4(%rbp)
	callq	_test
	leaq	L_.str.1(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	callq	_libmin_success
	xorl	%eax, %eax
	addq	$16, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.p2align	4, 0x90                         ## -- Begin function test
_test:                                  ## @test
	.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
	leaq	L_.str.2(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rdi
	callq	_run_length_encode
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdi
	leaq	L_.str.3(%rip), %rsi
	callq	_libmin_strcmp
	cmpl	$0, %eax
	jne	LBB2_2
## %bb.1:
	jmp	LBB2_3
LBB2_2:
	movl	$1, %edi
	callq	_libmin_fail
LBB2_3:
	movq	-8(%rbp), %rsi
	movq	-16(%rbp), %rdx
	leaq	L_.str.4(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movq	-16(%rbp), %rdi
	callq	_libmin_free
	leaq	L_.str.5(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rdi
	callq	_run_length_encode
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdi
	leaq	L_.str.6(%rip), %rsi
	callq	_libmin_strcmp
	cmpl	$0, %eax
	jne	LBB2_5
## %bb.4:
	jmp	LBB2_6
LBB2_5:
	movl	$1, %edi
	callq	_libmin_fail
LBB2_6:
	movq	-8(%rbp), %rsi
	movq	-16(%rbp), %rdx
	leaq	L_.str.4(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movq	-16(%rbp), %rdi
	callq	_libmin_free
	leaq	L_.str.7(%rip), %rax
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rdi
	callq	_run_length_encode
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rdi
	leaq	L_.str.8(%rip), %rsi
	callq	_libmin_strcmp
	cmpl	$0, %eax
	jne	LBB2_8
## %bb.7:
	jmp	LBB2_9
LBB2_8:
	movl	$1, %edi
	callq	_libmin_fail
LBB2_9:
	movq	-8(%rbp), %rsi
	movq	-16(%rbp), %rdx
	leaq	L_.str.4(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movq	-16(%rbp), %rdi
	callq	_libmin_free
	addq	$16, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"%d"

L_.str.1:                               ## @.str.1
	.asciz	"All tests have passed!\n"

L_.str.2:                               ## @.str.2
	.asciz	"aaaaaaabbbaaccccdefaadr"

L_.str.3:                               ## @.str.3
	.asciz	"7a3b2a4c1d1e1f2a1d1r"

L_.str.4:                               ## @.str.4
	.asciz	"in: %s -> out: %s\n"

L_.str.5:                               ## @.str.5
	.asciz	"lidjhvipdurevbeirbgipeahapoeuhwaipefupwieofb"

L_.str.6:                               ## @.str.6
	.asciz	"1l1i1d1j1h1v1i1p1d1u1r1e1v1b1e1i1r1b1g1i1p1e1a1h1a1p1o1e1u1h1w1a1i1p1e1f1u1p1w1i1e1o1f1b"

L_.str.7:                               ## @.str.7
	.asciz	"htuuuurwuquququuuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahghghrw"

L_.str.8:                               ## @.str.8
	.asciz	"1h1t4u1r1w1u1q1u1q1u1q3u76a1h1g1h1g1h1r1w"

.subsections_via_symbols


ARM64 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_run_length_encode              ; -- Begin function run_length_encode
	.p2align	2
_run_length_encode:                     ; @run_length_encode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	adrp	x8, ___stack_chk_guard@GOTPAGE
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
	ldr	x8, [x8]
	stur	x8, [x29, #-8]
	stur	x0, [x29, #-40]
	ldur	x0, [x29, #-40]
	bl	_libmin_strlen
	mov	x8, x0
	stur	w8, [x29, #-44]
	stur	wzr, [x29, #-48]
	ldur	x0, [x29, #-40]
	bl	_libmin_strlen
	mov	x8, #2
	mul	x8, x8, x0
	add	x0, x8, #1
	bl	_libmin_malloc
	str	x0, [sp, #56]
	str	wzr, [sp, #52]
	b	LBB0_1
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_3 Depth 2
	ldr	w8, [sp, #52]
	ldur	w9, [x29, #-44]
	subs	w8, w8, w9
	cset	w8, ge
	tbnz	w8, #0, LBB0_7
	b	LBB0_2
LBB0_2:                                 ;   in Loop: Header=BB0_1 Depth=1
	str	wzr, [sp, #48]
	ldur	x8, [x29, #-40]
	ldrsw	x9, [sp, #52]
	add	x8, x8, x9
	ldrb	w8, [x8]
	strb	w8, [sp, #47]
	b	LBB0_3
LBB0_3:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldrsb	w8, [sp, #47]
	ldur	x9, [x29, #-40]
	ldr	w10, [sp, #52]
	ldr	w11, [sp, #48]
	add	w10, w10, w11
	ldrsb	w9, [x9, w10, sxtw]
	subs	w8, w8, w9
	cset	w8, ne
	tbnz	w8, #0, LBB0_5
	b	LBB0_4
LBB0_4:                                 ;   in Loop: Header=BB0_3 Depth=2
	ldr	w8, [sp, #48]
	add	w8, w8, #1
	str	w8, [sp, #48]
	b	LBB0_3
LBB0_5:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [sp, #48]
	subs	w9, w8, #1
	ldr	w8, [sp, #52]
	add	w8, w8, w9
	str	w8, [sp, #52]
	ldr	w9, [sp, #48]
                                        ; implicit-def: $x8
	mov	x8, x9
	mov	x9, sp
	str	x8, [x9]
	sub	x0, x29, #28
	str	x0, [sp, #24]                   ; 8-byte Folded Spill
	mov	x1, #20
	adrp	x2, l_.str@PAGE
	add	x2, x2, l_.str@PAGEOFF
	bl	_libmin_snprintf
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	ldr	x8, [sp, #56]
	ldursw	x9, [x29, #-48]
	add	x8, x8, x9
	str	x8, [sp, #16]                   ; 8-byte Folded Spill
	bl	_libmin_strlen
	ldr	x1, [sp, #24]                   ; 8-byte Folded Reload
	mov	x2, x0
	ldr	x0, [sp, #16]                   ; 8-byte Folded Reload
	bl	_libmin_strncpy
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	bl	_libmin_strlen
	ldursw	x8, [x29, #-48]
	add	x8, x8, x0
                                        ; kill: def $w8 killed $w8 killed $x8
	stur	w8, [x29, #-48]
	ldrb	w8, [sp, #47]
	ldr	x9, [sp, #56]
	ldursw	x10, [x29, #-48]
	add	x9, x9, x10
	strb	w8, [x9]
	ldur	w8, [x29, #-48]
	add	w8, w8, #1
	stur	w8, [x29, #-48]
	b	LBB0_6
LBB0_6:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [sp, #52]
	add	w8, w8, #1
	str	w8, [sp, #52]
	b	LBB0_1
LBB0_7:
	ldr	x8, [sp, #56]
	ldursw	x9, [x29, #-48]
	add	x8, x8, x9
	strb	wzr, [x8]
	ldr	x0, [sp, #56]
	bl	_libmin_strlen
	add	x0, x0, #1
	bl	_libmin_malloc
	str	x0, [sp, #32]
	ldr	x0, [sp, #32]
	ldr	x1, [sp, #56]
	bl	_libmin_strcpy
	ldr	x0, [sp, #56]
	bl	_libmin_free
	ldr	x8, [sp, #32]
	str	x8, [sp, #8]                    ; 8-byte Folded Spill
	ldur	x9, [x29, #-8]
	adrp	x8, ___stack_chk_guard@GOTPAGE
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
	ldr	x8, [x8]
	subs	x8, x8, x9
	cset	w8, eq
	tbnz	w8, #0, LBB0_9
	b	LBB0_8
LBB0_8:
	bl	___stack_chk_fail
LBB0_9:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.cfi_endproc
                                        ; -- End function
	.globl	_main                           ; -- Begin function main
	.p2align	2
_main:                                  ; @main
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #32
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	mov	w8, #0
	str	w8, [sp, #8]                    ; 4-byte Folded Spill
	stur	wzr, [x29, #-4]
	bl	_test
	adrp	x0, l_.str.1@PAGE
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_libmin_printf
	bl	_libmin_success
	ldr	w0, [sp, #8]                    ; 4-byte Folded Reload
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #32
	ret
	.cfi_endproc
                                        ; -- End function
	.p2align	2                               ; -- Begin function test
_test:                                  ; @test
	.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
	adrp	x8, l_.str.2@PAGE
	add	x8, x8, l_.str.2@PAGEOFF
	stur	x8, [x29, #-8]
	ldur	x0, [x29, #-8]
	bl	_run_length_encode
	str	x0, [sp, #16]
	ldr	x0, [sp, #16]
	adrp	x1, l_.str.3@PAGE
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_libmin_strcmp
	subs	w8, w0, #0
	cset	w8, ne
	tbnz	w8, #0, LBB2_2
	b	LBB2_1
LBB2_1:
	b	LBB2_3
LBB2_2:
	mov	w0, #1
	bl	_libmin_fail
	b	LBB2_3
LBB2_3:
	ldur	x10, [x29, #-8]
	ldr	x8, [sp, #16]
	mov	x9, sp
	str	x10, [x9]
	str	x8, [x9, #8]
	adrp	x0, l_.str.4@PAGE
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_libmin_printf
	ldr	x0, [sp, #16]
	bl	_libmin_free
	adrp	x8, l_.str.5@PAGE
	add	x8, x8, l_.str.5@PAGEOFF
	stur	x8, [x29, #-8]
	ldur	x0, [x29, #-8]
	bl	_run_length_encode
	str	x0, [sp, #16]
	ldr	x0, [sp, #16]
	adrp	x1, l_.str.6@PAGE
	add	x1, x1, l_.str.6@PAGEOFF
	bl	_libmin_strcmp
	subs	w8, w0, #0
	cset	w8, ne
	tbnz	w8, #0, LBB2_5
	b	LBB2_4
LBB2_4:
	b	LBB2_6
LBB2_5:
	mov	w0, #1
	bl	_libmin_fail
	b	LBB2_6
LBB2_6:
	ldur	x10, [x29, #-8]
	ldr	x8, [sp, #16]
	mov	x9, sp
	str	x10, [x9]
	str	x8, [x9, #8]
	adrp	x0, l_.str.4@PAGE
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_libmin_printf
	ldr	x0, [sp, #16]
	bl	_libmin_free
	adrp	x8, l_.str.7@PAGE
	add	x8, x8, l_.str.7@PAGEOFF
	stur	x8, [x29, #-8]
	ldur	x0, [x29, #-8]
	bl	_run_length_encode
	str	x0, [sp, #16]
	ldr	x0, [sp, #16]
	adrp	x1, l_.str.8@PAGE
	add	x1, x1, l_.str.8@PAGEOFF
	bl	_libmin_strcmp
	subs	w8, w0, #0
	cset	w8, ne
	tbnz	w8, #0, LBB2_8
	b	LBB2_7
LBB2_7:
	b	LBB2_9
LBB2_8:
	mov	w0, #1
	bl	_libmin_fail
	b	LBB2_9
LBB2_9:
	ldur	x10, [x29, #-8]
	ldr	x8, [sp, #16]
	mov	x9, sp
	str	x10, [x9]
	str	x8, [x9, #8]
	adrp	x0, l_.str.4@PAGE
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_libmin_printf
	ldr	x0, [sp, #16]
	bl	_libmin_free
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"%d"

l_.str.1:                               ; @.str.1
	.asciz	"All tests have passed!\n"

l_.str.2:                               ; @.str.2
	.asciz	"aaaaaaabbbaaccccdefaadr"

l_.str.3:                               ; @.str.3
	.asciz	"7a3b2a4c1d1e1f2a1d1r"

l_.str.4:                               ; @.str.4
	.asciz	"in: %s -> out: %s\n"

l_.str.5:                               ; @.str.5
	.asciz	"lidjhvipdurevbeirbgipeahapoeuhwaipefupwieofb"

l_.str.6:                               ; @.str.6
	.asciz	"1l1i1d1j1h1v1i1p1d1u1r1e1v1b1e1i1r1b1g1i1p1e1a1h1a1p1o1e1u1h1w1a1i1p1e1f1u1p1w1i1e1o1f1b"

l_.str.7:                               ; @.str.7
	.asciz	"htuuuurwuquququuuaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahghghrw"

l_.str.8:                               ; @.str.8
	.asciz	"1h1t4u1r1w1u1q1u1q1u1q3u76a1h1g1h1g1h1r1w"

.subsections_via_symbols