// File: /workspace/github_c_makefile_star2_O2/mikebdp2[P]AtomDis/main.c
// Function: sub_dest
int sub_dest (uint8_t *d, char *out, int type, int align, int size, int index) {
    uint32_t    val;
    int         r;
    const char *ind;
    switch (type) {
    case D_REG:
	val  = *((uint16_t *) d);
	r    = 2;
	break;
    case D_ID:  case D_IM:
	out += sprintf (out, "<internal - illegal addrtype %s>", addrnames [type]);
	val  = 0;
	r    = 0;
	break;
    default:
	val = *d;
	r   = 1;
    }
    if (type == D_WS && (ind = get_index (INDEX_WORK_REG, val)) )
	out += sprintf (out, "%s", ind);
    else if (r)
	out += sprintf (out, addrtypes [type], val << addrtypes_shift[type]);
    switch (size) {
    case 1:
	out += sprintf (out, " [%s]", align_byte[align]);
	break;
    case 2:
	out += sprintf (out, " [%s]", align_word[align]);
	break;
    case 4:
	out += sprintf (out, " [%s]", align_long[align]);
	break;
    }
    if (type == D_REG && (ind = get_index (last_reg_index, val+last_reg_offset)) )
	out += sprintf (out, "  (%s)", ind);
    if (r && (ind = get_index (index, val)) )
	out += sprintf (out, "  (%s)", ind);
    return r;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, 0x4(%rsp)
movl %r8d, %ebp
movl %ecx, %r13d
movl %edx, %r12d
movq %rsi, %rbx
leal -0x4(%r12), %eax
cmpl $0x2, %eax
jae 0x4ce1
movl %r12d, %eax
leaq 0x38465(%rip), %rcx     # 0x3d120
movq (%rcx,%rax,8), %rdx
leaq 0x1c623(%rip), %rsi     # 0x212e9
movl $0x0, (%rsp)
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41d0
cltq
movb $0x1, %r14b
xorl %r15d, %r15d
jmp 0x4d5a
testl %r12d, %r12d
jne 0x4cf2
movzwl (%rdi), %r15d
pushq $0x2
popq %rax
movl %eax, (%rsp)
jmp 0x4d2e
movzbl (%rdi), %r15d
pushq $0x1
popq %r14
cmpl $0x2, %r12d
jne 0x4d2a
pushq $0x4
popq %rdi
movl %r15d, %esi
callq 0x20888
testq %rax, %rax
je 0x4d2a
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4080
subl %ebx, %eax
cltq
pushq $0x1
popq %rcx
movl %ecx, (%rsp)
xorl %r14d, %r14d
jmp 0x4d5a
movl %r14d, (%rsp)
movslq %r12d, %rax
leaq 0x38448(%rip), %rcx     # 0x3d180
movq (%rcx,%rax,8), %rsi
leaq 0x393bd(%rip), %rcx     # 0x3e100
movb (%rcx,%rax,4), %cl
movl %r15d, %edx
shll %cl, %edx
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41d0
cltq
addq %rax, %rbx
cmpl $0x1, %ebp
je 0x4d7e
cmpl $0x4, %ebp
je 0x4d75
cmpl $0x2, %ebp
jne 0x4da2
leaq 0x384fd(%rip), %rax     # 0x3d270
jmp 0x4d85
leaq 0x38514(%rip), %rax     # 0x3d290
jmp 0x4d85
leaq 0x384cb(%rip), %rax     # 0x3d250
movslq %r13d, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1c577(%rip), %rsi     # 0x2130a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x41d0
cltq
addq %rax, %rbx
testl %r12d, %r12d
jne 0x4dd9
movl 0x393a7(%rip), %edi     # 0x3e154
movl 0x393a5(%rip), %esi     # 0x3e158
addl %r15d, %esi
callq 0x20888
testq %rax, %rax
je 0x4dd9
leaq 0x1c73f(%rip), %rsi     # 0x21506
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x41d0
cltq
addq %rax, %rbx
testb %r14b, %r14b
jne 0x4e03
movl 0x4(%rsp), %edi
movl %r15d, %esi
callq 0x20888
testq %rax, %rax
je 0x4e03
leaq 0x1c710(%rip), %rsi     # 0x21506
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x41d0
movl (%rsp), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq