Skip to content

Instantly share code, notes, and snippets.

@rsms
Last active February 25, 2022 07:30
Embed
What would you like to do?
_smap_make: ; @smap_make
stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
stp x29, x30, [sp, #16] ; 16-byte Folded Spill
mov x8, x1
mov x19, x0
stp x1, x2, [x0, #24]
str xzr, [x0, #16]
str wzr, [x0, #4]
cbz w3, LBB0_2
add w9, w3, #1 ; =1
orr w9, w9, #0x1
ucvtf d0, w9
Lloh0:
adrp x9, _captab@PAGE
Lloh1:
add x9, x9, _captab@PAGEOFF
add x9, x9, w4, uxtw #3
ldur d1, [x9, #-8]
fmul d0, d1, d0
fcvtzu w9, d0
add w9, w9, #1 ; =1
and w9, w9, #0xfffffffe
b LBB0_3
LBB0_2:
mov w9, #8
LBB0_3:
str w9, [x19]
strb w4, [x19, #12]
lsr w10, w9, w4
sub w10, w9, w10
str w10, [x19, #8]
mov w10, #24
umull x20, w9, w10
mov x0, x2
mov x1, #0
mov x2, #0
mov x3, x20
blr x8
str x0, [x19, #16]
cbz x0, LBB0_6
mov x1, x20
bl _bzero
LBB0_5:
mov x0, x19
ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
ret
LBB0_6:
mov x19, #0
b LBB0_5
_smap_dispose: ; @smap_dispose
ldr w8, [x0]
add x8, x8, x8, lsl #1
lsl x2, x8, #3
ldp x1, x4, [x0, #16]
ldr x0, [x0, #32]
mov x3, #0
br x4
_smap_clear: ; @smap_clear
stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
str wzr, [x0, #4]
ldr x8, [x0, #16]
ldr w9, [x0]
add x9, x9, x9, lsl #1
lsl x1, x9, #3
mov x0, x8
bl _bzero
ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
ret
_smap_assign: ; @smap_assign
sub sp, sp, #144 ; =144
stp x28, x27, [sp, #48] ; 16-byte Folded Spill
stp x26, x25, [sp, #64] ; 16-byte Folded Spill
stp x24, x23, [sp, #80] ; 16-byte Folded Spill
stp x22, x21, [sp, #96] ; 16-byte Folded Spill
stp x20, x19, [sp, #112] ; 16-byte Folded Spill
stp x29, x30, [sp, #128] ; 16-byte Folded Spill
mov x19, x2
mov x20, x1
mov x21, x0
ldp w8, w9, [x0, #4]
cmp w8, w9
b.hs LBB3_10
LBB3_1:
mov x0, x20
mov x1, x19
bl _strhash
ldr w24, [x21]
sub w8, w24, #1 ; =1
and w23, w8, w0
ldr x22, [x21, #16]
mov w25, #24
LBB3_2: ; =>This Inner Loop Header: Depth=1
umaddl x0, w23, w25, x22
ldr x26, [x0]
cbz x26, LBB3_6
bl _OUTLINED_FUNCTION_0
tbnz w0, #0, LBB3_7
cmp x26, #1 ; =1
b.eq LBB3_6
add w8, w23, #1 ; =1
cmp w8, w24
csinc w23, wzr, w23, eq
b LBB3_2
LBB3_6:
mov w8, w23
ldr w9, [x21, #4]
add w9, w9, #1 ; =1
str w9, [x21, #4]
mov w9, #24
umaddl x9, w23, w9, x22
stp x20, x19, [x9]
b LBB3_8
LBB3_7:
mov w8, w23
LBB3_8:
mov w9, #24
madd x8, x8, x9, x22
add x0, x8, #16 ; =16
LBB3_9:
ldp x29, x30, [sp, #128] ; 16-byte Folded Reload
ldp x20, x19, [sp, #112] ; 16-byte Folded Reload
ldp x22, x21, [sp, #96] ; 16-byte Folded Reload
ldp x24, x23, [sp, #80] ; 16-byte Folded Reload
ldp x26, x25, [sp, #64] ; 16-byte Folded Reload
ldp x28, x27, [sp, #48] ; 16-byte Folded Reload
add sp, sp, #144 ; =144
ret
LBB3_10:
ldr w8, [x21]
adds w26, w8, w8
b.lo LBB3_12
mov x0, #0
b LBB3_9
LBB3_12:
mov w27, #24
umull x3, w26, w27
ldp x8, x0, [x21, #24]
mov x1, #0
mov x2, #0
blr x8
cbz x0, LBB3_9
mov x22, x0
mov x9, #0
sub w8, w26, #1 ; =1
str w8, [sp, #12] ; 4-byte Folded Spill
LBB3_14: ; =>This Loop Header: Depth=1
ldr w8, [x21]
cmp x9, x8
b.hs LBB3_22
ldr x8, [x21, #16]
madd x8, x9, x27, x8
ldr x23, [x8]
cbz x23, LBB3_21
str x9, [sp, #40] ; 8-byte Folded Spill
ldur q0, [x8, #8]
str q0, [sp, #16] ; 16-byte Folded Spill
fmov x24, d0
mov x0, x23
mov x1, x24
bl _strhash
ldr w8, [sp, #12] ; 4-byte Folded Reload
and w28, w0, w8
LBB3_17: ; Parent Loop BB3_14 Depth=1
umaddl x25, w28, w27, x22
ldr x8, [x25]
cbz x8, LBB3_20
mov x0, x25
mov x1, x23
mov x2, x24
bl _streq
tbnz w0, #0, LBB3_20
add w8, w28, #1 ; =1
cmp w8, w26
csinc w28, wzr, w28, eq
b LBB3_17
LBB3_20: ; in Loop: Header=BB3_14 Depth=1
str x23, [x25]
ldr q0, [sp, #16] ; 16-byte Folded Reload
stur q0, [x25, #8]
ldr x9, [sp, #40] ; 8-byte Folded Reload
LBB3_21: ; in Loop: Header=BB3_14 Depth=1
add x9, x9, #1 ; =1
b LBB3_14
LBB3_22:
add x8, x8, x8, lsl #1
lsl x2, x8, #3
ldp x1, x8, [x21, #16]
ldr x0, [x21, #32]
mov x3, #0
blr x8
str x22, [x21, #16]
str w26, [x21]
ldrb w8, [x21, #12]
lsr w8, w26, w8
sub w8, w26, w8
str w8, [x21, #8]
b LBB3_1
_strhash: ; @strhash
mov w8, #40389
movk w8, #33052, lsl #16
mov w9, #403
movk w9, #256, lsl #16
cbz x1, LBB4_2
LBB4_1: ; =>This Inner Loop Header: Depth=1
ldrb w10, [x0], #1
eor w8, w8, w10
mul w8, w8, w9
sub x1, x1, #1 ; =1
cbnz x1, LBB4_1
LBB4_2:
mov x0, x8
ret
_streq: ; @streq
stp x29, x30, [sp, #-16]! ; 16-byte Folded Spill
ldr x8, [x0, #8]
cmp x8, x2
b.ne LBB5_2
ldr x0, [x0]
bl _memcmp
cmp w0, #0 ; =0
cset w0, eq
b LBB5_3
LBB5_2:
mov w0, #0
LBB5_3:
ldp x29, x30, [sp], #16 ; 16-byte Folded Reload
ret
_smap_lookup: ; @smap_lookup
stp x24, x23, [sp, #-64]! ; 16-byte Folded Spill
stp x22, x21, [sp, #16] ; 16-byte Folded Spill
stp x20, x19, [sp, #32] ; 16-byte Folded Spill
stp x29, x30, [sp, #48] ; 16-byte Folded Spill
mov x19, x2
mov x20, x1
mov x21, x0
mov x0, x1
mov x1, x2
bl _strhash
ldr w23, [x21]
sub w8, w23, #1 ; =1
and w22, w8, w0
ldr x21, [x21, #16]
mov w24, #24
LBB6_1: ; =>This Inner Loop Header: Depth=1
umaddl x0, w22, w24, x21
ldr x8, [x0]
cbz x8, LBB6_4
bl _OUTLINED_FUNCTION_0
cbnz w0, LBB6_5
add w8, w22, #1 ; =1
cmp w8, w23
csinc w22, wzr, w22, eq
b LBB6_1
LBB6_4:
mov x0, #0
b LBB6_6
LBB6_5:
mov w8, #24
umaddl x8, w22, w8, x21
add x0, x8, #16 ; =16
LBB6_6:
ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
ldp x20, x19, [sp, #32] ; 16-byte Folded Reload
ldp x22, x21, [sp, #16] ; 16-byte Folded Reload
ldp x24, x23, [sp], #64 ; 16-byte Folded Reload
ret
_smap_del: ; @smap_del
stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill
stp x29, x30, [sp, #16] ; 16-byte Folded Spill
mov x19, x0
bl _smap_lookup
cbz x0, LBB7_2
ldr w8, [x19, #4]
sub w8, w8, #1 ; =1
str w8, [x19, #4]
mov w8, #1
stp x8, xzr, [x0, #-16]
LBB7_2:
ldp x29, x30, [sp, #16] ; 16-byte Folded Reload
ldp x20, x19, [sp], #32 ; 16-byte Folded Reload
ret
_smap_itnext: ; @smap_itnext
ldr x8, [x1]
ldr x9, [x0, #16]
ldr w10, [x0]
mov w11, #24
madd x9, x10, x11, x9
sub x9, x9, #24 ; =24
LBB8_1: ; =>This Inner Loop Header: Depth=1
mov x10, x8
cmp x9, x8
b.eq LBB8_4
add x8, x10, #24 ; =24
ldr x11, [x10, #24]
cmp x11, #2 ; =2
b.lo LBB8_1
str x8, [x1]
LBB8_4:
cmp x9, x10
cset w0, ne
ret
_OUTLINED_FUNCTION_0: ; @OUTLINED_FUNCTION_0 Thunk
mov x1, x20
mov x2, x19
b _streq
smap_make: # @smap_make
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %rbx
movq %rsi, 24(%rdi)
movq %rdx, 32(%rdi)
andq $0, 16(%rdi)
andl $0, 4(%rdi)
testl %ecx, %ecx
je .LBB0_1
incl %ecx
orl $1, %ecx
cvtsi2sd %rcx, %xmm0
movzbl %r8b, %ecx
mulsd captab-8(,%rcx,8), %xmm0
cvttsd2si %xmm0, %rsi
incl %esi
andl $-2, %esi
jmp .LBB0_3
.LBB0_1:
pushq $8
popq %rsi
.LBB0_3:
movl %esi, (%rbx)
movb %r8b, 12(%rbx)
movl %esi, %edi
movl %r8d, %ecx
shrl %cl, %edi
movl %esi, %ecx
subl %edi, %esi
movl %esi, 8(%rbx)
imulq $24, %rcx, %r14
xorl %r15d, %r15d
movq %rdx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r14, %rcx
callq *%rax
movq %rax, 16(%rbx)
testq %rax, %rax
je .LBB0_5
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq memset@PLT
movq %rbx, %r15
.LBB0_5:
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
.Lfunc_end0:
smap_dispose: # @smap_dispose
movq 16(%rdi), %rsi
movl (%rdi), %eax
imulq $24, %rax, %rdx
movq 24(%rdi), %rax
movq 32(%rdi), %rdi
xorl %ecx, %ecx
jmpq *%rax # TAILCALL
.Lfunc_end1:
smap_clear: # @smap_clear
andl $0, 4(%rdi)
movq 16(%rdi), %rax
movl (%rdi), %ecx
imulq $24, %rcx, %rdx
movq %rax, %rdi
xorl %esi, %esi
jmp memset@PLT # TAILCALL
.Lfunc_end2:
smap_assign: # @smap_assign
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $88, %rsp
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rbp
movl 4(%rdi), %eax
cmpl 8(%rdi), %eax
movq %rdi, 40(%rsp) # 8-byte Spill
jae .LBB3_1
.LBB3_14:
movq %r14, 8(%rsp) # 8-byte Spill
movq %r14, %rdi
movq %rbx, %r14
movq %rbx, %rsi
callq strhash
movl (%rbp), %r12d
leal -1(%r12), %ebx
andl %eax, %ebx
movq 16(%rbp), %rbp
.LBB3_15: # =>This Inner Loop Header: Depth=1
movl %ebx, %r15d
imulq $24, %r15, %rdi
movq (%rbp,%rdi), %r13
testq %r13, %r13
je .LBB3_19
addq %rbp, %rdi
movq 8(%rsp), %rsi # 8-byte Reload
movq %r14, %rdx
callq streq
testb %al, %al
jne .LBB3_20
cmpq $1, %r13
je .LBB3_19
incl %ebx
cmpl %r12d, %ebx
movl $0, %eax
cmovel %eax, %ebx
jmp .LBB3_15
.LBB3_19:
movq 40(%rsp), %rax # 8-byte Reload
incl 4(%rax)
imulq $24, %r15, %rax
movq 8(%rsp), %rcx # 8-byte Reload
movq %rcx, (%rbp,%rax)
movq %r14, 8(%rbp,%rax)
.LBB3_20:
imulq $24, %r15, %rax
leaq (%rax,%rbp), %r12
addq $16, %r12
.LBB3_21:
movq %r12, %rax
addq $88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
.LBB3_1:
movl (%rbp), %r15d
addl %r15d, %r15d
jae .LBB3_3
xorl %r12d, %r12d
jmp .LBB3_21
.LBB3_3:
movl %r15d, %eax
imulq $24, %rax, %rcx
movq 32(%rbp), %rdi
xorl %r12d, %r12d
xorl %esi, %esi
xorl %edx, %edx
callq *24(%rbp)
movq %rax, 16(%rsp) # 8-byte Spill
testq %rax, %rax
je .LBB3_21
movq %r15, 32(%rsp) # 8-byte Spill
leal -1(%r15), %eax
movl %eax, 28(%rsp) # 4-byte Spill
xorl %edx, %edx
.LBB3_5: # =>This Loop Header: Depth=1
movl (%rbp), %eax
cmpq %rax, %rdx
jae .LBB3_13
movq 16(%rbp), %rax
imulq $24, %rdx, %rcx
movq (%rax,%rcx), %rdi
testq %rdi, %rdi
je .LBB3_12
movq %rdx, 48(%rsp) # 8-byte Spill
movdqu 8(%rax,%rcx), %xmm0
movdqa %xmm0, 64(%rsp) # 16-byte Spill
movq %xmm0, %rsi
movq %rdi, 8(%rsp) # 8-byte Spill
movq %rsi, 56(%rsp) # 8-byte Spill
callq strhash
movl %eax, %r13d
andl 28(%rsp), %r13d # 4-byte Folded Reload
.LBB3_8: # Parent Loop BB3_5 Depth=1
movl %r13d, %ebp
imulq $24, %rbp, %rax
movq 16(%rsp), %rcx # 8-byte Reload
leaq (%rcx,%rax), %r15
cmpq $0, (%rcx,%rax)
je .LBB3_11
movq %r15, %rdi
movq 8(%rsp), %rsi # 8-byte Reload
movq 56(%rsp), %rdx # 8-byte Reload
callq streq
testb %al, %al
jne .LBB3_11
incl %r13d
cmpl 32(%rsp), %r13d # 4-byte Folded Reload
cmovel %r12d, %r13d
jmp .LBB3_8
.LBB3_11: # in Loop: Header=BB3_5 Depth=1
movq 8(%rsp), %rax # 8-byte Reload
movq %rax, (%r15)
imulq $24, %rbp, %rax
movq 16(%rsp), %rcx # 8-byte Reload
movdqa 64(%rsp), %xmm0 # 16-byte Reload
movdqu %xmm0, 8(%rcx,%rax)
movq 40(%rsp), %rbp # 8-byte Reload
movq 48(%rsp), %rdx # 8-byte Reload
.LBB3_12: # in Loop: Header=BB3_5 Depth=1
incq %rdx
jmp .LBB3_5
.LBB3_13:
imulq $24, %rax, %rdx
movq 16(%rbp), %rsi
movq 32(%rbp), %rdi
xorl %ecx, %ecx
callq *24(%rbp)
movq 16(%rsp), %rax # 8-byte Reload
movq %rax, 16(%rbp)
movq 32(%rsp), %rdx # 8-byte Reload
movl %edx, (%rbp)
movb 12(%rbp), %cl
movl %edx, %eax
shrl %cl, %eax
subl %eax, %edx
movl %edx, 8(%rbp)
jmp .LBB3_14
.Lfunc_end3:
strhash: # @strhash
movl $-2128831035, %eax # imm = 0x811C9DC5
xorl %ecx, %ecx
.LBB4_1: # =>This Inner Loop Header: Depth=1
cmpq %rcx, %rsi
je .LBB4_2
movzbl (%rdi,%rcx), %edx
xorl %edx, %eax
imull $16777619, %eax, %eax # imm = 0x1000193
incq %rcx
jmp .LBB4_1
.LBB4_2:
retq
.Lfunc_end4:
streq: # @streq
pushq %rax
cmpq %rdx, 8(%rdi)
jne .LBB5_1
movq (%rdi), %rdi
callq memcmp
testl %eax, %eax
sete %al
jmp .LBB5_3
.LBB5_1:
xorl %eax, %eax
.LBB5_3:
popq %rcx
retq
.Lfunc_end5:
smap_lookup: # @smap_lookup
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %r12
movq %rsi, %rdi
movq %rdx, (%rsp) # 8-byte Spill
movq %rdx, %rsi
callq strhash
movl (%r12), %r13d
leal -1(%r13), %ebp
andl %eax, %ebp
movq 16(%r12), %rbx
xorl %r12d, %r12d
.LBB6_1: # =>This Inner Loop Header: Depth=1
movl %ebp, %r14d
imulq $24, %r14, %rdi
cmpq $0, (%rbx,%rdi)
je .LBB6_4
addq %rbx, %rdi
movq %r15, %rsi
movq (%rsp), %rdx # 8-byte Reload
callq streq
testb %al, %al
jne .LBB6_3
incl %ebp
cmpl %r13d, %ebp
cmovel %r12d, %ebp
jmp .LBB6_1
.LBB6_3:
imulq $24, %r14, %rax
leaq (%rbx,%rax), %r12
addq $16, %r12
.LBB6_4:
movq %r12, %rax
addq $8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
.Lfunc_end6:
smap_del: # @smap_del
pushq %rbx
movq %rdi, %rbx
callq smap_lookup
testq %rax, %rax
je .LBB7_2
decl 4(%rbx)
movq $1, -16(%rax)
andq $0, -8(%rax)
.LBB7_2:
popq %rbx
retq
.Lfunc_end7:
smap_itnext: # @smap_itnext
movq (%rsi), %rcx
movq 16(%rdi), %rax
movl (%rdi), %edx
imulq $24, %rdx, %rdx
addq %rdx, %rax
addq $-24, %rax
.LBB8_1: # =>This Inner Loop Header: Depth=1
movq %rcx, %rdx
cmpq %rcx, %rax
je .LBB8_4
leaq 24(%rdx), %rcx
cmpq $2, 24(%rdx)
jb .LBB8_1
movq %rcx, (%rsi)
.LBB8_4:
cmpq %rdx, %rax
setne %al
retq
.Lfunc_end8:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment