// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/rec_fixupp.c
// Function: fixupp
void fixupp(size_t length, int extension)
{
    uchar   type;           /* First byte of a FIXUPP packet */
    int             kind;
    int             thread;
    int             locat;
    int             relate;
    int             size;
    int             form;
    int             offset;
    int             mode;
    int             index;

    --length;                           /* Subtract 1 for checksum */

    while ( length ) {
        type = get_byte();
        --length;
        if ( type & 0x80 ) {
            /*
            ** True FixUp aka Explicit FixUp Record
            */
            --length;
            locat = ((int)type << 8) + get_byte();
            relate = ( locat & 0x4000 ) >> 14;  /* mode */
            size   = ( locat & 0x2000 ) >> 13;  /* zero */
            form   = ( locat & 0x1C00 ) >> 10;  /* LOC [0,4] */
            offset = ( locat & 0x03FF );

            length -= decode_fixup( relate, size, form, offset, extension );
        } else {
            /*
            ** Thread FixUp
            */
            kind   = ( type & 0x40 ) >> 6;
            mode   = ( type & 0x1C ) >> 2;
            thread = ( type & 0x03 );
            threads[kind][thread].mode  = mode;
            if ( mode == 0 || thread < 4 ) {
                length -= get_index( &index );
                threads[kind][thread].index = index;
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x8(%rbp)
cmpq $0x0, -0x8(%rbp)
je 0x14f59
callq 0x11ad0
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x8(%rbp)
movzbl -0xd(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x14ed1
movq -0x8(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x8(%rbp)
movzbl -0xd(%rbp), %eax
shll $0x8, %eax
movl %eax, -0x38(%rbp)
callq 0x11ad0
movb %al, %cl
movl -0x38(%rbp), %eax
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
andl $0x4000, %eax           # imm = 0x4000
sarl $0xe, %eax
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
andl $0x2000, %eax           # imm = 0x2000
sarl $0xd, %eax
movl %eax, -0x24(%rbp)
movl -0x1c(%rbp), %eax
andl $0x1c00, %eax           # imm = 0x1C00
sarl $0xa, %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0x2c(%rbp)
movl -0x20(%rbp), %edi
movl -0x24(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x2c(%rbp), %ecx
movl -0xc(%rbp), %r8d
callq 0x14c40
movslq %eax, %rcx
movq -0x8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x8(%rbp)
jmp 0x14f54
movzbl -0xd(%rbp), %eax
andl $0x40, %eax
sarl $0x6, %eax
movl %eax, -0x14(%rbp)
movzbl -0xd(%rbp), %eax
andl $0x1c, %eax
sarl $0x2, %eax
movl %eax, -0x30(%rbp)
movzbl -0xd(%rbp), %eax
andl $0x3, %eax
movl %eax, -0x18(%rbp)
movl -0x30(%rbp), %edx
movslq -0x14(%rbp), %rcx
leaq 0xb16d(%rip), %rax      # 0x20070
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movl %edx, (%rax,%rcx,8)
cmpl $0x0, -0x30(%rbp)
je 0x14f1d
cmpl $0x4, -0x18(%rbp)
jge 0x14f52
leaq -0x34(%rbp), %rdi
callq 0x11c80
movswq %ax, %rcx
movq -0x8(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x8(%rbp)
movl -0x34(%rbp), %edx
movslq -0x14(%rbp), %rcx
leaq 0xb12d(%rip), %rax      # 0x20070
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x18(%rbp), %rcx
movl %edx, 0x4(%rax,%rcx,8)
jmp 0x14f54
jmp 0x14e1b
addq $0x40, %rsp
popq %rbp
retq
nop