xmeta
11/11/2014 - 7:17 AM

Rust_FizzBuzz.asm

fn main() {
    for num in std::iter::range_inclusive(1i, 1000) {
        match (num % 3, num % 5) {
            (0, 0) => println!("FizzBuzz"),
            (0, _) => println!("Fizz"),
            (_, 0) => println!("Buzz"),
            (_, _) => println!("{}", num),
        }
    }
}
	.text
	.file	"rust-out.0.rs"
	.section	.text._ZN4main20h59a69c0d48e7122aeaaE,"ax",@progbits
	.align	16, 0x90
	.type	_ZN4main20h59a69c0d48e7122aeaaE,@function
_ZN4main20h59a69c0d48e7122aeaaE:
	.cfi_startproc
	cmpq	%fs:112, %rsp
	ja	.LBB0_2
	movabsq	$136, %r10
	movabsq	$0, %r11
	callq	__morestack
	retq
.LBB0_2:
	pushq	%rbp
.Ltmp0:
	.cfi_def_cfa_offset 16
	pushq	%r15
.Ltmp1:
	.cfi_def_cfa_offset 24
	pushq	%r14
.Ltmp2:
	.cfi_def_cfa_offset 32
	pushq	%r13
.Ltmp3:
	.cfi_def_cfa_offset 40
	pushq	%r12
.Ltmp4:
	.cfi_def_cfa_offset 48
	pushq	%rbx
.Ltmp5:
	.cfi_def_cfa_offset 56
	subq	$88, %rsp
.Ltmp6:
	.cfi_def_cfa_offset 144
.Ltmp7:
	.cfi_offset %rbx, -56
.Ltmp8:
	.cfi_offset %r12, -48
.Ltmp9:
	.cfi_offset %r13, -40
.Ltmp10:
	.cfi_offset %r14, -32
.Ltmp11:
	.cfi_offset %r15, -24
.Ltmp12:
	.cfi_offset %rbp, -16
	movl	$1, %ebx
	xorl	%r15d, %r15d
	movabsq	$7378697629483820647, %r13
	leaq	80(%rsp), %rbp
	leaq	16(%rsp), %r14
	leaq	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68YbaE(%rip), %r12
	jmp	.LBB0_3
	.align	16, 0x90
.LBB0_14:
	movq	%r14, %rdi
	callq	_ZN2io5stdio12println_args20hbce4bdc0b581726cEelE@PLT
.LBB0_3:
	cmpq	$1000, %rbx
	jge	.LBB0_4
	movq	%rbx, 72(%rsp)
	movb	$1, 64(%rsp)
	movq	%rbx, %rax
	movabsq	$6148914691236517206, %rcx
	imulq	%rcx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rax,2), %rcx
	movq	%rbx, %rax
	imulq	%r13
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	%rdx
	addq	%rax, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	movq	%rbx, %rax
	subq	%rdx, %rax
	cmpq	%rcx, %rbx
	leaq	1(%rbx), %rbx
	je	.LBB0_10
	testq	%rax, %rax
	je	.LBB0_6
	movq	_ZN3fmt3num13int.fmt..Show3fmt20ha5124fb20fd9c8a8zFxE@GOTPCREL(%rip), %rax
	movq	%rax, (%rsp)
	leaq	72(%rsp), %rax
	movq	%rax, 8(%rsp)
	leaq	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68DcaE(%rip), %rax
	movq	%rax, 16(%rsp)
	movq	$1, 24(%rsp)
	movq	$0, 32(%rsp)
	leaq	(%rsp), %rax
	movq	%rax, 48(%rsp)
	movq	$1, 56(%rsp)
	jmp	.LBB0_14
	.align	16, 0x90
.LBB0_4:
	testb	%r15b, %r15b
	jne	.LBB0_16
	movq	$1000, 72(%rsp)
	movb	$1, 64(%rsp)
	movb	$1, %r15b
	movl	$1000, %ebx
.LBB0_6:
	movq	%r12, 16(%rsp)
	jmp	.LBB0_13
.LBB0_10:
	testq	%rax, %rax
	je	.LBB0_15
	leaq	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68lbaE(%rip), %rax
	jmp	.LBB0_12
.LBB0_15:
	leaq	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68IaaE(%rip), %rax
.LBB0_12:
	movq	%rax, 16(%rsp)
