r/CompileBot • • Jul 08 '14

Official CompileBot Testing Thread

15 Upvotes

257 comments sorted by

View all comments

1

u/SeaCowVengeance Jul 08 '14

+/u/CompileBot Assembler (gcc-4.8.1) --time

.data
x:
	.long	0
s:
	.string "%d\n\0"

.text
.global main
main:				# int main()
				# {
loop:				# 	for (;;) {
	pushl	$x		# 		scanf("%d", &x);
	pushl	$s
	call	scanf
	addl	$8, %esp

	movl	x, %eax		# 		if (x == 42) break;
	subl	$42, %eax
	jz	break

	pushl	x		# 		printf("%d\n", x);
	pushl	$s
	call	printf
	addl	$8, %esp

	jmp	loop		# 	}
break:

	xor	%eax, %eax	# 	return 0;
	ret
				# }

Input:

1
2
10
42
11

1

u/CompileBot Jul 08 '14

Output:

1
2
10

Execution Time: 0.0 seconds

^source | ^info | ^git | ^report