Program: bloom-filter

x86 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bad_search                     ## -- Begin function bad_search
	.p2align	4, 0x90
_bad_search:                            ## @bad_search
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	movq	%rdi, -16(%rbp)
	movl	%esi, -20(%rbp)
	movq	%rdx, -32(%rbp)
	movl	$0, -36(%rbp)
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movslq	-36(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jae	LBB0_6
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-16(%rbp), %rax
	movslq	-36(%rbp), %rcx
	movl	(%rax,%rcx,4), %eax
	cmpl	-20(%rbp), %eax
	jne	LBB0_4
## %bb.3:
	movl	$1, -4(%rbp)
	jmp	LBB0_7
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	jmp	LBB0_5
LBB0_5:                                 ##   in Loop: Header=BB0_1 Depth=1
	movl	-36(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
	jmp	LBB0_1
LBB0_6:
	movl	$0, -4(%rbp)
LBB0_7:
	movl	-4(%rbp), %eax
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__literal4,4byte_literals
	.p2align	2                               ## -- Begin function main
LCPI1_0:
	.long	0x42a00000                      ## float 80
LCPI1_1:
	.long	0x3d480000                      ## float 0.048828125
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_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	$64, %rsp
	movl	$0, -4(%rbp)
	movl	$0, -8(%rbp)
	movl	$0, -12(%rbp)
	movl	$0, -16(%rbp)
	movl	$0, -20(%rbp)
	movl	$8192, %edi                     ## imm = 0x2000
	callq	_libmin_malloc
	movq	%rax, -32(%rbp)
	movl	$8192, %edi                     ## imm = 0x2000
	callq	_libmin_malloc
	movq	%rax, -40(%rbp)
	movl	$8192, %edi                     ## imm = 0x2000
	callq	_create_bfilter
	movq	%rax, -48(%rbp)
	movq	-48(%rbp), %rax
	movq	(%rax), %rsi
	shlq	$2, %rsi
	shrq	$10, %rsi
	leaq	L_.str(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	movl	$42, %edi
	callq	_libmin_srand
	movl	$0, -52(%rbp)
LBB1_1:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$2048, -52(%rbp)                ## imm = 0x800
	jge	LBB1_7
## %bb.2:                               ##   in Loop: Header=BB1_1 Depth=1
	callq	_libmin_rand
	movl	%eax, %edx
	movq	-32(%rbp), %rax
	movslq	-52(%rbp), %rcx
	movl	%edx, (%rax,%rcx,4)
	movq	-48(%rbp), %rdi
	movq	-32(%rbp), %rsi
	movslq	-52(%rbp), %rax
	shlq	$2, %rax
	addq	%rax, %rsi
	callq	_bfilter_add
	callq	_libmin_rand
	andl	$1, %eax
	cmpl	$0, %eax
	je	LBB1_4
## %bb.3:                               ##   in Loop: Header=BB1_1 Depth=1
	movq	-32(%rbp), %rax
	movslq	-52(%rbp), %rcx
	movl	(%rax,%rcx,4), %edx
	movq	-40(%rbp), %rax
	movslq	-52(%rbp), %rcx
	movl	%edx, (%rax,%rcx,4)
	jmp	LBB1_5
LBB1_4:                                 ##   in Loop: Header=BB1_1 Depth=1
	callq	_libmin_rand
	movl	%eax, %edx
	movq	-40(%rbp), %rax
	movslq	-52(%rbp), %rcx
	movl	%edx, (%rax,%rcx,4)
LBB1_5:                                 ##   in Loop: Header=BB1_1 Depth=1
	jmp	LBB1_6
LBB1_6:                                 ##   in Loop: Header=BB1_1 Depth=1
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -52(%rbp)
	jmp	LBB1_1
LBB1_7:
	movl	$0, -52(%rbp)
LBB1_8:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$2048, -52(%rbp)                ## imm = 0x800
	jge	LBB1_26
## %bb.9:                               ##   in Loop: Header=BB1_8 Depth=1
	movl	$0, -56(%rbp)
	movl	$0, -60(%rbp)
	movq	-48(%rbp), %rdi
	movq	-40(%rbp), %rsi
	movslq	-52(%rbp), %rax
	shlq	$2, %rax
	addq	%rax, %rsi
	callq	_bfilter_check
	movl	%eax, -56(%rbp)
	movq	-32(%rbp), %rdi
	movq	-40(%rbp), %rax
	movslq	-52(%rbp), %rcx
	movl	(%rax,%rcx,4), %esi
	movl	$2048, %edx                     ## imm = 0x800
	callq	_bad_search
	movl	%eax, -60(%rbp)
	cmpl	$0, -60(%rbp)
	je	LBB1_12
## %bb.10:                              ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -56(%rbp)
	je	LBB1_12
## %bb.11:                              ##   in Loop: Header=BB1_8 Depth=1
	movl	-12(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -12(%rbp)
	jmp	LBB1_24
LBB1_12:                                ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -60(%rbp)
	jne	LBB1_15
## %bb.13:                              ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -56(%rbp)
	jne	LBB1_15
## %bb.14:                              ##   in Loop: Header=BB1_8 Depth=1
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -20(%rbp)
	jmp	LBB1_23
LBB1_15:                                ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -60(%rbp)
	jne	LBB1_18
## %bb.16:                              ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -56(%rbp)
	je	LBB1_18
## %bb.17:                              ##   in Loop: Header=BB1_8 Depth=1
	movl	-8(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	jmp	LBB1_22
LBB1_18:                                ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -60(%rbp)
	je	LBB1_21
## %bb.19:                              ##   in Loop: Header=BB1_8 Depth=1
	cmpl	$0, -56(%rbp)
	jne	LBB1_21
## %bb.20:                              ##   in Loop: Header=BB1_8 Depth=1
	movl	-16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -16(%rbp)
LBB1_21:                                ##   in Loop: Header=BB1_8 Depth=1
	jmp	LBB1_22
LBB1_22:                                ##   in Loop: Header=BB1_8 Depth=1
	jmp	LBB1_23
LBB1_23:                                ##   in Loop: Header=BB1_8 Depth=1
	jmp	LBB1_24
LBB1_24:                                ##   in Loop: Header=BB1_8 Depth=1
	jmp	LBB1_25
LBB1_25:                                ##   in Loop: Header=BB1_8 Depth=1
	movl	-52(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -52(%rbp)
	jmp	LBB1_8
LBB1_26:
	movl	-12(%rbp), %esi
	movl	-20(%rbp), %edx
	movl	-8(%rbp), %ecx
	movl	-16(%rbp), %r8d
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
                                        ## kill: def $al killed $al killed $eax
	callq	_libmin_printf
	movl	-12(%rbp), %eax
	movl	-20(%rbp), %ecx
	addl	%ecx, %eax
                                        ## kill: def $rax killed $eax
	cvtsi2ss	%rax, %xmm1
	movss	LCPI1_1(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	mulss	%xmm1, %xmm0
	movss	%xmm0, -64(%rbp)
	movss	-64(%rbp), %xmm0                ## xmm0 = mem[0],zero,zero,zero
	cvtss2sd	%xmm0, %xmm0
	leaq	L_.str.2(%rip), %rdi
	movb	$1, %al
	callq	_libmin_printf
	movss	LCPI1_0(%rip), %xmm0            ## xmm0 = mem[0],zero,zero,zero
	ucomiss	-64(%rbp), %xmm0
	jbe	LBB1_28
## %bb.27:
	leaq	L_.str.3(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
LBB1_28:
	cmpl	$0, -16(%rbp)
	je	LBB1_30
## %bb.29:
	leaq	L_.str.4(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
	jmp	LBB1_31
LBB1_30:
	leaq	L_.str.5(%rip), %rdi
	movb	$0, %al
	callq	_libmin_printf
LBB1_31:
	movq	-40(%rbp), %rdi
	callq	_libmin_free
	movq	-32(%rbp), %rdi
	callq	_libmin_free
	movq	-48(%rbp), %rdi
	callq	_destroy_bfilter
	callq	_libmin_success
	xorl	%eax, %eax
	addq	$64, %rsp
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Using %lu kilobytes for filter.\n\n"

L_.str.1:                               ## @.str.1
	.asciz	"True positives: %i\nTrue negatives: %i\nFalse positives: %i\nFalse negatives: %i\n"

L_.str.2:                               ## @.str.2
	.asciz	"\n%3.2f%% success rate\n\n"

L_.str.3:                               ## @.str.3
	.asciz	"WARNING: Success rate less than 80%%.\n\n"

L_.str.4:                               ## @.str.4
	.asciz	"**ERROR:** Test FAILED.\n"

L_.str.5:                               ## @.str.5
	.asciz	"Test PASSED.\n"

.subsections_via_symbols


ARM64 assembly:
	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bad_search                     ; -- Begin function bad_search
	.p2align	2
_bad_search:                            ; @bad_search
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	str	x0, [sp, #32]
	str	w1, [sp, #28]
	str	x2, [sp, #16]
	str	wzr, [sp, #12]
	b	LBB0_1
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldrsw	x8, [sp, #12]
	ldr	x9, [sp, #16]
	subs	x8, x8, x9
	cset	w8, hs
	tbnz	w8, #0, LBB0_6
	b	LBB0_2
LBB0_2:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [sp, #32]
	ldrsw	x9, [sp, #12]
	ldr	w8, [x8, x9, lsl #2]
	ldr	w9, [sp, #28]
	subs	w8, w8, w9
	cset	w8, ne
	tbnz	w8, #0, LBB0_4
	b	LBB0_3
LBB0_3:
	mov	w8, #1
	str	w8, [sp, #44]
	b	LBB0_7
LBB0_4:                                 ;   in Loop: Header=BB0_1 Depth=1
	b	LBB0_5
LBB0_5:                                 ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [sp, #12]
	add	w8, w8, #1
	str	w8, [sp, #12]
	b	LBB0_1
LBB0_6:
	str	wzr, [sp, #44]
	b	LBB0_7
LBB0_7:
	ldr	w0, [sp, #44]
	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, #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
	stur	wzr, [x29, #-4]
	stur	wzr, [x29, #-8]
	stur	wzr, [x29, #-12]
	stur	wzr, [x29, #-16]
	stur	wzr, [x29, #-20]
	mov	x0, #8192
	str	x0, [sp, #40]                   ; 8-byte Folded Spill
	bl	_libmin_malloc
	mov	x8, x0
	ldr	x0, [sp, #40]                   ; 8-byte Folded Reload
	stur	x8, [x29, #-32]
	bl	_libmin_malloc
	mov	x8, x0
	ldr	x0, [sp, #40]                   ; 8-byte Folded Reload
	stur	x8, [x29, #-40]
	bl	_create_bfilter
	stur	x0, [x29, #-48]
	ldur	x8, [x29, #-48]
	ldr	x8, [x8]
	lsl	x8, x8, #2
	mov	x9, #1024
	udiv	x8, x8, x9
	mov	x9, sp
	str	x8, [x9]
	adrp	x0, l_.str@PAGE
	add	x0, x0, l_.str@PAGEOFF
	bl	_libmin_printf
	mov	w0, #42
	bl	_libmin_srand
	stur	wzr, [x29, #-52]
	b	LBB1_1
LBB1_1:                                 ; =>This Inner Loop Header: Depth=1
	ldur	w8, [x29, #-52]
	subs	w8, w8, #2048
	cset	w8, ge
	tbnz	w8, #0, LBB1_7
	b	LBB1_2
LBB1_2:                                 ;   in Loop: Header=BB1_1 Depth=1
	bl	_libmin_rand
	ldur	x8, [x29, #-32]
	ldursw	x9, [x29, #-52]
	str	w0, [x8, x9, lsl #2]
	ldur	x0, [x29, #-48]
	ldur	x8, [x29, #-32]
	ldursw	x9, [x29, #-52]
	add	x1, x8, x9, lsl #2
	bl	_bfilter_add
	bl	_libmin_rand
	ands	w8, w0, #0x1
	cset	w8, eq
	tbnz	w8, #0, LBB1_4
	b	LBB1_3
LBB1_3:                                 ;   in Loop: Header=BB1_1 Depth=1
	ldur	x8, [x29, #-32]
	ldursw	x9, [x29, #-52]
	ldr	w8, [x8, x9, lsl #2]
	ldur	x9, [x29, #-40]
	ldursw	x10, [x29, #-52]
	str	w8, [x9, x10, lsl #2]
	b	LBB1_5
LBB1_4:                                 ;   in Loop: Header=BB1_1 Depth=1
	bl	_libmin_rand
	ldur	x8, [x29, #-40]
	ldursw	x9, [x29, #-52]
	str	w0, [x8, x9, lsl #2]
	b	LBB1_5
LBB1_5:                                 ;   in Loop: Header=BB1_1 Depth=1
	b	LBB1_6
LBB1_6:                                 ;   in Loop: Header=BB1_1 Depth=1
	ldur	w8, [x29, #-52]
	add	w8, w8, #1
	stur	w8, [x29, #-52]
	b	LBB1_1
LBB1_7:
	stur	wzr, [x29, #-52]
	b	LBB1_8
LBB1_8:                                 ; =>This Inner Loop Header: Depth=1
	ldur	w8, [x29, #-52]
	subs	w8, w8, #2048
	cset	w8, ge
	tbnz	w8, #0, LBB1_26
	b	LBB1_9
LBB1_9:                                 ;   in Loop: Header=BB1_8 Depth=1
	str	wzr, [sp, #56]
	str	wzr, [sp, #52]
	ldur	x0, [x29, #-48]
	ldur	x8, [x29, #-40]
	ldursw	x9, [x29, #-52]
	add	x1, x8, x9, lsl #2
	bl	_bfilter_check
	str	w0, [sp, #56]
	ldur	x0, [x29, #-32]
	ldur	x8, [x29, #-40]
	ldursw	x9, [x29, #-52]
	ldr	w1, [x8, x9, lsl #2]
	mov	x2, #2048
	bl	_bad_search
	str	w0, [sp, #52]
	ldr	w8, [sp, #52]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB1_12
	b	LBB1_10
LBB1_10:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #56]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB1_12
	b	LBB1_11
LBB1_11:                                ;   in Loop: Header=BB1_8 Depth=1
	ldur	w8, [x29, #-12]
	add	w8, w8, #1
	stur	w8, [x29, #-12]
	b	LBB1_24
LBB1_12:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #52]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB1_15
	b	LBB1_13
LBB1_13:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #56]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB1_15
	b	LBB1_14
LBB1_14:                                ;   in Loop: Header=BB1_8 Depth=1
	ldur	w8, [x29, #-20]
	add	w8, w8, #1
	stur	w8, [x29, #-20]
	b	LBB1_23
LBB1_15:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #52]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB1_18
	b	LBB1_16
LBB1_16:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #56]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB1_18
	b	LBB1_17
LBB1_17:                                ;   in Loop: Header=BB1_8 Depth=1
	ldur	w8, [x29, #-8]
	add	w8, w8, #1
	stur	w8, [x29, #-8]
	b	LBB1_22
LBB1_18:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #52]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB1_21
	b	LBB1_19
LBB1_19:                                ;   in Loop: Header=BB1_8 Depth=1
	ldr	w8, [sp, #56]
	subs	w8, w8, #0
	cset	w8, ne
	tbnz	w8, #0, LBB1_21
	b	LBB1_20
LBB1_20:                                ;   in Loop: Header=BB1_8 Depth=1
	ldur	w8, [x29, #-16]
	add	w8, w8, #1
	stur	w8, [x29, #-16]
	b	LBB1_21
LBB1_21:                                ;   in Loop: Header=BB1_8 Depth=1
	b	LBB1_22
LBB1_22:                                ;   in Loop: Header=BB1_8 Depth=1
	b	LBB1_23
LBB1_23:                                ;   in Loop: Header=BB1_8 Depth=1
	b	LBB1_24
LBB1_24:                                ;   in Loop: Header=BB1_8 Depth=1
	b	LBB1_25
LBB1_25:                                ;   in Loop: Header=BB1_8 Depth=1
	ldur	w8, [x29, #-52]
	add	w8, w8, #1
	stur	w8, [x29, #-52]
	b	LBB1_8
LBB1_26:
	ldur	w8, [x29, #-12]
                                        ; implicit-def: $x12
	mov	x12, x8
	ldur	w8, [x29, #-20]
                                        ; implicit-def: $x11
	mov	x11, x8
	ldur	w8, [x29, #-8]
                                        ; implicit-def: $x10
	mov	x10, x8
	ldur	w9, [x29, #-16]
                                        ; implicit-def: $x8
	mov	x8, x9
	mov	x9, sp
	str	x12, [x9]
	str	x11, [x9, #8]
	str	x10, [x9, #16]
	str	x8, [x9, #24]
	adrp	x0, l_.str.1@PAGE
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_libmin_printf
	ldur	w8, [x29, #-12]
	ldur	w9, [x29, #-20]
	add	w8, w8, w9
	ucvtf	s1, w8
	mov	w8, #1028128768
	fmov	s0, w8
	fmul	s0, s0, s1
	str	s0, [sp, #48]
	ldr	s0, [sp, #48]
	fcvt	d0, s0
	mov	x8, sp
	str	d0, [x8]
	adrp	x0, l_.str.2@PAGE
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_libmin_printf
	ldr	s0, [sp, #48]
	mov	w8, #1117782016
	fmov	s1, w8
	fcmp	s0, s1
	cset	w8, pl
	tbnz	w8, #0, LBB1_28
	b	LBB1_27
LBB1_27:
	adrp	x0, l_.str.3@PAGE
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_libmin_printf
	b	LBB1_28
LBB1_28:
	ldur	w8, [x29, #-16]
	subs	w8, w8, #0
	cset	w8, eq
	tbnz	w8, #0, LBB1_30
	b	LBB1_29
LBB1_29:
	adrp	x0, l_.str.4@PAGE
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_libmin_printf
	b	LBB1_31
LBB1_30:
	adrp	x0, l_.str.5@PAGE
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_libmin_printf
	b	LBB1_31
LBB1_31:
	ldur	x0, [x29, #-40]
	bl	_libmin_free
	ldur	x0, [x29, #-32]
	bl	_libmin_free
	ldur	x0, [x29, #-48]
	bl	_destroy_bfilter
	bl	_libmin_success
	mov	w0, #0
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Using %lu kilobytes for filter.\n\n"

l_.str.1:                               ; @.str.1
	.asciz	"True positives: %i\nTrue negatives: %i\nFalse positives: %i\nFalse negatives: %i\n"

l_.str.2:                               ; @.str.2
	.asciz	"\n%3.2f%% success rate\n\n"

l_.str.3:                               ; @.str.3
	.asciz	"WARNING: Success rate less than 80%%.\n\n"

l_.str.4:                               ; @.str.4
	.asciz	"**ERROR:** Test FAILED.\n"

l_.str.5:                               ; @.str.5
	.asciz	"Test PASSED.\n"

.subsections_via_symbols