[BITS 16]
[org 0]
[section .text]

start:
	mov ax,cs
	mov ds,ax
	mov es,ax

	mov ah,03
	mov bh,0
	int 10h

	call _main

	jmp 0x1000:0

global _main
global _is_digit
global _strlen
global _atoi
global _scanf
global _print_short
global _printf
global _strcpy
global _putc
global _getch
global _bzero
global _strcmp

[segment .text]

%include "io.asm"


%define _ret -2
%define _i -4
%define _n -6
%define _off -8
%define _num -20
%define temp2 -22
%define _str 4

_atoi:
	push bp
	mov bp,sp
	sub sp,word 20
	push word 0
	mov bx,word 4
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 10000
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 3
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 1000
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 2
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 100
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 1
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 10
	pop di
	mov [di],dx
	mov ax,dx
	push word 0
	mov bx,word 0
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	push bx
	mov dx,word 1
	pop di
	mov [di],dx
	mov ax,dx
	mov [bp+_ret],word 0
	push word [bp+_str]
	call _strlen
	add sp,word 2
	mov [bp+_n],ax
	push word [bp+_n]
	mov bx,word 1
	pop dx
	sub dx,bx
	mov [bp+_off],dx
	mov [bp+_i],word 0
	push ax
.L20:	
	push word [bp+_i]
	mov bx,word [bp+_n]
	pop dx
	cmp dx,bx
	jl .L21
	mov ax,word 0
	jmp .L22
.L21:	
	mov ax,word 1
.L22:	
	cmp ax,word 0
	je .L19
	sub sp,word 2
	push word 0
	mov bx,word [bp+_i]
	pop dx
	add bx,dx
	push bx
	mov bx,[bp+_str]
	pop dx
	push bx
	add bx,dx
	mov al,[bx]
	cpush al
	pop word [bp+temp2]
	mov ax,'0'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L24
	jmp .L23
.L24:	
	mov ax,'1'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L25
	push word [bp+_ret]
	push 1
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L25:	
	mov ax,'2'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L26
	push word [bp+_ret]
	push 2
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L26:	
	mov ax,'3'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L27
	push word [bp+_ret]
	push 3
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L27:	
	mov ax,'4'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L28
	push word [bp+_ret]
	push 4
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L28:	
	mov ax,'5'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L29
	push word [bp+_ret]
	push 5
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L29:	
	mov ax,'6'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L30
	push word [bp+_ret]
	push 6
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L30:	
	mov ax,'7'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L31
	push word [bp+_ret]
	push 7
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L31:	
	mov ax,'8'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L32
	push word [bp+_ret]
	push 8
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L32:	
	mov ax,'9'
	mov bx,word [bp+temp2]
	cmp ax,bx
	jne .L33
	push word [bp+_ret]
	push 9
	push word 0
	push word [bp+_off]
	mov bx,word [bp+_i]
	pop dx
	sub dx,bx
	mov bx,dx
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_num]
	pop dx
	imul dx,word 2
	add bx,dx
	mov bx,word [bx]
	pop dx
	imul bx,dx
	pop dx
	add dx,bx
	mov [bp+_ret],dx
	jmp .L23
.L33:	
.L23:	
	inc word [bp+_i]
	mov ax,word [bp+_i]
	jmp .L20
.L19:	
	mov ax,word [bp+_ret]
	leave
	ret
%undef _ret
%undef _i
%undef _n
%undef _off
%undef _num
%undef temp2
%undef _str

%define _ch 4

_is_digit:
	push bp
	mov bp,sp
	push word [bp+_ch]
	mov bx,word '0'
	pop dx
	cmp dx,bx
	jge .L12
	push 0
	jmp .L13
.L12:	
	push 1
.L13:	
	push word [bp+_ch]
	mov bx,word '9'
	pop dx
	cmp dx,bx
	jle .L14
	push 0
	jmp .L15
.L14:	
	push 1
.L15:	
	pop bx
	pop ax
	and ax,bx
	cmp ax,word 0
	je .L16
	mov ax,word 1
	leave
	ret
	jmp .L11
.L16:	
.L11:	
	mov ax,word 0
	leave
	ret
%undef _ch

%define temp1 -2

