From 0843094b9d862f015077867263c775f4f0b3af5e Mon Sep 17 00:00:00 2001 From: Franciszek Malinka Date: Mon, 29 Mar 2021 01:45:30 +0200 Subject: update --- Semestr 4/ask/lista5/zad2.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Semestr 4/ask/lista5/zad2.c (limited to 'Semestr 4/ask/lista5/zad2.c') diff --git a/Semestr 4/ask/lista5/zad2.c b/Semestr 4/ask/lista5/zad2.c new file mode 100644 index 0000000..ab9cb54 --- /dev/null +++ b/Semestr 4/ask/lista5/zad2.c @@ -0,0 +1,44 @@ +#include +#include + +long puzzle2(char *rdi /* rdi */, char *rsi /* rsi */) { + char *rax = rdi; +L3: + char r9b = *rax; + char *r8 = rax + 1; + char *rdx = rsi; +L2: + char cl = *rdx; + rdx++; + if (cl == 0) { + goto L4; + } + if (cl != r9b) { + goto L2; + } + rax = r8; + goto L3; +L4: + return rax - rdi; +} + + +// funkcja sprawdza jaka jest pierwsza litera z s która nie występuje w d +// jesli wszystkie występują, to zwróci długość s. +long puzzle2_decoded(char *s /* rdi */, char *d /* rsi */) { + for (char *result = s ; ; result++) { + char first = *result; + char *crawl = d; + for (char *crawl = d; *crawl != first; crawl++) { + if (*crawl == 0) { + return result - s; + } + } + } +} + + + +int main() { + +} \ No newline at end of file -- cgit v1.2.3