--- /dev/null
+all: asma.o
+
+asma.o: asma.s
+ gcc -c -o asma.o asma.s
+
+.PHONY: clean
+clean:
+ rm -f asma.o asma
+
+test1: all
+ gcc -pedantic -ansi -Wall -g -o asma asma.s main.c -D_GNU_SOURCE
+
+test2:
+ /usr/ftp/pub/ublu/test/asma/test
+
--- /dev/null
+ .file "asma.c"
+ .text
+.globl asma
+ .type asma, @function
+asma:
+.LFB2:
+ movq %rdi, %rax
+ ret
+.LFE2:
+ .size asma, .-asma
+ .section .eh_frame,"a",@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string "zR"
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .uleb128 0x1
+ .byte 0x3
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .long .LFB2
+ .long .LFE2-.LFB2
+ .uleb128 0x0
+ .align 8
+.LEFDE1:
+ .ident "GCC: (Debian 4.3.2-1.1) 4.3.2"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+ .file "asma_ref.c"
+ .text
+.globl asma_ref
+ .type asma_ref, @function
+asma_ref:
+.LFB2:
+ movl $0, %ecx
+.L4:
+ movzbl (%rdi,%rcx), %edx
+ leal -65(%rdx), %eax
+ cmpb $26, %al
+ sbbl %eax, %eax
+ andl $32, %eax
+ addl %edx, %eax
+ movb %al, (%rdi,%rcx)
+ addq $1, %rcx
+ cmpq $16, %rcx
+ jne .L4
+ movq %rdi, %rax
+ ret
+.LFE2:
+ .size asma_ref, .-asma_ref
+ .section .eh_frame,"a",@progbits
+.Lframe1:
+ .long .LECIE1-.LSCIE1
+.LSCIE1:
+ .long 0x0
+ .byte 0x1
+ .string "zR"
+ .uleb128 0x1
+ .sleb128 -8
+ .byte 0x10
+ .uleb128 0x1
+ .byte 0x3
+ .byte 0xc
+ .uleb128 0x7
+ .uleb128 0x8
+ .byte 0x90
+ .uleb128 0x1
+ .align 8
+.LECIE1:
+.LSFDE1:
+ .long .LEFDE1-.LASFDE1
+.LASFDE1:
+ .long .LASFDE1-.Lframe1
+ .long .LFB2
+ .long .LFE2-.LFB2
+ .uleb128 0x0
+ .align 8
+.LEFDE1:
+ .ident "GCC: (Debian 4.3.2-1.1) 4.3.2"
+ .section .note.GNU-stack,"",@progbits
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+extern unsigned char *asma(unsigned char *s);
+
+unsigned char *asma_ref(unsigned char *s)
+{
+ int i;
+ for (i=0; i<16; i++) {
+ unsigned char c = s[i];
+ c += (c >= 'A' && c <= 'Z') ? 'a'-'A' : 0;
+ s[i] = c;
+ }
+ return s;
+}
+
+int main(int argc, char **argv) {
+ char *input1[]={"asdfABCDEFGHKL54", "foofuuMUHkk"};
+ char *output1;
+ char *output2;
+ char *input2;
+ char *input3;
+ int i;
+
+ for(i = 0; i < 2; i++) {
+ input2 = strdup(input1[i]);
+ input3 = strdup(input1[i]);
+ output1 = (unsigned char*) asma_ref((unsigned char *)(input2));
+ output2 = (unsigned char*) asma((unsigned char *)(input3));
+
+ output1[16]='\0';
+ output2[16]='\0';
+
+ if(memcmp(output1,output2, 16)) {
+ printf("Testfall falsch; erwartet:\n\t\"%s\"\ntatsaechliches Ergebnis:\n\t\"%s\"\n", output1, output2);
+ } else {
+ printf("Testfall \"%s\" passt.\n", output1);
+ }
+
+ free(input2);
+ free(input3);
+ }
+
+ return 0;
+}
+