// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: xv6_syscall
int xv6_syscall(uint32_t regs[]) {
	switch (regs[EAX]) {
		case 2: /* exit */
			return 0;
		case 5: /* read */
			return xv6_read(regs);
		case 10: /* dup */
			return xv6_dup(regs);
		case 12: /* sbrk */
			return xv6_sbrk(regs);
		case 15: /* open */
			return xv6_open(regs);
		case 16: /* write */
			return xv6_write(regs);
		case 21:
			return xv6_close(regs);
		default: /* 不正もしくは未実装 */
			regs[EAX] = -1;
			break;
	}
	return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movl (%rdi), %ecx
leal -0x2(%rcx), %eax
cmpl $0xe, %eax
ja 0x9749
leaq 0x3bb3(%rip), %rcx      # 0xd2ec
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
jmp 0x9c64
cmpl $0x15, %ecx
jne 0x9ad2
movl 0x10(%rbx), %edi
pushq $0x1
popq %rbp
leaq 0xc(%rsp), %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x626c
pushq $-0x1
popq %rcx
testl %eax, %eax
je 0x9b4e
movl 0xc(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9b4e
leaq 0x11628(%rip), %r14     # 0x1adb0
movq (%r14,%rax,8), %rdx
testq %rdx, %rdx
je 0x9b4e
movl 0x8(%rdx), %ecx
leal -0x1(%rcx), %esi
movl %esi, 0x8(%rdx)
cmpl $0x1, %ecx
jg 0x97b7
movq (%rdx), %rdi
callq 0x1070
movl 0xc(%rsp), %eax
movq (%r14,%rax,8), %rcx
andq $0x0, (%rcx)
andq $0x0, (%r14,%rax,8)
xorl %ecx, %ecx
jmp 0x9b4e
movl 0x10(%rbx), %edi
pushq $0x1
popq %rbp
leaq 0xc(%rsp), %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x626c
pushq $-0x1
popq %rcx
testl %eax, %eax
je 0x9b4e
movl 0xc(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9b4e
leaq 0x115b7(%rip), %rdx     # 0x1adb0
movq (%rdx,%rax,8), %rdi
testq %rdi, %rdi
je 0x9b4e
xorl %esi, %esi
cmpq $0x400, %rsi            # imm = 0x400
je 0x9b4e
cmpq $0x0, (%rdx)
je 0x9b3b
incq %rsi
addq $0x8, %rdx
jmp 0x9808
movl 0x10(%rbx), %edi
pushq $0x3
popq %rsi
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0x626c
testl %eax, %eax
je 0x9ad2
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %esi
callq 0x606d
testl %eax, %eax
je 0x9ad2
movl 0xc(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9ad2
leaq 0x11538(%rip), %r12     # 0x1adb0
movq (%r12,%rax,8), %rax
testq %rax, %rax
je 0x9ad2
cmpl $0x0, 0x10(%rax)
je 0x9ad2
movl 0x10(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0x9c75
movq %rax, %r14
movl 0x14(%rsp), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x5bd0
movl 0xc(%rsp), %eax
movq (%r12,%rax,8), %rax
cmpl $0x1, 0x14(%rax)
jne 0x98da
movq (%rax), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x1120
movl 0xc(%rsp), %eax
movq (%r12,%rax,8), %rax
movl 0x10(%rsp), %edx
movq (%rax), %rcx
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x1190
movl 0x10(%rsp), %ecx
cmpq %rcx, %rax
pushq $-0x1
popq %rax
cmovel %ecx, %eax
movl %eax, (%rbx)
movl 0xc(%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x2, 0x14(%rax)
movq %r14, %rdi
callq 0x1030
jmp 0x9ad5
movl 0x10(%rbx), %edi
pushq $0x1
popq %rbp
leaq 0xc(%rsp), %rdx
movl %ebp, %esi
xorl %eax, %eax
callq 0x626c
testl %eax, %eax
je 0x9c61
movl 0xb46b(%rip), %edi      # 0x14da4
movl 0xc(%rsp), %esi
leal (%rsi,%rdi), %r14d
testl %esi, %esi
js 0x9ae5
cmpl %edi, %r14d
jae 0x9aee
jmp 0x9c61
movl 0x10(%rbx), %edi
pushq $0x3
popq %rsi
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
leaq 0x10(%rsp), %r8
xorl %eax, %eax
callq 0x626c
testl %eax, %eax
je 0x9ad2
movl 0xc(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0x9ad2
leaq 0x1141e(%rip), %r12     # 0x1adb0
movq (%r12,%rax,8), %r13
testq %r13, %r13
je 0x9ad2
cmpl $0x0, 0xc(%r13)
je 0x9ad2
movl 0x10(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0x9c75
movq %rax, %r14
cmpl $0x2, 0x14(%r13)
jne 0x99e5
movq (%r13), %rdi
pushq $0x1
popq %rdx
xorl %esi, %esi
callq 0x1120
movl 0x10(%rsp), %r15d
movl 0xc(%rsp), %eax
movq (%r12,%rax,8), %r13
movq (%r13), %rcx
pushq $0x1
popq %rsi
movq %r14, %rdi
movq %r15, %rdx
callq 0x1060
movq %rax, %r15
movl 0xc(%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x1, 0x14(%rax)
movl 0x14(%rsp), %edi
movl %r15d, %esi
callq 0x606d
testl %eax, %eax
je 0x9ad2
movl 0x14(%rsp), %esi
movq %r14, %rdi
movl %r15d, %edx
callq 0x5d3e
movq %r14, %rdi
callq 0x1030
movl %r15d, (%rbx)
jmp 0x9ad5
movl 0x10(%rbx), %edi
pushq $0x2
popq %rsi
leaq 0xc(%rsp), %rdx
leaq 0x14(%rsp), %rcx
xorl %eax, %eax
callq 0x626c
testl %eax, %eax
je 0x9ad2
xorl %r13d, %r13d
pushq $0x1
popq %rbp
xorl %r12d, %r12d
movb $0x0, 0x10(%rsp)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %r13
je 0x9add
movl 0xc(%rsp), %edi
addl %r13d, %edi
movl %ebp, %esi
callq 0x606d
testl %eax, %eax
je 0x9add
movl 0xc(%rsp), %esi
addl %r13d, %esi
leaq 0x10(%rsp), %rdi
movl %ebp, %edx
callq 0x5bd0
leaq 0x1(%r13), %r15
movq %r12, %rdi
movq %r15, %rsi
callq 0x1130
testq %rax, %rax
je 0x9c83
movq %rax, %r14
movb 0x10(%rsp), %al
movb %al, (%r14,%r13)
testb %al, %al
je 0x9b19
addl 0xc(%rsp), %r13d
cmpl $-0x1, %r13d
je 0x9c59
movq %r15, %r13
movq %r14, %r12
jmp 0x9a60
orl $-0x1, (%rbx)
pushq $0x1
popq %rbp
jmp 0x9c64
movq %r12, %rdi
jmp 0x9c5c
cmpl %edi, %r14d
ja 0x9c61
cmpl 0xb2ab(%rip), %r14d     # 0x14da0
jb 0x9c61
cmpl %r14d, %edi
jae 0x9b0b
callq 0x5e70
movl 0xb299(%rip), %edi      # 0x14da4
movl %edi, (%rbx)
movl %r14d, 0xb290(%rip)     # 0x14da4
jmp 0x9c64
leaq 0x11290(%rip), %rax     # 0x1adb0
xorl %r15d, %r15d
cmpq $0x400, %r15            # imm = 0x400
je 0x9b55
cmpq $0x0, (%rax)
je 0x9b5b
incq %r15
addq $0x8, %rax
jmp 0x9b23
movq %rdi, (%rdx)
leaq 0x1126b(%rip), %rcx     # 0x1adb0
movq (%rcx,%rax,8), %rax
incl 0x8(%rax)
movl %esi, %ecx
movl %ecx, (%rbx)
jmp 0x9c64
movl $0x400, %r15d           # imm = 0x400
pushq $-0x18
popq %rax
leaq 0xb24b(%rip), %r12      # 0x14db0
leaq 0x18(%rax), %r13
cmpq $0x6000, %r13           # imm = 0x6000
je 0x9c59
cmpq $0x0, 0x18(%rax,%r12)
movq %r13, %rax
jne 0x9b65
cmpl $0x400, %r15d           # imm = 0x400
jae 0x9c59
leaq (%r12,%r13), %rax
movq %rax, 0x20(%rsp)
movl 0x14(%rsp), %eax
movl %eax, %edx
andl $0x3, %edx
setne 0x1a(%rsp)
leaq 0x377c(%rip), %rcx      # 0xd328
leaq 0x32ea(%rip), %rsi      # 0xce9d
cmovneq %rcx, %rsi
movl %edx, 0x1c(%rsp)
cmpl $0x1, %edx
setne 0x19(%rsp)
btl $0x9, %eax
setae 0x1b(%rsp)
movq %r14, %rdi
callq 0x1150
movq 0x20(%rsp), %rdx
movq %rax, (%rdx)
testq %rax, %rax
setne %cl
orb 0x1b(%rsp), %cl
jne 0x9c0f
cmpl $0x1, 0x1c(%rsp)
leaq 0x3737(%rip), %rax      # 0xd32b
leaq 0x2c1b(%rip), %rsi      # 0xc816
cmovneq %rax, %rsi
movq %r14, %rdi
callq 0x1150
movq 0x20(%rsp), %rdx
movq %rax, (%rdx)
testq %rax, %rax
je 0x9c59
xorl %esi, %esi
movb 0x19(%rsp), %al
movb %al, %sil
xorl %eax, %eax
movb 0x1a(%rsp), %cl
movb %cl, %al
movl $0x1, 0x8(%r13,%r12)
movl %esi, 0xc(%r13,%r12)
movl %eax, 0x10(%r13,%r12)
andl $0x0, 0x14(%r13,%r12)
movl %r15d, %eax
leaq 0x11168(%rip), %rcx     # 0x1adb0
movq %rdx, (%rcx,%rax,8)
movq %r14, %rdi
callq 0x1030
movl %r15d, (%rbx)
jmp 0x9c64
movq %r14, %rdi
callq 0x1030
orl $-0x1, (%rbx)
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2fa4(%rip), %rdi      # 0xcc20
callq 0x1160
jmp 0x9c97
leaq 0x32e0(%rip), %rdi      # 0xcf6a
callq 0x1160
movq %r12, %rdi
callq 0x1030
pushq $-0x1
jmp 0x9ad7
nop