.LBB0_13:
	movq	$1, 24(%rsp)
	movq	$0, 32(%rsp)
	movq	%rbp, 48(%rsp)
	movq	$0, 56(%rsp)
	jmp	.LBB0_14
.LBB0_16:
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
.Ltmp13:
	.size	_ZN4main20h59a69c0d48e7122aeaaE, .Ltmp13-_ZN4main20h59a69c0d48e7122aeaaE
	.cfi_endproc

	.section	.text.main,"ax",@progbits
	.globl	main
	.align	16, 0x90
	.type	main,@function
main:
	.cfi_startproc
	movq	%rsi, %rax
	movq	%rdi, %rcx
	leaq	_ZN4main20h59a69c0d48e7122aeaaE(%rip), %rdi
	movq	%rcx, %rsi
	movq	%rax, %rdx
	jmp	_ZN10lang_start20h040d2e3ae51e247fhjeE@PLT
.Ltmp14:
	.size	main, .Ltmp14-main
	.cfi_endproc

	.type	str1603,@object
	.section	.rodata.str1603,"a",@progbits
str1603:
	.ascii	"FizzBuzz"
	.size	str1603, 8

	.type	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68IaaE,@object
	.section	.data.rel.ro.local._ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68IaaE,"aw",@progbits
	.align	8
_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68IaaE:
	.quad	str1603
	.quad	8
	.size	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68IaaE, 16

	.type	str1606,@object
	.section	.rodata.str1606,"a",@progbits
str1606:
	.ascii	"Fizz"
	.size	str1606, 4

	.type	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68lbaE,@object
	.section	.data.rel.ro.local._ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68lbaE,"aw",@progbits
	.align	8
_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68lbaE:
	.quad	str1606
	.quad	4
	.size	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68lbaE, 16

	.type	str1607,@object
	.section	.rodata.str1607,"a",@progbits
str1607:
	.ascii	"Buzz"
	.size	str1607, 4

	.type	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68YbaE,@object
	.section	.data.rel.ro.local._ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68YbaE,"aw",@progbits
	.align	8
_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68YbaE:
	.quad	str1607
	.quad	4
	.size	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68YbaE, 16

	.type	str1612,@object
	.section	.rodata.str1612,"a",@progbits
str1612:
	.size	str1612, 0

	.type	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68DcaE,@object
	.section	.data.rel.ro.local._ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68DcaE,"aw",@progbits
	.align	8
_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68DcaE:
	.quad	str1612
	.quad	0
	.size	_ZN4main15__STATIC_FMTSTR20h569ba20a0d6b6e68DcaE, 16


	.section	".note.GNU-stack","",@progbits
fn main() {
    for num in std::iter::range_inclusive(1i, 1000) {
        let num_string = num.to_string();
        println!("{}",
            match (num % 3, num % 5) {
                (0, 0) => "FizzBuzz",
                (0, _) => "Fizz",
                (_, 0) => "Buzz",
                (_, _) => num_string.as_slice(),
            });
    }
}
	.text
	.file	"rust-out.0.rs"
	.section	.text._ZN4main20h3acd01ffb6becc08eaaE,"ax",@progbits
	.align	16, 0x90
	.type	_ZN4main20h3acd01ffb6becc08eaaE,@function
_ZN4main20h3acd01ffb6becc08eaaE:
	.cfi_startproc
	.cfi_personality 155, DW.ref.rust_eh_personality
.Leh_func_begin0:
	.cfi_lsda 27, .Lexception0
	cmpq	%fs:112, %rsp
	ja	.LBB0_2
	movabsq	$168, %r10
	movabsq	$0, %r11
	callq	__morestack
	retq
.LBB0_2:
	pushq	%rbp
.Ltmp3:
	.cfi_def_cfa_offset 16
	pushq	%r15
.Ltmp4:
	.cfi_def_cfa_offset 24
	pushq	%r14
.Ltmp5:
	.cfi_def_cfa_offset 32
	pushq	%r13
.Ltmp6:
	.cfi_def_cfa_offset 40
	pushq	%r12
.Ltmp7:
	.cfi_def_cfa_offset 48
	pushq	%rbx
.Ltmp8:
	.cfi_def_cfa_offset 56
	subq	$120, %rsp
.Ltmp9:
	.cfi_def_cfa_offset 176
.Ltmp10:
	.cfi_offset %rbx, -56
.Ltmp11:
	.cfi_offset %r12, -48
