// File: /workspace/github_c_makefile_star2_O0/mikebdp2[P]AtomDis/main.c
// Function: op_switch
int op_switch (uint8_t *d, char *out) {
    const optab_t *op = &optable[d[0]];
    uint8_t       *t    = d+1;
    int            attr = *t++;
    int            i = 0;
    /* Multiline, because even the hexdump typically needs lots of space */
    out += sprintf (out, "\n                          %-5s  ", op->name);
    t   += sub_src (t, out, attr & 0x07, (attr & 0x38) >> 3, size_align[(attr & 0x38)>>3], op->srcindex);
    out += strlen  (out);

    while (t[0] != 0x5a && t[1] != 0x5a) { /* EndOfSwitch: 2x NOP */
	if (*t++ != 'c') {
	    out += sprintf (out, "missing CASE for switch");
	    t   -= 3;
	    break;
	}
	if (! (i++ & 7))
	    out += sprintf (out, "\n       ");
	switch (size_align[(attr & 0x38)>>3]) {
	case 1:
	    out += sprintf (out, " %02x->", *t++);
	    break;
	case 2:
	    out += sprintf (out, " %04x->", *(uint16_t *)t);
	    t   += 2;
	    break;
	case 4:
	    out += sprintf (out, " %08x->", *(uint32_t *)t);
	    t   += 4;
	    break;
	}
	out += sprintf (out, "%04x", *(uint16_t *)t);
	t   += 2;
    }
    t += 2;
    return t - d;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movzbl (%rax), %eax
movl %eax, %ecx
leaq 0x5d630(%rip), %rax     # 0x61dd0
shlq $0x5, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movzbl (%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x47c58(%rip), %rsi     # 0x4c43e
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x24(%rbp), %edx
andl $0x7, %edx
movl -0x24(%rbp), %ecx
andl $0x38, %ecx
sarl $0x3, %ecx
movl -0x24(%rbp), %eax
andl $0x38, %eax
sarl $0x3, %eax
movslq %eax, %r8
leaq 0x478c9(%rip), %rax     # 0x4c0f0
movl (%rax,%r8,4), %r8d
movq -0x18(%rbp), %rax
movl 0x14(%rax), %r9d
callq 0x54f0
movl %eax, %ecx
movq -0x20(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4070
addq -0x10(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
movzbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x5a, %ecx
movb %al, -0x29(%rbp)
je 0x487b
movq -0x20(%rbp), %rax
movzbl 0x1(%rax), %eax
cmpl $0x5a, %eax
setne %al
movb %al, -0x29(%rbp)
movb -0x29(%rbp), %al
testb $0x1, %al
jne 0x4887
jmp 0x4a14
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movzbl (%rax), %eax
cmpl $0x63, %eax
je 0x48d1
movq -0x10(%rbp), %rdi
leaq 0x47bb7(%rip), %rsi     # 0x4c460
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
addq $-0x3, %rax
movq %rax, -0x20(%rbp)
jmp 0x4a14
movl -0x28(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x28(%rbp)
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x4906
movq -0x10(%rbp), %rdi
leaq 0x47b89(%rip), %rsi     # 0x4c478
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movl -0x24(%rbp), %eax
andl $0x38, %eax
shrl %eax
leaq 0x477db(%rip), %rcx     # 0x4c0f0
movl (%rax,%rcx), %eax
movl %eax, -0x30(%rbp)
subl $0x1, %eax
je 0x4939
jmp 0x4922
movl -0x30(%rbp), %eax
subl $0x2, %eax
je 0x496f
jmp 0x492c
movl -0x30(%rbp), %eax
subl $0x4, %eax
je 0x49a6
jmp 0x49da
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x20(%rbp)
movzbl (%rax), %edx
leaq 0x47b2b(%rip), %rsi     # 0x4c481
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
jmp 0x49da
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movzwl (%rax), %edx
leaq 0x47b08(%rip), %rsi     # 0x4c489
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x49da
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movl (%rax), %edx
leaq 0x47ada(%rip), %rsi     # 0x4c491
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
addq $0x4, %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rax
movzwl (%rax), %edx
leaq 0x47b5d(%rip), %rsi     # 0x4c549
movb $0x0, %al
callq 0x41b0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
jmp 0x4859
movq -0x20(%rbp), %rax
addq $0x2, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq -0x8(%rbp), %rcx
subq %rcx, %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)