_main:
	push bp
	mov bp,sp
	sub sp,word 2
	push 10
	pop word [bp+temp1]
	mov ax,word 1
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L1
	push C0
	call _printf
	add sp,word 2
	jmp .L0
.L1:	
	mov ax,word 2
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L2
	push C1
	call _printf
	add sp,word 2
	jmp .L0
.L2:	
	mov ax,word 3
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L3
	push C2
	call _printf
	add sp,word 2
	jmp .L0
.L3:	
	mov ax,word 4
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L4
	push C3
	call _printf
	add sp,word 2
	jmp .L0
.L4:	
	mov ax,word 5
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L5
	push C4
	call _printf
	add sp,word 2
	jmp .L0
.L5:	
	mov ax,word 6
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L6
	push C5
	call _printf
	add sp,word 2
	jmp .L0
.L6:	
	mov ax,word 7
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L7
	push C6
	call _printf
	add sp,word 2
	jmp .L0
.L7:	
	mov ax,word 8
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L8
	push C7
	call _printf
	add sp,word 2
	jmp .L0
.L8:	
	mov ax,word 9
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L9
	push C8
	call _printf
	add sp,word 2
	jmp .L0
.L9:	
	mov ax,word 10
	mov bx,word [bp+temp1]
	cmp ax,bx
	jne .L10
	push C9
	call _printf
	add sp,word 2
	jmp .L0
.L10:	
	push C10
	call _printf
	add sp,word 2
.L0:	
	mov ax,word 0
	leave
	ret
%undef temp1

%define _ret -2
%define _n -4
%define _byte_array -14
%define _buffer -24
%define _index -26
%define _number 4

_print_short:
	push bp
	mov bp,sp
	sub sp,word 26
	mov [bp+_ret],word 0
	push word 0
	mov bx,word 0
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '0'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 1
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '1'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 2
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '2'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 3
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '3'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 4
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '4'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 5
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '5'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 6
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '6'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 7
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '7'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 8
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '8'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word 0
	mov bx,word 9
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	push bx
	push word '9'
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	push word [bp+_number]
	mov bx,word 0
	pop dx
	cmp dx,bx
	je .L60
	mov ax,word 0
	jmp .L61
.L60:	
	mov ax,word 1
.L61:	
	cmp ax,word 0
	je .L62
	push word '0'
	call _putc
	add sp,word 2
	jmp .L59
.L62:	
.L59:	
	mov [bp+_index],word 0
.L64:	
	mov ax,word [bp+_number]
	cmp ax,word 0
	je .L63
	push word [bp+_number]
	mov bx,word 10
	pop ax
	xor dx,dx
	idiv bx
	mov [bp+_n],dx
	push word [bp+_number]
	mov bx,word 10
	pop ax
	xor dx,dx
	idiv bx
	mov [bp+_number],ax
	push word 0
	mov bx,word [bp+_index]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word 0
	mov bx,word [bp+_n]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_byte_array]
	pop dx
	add bx,dx
	mov al,[bx]
	pop di
	mov [di],al
	cpush al
	pop ax
	inc word [bp+_index]
	mov ax,word [bp+_index]
	jmp .L64
.L63:	
	dec word [bp+_index]
	mov ax,word [bp+_index]
.L66:	
	push word [bp+_index]
	mov bx,word 0
	pop dx
	cmp dx,bx
	jge .L67
	mov ax,word 0
	jmp .L68
.L67:	
	mov ax,word 1
.L68:	
	cmp ax,word 0
	je .L65
	push word 0
	mov bx,word [bp+_index]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	mov al,[bx]
	cpush al
	call _putc
	add sp,word 2
	dec word [bp+_index]
	mov ax,word [bp+_index]
	jmp .L66
.L65:	
	mov ax,word [bp+_ret]
	leave
	ret
%undef _ret
%undef _n
%undef _byte_array
%undef _buffer
%undef _index
%undef _number

%define _ptr -2
%define _ptr0 -4
%define _ptr1 -6
%define _i -8
%define _j -10
%define _ret -12
%define _fmt 4

