// File: /workspace/github_c_makefile_star2_O3/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 0xa864
leaq 0x3b08(%rip), %rcx      # 0xe35c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %ebp, %ebp
jmp 0xad85
cmpl $0x15, %ecx
jne 0xad7a
movl 0x10(%rbx), %edi
movl $0x1, %ebp
movq %rsp, %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x7157
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xac94
movl (%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xac94
leaq 0x11509(%rip), %r14     # 0x1bdb0
movq (%r14,%rax,8), %rdx
testq %rdx, %rdx
je 0xac94
movl 0x8(%rdx), %ecx
leal -0x1(%rcx), %esi
movl %esi, 0x8(%rdx)
cmpl $0x1, %ecx
jg 0xa8d8
movq (%rdx), %rdi
callq 0x1070
movl (%rsp), %eax
movq (%r14,%rax,8), %rcx
movq $0x0, (%rcx)
movq $0x0, (%r14,%rax,8)
xorl %ecx, %ecx
jmp 0xac94
movl 0x10(%rbx), %edi
movl $0x1, %ebp
movq %rsp, %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x7157
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testl %eax, %eax
je 0xac94
movl (%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xac94
leaq 0x1148f(%rip), %rdx     # 0x1bdb0
movq (%rdx,%rax,8), %rdi
testq %rdi, %rdi
je 0xac94
xorl %esi, %esi
cmpq $0x0, (%rdx)
je 0xac81
incq %rsi
addq $0x8, %rdx
cmpq $0x400, %rsi            # imm = 0x400
jne 0xa930
jmp 0xac94
movl 0x10(%rbx), %edi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0xad7a
movl 0x8(%rsp), %edi
movl 0x4(%rsp), %esi
callq 0x6ec9
testl %eax, %eax
je 0xad7a
movl (%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xad7a
leaq 0x11412(%rip), %r12     # 0x1bdb0
movq (%r12,%rax,8), %rax
testq %rax, %rax
je 0xad7a
cmpl $0x0, 0x10(%rax)
je 0xad7a
movl 0x4(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0xad96
movq %rax, %r14
movl 0x8(%rsp), %esi
movq %rax, %rdi
movl %r15d, %edx
callq 0x6a34
movl (%rsp), %eax
movq (%r12,%rax,8), %rax
cmpl $0x1, 0x14(%rax)
jne 0xaa00
movq (%rax), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1120
movl (%rsp), %eax
movq (%r12,%rax,8), %rax
movl 0x4(%rsp), %edx
movq (%rax), %rcx
movl $0x1, %esi
movq %r14, %rdi
callq 0x1190
movl 0x4(%rsp), %ecx
cmpq %rcx, %rax
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %ecx, %eax
movl %eax, (%rbx)
movl (%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x2, 0x14(%rax)
movq %r14, %rdi
callq 0x1030
jmp 0xad80
movl 0x10(%rbx), %edi
movq %rsp, %rdx
movl $0x1, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0xad7a
movl 0xb344(%rip), %edi      # 0x15da4
movl (%rsp), %esi
leal (%rsi,%rdi), %ebp
testl %esi, %esi
js 0xac00
cmpl %edi, %ebp
jae 0xac08
jmp 0xad7a
movl 0x10(%rbx), %edi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
leaq 0x4(%rsp), %r8
movl $0x3, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0xad7a
movl (%rsp), %eax
cmpq $0x3ff, %rax            # imm = 0x3FF
ja 0xad7a
leaq 0x112fb(%rip), %r12     # 0x1bdb0
movq (%r12,%rax,8), %r13
testq %r13, %r13
je 0xad7a
cmpl $0x0, 0xc(%r13)
je 0xad7a
movl 0x4(%rsp), %r15d
movq %r15, %rdi
callq 0x1100
testq %rax, %rax
je 0xad96
movq %rax, %r14
cmpl $0x2, 0x14(%r13)
jne 0xab09
movq (%r13), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x1120
movl 0x4(%rsp), %r15d
movl (%rsp), %eax
movq (%r12,%rax,8), %r13
movq (%r13), %rcx
movl $0x1, %esi
movq %r14, %rdi
movq %r15, %rdx
callq 0x1060
movq %rax, %r15
movl (%rsp), %eax
movq (%r12,%rax,8), %rax
movl $0x1, 0x14(%rax)
movl 0x8(%rsp), %edi
movl %r15d, %esi
callq 0x6ec9
testl %eax, %eax
je 0xad7a
movl 0x8(%rsp), %esi
movq %r14, %rdi
movl %r15d, %edx
callq 0x6b71
jmp 0xad65
movl 0x10(%rbx), %edi
movq %rsp, %rdx
leaq 0x8(%rsp), %rcx
movl $0x2, %esi
xorl %eax, %eax
callq 0x7157
testl %eax, %eax
je 0xad7a
leaq 0x4(%rsp), %r15
movb $0x0, (%r15)
movl (%rsp), %edi
xorl %r13d, %r13d
xorl %r12d, %r12d
addl %r13d, %edi
movl $0x1, %esi
callq 0x6ec9
testl %eax, %eax
je 0xac30
movl (%rsp), %esi
addl %r13d, %esi
movq %r15, %rdi
movl $0x1, %edx
callq 0x6a34
leaq 0x1(%r13), %rbp
movq %r12, %rdi
movq %rbp, %rsi
callq 0x1130
testq %rax, %rax
je 0xada4
movq %rax, %r14
movb 0x4(%rsp), %al
movb %al, (%r14,%r13)
testb %al, %al
je 0xac38
movl (%rsp), %edi
addl %edi, %r13d
cmpl $-0x1, %r13d
je 0xad72
movb $0x0, 0x4(%rsp)
movq %rbp, %r13
movq %r14, %r12
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rbp
jne 0xab87
jmp 0xad72
cmpl %edi, %ebp
ja 0xad7a
cmpl 0xb192(%rip), %ebp      # 0x15da0
jb 0xad7a
cmpl %ebp, %edi
jae 0xac23
callq 0x6caf
movl 0xb181(%rip), %edi      # 0x15da4
movl %edi, (%rbx)
movl %ebp, 0xb179(%rip)      # 0x15da4
jmp 0xad80
movq %r12, %r14
jmp 0xad72
leaq 0x11171(%rip), %rax     # 0x1bdb0
xorl %r15d, %r15d
cmpq $0x0, (%rax)
je 0xac5e
incq %r15
addq $0x8, %rax
cmpq $0x400, %r15            # imm = 0x400
jne 0xac42
movl $0x400, %r15d           # imm = 0x400
xorl %r12d, %r12d
leaq 0xb148(%rip), %r13      # 0x15db0
cmpq $0x0, (%r12,%r13)
je 0xac9b
addq $0x18, %r12
cmpq $0x6000, %r12           # imm = 0x6000
jne 0xac68
jmp 0xad72
movq %rdi, (%rdx)
leaq 0x11125(%rip), %rcx     # 0x1bdb0
movq (%rcx,%rax,8), %rax
incl 0x8(%rax)
movl %esi, %ecx
movl %ecx, (%rbx)
jmp 0xad85
cmpl $0x400, %r15d           # imm = 0x400
jae 0xad72
leaq (%r12,%r13), %rax
movq %rax, 0x10(%rsp)
movl 0x8(%rsp), %eax
movl %eax, %ebp
andl $0x3, %ebp
setne 0xe(%rsp)
leaq 0x36d2(%rip), %rcx      # 0xe398
leaq 0x3240(%rip), %rsi      # 0xdf0d
cmovneq %rcx, %rsi
cmpl $0x1, %ebp
setne 0xd(%rsp)
btl $0x9, %eax
setae 0xf(%rsp)
movq %r14, %rdi
callq 0x1150
movq 0x10(%rsp), %rdx
movq %rax, (%rdx)
testq %rax, %rax
setne %cl
orb 0xf(%rsp), %cl
jne 0xad25
cmpl $0x1, %ebp
leaq 0x3693(%rip), %rax      # 0xe39b
leaq 0x2b47(%rip), %rsi      # 0xd856
cmovneq %rax, %rsi
movq %r14, %rdi
movq %rdx, %rbp
callq 0x1150
movq %rbp, %rdx
movq %rax, (%rbp)
testq %rax, %rax
je 0xad72
xorl %esi, %esi
movb 0xd(%rsp), %al
movb %al, %sil
xorl %eax, %eax
movb 0xe(%rsp), %cl
movb %cl, %al
movl $0x1, 0x8(%r12,%r13)
movl %esi, 0xc(%r12,%r13)
movl %eax, 0x10(%r12,%r13)
movl $0x0, 0x14(%r12,%r13)
movl %r15d, %eax
leaq 0x1104f(%rip), %rcx     # 0x1bdb0
movq %rdx, (%rcx,%rax,8)
movq %r14, %rdi
callq 0x1030
movl %r15d, (%rbx)
jmp 0xad80
movq %r14, %rdi
callq 0x1030
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl $0x1, %ebp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2ec3(%rip), %rdi      # 0xdc60
callq 0x1160
jmp 0xadb8
leaq 0x322f(%rip), %rdi      # 0xdfda
callq 0x1160
movq %r12, %rdi
callq 0x1030
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0xad85
nop