clarify the purpose of this project
[nyanglibc.git] / libio / getchar.s
blobfc7a8cde3ff19217727018b94d9dbd5150246c3b
1 .text
2 .p2align 4,,15
3 .globl getchar
4 .type getchar, @function
5 getchar:
6 .LFB68:
7 pushq %rbp
8 pushq %rbx
9 subq $8, %rsp
10 movq stdin(%rip), %rbx
11 testb $-128, 116(%rbx)
12 jne .L2
13 movq 8(%rbx), %rax
14 cmpq 16(%rbx), %rax
15 jnb .L22
16 leaq 1(%rax), %rdx
17 movq %rdx, 8(%rbx)
18 movzbl (%rax), %r8d
19 .L1:
20 addq $8, %rsp
21 movl %r8d, %eax
22 popq %rbx
23 popq %rbp
24 ret
25 .p2align 4,,10
26 .p2align 3
27 .L2:
28 movl (%rbx), %edx
29 andl $32768, %edx
30 je .L23
31 movq %rbx, %rdi
32 .L5:
33 movq 8(%rdi), %rax
34 cmpq 16(%rdi), %rax
35 jnb .L24
36 leaq 1(%rax), %rdx
37 movq %rdx, 8(%rdi)
38 movzbl (%rax), %r8d
39 .L12:
40 testl $32768, (%rbx)
41 jne .L1
42 movq 136(%rbx), %rdi
43 movl 4(%rdi), %eax
44 subl $1, %eax
45 testl %eax, %eax
46 movl %eax, 4(%rdi)
47 jne .L1
48 movq $0, 8(%rdi)
49 #APP
50 # 885 "libioP.h" 1
51 movl %fs:24,%edx
52 # 0 "" 2
53 #NO_APP
54 testl %edx, %edx
55 jne .L13
56 subl $1, (%rdi)
57 addq $8, %rsp
58 movl %r8d, %eax
59 popq %rbx
60 popq %rbp
61 ret
62 .p2align 4,,10
63 .p2align 3
64 .L23:
65 movq 136(%rbx), %rcx
66 movq %fs:16, %rbp
67 cmpq %rbp, 8(%rcx)
68 je .L18
69 #APP
70 # 38 "getchar.c" 1
71 movl %fs:24,%eax
72 # 0 "" 2
73 #NO_APP
74 testl %eax, %eax
75 jne .L7
76 movl $1, %edx
77 #APP
78 # 47 "../sysdeps/unix/sysv/linux/x86/lowlevellock.h" 1
79 cmpxchgl %edx, (%rcx)
80 # 0 "" 2
81 #NO_APP
82 .L8:
83 movq 136(%rbx), %rcx
84 movq stdin(%rip), %rdi
85 movq %rbp, 8(%rcx)
86 .L6:
87 addl $1, 4(%rcx)
88 jmp .L5
89 .p2align 4,,10
90 .p2align 3
91 .L18:
92 movq %rbx, %rdi
93 jmp .L6
94 .p2align 4,,10
95 .p2align 3
96 .L22:
97 addq $8, %rsp
98 movq %rbx, %rdi
99 popq %rbx
100 popq %rbp
101 .LEHB0:
102 jmp __uflow
103 .LEHE0:
104 .p2align 4,,10
105 .p2align 3
106 .L24:
107 .LEHB1:
108 call __uflow
109 movl %eax, %r8d
110 jmp .L12
111 .p2align 4,,10
112 .p2align 3
113 .L7:
114 movl $1, %esi
115 movl %edx, %eax
116 lock cmpxchgl %esi, (%rcx)
117 je .L8
118 movq %rcx, %rdi
119 call __lll_lock_wait_private
120 .LEHE1:
121 jmp .L8
122 .p2align 4,,10
123 .p2align 3
124 .L13:
125 #APP
126 # 885 "libioP.h" 1
127 xchgl %eax, (%rdi)
128 # 0 "" 2
129 #NO_APP
130 cmpl $1, %eax
131 jle .L1
132 xorl %r10d, %r10d
133 movl $1, %edx
134 movl $129, %esi
135 movl $202, %eax
136 #APP
137 # 885 "libioP.h" 1
138 syscall
140 # 0 "" 2
141 #NO_APP
142 jmp .L1
143 .L19:
144 testl $32768, (%rbx)
145 movq %rax, %r8
146 jne .L15
147 movq 136(%rbx), %rdi
148 movl 4(%rdi), %eax
149 subl $1, %eax
150 testl %eax, %eax
151 movl %eax, 4(%rdi)
152 jne .L15
153 movq $0, 8(%rdi)
154 #APP
155 # 885 "libioP.h" 1
156 movl %fs:24,%edx
157 # 0 "" 2
158 #NO_APP
159 testl %edx, %edx
160 jne .L16
161 subl $1, (%rdi)
162 .L15:
163 movq %r8, %rdi
164 .LEHB2:
165 call _Unwind_Resume@PLT
166 .LEHE2:
167 .L16:
168 #APP
169 # 885 "libioP.h" 1
170 xchgl %eax, (%rdi)
171 # 0 "" 2
172 #NO_APP
173 subl $1, %eax
174 jle .L15
175 xorl %r10d, %r10d
176 movl $1, %edx
177 movl $129, %esi
178 movl $202, %eax
179 #APP
180 # 885 "libioP.h" 1
181 syscall
183 # 0 "" 2
184 #NO_APP
185 jmp .L15
186 .LFE68:
187 .globl __gcc_personality_v0
188 .section .gcc_except_table,"a",@progbits
189 .LLSDA68:
190 .byte 0xff
191 .byte 0xff
192 .byte 0x1
193 .uleb128 .LLSDACSE68-.LLSDACSB68
194 .LLSDACSB68:
195 .uleb128 .LEHB0-.LFB68
196 .uleb128 .LEHE0-.LEHB0
197 .uleb128 0
198 .uleb128 0
199 .uleb128 .LEHB1-.LFB68
200 .uleb128 .LEHE1-.LEHB1
201 .uleb128 .L19-.LFB68
202 .uleb128 0
203 .uleb128 .LEHB2-.LFB68
204 .uleb128 .LEHE2-.LEHB2
205 .uleb128 0
206 .uleb128 0
207 .LLSDACSE68:
208 .text
209 .size getchar, .-getchar
210 .hidden DW.ref.__gcc_personality_v0
211 .weak DW.ref.__gcc_personality_v0
212 .section .data.DW.ref.__gcc_personality_v0,"awG",@progbits,DW.ref.__gcc_personality_v0,comdat
213 .align 8
214 .type DW.ref.__gcc_personality_v0, @object
215 .size DW.ref.__gcc_personality_v0, 8
216 DW.ref.__gcc_personality_v0:
217 .quad __gcc_personality_v0
218 .hidden __lll_lock_wait_private
219 .hidden __uflow