.Ltmp12:
	.cfi_offset %r13, -40
.Ltmp13:
	.cfi_offset %r14, -32
.Ltmp14:
	.cfi_offset %r15, -24
.Ltmp15:
	.cfi_offset %rbp, -16
	movl	$1, %r12d
	xorl	%ebp, %ebp
	leaq	104(%rsp), %r15
	leaq	56(%rsp), %rbx
	leaq	_ZN4main15__STATIC_FMTSTR20h7fd2cf1a697be0a27aaE(%rip), %r14
	leaq	(%rsp), %r13
	jmp	.LBB0_3
	.align	16, 0x90
.LBB0_20:
	movq	16(%rsp), %rdi
	xorl	%edx, %edx
	callq	je_sdallocx@PLT
.LBB0_3:
	cmpq	$1000, %r12
	jge	.LBB0_4
	movq	%r12, %rax
	leaq	1(%r12), %r12
	jmp	.LBB0_7
	.align	16, 0x90
.LBB0_4:
	testb	%bpl, %bpl
	movl	$1000, %eax
	movb	$1, %bpl
	movl	$1000, %r12d
	jne	.LBB0_5
.LBB0_7:
	movq	%rax, 48(%rsp)
	movb	$1, 40(%rsp)
	movq	_ZN3fmt3num13int.fmt..Show3fmt20ha5124fb20fd9c8a8zFxE@GOTPCREL(%rip), %rax
	movq	%rax, 104(%rsp)
	leaq	48(%rsp), %rax
	movq	%rax, 112(%rsp)
	movq	_ZN9to_string10T.ToString9to_string15__STATIC_FMTSTR20h39bed30b09dcdc2a1ddE@GOTPCREL(%rip), %rax
	movq	%rax, 56(%rsp)
	movq	$1, 64(%rsp)
	movq	$0, 72(%rsp)
	movq	%r15, 88(%rsp)
	movq	$1, 96(%rsp)
	leaq	16(%rsp), %rdi
	movq	%rbx, %rsi
	callq	_ZN3fmt6format20h3d40543018c75a48OPpE@PLT
	movq	48(%rsp), %rcx
	movq	%rcx, %rax
	movabsq	$6148914691236517206, %rdx
	imulq	%rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rax,2), %rdi
	movq	%rcx, %rax
	movabsq	$7378697629483820647, %rdx
	imulq	%rdx
	movq	%rdx, %rax
	shrq	$63, %rax
	sarq	%rdx
	addq	%rax, %rdx
	leaq	(%rdx,%rdx,4), %rax
	movq	%rcx, %rsi
	subq	%rax, %rsi
	cmpq	%rdi, %rcx
	je	.LBB0_13
	testq	%rsi, %rsi
	je	.LBB0_16
	movups	16(%rsp), %xmm0
	movups	%xmm0, 104(%rsp)
	jmp	.LBB0_18
	.align	16, 0x90
.LBB0_13:
	testq	%rsi, %rsi
	je	.LBB0_15
	leaq	str1814(%rip), %rax
	jmp	.LBB0_17
	.align	16, 0x90
.LBB0_16:
	leaq	str1815(%rip), %rax
.LBB0_17:
	movq	%rax, 104(%rsp)
	movq	$4, 112(%rsp)
	jmp	.LBB0_18
.LBB0_15:
	leaq	str1813(%rip), %rax
	movq	%rax, 104(%rsp)
	movq	$8, 112(%rsp)
	.align	16, 0x90
.LBB0_18:
	leaq	_ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E(%rip), %rax
	movq	%rax, (%rsp)
	movq	%r15, 8(%rsp)
	movq	%r14, 56(%rsp)
	movq	$1, 64(%rsp)
	movq	$0, 72(%rsp)
	movq	%r13, 88(%rsp)
	movq	$1, 96(%rsp)
.Ltmp0:
	movq	%rbx, %rdi
	callq	_ZN2io5stdio12println_args20hbce4bdc0b581726cEelE@PLT
.Ltmp1:
	movq	32(%rsp), %rsi
	testq	%rsi, %rsi
	jne	.LBB0_20
	jmp	.LBB0_3
.LBB0_5:
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
.LBB0_10:
.Ltmp2:
	movq	%rax, %rbx
	movq	32(%rsp), %rsi
	testq	%rsi, %rsi
	je	.LBB0_12
	movq	16(%rsp), %rdi
	xorl	%edx, %edx
	callq	je_sdallocx@PLT
.LBB0_12:
	movq	%rbx, %rdi
	callq	_Unwind_Resume@PLT
.Ltmp16:
	.size	_ZN4main20h3acd01ffb6becc08eaaE, .Ltmp16-_ZN4main20h3acd01ffb6becc08eaaE
	.cfi_endproc
.Leh_func_end0:
	.section	.gcc_except_table,"a",@progbits
	.align	4
GCC_except_table0:
.Lexception0:
	.byte	255
	.byte	155
	.byte	41
	.byte	3
	.byte	39
.Lset0 = .Leh_func_begin0-.Leh_func_begin0
	.long	.Lset0
.Lset1 = .Ltmp0-.Leh_func_begin0
	.long	.Lset1
	.long	0
	.byte	0
.Lset2 = .Ltmp0-.Leh_func_begin0
	.long	.Lset2
.Lset3 = .Ltmp1-.Ltmp0
	.long	.Lset3
.Lset4 = .Ltmp2-.Leh_func_begin0
	.long	.Lset4
	.byte	0
.Lset5 = .Ltmp1-.Leh_func_begin0
	.long	.Lset5
.Lset6 = .Leh_func_end0-.Ltmp1
	.long	.Lset6
	.long	0
	.byte	0
	.align	4

	.section	.text.main,"ax",@progbits
	.globl	main
	.align	16, 0x90
	.type	main,@function
main:
	.cfi_startproc
	movq	%rsi, %rax
	movq	%rdi, %rcx
	leaq	_ZN4main20h3acd01ffb6becc08eaaE(%rip), %rdi
	movq	%rcx, %rsi
	movq	%rax, %rdx
	jmp	_ZN10lang_start20h040d2e3ae51e247fhjeE@PLT
.Ltmp17:
	.size	main, .Ltmp17-main
	.cfi_endproc

	.section	".text._ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E","ax",@progbits
	.align	16, 0x90
	.type	_ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E,@function
_ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E:
	.cfi_startproc
	cmpq	%fs:112, %rsp
	ja	.LBB2_2
	movabsq	$24, %r10
	movabsq	$0, %r11
	callq	__morestack
	retq
.LBB2_2:
	subq	$24, %rsp
.Ltmp18:
	.cfi_def_cfa_offset 32
	movups	(%rdi), %xmm0
	movups	%xmm0, 8(%rsp)
	leaq	8(%rsp), %rdi
	callq	_ZN3fmt8str.Show3fmt20hf662a19b4fc04c3fX5yE@PLT
	addq	$24, %rsp
	retq
.Ltmp19:
	.size	_ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E, .Ltmp19-_ZN3fmt20_$BP$$x27a$x20T.Show3fmt20h9277125265717576141E
	.cfi_endproc

	.type	str1813,@object
	.section	.rodata.str1813,"a",@progbits
str1813:
	.ascii	"FizzBuzz"
	.size	str1813, 8

	.type	str1814,@object
	.section	.rodata.str1814,"a",@progbits
str1814:
	.ascii	"Fizz"
	.size	str1814, 4

	.type	str1815,@object
	.section	.rodata.str1815,"a",@progbits
str1815:
	.ascii	"Buzz"
	.size	str1815, 4

	.type	str1824,@object
	.section	.rodata.str1824,"a",@progbits
str1824:
	.size	str1824, 0

	.type	_ZN4main15__STATIC_FMTSTR20h7fd2cf1a697be0a27aaE,@object
	.section	.data.rel.ro.local._ZN4main15__STATIC_FMTSTR20h7fd2cf1a697be0a27aaE,"aw",@progbits
	.align	8
_ZN4main15__STATIC_FMTSTR20h7fd2cf1a697be0a27aaE:
	.quad	str1824
	.quad	0
	.size	_ZN4main15__STATIC_FMTSTR20h7fd2cf1a697be0a27aaE, 16

	.hidden	DW.ref.rust_eh_personality
	.weak	DW.ref.rust_eh_personality
	.section	.data.DW.ref.rust_eh_personality,"aGw",@progbits,DW.ref.rust_eh_personality,comdat
	.align	8
	.type	DW.ref.rust_eh_personality,@object
	.size	DW.ref.rust_eh_personality, 8
DW.ref.rust_eh_personality:
	.quad	rust_eh_personality

	.section	".note.GNU-stack","",@progbits