Created
August 7, 2022 19:23
-
-
Save Frityet/c966cf46a97d6b8542651fbf2486c15c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vector_create: | |
push rbp | |
mov rbp, rsp | |
mov QWORD PTR [rbp-40], rdi | |
mov QWORD PTR [rbp-48], rsi | |
pxor xmm0, xmm0 | |
movaps XMMWORD PTR [rbp-32], xmm0 | |
movq QWORD PTR [rbp-16], xmm0 | |
mov rax, QWORD PTR [rbp-48] | |
mov QWORD PTR [rbp-32], rax | |
mov rcx, QWORD PTR [rbp-40] | |
mov rax, QWORD PTR [rbp-32] | |
mov rdx, QWORD PTR [rbp-24] | |
mov QWORD PTR [rcx], rax | |
mov QWORD PTR [rcx+8], rdx | |
mov rax, QWORD PTR [rbp-16] | |
mov QWORD PTR [rcx+16], rax | |
mov rax, QWORD PTR [rbp-40] | |
pop rbp | |
ret | |
main: | |
push rbp | |
mov rbp, rsp | |
sub rsp, 32 | |
lea rax, [rbp-32] | |
mov esi, 100 | |
mov rdi, rax | |
call Vector_create | |
mov eax, 0 | |
leave | |
ret |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stddef.h> | |
#include <stdint.h> | |
struct Vector { | |
uint64_t size; | |
void *data; | |
uint64_t field2; | |
}; | |
struct Vector Vector_create(uint64_t size) | |
{ | |
struct Vector v = { | |
.size = size, | |
.data = NULL | |
}; | |
return v; | |
} | |
int main() | |
{ | |
struct Vector v = Vector_create(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment