What does this code do?
Optimizing GCC 4.8.2:
.LC0:
.string "Usage: "
.LC1:
.string "error #1!"
.LC2:
.string "error #2!"
main:
push rbx
mov rbx, rsi
sub rsp, 160
cmp edi, 2
je .L2
mov edi, OFFSET FLAT:.LC0
call puts
.L2:
mov rsi, QWORD PTR [rbx+8]
lea rdx, [rsp+16]
mov edi, 1
call __xstat
test eax, eax
js .L10
mov rax, QWORD PTR [rsp+88]
xor edi, edi
mov QWORD PTR [rsp], rax
call time
mov rdi, QWORD PTR [rbx+8]
mov rsi, rsp
mov QWORD PTR [rsp+8], rax
call utime
test eax, eax
js .L11
add rsp, 160
xor eax, eax
pop rbx
ret
.L10:
mov edi, OFFSET FLAT:.LC1
call puts
xor edi, edi
call exit
.L11:
mov edi, OFFSET FLAT:.LC2
call puts
xor edi, edi
call exit
Executable file is also available for download: here. Don't forget to set executable flag: chmod +x e12.
More challenges: challenges.re; about solutions: challenges.re/#Solutions.