// File: /workspace/github_c_makefile_star2_O1/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 $0x18, %rsp
movq %rdi, %rbx
movl (%rdi), %ecx
leal -0x2(%rcx), %eax
cmpl $0xe, %eax
ja 0xb374
leaq 0x3000(%rip), %rcx      # 0xe364
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
jmp 0xb90c
cmpl $0x15, %ecx
jne 0xb7e7
movl 0x10(%rbx), %edi
movl $0x1, %ebp
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x735a
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xb90a
movl 0x8(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xb90a
leaq 0x109f6(%rip), %r14     # 0x1bdb0
movq (%r14,%rax,8), %rax
testq %rax, %rax
je 0xb90a
movl 0x8(%rax), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x8(%rax)
cmpl $0x1, %ecx
jg 0xb3ec
movq (%rax), %rdi
callq 0x1070
movl 0x8(%rsp), %eax
movq (%r14,%rax,8), %rax
movq $0x0, (%rax)
movl 0x8(%rsp), %eax
movq $0x0, (%r14,%rax,8)
xorl %ecx, %ecx
jmp 0xb90a
movl 0x10(%rbx), %edi
movl $0x1, %ebp
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x735a
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xb90a
movl 0x8(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xb90a
leaq 0x10974(%rip), %rdx     # 0x1bdb0
movq (%rdx,%rax,8), %rdi
testq %rdi, %rdi
je 0xb90a
xorl %esi, %esi
cmpq $0x0, (%rdx)
je 0xb8f7
incq %rsi
addq $0x8, %rdx
cmpq $0x400, %rsi            # imm = 0x400
jne 0xb44b
jmp 0xb90a
movl 0x10(%rbx), %edi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0xb7e7
movl 0x10(%rsp), %edi
movl 0xc(%rsp), %esi
callq 0x7134
testl %eax, %eax
je 0xb7e7
movl 0x8(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xb7e7
leaq 0x108f4(%rip), %r12     # 0x1bdb0
movq (%r12,%rax,8), %rax
testq %rax, %rax
je 0xb7e7
cmpl $0x0, 0x10(%rax)
je 0xb7e7
movl 0xc(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0xb91d
movq %rax, %r14
movl 0x10(%rsp), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x6c34
movl 0x8(%rsp), %eax
movq (%r12,%rax,8), %rax
cmpl $0x1, 0x14(%rax)
jne 0xb518
movq (%rax), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1120
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %eax
movq (%r12,%rax,8), %rax
movq (%rax), %rcx
movl $0x1, %esi
movq %r14, %rdi
callq 0x1190
movl 0xc(%rsp), %ecx
cmpq %rcx, %rax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
movl %eax, (%rbx)
movl 0x8(%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x2, 0x14(%rax)
movq %r14, %rdi
callq 0x1030
jmp 0xb7ed
movl 0x10(%rbx), %edi
leaq 0x8(%rsp), %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0xb7e7
movl 0xa821(%rip), %edi      # 0x15da4
movl 0x8(%rsp), %esi
leal (%rsi,%rdi), %ebp
testl %esi, %esi
js 0xb7d7
cmpl %edi, %ebp
jae 0xb7db
jmp 0xb7e7
movl 0x10(%rbx), %edi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
leaq 0xc(%rsp), %r8
movl $0x3, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0xb7e7
movl 0x8(%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xb7e7
leaq 0x107d4(%rip), %r12     # 0x1bdb0
movq (%r12,%rax,8), %r15
testq %r15, %r15
je 0xb7e7
cmpl $0x0, 0xc(%r15)
je 0xb7e7
movl 0xc(%rsp), %edi
callq 0x1100
testq %rax, %rax
je 0xb91d
movq %rax, %r14
cmpl $0x2, 0x14(%r15)
jne 0xb61f
movq (%r15), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1120
movl 0xc(%rsp), %edx
movl 0x8(%rsp), %eax
movq (%r12,%rax,8), %rax
movq (%rax), %rcx
movl $0x1, %esi
movq %r14, %rdi
callq 0x1060
movq %rax, %r15
movl 0x8(%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x1, 0x14(%rax)
movl 0x10(%rsp), %edi
movl %r15d, %esi
callq 0x7134
testl %eax, %eax
je 0xb7e7
movl 0x10(%rsp), %esi
movq %r14, %rdi
movl %r15d, %edx
callq 0x6d8a
movq %r14, %rdi
callq 0x1030
movl %r15d, (%rbx)
jmp 0xb7ed
movl 0x10(%rbx), %edi
xorl %r12d, %r12d
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movl $0x2, %esi
xorl %eax, %eax
callq 0x735a
testl %eax, %eax
je 0xb7cd
xorl %r14d, %r14d
movb $0x0, 0xc(%rsp)
cmpl $-0x1, %r12d
je 0xb718
movl 0x8(%rsp), %edi
addl %r12d, %edi
movl $0x1, %esi
callq 0x7134
testl %eax, %eax
je 0xb718
movl 0x8(%rsp), %esi
addl %r12d, %esi
leaq 0xc(%rsp), %rdi
movl $0x1, %edx
callq 0x6c34
leal 0x1(%r12), %r15d
movq %r14, %rdi
movq %r15, %rsi
callq 0x1130
testq %rax, %rax
je 0xb75c
movq %rax, %r13
movb 0xc(%rsp), %al
movl %r12d, %ecx
movb %al, (%r13,%rcx)
testb %al, %al
je 0xb732
movl 0x8(%rsp), %ecx
addl %r12d, %ecx
xorl %eax, %eax
cmpl $-0x1, %ecx
je 0xb744
movl %r15d, %r12d
jmp 0xb737
movq %r14, %rdi
callq 0x1030
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x1, %eax
movl $0x1, %ebp
jmp 0xb73a
movl $0x2, %eax
movq %r13, %r14
testl %eax, %eax
je 0xb6a7
jmp 0xb77c
movq %r13, %rdi
callq 0x1030
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x1, %eax
movq %r13, %r14
jmp 0xb72b
leaq 0x287f(%rip), %rdi      # 0xdfe2
callq 0x1160
movq %r14, %rdi
callq 0x1030
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0x1, %eax
jmp 0xb73a
cmpl $0x2, %eax
jne 0xb90c
leaq 0x10624(%rip), %rax     # 0x1bdb0
xorl %r15d, %r15d
cmpq $0x0, (%rax)
je 0xb7ab
incq %r15
addq $0x8, %rax
cmpq $0x400, %r15            # imm = 0x400
jne 0xb78f
movl $0x400, %r15d           # imm = 0x400
xorl %r12d, %r12d
leaq 0xa5fb(%rip), %rax      # 0x15db0
xorl %ecx, %ecx
cmpq $0x0, (%rcx,%rax)
je 0xb7f7
addq $0x18, %rcx
cmpq $0x6000, %rcx           # imm = 0x6000
jne 0xb7b7
jmp 0xb7fd
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xb8d4
cmpl %edi, %ebp
ja 0xb7e7
cmpl 0xa5bf(%rip), %ebp      # 0x15da0
jae 0xb8db
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x1, %ebp
jmp 0xb90c
addq %rcx, %rax
movq %rax, %r12
cmpl $0x400, %r15d           # imm = 0x400
setae %al
testq %r12, %r12
sete %cl
orb %al, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jne 0xb8cc
movl 0x10(%rsp), %eax
movl %eax, %r13d
andl $0x3, %r13d
setne 0x16(%rsp)
leaq 0x2b6f(%rip), %rcx      # 0xe3a0
leaq 0x26dd(%rip), %rsi      # 0xdf15
cmovneq %rcx, %rsi
cmpl $0x1, %r13d
setne 0x15(%rsp)
btl $0x9, %eax
setae 0x17(%rsp)
movq %r14, %rdi
callq 0x1150
movq %rax, (%r12)
testq %rax, %rax
setne %al
orb 0x17(%rsp), %al
jne 0xb888
cmpl $0x1, %r13d
leaq 0x2b32(%rip), %rax      # 0xe3a3
leaq 0x1f76(%rip), %rsi      # 0xd7ee
cmovneq %rax, %rsi
movq %r14, %rdi
callq 0x1150
movq %rax, (%r12)
cmpq $0x0, (%r12)
je 0xb8cc
xorl %edx, %edx
movb 0x15(%rsp), %al
movb %al, %dl
xorl %eax, %eax
movb 0x16(%rsp), %cl
movb %cl, %al
movl $0x1, 0x8(%r12)
movl %edx, 0xc(%r12)
movl %eax, 0x10(%r12)
movl $0x0, 0x14(%r12)
movl %r15d, %eax
leaq 0x104eb(%rip), %rcx     # 0x1bdb0
movq %r12, (%rcx,%rax,8)
movl %r15d, %ebp
movq %r14, %rdi
callq 0x1030
movl %ebp, (%rbx)
jmp 0xb7ed
cmpl %ebp, %edi
jae 0xb8e4
callq 0x6edb
movl 0xa4ba(%rip), %eax      # 0x15da4
movl %eax, (%rbx)
movl %ebp, 0xa4b2(%rip)      # 0x15da4
jmp 0xb7ed
movq %rdi, (%rdx)
leaq 0x104af(%rip), %rcx     # 0x1bdb0
movq (%rcx,%rax,8), %rax
incl 0x8(%rax)
movl %esi, %ecx
movl %ecx, (%rbx)
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x22dc(%rip), %rdi      # 0xdc00
callq 0x1160
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xb90c