_printf:
	push bp
	mov bp,sp
	sub sp,word 12
	mov [bp+_ret],word 0
	mov ax,word [bp+_fmt]
	mov [bp+_ptr],ax
	mov [bp+_i],word 2
.L70:	
	mov di,[bp+_ptr]
	mov al,[di]
	cmp al,byte 0
	je .L69
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L72
	mov ax,word 0
	jmp .L73
.L72:	
	mov ax,word 1
.L73:	
	cmp ax,word 0
	je .L74
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L76
	mov ax,word 0
	jmp .L77
.L76:	
	mov ax,word 1
.L77:	
	cmp ax,word 0
	je .L78
	push word '%'
	call _putc
	add sp,word 2
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L75
.L78:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 'x'
	pop dx
	cmp dx,bx
	je .L79
	mov ax,word 0
	jmp .L80
.L79:	
	mov ax,word 1
.L80:	
	cmp ax,word 0
	je .L81
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	push dx
	call _tohex
	add sp,word 2
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L75
.L81:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 'd'
	pop dx
	cmp dx,bx
	je .L82
	mov ax,word 0
	jmp .L83
.L82:	
	mov ax,word 1
.L83:	
	cmp ax,word 0
	je .L84
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	push dx
	call _print_short
	add sp,word 2
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L75
.L84:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	mov bx,word 's'
	pop dx
	cmp dx,bx
	je .L85
	mov ax,word 0
	jmp .L86
.L85:	
	mov ax,word 1
.L86:	
	cmp ax,word 0
	je .L87
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_i]
	pop dx
	add dx,bx
	mov [bp+_ptr0],dx
	push bp
	mov ax,[bp+_ptr0]
	mov bp,ax
	mov dx,[bp]
	pop bp
	mov [bp+_ptr1],dx
.L89:	
	mov di,[bp+_ptr1]
	mov al,[di]
	cmp al,byte 0
	je .L88
	mov di,[bp+_ptr1]
	mov al,[di]
	cpush al
	call _putc
	add sp,word 2
	inc word [bp+_ptr1]
	mov ax,word [bp+_ptr1]
	jmp .L89
.L88:	
	push 2
	mov bx,[bp+_i]
	pop dx
	add bx,dx
	mov [bp+_i],bx
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L75
.L87:	
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
.L75:	
	jmp .L71
.L74:	
	mov di,[bp+_ptr]
	mov al,[di]
	cpush al
	call _putc
	add sp,word 2
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
.L71:	
	jmp .L70
.L69:	
	mov ax,word 0
	leave
	ret
%undef _ptr
%undef _ptr0
%undef _ptr1
%undef _i
%undef _j
%undef _ret
%undef _fmt

%define _ptr -2
%define _p -4
%define _temp -6
%define _buffer -106
%define _offset -108
%define _ch -110
%define _count -112
%define _fmt 4

_scanf:
	push bp
	mov bp,sp
	sub sp,word 112
	mov [bp+_offset],word 0
	mov [bp+_count],word 2
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_count]
	pop dx
	add dx,bx
	mov [bp+_ptr],dx
	mov ax,word [bp+_fmt]
	mov [bp+_p],ax
	push ax
.L35:	
	mov di,[bp+_p]
	mov al,[di]
	cmp al,byte 0
	je .L34
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word '%'
	pop dx
	cmp dx,bx
	je .L37
	mov ax,word 0
	jmp .L38
.L37:	
	mov ax,word 1
.L38:	
	cmp ax,word 0
	je .L39
	inc word [bp+_p]
	mov ax,word [bp+_p]
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'd'
	pop dx
	cmp dx,bx
	je .L41
	mov ax,word 0
	jmp .L42
.L41:	
	mov ax,word 1
.L42:	
	cmp ax,word 0
	je .L43
	push bp
	mov ax,[bp+_ptr]
	mov bp,ax
	mov dx,[bp]
	pop bp
	mov [bp+_temp],dx
	call _getch
	mov [bp+_ch],ax
	push word [bp+_ch]
	call _putc
	add sp,word 2
	mov [bp+_offset],word 0
.L45:	
	push word [bp+_ch]
	call _is_digit
	add sp,word 2
	push ax
	push word [bp+_ch]
	mov bx,word 13
	pop dx
	cmp dx,bx
	jne .L46
	push 0
	jmp .L47
.L46:	
	push 1
.L47:	
	push word [bp+_ch]
	mov bx,word 10
	pop dx
	cmp dx,bx
	jne .L48
	push 0
	jmp .L49
.L48:	
	push 1
.L49:	
	pop bx
	pop ax
	and ax,bx
	mov bx,ax
	pop ax
	and ax,bx
	cmp ax,word 0
	je .L44
	push word 0
	mov bx,word [bp+_offset]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word [bp+_ch]
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	inc word [bp+_offset]
	mov ax,word [bp+_offset]
	call _getch
	mov [bp+_ch],ax
	push word [bp+_ch]
	call _putc
	add sp,word 2
	jmp .L45
.L44:	
	push word 0
	mov bx,word [bp+_offset]
	pop dx
	add bx,dx
	push bx
	lea bx,[bp+_buffer]
	pop dx
	add bx,dx
	push bx
	push word 0
	cpop al
	pop di
	mov [di],al
	cpush al
	pop ax
	lea ax,[bp+_buffer]
	push ax
	call _atoi
	add sp,word 2
	mov di,[bp+_temp]
	mov [di],ax
	push word [bp+_count]
	mov bx,word 2
	pop dx
	add dx,bx
	mov [bp+_count],dx
	lea ax,[bp+_fmt]
	push ax
	mov bx,word [bp+_count]
	pop dx
	add dx,bx
	mov [bp+_ptr],dx
	jmp .L40
.L43:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'f'
	pop dx
	cmp dx,bx
	je .L50
	mov ax,word 0
	jmp .L51
.L50:	
	mov ax,word 1
.L51:	
	cmp ax,word 0
	je .L52
	nop
	jmp .L40
.L52:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 's'
	pop dx
	cmp dx,bx
	je .L53
	mov ax,word 0
	jmp .L54
.L53:	
	mov ax,word 1
.L54:	
	cmp ax,word 0
	je .L55
	nop
	jmp .L40
.L55:	
	mov di,[bp+_p]
	mov al,[di]
	cpush al
	mov bx,word 'c'
	pop dx
	cmp dx,bx
	je .L56
	mov ax,word 0
	jmp .L57
.L56:	
	mov ax,word 1
.L57:	
	cmp ax,word 0
	je .L58
	nop
	jmp .L40
.L58:	
.L40:	
	jmp .L36
.L39:	
	nop
.L36:	
	inc word [bp+_p]
	mov ax,word [bp+_p]
	jmp .L35
.L34:	
	mov ax,word 0
	leave
	ret
%undef _ptr
%undef _p
%undef _temp
%undef _buffer
%undef _offset
%undef _ch
%undef _count
%undef _fmt

%define _a 4
%define _b 6

_strcpy:
	push bp
	mov bp,sp
.L91:	
	mov di,[bp+_b]
	mov al,[di]
	mov di,[bp+_a]
	mov [di],al
	cmp al,byte 0
	je .L90
	inc word [bp+_a]
	mov ax,word [bp+_a]
	inc word [bp+_b]
	mov ax,word [bp+_b]
	jmp .L91
.L90:	
	leave
	ret

%undef _a
%undef _b

%define _n -2
%define _ptr 4

_strlen:
	push bp
	mov bp,sp
	sub sp,word 2
	mov [bp+_n],word 0
.L18:	
	mov di,[bp+_ptr]
	mov al,[di]
	cmp al,byte 0
	je .L17
	inc word [bp+_n]
	mov ax,word [bp+_n]
	inc word [bp+_ptr]
	mov ax,word [bp+_ptr]
	jmp .L18
.L17:	
	mov ax,word [bp+_n]
	leave
	ret
%undef _n
%undef _ptr



[section .data]

C0: db 'case 1',10,0
C1: db 'case 2',10,0
C2: db 'case 3',10,0
C3: db 'case 4',10,0
C4: db 'case 5',10,0
C5: db 'case 6',10,0
C6: db 'case 7',10,0
C7: db 'case 8',10,0
C8: db 'case 9',10,0
C9: db 'case 10',10,0
C10: db 'default',10,0

[section .bss]

answer: resb 20
