Skip to content

Instantly share code, notes, and snippets.

@nwmcsween
Created July 3, 2012 22:23
Show Gist options
  • Select an option

  • Save nwmcsween/3043799 to your computer and use it in GitHub Desktop.

Select an option

Save nwmcsween/3043799 to your computer and use it in GitHub Desktop.
llvm
--- readdir.s 2012-07-03 15:25:01.324857380 +0000
+++ readdir_o.s 2012-07-03 15:25:28.108185315 +0000
@@ -14,20 +14,8 @@
movq %rdi, %rbx
movl 16(%rbx), %eax
cmpl 20(%rbx), %eax
- jl .LBB0_3
-# BB#1:
- movl (%rbx), %edi
- leaq 32(%rbx), %rsi
- movl $2048, %edx # imm = 0x800
- callq __getdents
- movl %eax, %ecx
- xorl %eax, %eax
- testl %ecx, %ecx
- jle .LBB0_4
-# BB#2:
- movl %ecx, 20(%rbx)
- movl $0, 16(%rbx)
- xorl %eax, %eax
+ jge .LBB0_1
+ .align 16, 0x90
.LBB0_3:
movslq %eax, %rax
movzwl 48(%rbx,%rax), %ecx
@@ -37,9 +25,24 @@
movq 40(%rbx,%rax), %rcx
movq %rcx, 8(%rbx)
leaq 32(%rbx,%rax), %rax
+ .align 16, 0x90
.LBB0_4:
popq %rbx
ret
+.LBB0_1:
+ movl (%rbx), %edi
+ leaq 32(%rbx), %rsi
+ movl $2048, %edx # imm = 0x800
+ callq __getdents
+ movl %eax, %ecx
+ xorl %eax, %eax
+ testl %ecx, %ecx
+ jle .LBB0_4
+# BB#2:
+ movl %ecx, 20(%rbx)
+ movl $0, 16(%rbx)
+ xorl %eax, %eax
+ jmp .LBB0_3
.Ltmp4:
.size readdir, .Ltmp4-readdir
.cfi_endproc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment