Skip to content

Instantly share code, notes, and snippets.

@mjhoy
Created October 9, 2019 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mjhoy/605d82ec5cb1597a75ba1ca08fdf3861 to your computer and use it in GitHub Desktop.
Save mjhoy/605d82ec5cb1597a75ba1ca08fdf3861 to your computer and use it in GitHub Desktop.
9c9
< subq $16, %rsp
---
> subq $32, %rsp
14c14,19
< movl $0, (%rax)
---
> movq %rax, -16(%rbp)
> movl $0, -20(%rbp)
> movl -20(%rbp), %eax
> movl %eax, %edx
> movq -16(%rbp), %rax
> movl %edx, (%rax)
28,33c33,34
< movl $0, -4(%rbp)
< L6:
< movq -24(%rbp), %rax
< movl (%rax), %eax
< cmpl %eax, -4(%rbp)
< jne L6
---
> movl $0, -12(%rbp)
> L7:
35c36,54
< movl $1, (%rax)
---
> movq %rax, -8(%rbp)
> movl $1, -16(%rbp)
> movl -16(%rbp), %eax
> movl %eax, %ecx
> movq -8(%rbp), %rsi
> leaq -12(%rbp), %rdx
> movl (%rdx), %eax
> lock; cmpxchgl %ecx, (%rsi)
> movl %eax, %ecx
> sete %al
> testb %al, %al
> jne L4
> movl %ecx, (%rdx)
> L4:
> testb %al, %al
> jne L10
> movl $0, -12(%rbp)
> jmp L7
> L10:
48c67,72
< movq %rdi, -8(%rbp)
---
> movq %rdi, -24(%rbp)
> movq -24(%rbp), %rax
> movq %rax, -8(%rbp)
> movl $0, -12(%rbp)
> movl -12(%rbp), %eax
> movl %eax, %edx
50c74,76
< movl $0, (%rax)
---
> xchgl (%rax), %edx
> movl %edx, %eax
> movl %eax, -16(%rbp)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment