aboutsummaryrefslogtreecommitdiff
path: root/semestr-4/ask/lista5/zad1.s
blob: b935b9ebb8ac9b954aeb5d7a12e69038a43d15f5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
	.file	"zad1.c"
	.text
	.p2align 4
	.globl	puzzle
	.type	puzzle, @function
puzzle:
.LFB23:
	.cfi_startproc
	endbr64
	xorl	%r8d, %r8d
	testl	%esi, %esi
	je	.L1
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movl	%edi, %edx
	addl	$1, %eax
	sarq	%rdi
	andl	$1, %edx
	addl	%edx, %r8d
	cmpl	%esi, %eax
	jne	.L3
.L1:
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	puzzle, .-puzzle
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld%u"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	subq	$40, %rsp
	.cfi_def_cfa_offset 48
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	12(%rsp), %ecx
	movq	16(%rsp), %rax
	xorl	%r8d, %r8d
	testl	%ecx, %ecx
	je	.L8
	xorl	%edx, %edx
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%eax, %esi
	addl	$1, %edx
	sarq	%rax
	andl	$1, %esi
	addl	%esi, %r8d
	cmpl	%ecx, %edx
	jne	.L10
.L8:
	movq	24(%rsp), %rax
	xorq	%fs:40, %rax
	jne	.L16
	movl	%r8d, %eax
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L16:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4: